diff options
author | Andrew Tridgell <tridge@samba.org> | 2008-12-03 17:47:39 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2008-12-03 17:47:39 +1100 |
commit | a226d86dcec393b2cd657d5441c3041dfdf5cd8f (patch) | |
tree | 03ef7f3207607a4e5351bf50892b0a39dcf6f219 /source3/rpc_client | |
parent | 30eff4f31b497ac94d8ee02ee2ec24bc8865ce0d (diff) | |
parent | 85b8cccab072bab263061654b677bc84826646c9 (diff) | |
download | samba-a226d86dcec393b2cd657d5441c3041dfdf5cd8f.tar.gz samba-a226d86dcec393b2cd657d5441c3041dfdf5cd8f.tar.bz2 samba-a226d86dcec393b2cd657d5441c3041dfdf5cd8f.zip |
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'source3/rpc_client')
-rw-r--r-- | source3/rpc_client/cli_reg.c | 17 | ||||
-rw-r--r-- | source3/rpc_client/init_netlogon.c | 18 | ||||
-rw-r--r-- | source3/rpc_client/init_samr.c | 154 |
3 files changed, 158 insertions, 31 deletions
diff --git a/source3/rpc_client/cli_reg.c b/source3/rpc_client/cli_reg.c index ba98e25d63..2ed7119f4b 100644 --- a/source3/rpc_client/cli_reg.c +++ b/source3/rpc_client/cli_reg.c @@ -60,20 +60,3 @@ NTSTATUS rpccli_winreg_Connect(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return NT_STATUS_INVALID_PARAMETER; } - -/******************************************************************* - Fill in a REGVAL_BUFFER for the data given a REGISTRY_VALUE - *******************************************************************/ - -uint32 reg_init_regval_buffer( REGVAL_BUFFER *buf2, REGISTRY_VALUE *val ) -{ - uint32 real_size = 0; - - if ( !buf2 || !val ) - return 0; - - real_size = regval_size(val); - init_regval_buffer( buf2, (unsigned char*)regval_data_p(val), real_size ); - - return real_size; -} diff --git a/source3/rpc_client/init_netlogon.c b/source3/rpc_client/init_netlogon.c index e4c39e739e..6f7a541f72 100644 --- a/source3/rpc_client/init_netlogon.c +++ b/source3/rpc_client/init_netlogon.c @@ -172,7 +172,8 @@ static NTSTATUS nt_token_to_group_list(TALLOC_CTX *mem_ctx, *****************************************************************************/ NTSTATUS serverinfo_to_SamInfo3(struct auth_serversupplied_info *server_info, - uint8_t pipe_session_key[16], + uint8_t *pipe_session_key, + size_t pipe_session_key_len, struct netr_SamInfo3 *sam3) { struct samu *sampw; @@ -203,6 +204,13 @@ NTSTATUS serverinfo_to_SamInfo3(struct auth_serversupplied_info *server_info, user_sid = pdb_get_user_sid(sampw); group_sid = pdb_get_group_sid(sampw); + if (pipe_session_key && pipe_session_key_len != 16) { + DEBUG(0,("serverinfo_to_SamInfo3: invalid " + "pipe_session_key_len[%zu] != 16\n", + pipe_session_key_len)); + return NT_STATUS_INTERNAL_ERROR; + } + if ((user_sid == NULL) || (group_sid == NULL)) { DEBUG(1, ("_netr_LogonSamLogon: User without group or user SID\n")); return NT_STATUS_UNSUCCESSFUL; @@ -248,14 +256,18 @@ NTSTATUS serverinfo_to_SamInfo3(struct auth_serversupplied_info *server_info, server_info->user_session_key.data, MIN(sizeof(user_session_key.key), server_info->user_session_key.length)); - SamOEMhash(user_session_key.key, pipe_session_key, 16); + if (pipe_session_key) { + SamOEMhash(user_session_key.key, pipe_session_key, 16); + } } if (server_info->lm_session_key.length) { memcpy(lm_session_key.key, server_info->lm_session_key.data, MIN(sizeof(lm_session_key.key), server_info->lm_session_key.length)); - SamOEMhash(lm_session_key.key, pipe_session_key, 8); + if (pipe_session_key) { + SamOEMhash(lm_session_key.key, pipe_session_key, 8); + } } groups.count = num_gids; diff --git a/source3/rpc_client/init_samr.c b/source3/rpc_client/init_samr.c index 283be0d98b..6a9e6d1682 100644 --- a/source3/rpc_client/init_samr.c +++ b/source3/rpc_client/init_samr.c @@ -47,7 +47,7 @@ void init_samr_DomGeneralInformation(struct samr_DomGeneralInformation *r, const char *domain_name, const char *primary, uint64_t sequence_num, - uint32_t unknown2, + enum samr_DomainServerState domain_server_state, enum samr_Role role, uint32_t unknown3, uint32_t num_users, @@ -59,7 +59,7 @@ void init_samr_DomGeneralInformation(struct samr_DomGeneralInformation *r, init_lsa_String(&r->domain_name, domain_name); init_lsa_String(&r->primary, primary); r->sequence_num = sequence_num; - r->unknown2 = unknown2; + r->domain_server_state = domain_server_state; r->role = role; r->unknown3 = unknown3; r->num_users = num_users; @@ -134,11 +134,12 @@ void init_samr_DomInfo8(struct samr_DomInfo8 *r, ********************************************************************/ void init_samr_DomInfo9(struct samr_DomInfo9 *r, - uint32_t unknown) + enum samr_DomainServerState domain_server_state) { - r->unknown = unknown; + r->domain_server_state = domain_server_state; } + /******************************************************************* inits a structure. ********************************************************************/ @@ -252,6 +253,53 @@ void init_samr_alias_info3(struct lsa_String *r, } /******************************************************************* + inits a samr_UserInfo5 structure. +********************************************************************/ + +void init_samr_user_info5(struct samr_UserInfo5 *r, + const char *account_name, + const char *full_name, + uint32_t rid, + uint32_t primary_gid, + const char *home_directory, + const char *home_drive, + const char *logon_script, + const char *profile_path, + const char *description, + const char *workstations, + NTTIME last_logon, + NTTIME last_logoff, + struct samr_LogonHours logon_hours, + uint16_t bad_password_count, + uint16_t logon_count, + NTTIME last_password_change, + NTTIME acct_expiry, + uint32_t acct_flags) +{ + DEBUG(5, ("init_samr_user_info5\n")); + + init_lsa_String(&r->account_name, account_name); + init_lsa_String(&r->full_name, full_name); + r->rid = rid; + r->primary_gid = primary_gid; + init_lsa_String(&r->home_directory, home_directory); + init_lsa_String(&r->home_drive, home_drive); + init_lsa_String(&r->logon_script, logon_script); + init_lsa_String(&r->profile_path, profile_path); + init_lsa_String(&r->description, description); + init_lsa_String(&r->workstations, workstations); + r->last_logon = last_logon; + r->last_logoff = last_logoff; + r->logon_hours = logon_hours; + r->bad_password_count = bad_password_count; + r->logon_count = logon_count; + r->last_password_change = last_password_change; + r->acct_expiry = acct_expiry; + r->acct_flags = acct_flags; +} + + +/******************************************************************* inits a samr_UserInfo7 structure. ********************************************************************/ @@ -410,8 +458,7 @@ void init_samr_user_info23(struct samr_UserInfo23 *r, uint8_t nt_password_set, uint8_t lm_password_set, uint8_t password_expired, - uint8_t data[516], - uint8_t pw_len) + struct samr_CryptPassword *pwd_buf) { memset(r, '\0', sizeof(*r)); init_samr_user_info21(&r->info, @@ -444,7 +491,7 @@ void init_samr_user_info23(struct samr_UserInfo23 *r, lm_password_set, password_expired); - memcpy(r->password.data, data, sizeof(r->password.data)); + r->password = *pwd_buf; } /************************************************************************* @@ -452,13 +499,98 @@ void init_samr_user_info23(struct samr_UserInfo23 *r, *************************************************************************/ void init_samr_user_info24(struct samr_UserInfo24 *r, - uint8_t data[516], - uint8_t pw_len) + struct samr_CryptPassword *pwd_buf, + uint8_t password_expired) { DEBUG(10, ("init_samr_user_info24:\n")); - memcpy(r->password.data, data, sizeof(r->password.data)); - r->pw_len = pw_len; + r->password = *pwd_buf; + r->password_expired = password_expired; +} + +/************************************************************************* + init_samr_user_info25 + *************************************************************************/ + +void init_samr_user_info25(struct samr_UserInfo25 *r, + NTTIME last_logon, + NTTIME last_logoff, + NTTIME last_password_change, + NTTIME acct_expiry, + NTTIME allow_password_change, + NTTIME force_password_change, + const char *account_name, + const char *full_name, + const char *home_directory, + const char *home_drive, + const char *logon_script, + const char *profile_path, + const char *description, + const char *workstations, + const char *comment, + struct lsa_BinaryString *parameters, + uint32_t rid, + uint32_t primary_gid, + uint32_t acct_flags, + uint32_t fields_present, + struct samr_LogonHours logon_hours, + uint16_t bad_password_count, + uint16_t logon_count, + uint16_t country_code, + uint16_t code_page, + uint8_t nt_password_set, + uint8_t lm_password_set, + uint8_t password_expired, + struct samr_CryptPasswordEx *pwd_buf) +{ + DEBUG(10, ("init_samr_user_info25:\n")); + + memset(r, '\0', sizeof(*r)); + init_samr_user_info21(&r->info, + last_logon, + last_logoff, + last_password_change, + acct_expiry, + allow_password_change, + force_password_change, + account_name, + full_name, + home_directory, + home_drive, + logon_script, + profile_path, + description, + workstations, + comment, + parameters, + rid, + primary_gid, + acct_flags, + fields_present, + logon_hours, + bad_password_count, + logon_count, + country_code, + code_page, + nt_password_set, + lm_password_set, + password_expired); + + r->password = *pwd_buf; +} + +/************************************************************************* + init_samr_user_info26 + *************************************************************************/ + +void init_samr_user_info26(struct samr_UserInfo26 *r, + struct samr_CryptPasswordEx *pwd_buf, + uint8_t password_expired) +{ + DEBUG(10, ("init_samr_user_info26:\n")); + + r->password = *pwd_buf; + r->password_expired = password_expired; } /************************************************************************* |