r26233: Pass loadparm context when creating krb5 contexts.
[jelmer/samba4-debian.git] / source / auth / auth_util.c
index 91f0e5163c7dd1a1db7180c6a67a70fd372f2f1b..baecb15f1e3d59c935f9628eecf7552853b9ad3a 100644 (file)
@@ -43,6 +43,7 @@ NTSTATUS auth_get_challenge_not_implemented(struct auth_method_context *ctx, TAL
 ****************************************************************************/
 
 NTSTATUS map_user_info(TALLOC_CTX *mem_ctx,
+                      const char *default_domain,
                       const struct auth_usersupplied_info *user_info,
                       struct auth_usersupplied_info **user_info_mapped)
 {
@@ -58,7 +59,7 @@ NTSTATUS map_user_info(TALLOC_CTX *mem_ctx,
        }
        
        /* don't allow "" as a domain, fixes a Win9X bug 
-          where it doens't supply a domain for logon script
+          where it doesn't supply a domain for logon script
           'net use' commands.                                 */
 
        /* Split user@realm names into user and realm components.  This is TODO to fix with proper userprincipalname support */
@@ -73,7 +74,7 @@ NTSTATUS map_user_info(TALLOC_CTX *mem_ctx,
                d++;
                domain = d;
        } else {
-               domain = lp_workgroup(global_loadparm);
+               domain = default_domain;
        }
 
        *user_info_mapped = talloc(mem_ctx, struct auth_usersupplied_info);
@@ -138,8 +139,8 @@ NTSTATUS encrypt_user_info(TALLOC_CTX *mem_ctx, struct auth_context *auth_contex
                        }
                        
                        chall_blob = data_blob_talloc(mem_ctx, challenge, 8);
-                       if (lp_client_ntlmv2_auth(global_loadparm)) {
-                               DATA_BLOB names_blob = NTLMv2_generate_names_blob(mem_ctx, lp_netbios_name(global_loadparm), lp_workgroup(global_loadparm));
+                       if (lp_client_ntlmv2_auth(auth_context->lp_ctx)) {
+                               DATA_BLOB names_blob = NTLMv2_generate_names_blob(mem_ctx, lp_netbios_name(auth_context->lp_ctx), lp_workgroup(auth_context->lp_ctx));
                                DATA_BLOB lmv2_response, ntlmv2_response, lmv2_session_key, ntlmv2_session_key;
                                
                                if (!SMBNTLMv2encrypt_hash(user_info_temp,
@@ -163,7 +164,7 @@ NTSTATUS encrypt_user_info(TALLOC_CTX *mem_ctx, struct auth_context *auth_contex
                                SMBOWFencrypt(user_info_in->password.hash.nt->hash, challenge, blob.data);
 
                                user_info_temp->password.response.nt = blob;
-                               if (lp_client_lanman_auth(global_loadparm) && user_info_in->password.hash.lanman) {
+                               if (lp_client_lanman_auth(auth_context->lp_ctx) && user_info_in->password.hash.lanman) {
                                        DATA_BLOB lm_blob = data_blob_talloc(mem_ctx, NULL, 24);
                                        SMBOWFencrypt(user_info_in->password.hash.lanman->hash, challenge, blob.data);
                                        user_info_temp->password.response.lanman = lm_blob;