Changeset 224 for branches/samba-3.3.x/source/rpc_server
- Timestamp:
- May 24, 2009, 7:55:48 AM (16 years ago)
- Location:
- branches/samba-3.3.x/source/rpc_server
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/rpc_server/srv_lsa_nt.c
r223 r224 829 829 &mapped_count); 830 830 831 if (NT_STATUS_IS_ERR(status)) { 831 /* Only return here when there is a real error. 832 NT_STATUS_NONE_MAPPED is a special case as it indicates that none of 833 the requested sids could be resolved. Older versions of XP (pre SP3) 834 rely that we return with the string representations of those SIDs in 835 that case. If we don't, XP crashes - Guenther 836 */ 837 838 if (NT_STATUS_IS_ERR(status) && 839 !NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) { 832 840 return status; 833 841 } -
branches/samba-3.3.x/source/rpc_server/srv_pipe.c
r222 r224 995 995 for (i=0; i<rpc_lookup_size; i++) { 996 996 DEBUGADD(10, ("checking %s\n", rpc_lookup[i].pipe.clnt)); 997 if (strequal(rpc_lookup[i].pipe.clnt, p->name) 998 && ndr_syntax_id_equal( 997 if (ndr_syntax_id_equal( 999 998 abstract, &rpc_lookup[i].rpc_interface) 1000 999 && ndr_syntax_id_equal( -
branches/samba-3.3.x/source/rpc_server/srv_samr_nt.c
r221 r224 621 621 return NT_STATUS_INVALID_HANDLE; 622 622 623 status = access_check_samr_function(info->acc_granted,624 SAMR_ACCESS_OPEN_DOMAIN,625 "_samr_OpenDomain" );626 627 if ( !NT_STATUS_IS_OK(status) )628 return status;629 630 623 /*check if access can be granted as requested by client. */ 631 624 map_max_allowed_access(p->pipe_user.nt_user_token, &des_access); … … 2898 2891 2899 2892 status = access_check_samr_function(info->acc_granted, 2900 SAMR_ACCESS_ OPEN_DOMAIN,2893 SAMR_ACCESS_LOOKUP_DOMAIN, 2901 2894 "_samr_QueryDomainInfo" ); 2902 2895 … … 3323 3316 3324 3317 se_map_generic( &des_access, &sam_generic_mapping ); 3325 info->acc_granted = des_access & (SAMR_ACCESS_ENUM_DOMAINS|SAMR_ACCESS_ OPEN_DOMAIN);3318 info->acc_granted = des_access & (SAMR_ACCESS_ENUM_DOMAINS|SAMR_ACCESS_LOOKUP_DOMAIN); 3326 3319 3327 3320 /* get a (unique) handle. open a policy on it. */ … … 3459 3452 3460 3453 status = access_check_samr_function(info->acc_granted, 3461 SAMR_ACCESS_ OPEN_DOMAIN,3454 SAMR_ACCESS_LOOKUP_DOMAIN, 3462 3455 "_samr_LookupDomain"); 3463 3456 if (!NT_STATUS_IS_OK(status)) { … … 3744 3737 } 3745 3738 3746 if (id18->password_expired) { 3747 pdb_set_pass_last_set_time(pwd, 0, PDB_CHANGED); 3748 } else { 3749 /* FIXME */ 3750 pdb_set_pass_last_set_time(pwd, time(NULL), PDB_CHANGED); 3751 } 3739 copy_id18_to_sam_passwd(pwd, id18); 3752 3740 3753 3741 return pdb_update_sam_account(pwd); … … 3956 3944 ********************************************************************/ 3957 3945 3958 static bool set_user_info_pw(uint8 *pass, struct samu *pwd, 3959 int level) 3946 static bool set_user_info_pw(uint8 *pass, struct samu *pwd) 3960 3947 { 3961 3948 uint32 len = 0; 3962 3949 char *plaintext_buf = NULL; 3963 3950 uint32 acct_ctrl; 3964 time_t last_set_time;3965 enum pdb_value_state last_set_state;3966 3951 3967 3952 DEBUG(5, ("Attempting administrator password change for user %s\n", … … 3969 3954 3970 3955 acct_ctrl = pdb_get_acct_ctrl(pwd); 3971 /* we need to know if it's expired, because this is an admin change, not a3972 user change, so it's still expired when we're done */3973 last_set_state = pdb_get_init_flags(pwd, PDB_PASSLASTSET);3974 last_set_time = pdb_get_pass_last_set_time(pwd);3975 3956 3976 3957 if (!decode_pw_buffer(talloc_tos(), … … 4015 3996 memset(plaintext_buf, '\0', strlen(plaintext_buf)); 4016 3997 4017 /*4018 * A level 25 change does reset the pwdlastset field, a level 244019 * change does not. I know this is probably not the full story, but4020 * it is needed to make XP join LDAP correctly, without it the later4021 * auth2 check can fail with PWD_MUST_CHANGE.4022 */4023 if (level != 25) {4024 /*4025 * restore last set time as this is an admin change, not a4026 * user pw change4027 */4028 pdb_set_pass_last_set_time (pwd, last_set_time,4029 last_set_state);4030 }4031 4032 3998 DEBUG(5,("set_user_info_pw: pdb_update_pwd()\n")); 4033 3999 4034 /* update the SAMBA password */ 4035 if(!NT_STATUS_IS_OK(pdb_update_sam_account(pwd))) { 4036 return False; 4000 return True; 4001 } 4002 4003 /******************************************************************* 4004 set_user_info_24 4005 ********************************************************************/ 4006 4007 static NTSTATUS set_user_info_24(TALLOC_CTX *mem_ctx, 4008 struct samr_UserInfo24 *id24, 4009 struct samu *pwd) 4010 { 4011 NTSTATUS status; 4012 4013 if (id24 == NULL) { 4014 DEBUG(5, ("set_user_info_24: NULL id24\n")); 4015 return NT_STATUS_INVALID_PARAMETER; 4016 } 4017 4018 if (!set_user_info_pw(id24->password.data, pwd)) { 4019 return NT_STATUS_WRONG_PASSWORD; 4020 } 4021 4022 copy_id24_to_sam_passwd(pwd, id24); 4023 4024 status = pdb_update_sam_account(pwd); 4025 if (!NT_STATUS_IS_OK(status)) { 4026 return status; 4037 4027 } 4038 4028 4039 return True;4029 return NT_STATUS_OK; 4040 4030 } 4041 4031 … … 4061 4051 if (id25->info.fields_present & SAMR_FIELD_LAST_PWD_CHANGE) { 4062 4052 return NT_STATUS_ACCESS_DENIED; 4053 } 4054 4055 if ((id25->info.fields_present & SAMR_FIELD_NT_PASSWORD_PRESENT) || 4056 (id25->info.fields_present & SAMR_FIELD_LM_PASSWORD_PRESENT)) { 4057 4058 if (!set_user_info_pw(id25->password.data, pwd)) { 4059 return NT_STATUS_WRONG_PASSWORD; 4060 } 4063 4061 } 4064 4062 … … 4087 4085 return NT_STATUS_OK; 4088 4086 } 4087 4088 /******************************************************************* 4089 set_user_info_26 4090 ********************************************************************/ 4091 4092 static NTSTATUS set_user_info_26(TALLOC_CTX *mem_ctx, 4093 struct samr_UserInfo26 *id26, 4094 struct samu *pwd) 4095 { 4096 NTSTATUS status; 4097 4098 if (id26 == NULL) { 4099 DEBUG(5, ("set_user_info_26: NULL id26\n")); 4100 return NT_STATUS_INVALID_PARAMETER; 4101 } 4102 4103 if (!set_user_info_pw(id26->password.data, pwd)) { 4104 return NT_STATUS_WRONG_PASSWORD; 4105 } 4106 4107 copy_id26_to_sam_passwd(pwd, id26); 4108 4109 status = pdb_update_sam_account(pwd); 4110 if (!NT_STATUS_IS_OK(status)) { 4111 return status; 4112 } 4113 4114 return NT_STATUS_OK; 4115 } 4116 4089 4117 4090 4118 /******************************************************************* … … 4248 4276 dump_data(100, info->info24.password.data, 516); 4249 4277 4250 if (!set_user_info_pw(info->info24.password.data, pwd, 4251 switch_value)) { 4252 status = NT_STATUS_WRONG_PASSWORD; 4253 } 4278 status = set_user_info_24(p->mem_ctx, 4279 &info->info24, pwd); 4254 4280 break; 4255 4281 … … 4266 4292 status = set_user_info_25(p->mem_ctx, 4267 4293 &info->info25, pwd); 4268 if (!NT_STATUS_IS_OK(status)) {4269 goto done;4270 }4271 if (!set_user_info_pw(info->info25.password.data, pwd,4272 switch_value)) {4273 status = NT_STATUS_WRONG_PASSWORD;4274 }4275 4294 break; 4276 4295 … … 4285 4304 dump_data(100, info->info26.password.data, 516); 4286 4305 4287 if (!set_user_info_pw(info->info26.password.data, pwd, 4288 switch_value)) { 4289 status = NT_STATUS_WRONG_PASSWORD; 4290 } 4306 status = set_user_info_26(p->mem_ctx, 4307 &info->info26, pwd); 4291 4308 break; 4292 4309 … … 4294 4311 status = NT_STATUS_INVALID_INFO_CLASS; 4295 4312 } 4296 4297 done:4298 4313 4299 4314 TALLOC_FREE(pwd); -
branches/samba-3.3.x/source/rpc_server/srv_samr_util.c
r206 r224 35 35 (!(s1) && (s2)) ||\ 36 36 ((s1) && (s2) && (strcmp((s1), (s2)) != 0)) 37 38 /************************************************************* 39 Copies a struct samr_UserInfo18 to a struct samu 40 **************************************************************/ 41 42 void copy_id18_to_sam_passwd(struct samu *to, 43 struct samr_UserInfo18 *from) 44 { 45 struct samr_UserInfo21 i; 46 47 if (from == NULL || to == NULL) { 48 return; 49 } 50 51 ZERO_STRUCT(i); 52 53 i.fields_present = SAMR_FIELD_EXPIRED_FLAG; 54 i.password_expired = from->password_expired; 55 56 copy_id21_to_sam_passwd("INFO_18", to, &i); 57 } 37 58 38 59 /************************************************************* … … 337 358 DEBUG(10,("%s SAMR_FIELD_EXPIRED_FLAG: %02X\n", l, 338 359 from->password_expired)); 339 if (from->password_expired == PASS_MUST_CHANGE_AT_NEXT_LOGON) {360 if (from->password_expired != 0) { 340 361 pdb_set_pass_last_set_time(to, 0, PDB_CHANGED); 341 362 } else { … … 346 367 for example, to clear an autolocked acct. 347 368 We must check to see if it's expired first. jmcd */ 369 370 uint32_t pwd_max_age = 0; 371 time_t now = time(NULL); 372 373 pdb_get_account_policy(AP_MAX_PASSWORD_AGE, &pwd_max_age); 374 375 if (pwd_max_age == (uint32_t)-1 || pwd_max_age == 0) { 376 pwd_max_age = get_time_t_max(); 377 } 378 348 379 stored_time = pdb_get_pass_last_set_time(to); 349 if (stored_time == 0) 350 pdb_set_pass_last_set_time(to, time(NULL),PDB_CHANGED); 380 381 /* we will only *set* a pwdlastset date when 382 a) the last pwdlastset time was 0 (user was forced to 383 change password). 384 b) the users password has not expired. gd. */ 385 386 if ((stored_time == 0) || 387 ((now - stored_time) > pwd_max_age)) { 388 pdb_set_pass_last_set_time(to, now, PDB_CHANGED); 389 } 351 390 } 352 391 } … … 369 408 370 409 /************************************************************* 410 Copies a struct samr_UserInfo24 to a struct samu 411 **************************************************************/ 412 413 void copy_id24_to_sam_passwd(struct samu *to, 414 struct samr_UserInfo24 *from) 415 { 416 struct samr_UserInfo21 i; 417 418 if (from == NULL || to == NULL) { 419 return; 420 } 421 422 ZERO_STRUCT(i); 423 424 i.fields_present = SAMR_FIELD_EXPIRED_FLAG; 425 i.password_expired = from->password_expired; 426 427 copy_id21_to_sam_passwd("INFO_24", to, &i); 428 } 429 430 /************************************************************* 371 431 Copies a struct samr_UserInfo25 to a struct samu 372 432 **************************************************************/ … … 381 441 copy_id21_to_sam_passwd("INFO_25", to, &from->info); 382 442 } 443 444 /************************************************************* 445 Copies a struct samr_UserInfo26 to a struct samu 446 **************************************************************/ 447 448 void copy_id26_to_sam_passwd(struct samu *to, 449 struct samr_UserInfo26 *from) 450 { 451 struct samr_UserInfo21 i; 452 453 if (from == NULL || to == NULL) { 454 return; 455 } 456 457 ZERO_STRUCT(i); 458 459 i.fields_present = SAMR_FIELD_EXPIRED_FLAG; 460 i.password_expired = from->password_expired; 461 462 copy_id21_to_sam_passwd("INFO_26", to, &i); 463 }
Note:
See TracChangeset
for help on using the changeset viewer.