From 23159453d3e61e2ad47fe6f86f3763280a11ea0c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 1 Jun 2010 20:27:03 +1000 Subject: s3:auth Rename user_info->smb_name -> user_info->client.account_name This is closer to the structure I want for a common struct auth_usersupplied_info. Andrew Bartlett --- source3/auth/auth.c | 14 +++++++------- source3/auth/auth_builtin.c | 2 +- source3/auth/auth_domain.c | 8 ++++---- source3/auth/auth_netlogond.c | 4 ++-- source3/auth/auth_script.c | 6 +++--- source3/auth/auth_server.c | 4 ++-- source3/auth/auth_wbc.c | 4 ++-- source3/auth/auth_winbind.c | 4 ++-- source3/auth/check_samsec.c | 2 +- source3/auth/user_info.c | 10 +++++----- source3/include/auth.h | 4 +++- 11 files changed, 32 insertions(+), 30 deletions(-) (limited to 'source3') diff --git a/source3/auth/auth.c b/source3/auth/auth.c index 4fabbdddef..eeb18c5c42 100644 --- a/source3/auth/auth.c +++ b/source3/auth/auth.c @@ -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); diff --git a/source3/auth/auth_builtin.c b/source3/auth/auth_builtin.c index 9e8fec9b4a..02a4682542 100644 --- a/source3/auth/auth_builtin.c +++ b/source3/auth/auth_builtin.c @@ -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); diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c index 9d63e59dd6..ec6b3ea059 100644 --- a/source3/auth/auth_domain.c +++ b/source3/auth/auth_domain.c @@ -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); } diff --git a/source3/auth/auth_netlogond.c b/source3/auth/auth_netlogond.c index 28ef93398c..7fea6a53fa 100644 --- a/source3/auth/auth_netlogond.c +++ b/source3/auth/auth_netlogond.c @@ -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)) { diff --git a/source3/auth/auth_script.c b/source3/auth/auth_script.c index 81c80eb4fb..6d30058fe6 100644 --- a/source3/auth/auth_script.c +++ b/source3/auth/auth_script.c @@ -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; } diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c index 35b7fe652c..9d31905d6b 100644 --- a/source3/auth/auth_server.c +++ b/source3/auth/auth_server.c @@ -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, diff --git a/source3/auth/auth_wbc.c b/source3/auth/auth_wbc.c index 7d46c8578c..cbdcb86182 100644 --- a/source3/auth/auth_wbc.c +++ b/source3/auth/auth_wbc.c @@ -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); diff --git a/source3/auth/auth_winbind.c b/source3/auth/auth_winbind.c index d534e59cfc..49ae3a9364 100644 --- a/source3/auth/auth_winbind.c +++ b/source3/auth/auth_winbind.c @@ -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); diff --git a/source3/auth/check_samsec.c b/source3/auth/check_samsec.c index 41a995e155..a60d124cb4 100644 --- a/source3/auth/check_samsec.c +++ b/source3/auth/check_samsec.c @@ -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, diff --git a/source3/auth/user_info.c b/source3/auth/user_info.c index de2022b8d5..09c780c7f8 100644 --- a/source3/auth/user_info.c +++ b/source3/auth/user_info.c @@ -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); diff --git a/source3/include/auth.h b/source3/include/auth.h index 9e55eeec59..e7f8e54dd4 100644 --- a/source3/include/auth.h +++ b/source3/include/auth.h @@ -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 */ -- cgit