s3-libads Default to NOT using the server-supplied principal from SPNEGO
[samba.git] / source3 / libsmb / cliconnect.c
index 9d0b1e343c4f503ada26ae38f9b2c7ac1f0954d4..6827b7b81e1a126c56e4982e5b5f348328c4b869 100644 (file)
@@ -1056,10 +1056,9 @@ ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
                        }
                }
 
-               /* If we get a bad principal, try to guess it if
-                  we have a valid host NetBIOS name.
+               /* We may not be allowed to use the server-supplied SPNEGO principal, or it may not have been supplied to us
                 */
-               if (strequal(principal, ADS_IGNORE_PRINCIPAL)) {
+               if (!lp_client_use_spnego_principal() || strequal(principal, ADS_IGNORE_PRINCIPAL)) {
                        TALLOC_FREE(principal);
                }