s3:auth Rename user_info->smb_name -> user_info->client.account_name
authorAndrew Bartlett <abartlet@samba.org>
Tue, 1 Jun 2010 10:27:03 +0000 (20:27 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 7 Jun 2010 13:34:28 +0000 (23:34 +1000)
This is closer to the structure I want for a common struct
auth_usersupplied_info.

Andrew Bartlett

source3/auth/auth.c
source3/auth/auth_builtin.c
source3/auth/auth_domain.c
source3/auth/auth_netlogond.c
source3/auth/auth_script.c
source3/auth/auth_server.c
source3/auth/auth_wbc.c
source3/auth/auth_winbind.c
source3/auth/check_samsec.c
source3/auth/user_info.c
source3/include/auth.h

index 4fabbdddefda99151a5f9964c6b92d6a8048bfd4..eeb18c5c423cddaff9af8e7a16ffb274982a6653 100644 (file)
@@ -214,7 +214,7 @@ static NTSTATUS check_ntlm_password(const struct auth_context *auth_context,
                return NT_STATUS_LOGON_FAILURE;
 
        DEBUG(3, ("check_ntlm_password:  Checking password for unmapped user [%s]\\[%s]@[%s] with the new password interface\n", 
-                 user_info->client_domain, user_info->smb_name, user_info->workstation_name));
+                 user_info->client_domain, user_info->client.account_name, user_info->workstation_name));
 
        DEBUG(3, ("check_ntlm_password:  mapped user is: [%s]\\[%s]@[%s]\n", 
                  user_info->domain, user_info->internal_username, user_info->workstation_name));
@@ -241,14 +241,14 @@ static NTSTATUS check_ntlm_password(const struct auth_context *auth_context,
 #endif
 
        /* This needs to be sorted:  If it doesn't match, what should we do? */
-       if (!check_domain_match(user_info->smb_name, user_info->domain))
+       if (!check_domain_match(user_info->client.account_name, user_info->domain))
                return NT_STATUS_LOGON_FAILURE;
 
        for (auth_method = auth_context->auth_method_list;auth_method; auth_method = auth_method->next) {
                NTSTATUS result;
 
                mem_ctx = talloc_init("%s authentication for user %s\\%s", auth_method->name, 
-                                           user_info->domain, user_info->smb_name);
+                                           user_info->domain, user_info->client.account_name);
 
                result = auth_method->auth(auth_context, auth_method->private_data, mem_ctx, user_info, server_info);
 
@@ -263,10 +263,10 @@ static NTSTATUS check_ntlm_password(const struct auth_context *auth_context,
 
                if (NT_STATUS_IS_OK(nt_status)) {
                        DEBUG(3, ("check_ntlm_password: %s authentication for user [%s] succeeded\n", 
-                                 auth_method->name, user_info->smb_name));
+                                 auth_method->name, user_info->client.account_name));
                } else {
                        DEBUG(5, ("check_ntlm_password: %s authentication for user [%s] FAILED with error %s\n", 
-                                 auth_method->name, user_info->smb_name, nt_errstr(nt_status)));
+                                 auth_method->name, user_info->client.account_name, nt_errstr(nt_status)));
                }
 
                talloc_destroy(mem_ctx);
@@ -300,7 +300,7 @@ static NTSTATUS check_ntlm_password(const struct auth_context *auth_context,
                        DEBUG((*server_info)->guest ? 5 : 2, 
                              ("check_ntlm_password:  %sauthentication for user [%s] -> [%s] -> [%s] succeeded\n", 
                               (*server_info)->guest ? "guest " : "", 
-                              user_info->smb_name, 
+                              user_info->client.account_name,
                               user_info->internal_username, 
                               unix_username));
                }
@@ -311,7 +311,7 @@ static NTSTATUS check_ntlm_password(const struct auth_context *auth_context,
        /* failed authentication; check for guest lapping */
 
        DEBUG(2, ("check_ntlm_password:  Authentication for user [%s] -> [%s] FAILED with error %s\n", 
-                 user_info->smb_name, user_info->internal_username, 
+                 user_info->client.account_name, user_info->internal_username,
                  nt_errstr(nt_status)));
        ZERO_STRUCTP(server_info); 
 
index 9e8fec9b4a0833a4057b744cf27431dedcdb7c0b..02a4682542700382c3f4fcd806c7ef81d4278d46 100644 (file)
@@ -93,7 +93,7 @@ static NTSTATUS check_name_to_ntstatus_security(const struct auth_context *auth_
 
        DEBUG(10, ("Check auth for: [%s]\n", user_info->internal_username));
 
-       fstrcpy(user, user_info->smb_name);
+       fstrcpy(user, user_info->client.account_name);
 
        if (strnequal("NT_STATUS", user, strlen("NT_STATUS"))) {
                strupper_m(user);
index 9d63e59dd60709ad30b0489ec78fcc0f5bfb317b..ec6b3ea05926f7201004a0904ebc56a5a6923d49 100644 (file)
@@ -308,7 +308,7 @@ static NTSTATUS domain_client_validate(TALLOC_CTX *mem_ctx,
                                                      mem_ctx,
                                                      user_info->logon_parameters,/* flags such as 'allow workstation logon' */ 
                                                      dc_name,                    /* server name */
-                                                     user_info->smb_name,        /* user name logging on. */
+                                                     user_info->client.account_name,        /* user name logging on. */
                                                      user_info->client_domain,   /* domain name */
                                                      user_info->workstation_name,/* workstation name */
                                                      chal,                       /* 8 byte challenge. */
@@ -324,7 +324,7 @@ static NTSTATUS domain_client_validate(TALLOC_CTX *mem_ctx,
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0,("domain_client_validate: unable to validate password "
                          "for user %s in domain %s to Domain controller %s. "
-                         "Error was %s.\n", user_info->smb_name,
+                         "Error was %s.\n", user_info->client.account_name,
                          user_info->client_domain, dc_name, 
                          nt_errstr(nt_status)));
 
@@ -334,7 +334,7 @@ static NTSTATUS domain_client_validate(TALLOC_CTX *mem_ctx,
                }
        } else {
                nt_status = make_server_info_info3(mem_ctx,
-                                               user_info->smb_name,
+                                               user_info->client.account_name,
                                                domain,
                                                server_info,
                                                info3);
@@ -355,7 +355,7 @@ static NTSTATUS domain_client_validate(TALLOC_CTX *mem_ctx,
                        }
                }
 
-               netsamlogon_cache_store(user_info->smb_name, info3);
+               netsamlogon_cache_store(user_info->client.account_name, info3);
                TALLOC_FREE(info3);
        }
 
index 28ef93398ca5a691ca609e308783e16de6aff574..7fea6a53fae8fc3d4022af8f5aa7117e4ef1981f 100644 (file)
@@ -83,7 +83,7 @@ static NTSTATUS netlogond_validate(TALLOC_CTX *mem_ctx,
                user_info->logon_parameters,           /* flags such as 'allow
                                                        * workstation logon' */
                global_myname(),                       /* server name */
-               user_info->smb_name,                   /* user name logging on. */
+               user_info->client.account_name,                   /* user name logging on. */
                user_info->client_domain,              /* domain name */
                user_info->workstation_name,           /* workstation name */
                (uchar *)auth_context->challenge.data, /* 8 byte challenge. */
@@ -281,7 +281,7 @@ static NTSTATUS check_netlogond_security(const struct auth_context *auth_context
 
  okay:
 
-       status = make_server_info_info3(mem_ctx, user_info->smb_name,
+       status = make_server_info_info3(mem_ctx, user_info->client.account_name,
                                        user_info->domain, server_info,
                                        info3);
        if (!NT_STATUS_IS_OK(status)) {
index 81c80eb4fbdd1f85aa6c3fbb2061410ff3a124aa..6d30058fe6c230103a1138822b30f678871cb140 100644 (file)
@@ -63,7 +63,7 @@ static NTSTATUS script_check_user_credentials(const struct auth_context *auth_co
        }               
 
        secret_str_len = strlen(user_info->domain) + 1 +
-                       strlen(user_info->smb_name) + 1 +
+                       strlen(user_info->client.account_name) + 1 +
                        16 + 1 + /* 8 bytes of challenge going to 16 */
                        48 + 1 + /* 24 bytes of challenge going to 48 */
                        48 + 1;
@@ -75,7 +75,7 @@ static NTSTATUS script_check_user_credentials(const struct auth_context *auth_co
 
        safe_strcpy( secret_str, user_info->domain, secret_str_len - 1);
        safe_strcat( secret_str, "\n", secret_str_len - 1);
-       safe_strcat( secret_str, user_info->smb_name, secret_str_len - 1);
+       safe_strcat( secret_str, user_info->client.account_name, secret_str_len - 1);
        safe_strcat( secret_str, "\n", secret_str_len - 1);
 
        for (i = 0; i < 8; i++) {
@@ -109,7 +109,7 @@ static NTSTATUS script_check_user_credentials(const struct auth_context *auth_co
 
        if (ret) {
                DEBUG(1,("script_check_user_credentials: failed to authenticate %s\\%s\n",
-                       user_info->domain, user_info->smb_name ));
+                       user_info->domain, user_info->client.account_name ));
                /* auth failed. */
                return NT_STATUS_NO_SUCH_USER;
        }
index 35b7fe652cf158cb75f3668726af7c39e01fb0ab..9d31905d6b0f9ece810512d508f79fdb98b5fa9a 100644 (file)
@@ -395,14 +395,14 @@ use this machine as the password server.\n"));
        if (!user_info->encrypted) {
                /* Plaintext available */
                nt_status = cli_session_setup(
-                       cli, user_info->smb_name, 
+                       cli, user_info->client.account_name,
                        (char *)user_info->plaintext_password.data, 
                        user_info->plaintext_password.length, 
                        NULL, 0, user_info->domain);
 
        } else {
                nt_status = cli_session_setup(
-                       cli, user_info->smb_name, 
+                       cli, user_info->client.account_name,
                        (char *)user_info->lm_resp.data, 
                        user_info->lm_resp.length, 
                        (char *)user_info->nt_resp.data, 
index 7d46c8578cdd25733b8c3c311aa05c4199139dcd..cbdcb86182d89792d2050e3fba813a2291bbb5f4 100644 (file)
@@ -63,7 +63,7 @@ static NTSTATUS check_wbc_security(const struct auth_context *auth_context,
 
        DEBUG(10, ("Check auth for: [%s]", user_info->internal_username));
 
-       params.account_name     = user_info->smb_name;
+       params.account_name     = user_info->client.account_name;
        params.domain_name      = user_info->domain;
        params.workstation_name = user_info->workstation_name;
 
@@ -120,7 +120,7 @@ static NTSTATUS check_wbc_security(const struct auth_context *auth_context,
        DEBUG(10,("wbcAuthenticateUserEx succeeded\n"));
 
        nt_status = make_server_info_wbcAuthUserInfo(mem_ctx,
-                                                    user_info->smb_name,
+                                                    user_info->client.account_name,
                                                     user_info->domain,
                                                     info, server_info);
        wbcFreeMemory(info);
index d534e59cfc8308ee57fec10b9a401c9dfedeb5fe..49ae3a936495939653e4ee9d1a459af9646f0218 100644 (file)
@@ -59,7 +59,7 @@ static NTSTATUS check_winbind_security(const struct auth_context *auth_context,
 
        /* Send off request */
 
-       params.account_name     = user_info->smb_name;
+       params.account_name     = user_info->client.account_name;
        params.domain_name      = user_info->domain;
        params.workstation_name = user_info->workstation_name;
 
@@ -114,7 +114,7 @@ static NTSTATUS check_winbind_security(const struct auth_context *auth_context,
        }
 
        nt_status = make_server_info_wbcAuthUserInfo(mem_ctx,
-                                                    user_info->smb_name,
+                                                    user_info->client.account_name,
                                                     user_info->domain,
                                                     info, server_info);
        wbcFreeMemory(info);
index 41a995e1556c28abf1244ffe17981b46d9c3b731..a60d124cb4581a4e809cf1c42d9f59172ef954b7 100644 (file)
@@ -99,7 +99,7 @@ static NTSTATUS sam_password_ok(TALLOC_CTX *mem_ctx,
                                           challenge,
                                           &user_info->lm_resp, &user_info->nt_resp,
                                           username,
-                                          user_info->smb_name,
+                                          user_info->client.account_name,
                                           user_info->client_domain,
                                           lm_hash,
                                           nt_hash,
index de2022b8d5013dcbf73cd4155ab8bca7ef90d970..09c780c7f86bdd0a653b558fce23959ffdd07a58 100644 (file)
@@ -52,8 +52,8 @@ NTSTATUS make_user_info(struct auth_usersupplied_info **user_info,
 
        DEBUG(5,("making strings for %s's user_info struct\n", internal_username));
 
-       (*user_info)->smb_name = SMB_STRDUP(smb_name);
-       if ((*user_info)->smb_name == NULL) {
+       (*user_info)->client.account_name = SMB_STRDUP(smb_name);
+       if ((*user_info)->client.account_name == NULL) {
                free_user_info(user_info);
                return NT_STATUS_NO_MEMORY;
        }
@@ -113,11 +113,11 @@ void free_user_info(struct auth_usersupplied_info **user_info)
 {
        DEBUG(5,("attempting to free (and zero) a user_info structure\n"));
        if (*user_info != NULL) {
-               if ((*user_info)->smb_name) {
+               if ((*user_info)->client.account_name) {
                        DEBUG(10,("structure was created for %s\n",
-                                 (*user_info)->smb_name));
+                                 (*user_info)->client.account_name));
                }
-               SAFE_FREE((*user_info)->smb_name);
+               SAFE_FREE((*user_info)->client.account_name);
                SAFE_FREE((*user_info)->internal_username);
                SAFE_FREE((*user_info)->client_domain);
                SAFE_FREE((*user_info)->domain);
index 9e55eeec596391d50ca4810368250f7c1b8bb2cc..e7f8e54dd48c27cf645af4482cb4130400f3ac5a 100644 (file)
@@ -27,12 +27,14 @@ struct auth_usersupplied_info {
        DATA_BLOB plaintext_password;
 
        bool encrypted;
+       struct {
+               char *account_name;   /* username before mapping */
+       } client;
 
        bool was_mapped;              /* Did the username map actually match? */
        char *client_domain;          /* domain name string */
        char *domain;                 /* domain name after mapping */
        char *internal_username;      /* username after mapping */
-       char *smb_name;               /* username before mapping */
        const char *workstation_name; /* workstation name (netbios calling
                                       * name) unicode string */