Changeset 134 for branches/samba-3.0/source/rpc_server
- Timestamp:
- May 23, 2008, 6:56:41 AM (17 years ago)
- Location:
- branches/samba-3.0/source/rpc_server
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.0/source/rpc_server/srv_netlog_nt.c
r1 r134 974 974 fstring group_sid_string; 975 975 unsigned char user_session_key[16]; 976 unsigned char lm_session_key[ 16];976 unsigned char lm_session_key[8]; 977 977 unsigned char pipe_session_key[16]; 978 978 … … 1055 1055 memcpy(pipe_session_key, p->auth.a_u.schannel_auth->sess_key, 16); 1056 1056 } 1057 SamOEMhash(lm_session_key, pipe_session_key, 16);1057 SamOEMhash(lm_session_key, pipe_session_key, 8); 1058 1058 memset(pipe_session_key, '\0', 16); 1059 1059 } -
branches/samba-3.0/source/rpc_server/srv_samr.c
r1 r134 1495 1495 return True; 1496 1496 } 1497 1498 /******************************************************************* 1499 api_samr_get_dispenum_index 1500 ********************************************************************/ 1501 1502 static BOOL api_samr_get_dispenum_index(pipes_struct *p) 1503 { 1504 SAMR_Q_GET_DISPENUM_INDEX q_u; 1505 SAMR_R_GET_DISPENUM_INDEX r_u; 1506 prs_struct *data = &p->in_data.data; 1507 prs_struct *rdata = &p->out_data.rdata; 1508 1509 ZERO_STRUCT(q_u); 1510 ZERO_STRUCT(r_u); 1511 1512 if(!samr_io_q_get_dispenum_index("", &q_u, data, 0)) { 1513 DEBUG(0,("api_samr_get_dispenum_index: unable to unmarshall SAMR_Q_GET_DISPENUM_INDEX.\n")); 1514 return False; 1515 } 1516 1517 r_u.status = _samr_get_dispenum_index(p, &q_u, &r_u); 1518 1519 /* store the response in the SMB stream */ 1520 if(!samr_io_r_get_dispenum_index("", &r_u, rdata, 0)) { 1521 DEBUG(0,("api_samr_get_dispenum_index: unable to marshall SAMR_R_GET_DISPENUM_INDEX.\n")); 1522 return False; 1523 } 1524 1525 return True; 1526 } 1527 1497 1528 1498 1529 /******************************************************************* … … 1556 1587 {"SAMR_CONNECT4" , SAMR_CONNECT4 , api_samr_connect4 }, 1557 1588 {"SAMR_CHGPASSWD_USER3" , SAMR_CHGPASSWD_USER3 , api_samr_chgpasswd_user3 }, 1558 {"SAMR_CONNECT5" , SAMR_CONNECT5 , api_samr_connect5 } 1589 {"SAMR_CONNECT5" , SAMR_CONNECT5 , api_samr_connect5 }, 1590 {"SAMR_GET_DISPENUM_INDEX", SAMR_GET_DISPENUM_INDEX, api_samr_get_dispenum_index }, 1591 {"SAMR_GET_DISPENUM_INDEX2",SAMR_GET_DISPENUM_INDEX2, api_samr_get_dispenum_index } 1559 1592 }; 1560 1593 -
branches/samba-3.0/source/rpc_server/srv_samr_nt.c
r124 r134 1339 1339 return disp_ret; 1340 1340 1341 /* calculate the total size */ 1342 total_data_size=num_account*struct_size; 1341 temp_size = num_account * struct_size; 1343 1342 1344 1343 if (num_account) { 1345 1344 r_u->status = STATUS_MORE_ENTRIES; 1346 1345 } else { 1346 r_u->status = NT_STATUS_OK; 1347 } 1348 1349 if (num_account < max_entries) { 1347 1350 r_u->status = NT_STATUS_OK; 1348 1351 } … … 3368 3371 ********************************************************************/ 3369 3372 3370 static BOOL set_user_info_pw(uint8 *pass, struct samu *pwd) 3373 static BOOL set_user_info_pw(uint8 *pass, struct samu *pwd, 3374 int level) 3371 3375 { 3372 3376 uint32 len; … … 3426 3430 ZERO_STRUCT(plaintext_buf); 3427 3431 3428 /* restore last set time as this is an admin change, not a user pw change */ 3429 pdb_set_pass_last_set_time (pwd, last_set_time, last_set_state); 3432 /* 3433 * A level 25 change does reset the pwdlastset field, a level 24 3434 * change does not. I know this is probably not the full story, but 3435 * it is needed to make XP join LDAP correctly, without it the later 3436 * auth2 check can fail with PWD_MUST_CHANGE. 3437 */ 3438 if (level != 25) { 3439 /* 3440 * restore last set time as this is an admin change, not a 3441 * user pw change 3442 */ 3443 pdb_set_pass_last_set_time (pwd, last_set_time, 3444 last_set_state); 3445 } 3430 3446 3431 3447 DEBUG(5,("set_user_info_pw: pdb_update_pwd()\n")); … … 3592 3608 dump_data(100, (char *)ctr->info.id24->pass, 516); 3593 3609 3594 if (!set_user_info_pw(ctr->info.id24->pass, pwd)) 3610 if (!set_user_info_pw(ctr->info.id24->pass, pwd, 3611 switch_value)) 3595 3612 r_u->status = NT_STATUS_ACCESS_DENIED; 3596 3613 break; … … 3609 3626 goto done; 3610 3627 } 3611 if (!set_user_info_pw(ctr->info.id25->pass, pwd)) 3628 if (!set_user_info_pw(ctr->info.id25->pass, pwd, 3629 switch_value)) 3612 3630 r_u->status = NT_STATUS_ACCESS_DENIED; 3613 3631 break; … … 3621 3639 dump_data(100, (char *)ctr->info.id26->pass, 516); 3622 3640 3623 if (!set_user_info_pw(ctr->info.id26->pass, pwd)) 3641 if (!set_user_info_pw(ctr->info.id26->pass, pwd, 3642 switch_value)) 3624 3643 r_u->status = NT_STATUS_ACCESS_DENIED; 3625 3644 break; … … 3778 3797 dump_data(100, (char *)ctr->info.id26->pass, 516); 3779 3798 3780 if (!set_user_info_pw(ctr->info.id26->pass, pwd)) 3799 if (!set_user_info_pw(ctr->info.id26->pass, pwd, 3800 switch_value)) 3781 3801 r_u->status = NT_STATUS_ACCESS_DENIED; 3782 3802 break; … … 5062 5082 return r_u->status; 5063 5083 } 5084 5085 /******************************************************************* 5086 _samr_get_dispenum_index 5087 ********************************************************************/ 5088 5089 NTSTATUS _samr_get_dispenum_index(pipes_struct *p, SAMR_Q_GET_DISPENUM_INDEX *q_u, SAMR_R_GET_DISPENUM_INDEX *r_u) 5090 { 5091 struct samr_info *info = NULL; 5092 uint32 max_entries = (uint32) -1; 5093 uint32 enum_context = 0; 5094 int i; 5095 uint32 num_account = 0; 5096 struct samr_displayentry *entries = NULL; 5097 fstring account_name; 5098 5099 DEBUG(5, ("_samr_get_dispenum_index: %d\n", __LINE__)); 5100 5101 r_u->status = NT_STATUS_UNSUCCESSFUL; 5102 5103 /* find the policy handle. open a policy on it. */ 5104 if (!find_policy_by_hnd(p, &q_u->domain_pol, (void **)(void *)&info)) 5105 return NT_STATUS_INVALID_HANDLE; 5106 5107 if ((q_u->switch_level < 1) || (q_u->switch_level > 3)) { 5108 DEBUG(0,("_samr_get_dispenum_index: Unknown info level (%u)\n", 5109 (unsigned int)q_u->switch_level )); 5110 return NT_STATUS_INVALID_INFO_CLASS; 5111 } 5112 5113 if (!rpcstr_pull_unistr2_fstring(account_name, &q_u->name.unistring)) { 5114 return NT_STATUS_NO_MEMORY; 5115 } 5116 5117 become_root(); 5118 5119 /* The following done as ROOT. Don't return without unbecome_root(). */ 5120 5121 switch (q_u->switch_level) { 5122 case 0x1: 5123 if (info->disp_info->users == NULL) { 5124 info->disp_info->users = pdb_search_users(ACB_NORMAL); 5125 if (info->disp_info->users == NULL) { 5126 unbecome_root(); 5127 return NT_STATUS_ACCESS_DENIED; 5128 } 5129 DEBUG(10,("_samr_get_dispenum_index: starting user enumeration at index %u\n", 5130 (unsigned int)enum_context )); 5131 } else { 5132 DEBUG(10,("_samr_get_dispenum_index: using cached user enumeration at index %u\n", 5133 (unsigned int)enum_context )); 5134 } 5135 5136 num_account = pdb_search_entries(info->disp_info->users, 5137 enum_context, max_entries, 5138 &entries); 5139 break; 5140 case 0x2: 5141 if (info->disp_info->machines == NULL) { 5142 info->disp_info->machines = 5143 pdb_search_users(ACB_WSTRUST|ACB_SVRTRUST); 5144 if (info->disp_info->machines == NULL) { 5145 unbecome_root(); 5146 return NT_STATUS_ACCESS_DENIED; 5147 } 5148 DEBUG(10,("_samr_get_dispenum_index: starting machine enumeration at index %u\n", 5149 (unsigned int)enum_context )); 5150 } else { 5151 DEBUG(10,("_samr_get_dispenum_index: using cached machine enumeration at index %u\n", 5152 (unsigned int)enum_context )); 5153 } 5154 5155 num_account = pdb_search_entries(info->disp_info->machines, 5156 enum_context, max_entries, 5157 &entries); 5158 break; 5159 case 0x3: 5160 if (info->disp_info->groups == NULL) { 5161 info->disp_info->groups = pdb_search_groups(); 5162 if (info->disp_info->groups == NULL) { 5163 unbecome_root(); 5164 return NT_STATUS_ACCESS_DENIED; 5165 } 5166 DEBUG(10,("_samr_get_dispenum_index: starting group enumeration at index %u\n", 5167 (unsigned int)enum_context )); 5168 } else { 5169 DEBUG(10,("_samr_get_dispenum_index: using cached group enumeration at index %u\n", 5170 (unsigned int)enum_context )); 5171 } 5172 5173 num_account = pdb_search_entries(info->disp_info->groups, 5174 enum_context, max_entries, 5175 &entries); 5176 break; 5177 default: 5178 unbecome_root(); 5179 smb_panic("info class changed"); 5180 break; 5181 } 5182 unbecome_root(); 5183 5184 /* Ensure we cache this enumeration. */ 5185 set_disp_info_cache_timeout(info->disp_info, DISP_INFO_CACHE_TIMEOUT); 5186 5187 DEBUG(10,("_samr_get_dispenum_index: looking for :%s\n", account_name)); 5188 5189 for (i=0; i<num_account; i++) { 5190 if (strequal(entries[i].account_name, account_name)) { 5191 DEBUG(10,("_samr_get_dispenum_index: found %s at idx %d\n", 5192 account_name, i)); 5193 5194 init_samr_r_get_dispenum_index(r_u, i); 5195 5196 return NT_STATUS_OK; 5197 } 5198 } 5199 5200 /* assuming account_name lives at the very end */ 5201 init_samr_r_get_dispenum_index(r_u, num_account); 5202 5203 return NT_STATUS_OK; 5204 } -
branches/samba-3.0/source/rpc_server/srv_spoolss_nt.c
r124 r134 511 511 512 512 printer = NULL; 513 result = get_a_printer( NULL, &printer, 2, sname ); 513 514 /* This call doesn't fill in the location or comment from 515 * a CUPS server for efficiency with large numbers of printers. 516 * JRA. 517 */ 518 result = get_a_printer_search( NULL, &printer, 2, sname ); 514 519 if ( !W_ERROR_IS_OK(result) ) { 515 520 DEBUG(0,("set_printer_hnd_name: failed to lookup printer [%s] -- result [%s]\n", … … 9472 9477 9473 9478 /* copy data into the reply */ 9474 9475 r_u->ctr.size = r_u->needed; 9479 9480 /* mz: Vista x64 returns 0x6f7 (The stub received bad data), if the 9481 response buffer size is != the offered buffer size 9482 9483 r_u->ctr.size = r_u->needed; 9484 */ 9485 r_u->ctr.size = in_size; 9476 9486 9477 9487 r_u->ctr.size_of_array = r_u->returned;
Note:
See TracChangeset
for help on using the changeset viewer.