diff options
author | Andrew Bartlett <abartlet@samba.org> | 2004-06-07 03:46:32 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:56:35 -0500 |
commit | bcac502d4470094108348bd3945e569f81a26b19 (patch) | |
tree | 78a6a0edd8bf40c716d2111af829f6c99e4828f2 /source4/auth/auth_sam.c | |
parent | f5108651ee95f16128be1b0cfb36c38fac8b5348 (diff) | |
download | samba-bcac502d4470094108348bd3945e569f81a26b19.tar.gz samba-bcac502d4470094108348bd3945e569f81a26b19.tar.bz2 samba-bcac502d4470094108348bd3945e569f81a26b19.zip |
r1058: The start of work on the SamLogon call for NETLOGON.
This starts to store information about the user in the server_info
struct - like the account name, the full name etc.
Also, continue to make the names of the structure elements in the
logon reply more consistant with those in the SAMR pipe.
Andrew Bartlett
(This used to be commit 3ccd96bd945e0fd95e42c69ad8ff07055af2e62b)
Diffstat (limited to 'source4/auth/auth_sam.c')
-rw-r--r-- | source4/auth/auth_sam.c | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/source4/auth/auth_sam.c b/source4/auth/auth_sam.c index 2481b97ce6..e7f428c922 100644 --- a/source4/auth/auth_sam.c +++ b/source4/auth/auth_sam.c @@ -196,6 +196,19 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context, "accountExpires", "objectSid", "userWorkstations", + + /* required for server_info, not access control: */ + "sAMAaccountName", + "displayName", + "scriptPath", + "profilePath", + "homeDirectory", + "homeDrive", + "lastLogon", + "lastLogoff", + "accountExpires", + "badPwdCount", + "logonCount", NULL, }; @@ -346,14 +359,67 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context, (*server_info)->n_domain_groups = group_ret; (*server_info)->domain_groups = groupSIDs; - } + (*server_info)->account_name + = talloc_strdup((*server_info)->mem_ctx, + samdb_result_string(msgs[0], "sAMAccountName", "")); + + (*server_info)->domain + = talloc_strdup((*server_info)->mem_ctx, + samdb_result_string(msgs_domain[0], "name", "")); + + (*server_info)->full_name + = talloc_strdup((*server_info)->mem_ctx, + samdb_result_string(msgs[0], "displayName", "")); + + (*server_info)->logon_script + = talloc_strdup((*server_info)->mem_ctx, + samdb_result_string(msgs[0], "scriptPath", "")); + (*server_info)->profile_path + = talloc_strdup((*server_info)->mem_ctx, + samdb_result_string(msgs[0], "profilePath", "")); + (*server_info)->home_directory + = talloc_strdup((*server_info)->mem_ctx, + samdb_result_string(msgs[0], "homeDirectory", "")); + + (*server_info)->home_drive + = talloc_strdup((*server_info)->mem_ctx, + samdb_result_string(msgs[0], "homeDrive", "")); + + (*server_info)->last_logon = samdb_result_nttime(msgs[0], "lastLogon", 0); + (*server_info)->last_logoff = samdb_result_nttime(msgs[0], "lastLogoff", 0); + (*server_info)->acct_expiry = samdb_result_nttime(msgs[0], "accountExpires", 0); + (*server_info)->last_password_change = samdb_result_nttime(msgs[0], "pwdLastSet", 0); + (*server_info)->allow_password_change + = samdb_result_allow_password_change(sam_ctx, mem_ctx, + domain_dn, msgs[0], "pwdLastSet"); + (*server_info)->allow_password_change + = samdb_result_force_password_change(sam_ctx, mem_ctx, + domain_dn, msgs[0], "pwdLastSet"); + + (*server_info)->logon_count = samdb_result_uint(msgs[0], "logonCount", 0); + (*server_info)->bad_password_count = samdb_result_uint(msgs[0], "badPwdCount", 0); + + (*server_info)->acct_flags = samdb_result_acct_flags(msgs[0], "userAccountControl"); + (*server_info)->guest = False; (*server_info)->user_session_key = user_sess_key; (*server_info)->lm_session_key = lm_sess_key; + if (!(*server_info)->account_name + || !(*server_info)->full_name + || !(*server_info)->logon_script + || !(*server_info)->profile_path + || !(*server_info)->home_directory + || !(*server_info)->home_drive) { + talloc_destroy((*server_info)->mem_ctx); + return NT_STATUS_NO_MEMORY; + } + + samdb_close(sam_ctx); + return nt_status; } |