- const char *OIDs_plain[] = {OID_NTLMSSP, NULL};
-
- global_spnego_negotiated = True;
-
- memset(guid, '\0', sizeof(guid));
-
- safe_strcpy(unix_name, global_myname(), sizeof(unix_name)-1);
- strlower_m(unix_name);
- push_ascii_nstring(dos_name, unix_name);
- safe_strcpy(guid, dos_name, sizeof(guid)-1);
-
-#ifdef DEVELOPER
- /* Fix valgrind 'uninitialized bytes' issue. */
- slen = strlen(dos_name);
- if (slen < sizeof(guid)) {
- memset(guid+slen, '\0', sizeof(guid) - slen);
+ const char *OIDs_ntlm[] = {OID_NTLMSSP, NULL};
+ struct auth_generic_state *auth_ntlmssp_state;
+
+ sconn->use_gensec_hook = false;
+
+ /* See if we can get an SPNEGO blob out of the gensec hook (if auth_samba4 is loaded) */
+ status = auth_ntlmssp_prepare(sconn->remote_address,
+ &auth_ntlmssp_state);
+ if (NT_STATUS_IS_OK(status)) {
+ status = auth_generic_start(auth_ntlmssp_state, GENSEC_OID_SPNEGO);
+ if (NT_STATUS_IS_OK(status)) {
+ status = gensec_update(auth_ntlmssp_state->gensec_security, ctx,
+ NULL, data_blob_null, &blob);
+ /* If we get the list of OIDs, the 'OK' answer
+ * is NT_STATUS_MORE_PROCESSING_REQUIRED */
+ if (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
+ sconn->use_gensec_hook = true;
+ }
+ }
+ TALLOC_FREE(auth_ntlmssp_state);