Changeset 228 for branches/samba-3.2.x/source/rpc_server
- Timestamp:
- May 26, 2009, 9:44:50 AM (16 years ago)
- Location:
- branches/samba-3.2.x/source/rpc_server
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.2.x/source/rpc_server/srv_eventlog_lib.c
r133 r228 141 141 ********************************************************************/ 142 142 143 static bool make_way_for_eventlogs( TDB_CONTEXT * the_tdb, int32 needed,143 static bool make_way_for_eventlogs( TDB_CONTEXT * the_tdb, int32_t needed, 144 144 bool whack_by_date ) 145 145 { 146 int start_record, i, new_start;147 int end_record;148 int nbytes, reclen, len, Retention, MaxSize;149 int tresv1, trecnum, timegen, timewr;146 int32_t start_record, i, new_start; 147 int32_t end_record; 148 int32_t reclen, tresv1, trecnum, timegen, timewr; 149 int nbytes, len, Retention, MaxSize; 150 150 TDB_DATA key, ret; 151 151 time_t current_time, exp_time; … … 174 174 175 175 DEBUG( 3, 176 ( "MaxSize [%d] Retention [%d] Current Time [% d] exp_time [%d]\n",177 MaxSize, Retention, (u int32)current_time, (uint32)exp_time ) );176 ( "MaxSize [%d] Retention [%d] Current Time [%u] exp_time [%u]\n", 177 MaxSize, Retention, (unsigned int)current_time, (unsigned int)exp_time ) ); 178 178 DEBUG( 3, 179 ( "Start Record [%d] End Record [%d]\n", start_record, 180 end_record ) ); 179 ( "Start Record [%u] End Record [%u]\n", 180 (unsigned int)start_record, 181 (unsigned int)end_record )); 181 182 182 183 for ( i = start_record; i < end_record; i++ ) { 183 184 /* read a record, add the amt to nbytes */ 184 key.dsize = sizeof( int32);185 key.dptr = ( uint8 * ) ( int32 * ) &i;185 key.dsize = sizeof(int32_t); 186 key.dptr = (unsigned char *)&i; 186 187 ret = tdb_fetch( the_tdb, key ); 187 188 if ( ret.dsize == 0 ) { … … 199 200 DEBUG( 10,("make_way_for_eventlogs: tdb_unpack failed.\n")); 200 201 tdb_unlock_bystring( the_tdb, EVT_NEXT_RECORD ); 202 SAFE_FREE( ret.dptr ); 201 203 return False; 202 204 } 203 205 204 206 DEBUG( 8, 205 ( "read record % d, record size is [%d], total so far [%d]\n",206 i, reclen, nbytes ) );207 ( "read record %u, record size is [%d], total so far [%d]\n", 208 (unsigned int)i, reclen, nbytes ) ); 207 209 208 210 SAFE_FREE( ret.dptr ); … … 221 223 222 224 DEBUG( 3, 223 ( "nbytes [%d] needed [%d] start_record is [% d], should be set to [%d]\n",224 nbytes, needed, start_record,i ) );225 ( "nbytes [%d] needed [%d] start_record is [%u], should be set to [%u]\n", 226 nbytes, needed, (unsigned int)start_record, (unsigned int)i ) ); 225 227 /* todo - remove eventlog entries here and set starting record to start_record... */ 226 228 new_start = i; 227 229 if ( start_record != new_start ) { 228 230 for ( i = start_record; i < new_start; i++ ) { 229 key.dsize = sizeof( int32);230 key.dptr = ( uint8 * ) ( int32 * ) &i;231 key.dsize = sizeof(int32_t); 232 key.dptr = (unsigned char *)&i; 231 233 tdb_delete( the_tdb, key ); 232 234 } … … 268 270 ********************************************************************/ 269 271 270 bool can_write_to_eventlog( TDB_CONTEXT * tdb, int32 needed )272 bool can_write_to_eventlog( TDB_CONTEXT * tdb, int32_t needed ) 271 273 { 272 274 int calcd_size; … … 314 316 { 315 317 TDB_CONTEXT *tdb = NULL; 316 uint32 vers_id;318 uint32_t vers_id; 317 319 ELOG_TDB *ptr; 318 320 char *tdbpath = NULL; … … 455 457 TALLOC_CTX *mem_ctx = NULL; 456 458 TDB_DATA kbuf, ebuf; 457 uint32 n_packed;459 uint32_t n_packed; 458 460 459 461 if ( !ee ) -
branches/samba-3.2.x/source/rpc_server/srv_eventlog_nt.c
r133 r228 81 81 82 82 sec_desc = get_nt_acl_no_snum( info, tdbname ); 83 SAFE_FREE( tdbname );83 TALLOC_FREE( tdbname ); 84 84 85 85 if ( !sec_desc ) { … … 292 292 TDB_DATA ret, key; 293 293 294 int srecno;295 int reclen;294 int32_t srecno; 295 int32_t reclen; 296 296 int len; 297 297 … … 302 302 char *puserdata = NULL; 303 303 304 key.dsize = sizeof(int32 );304 key.dsize = sizeof(int32_t); 305 305 306 306 srecno = recno; 307 key.dptr = ( uint8 * )&srecno;307 key.dptr = (unsigned char *)&srecno; 308 308 309 309 ret = tdb_fetch( tdb, key ); … … 428 428 WERROR wresult; 429 429 char *elogname = info->logname; 430 TALLOC_CTX *ctx = talloc_ tos();430 TALLOC_CTX *ctx = talloc_stackframe(); 431 431 bool ret = false; 432 432 … … 435 435 if ( !info->etdb ) { 436 436 DEBUG( 4, ( "No open tdb! (%s)\n", info->logname ) ); 437 return False;437 goto done; 438 438 } 439 439 /* set resonable defaults. 512Kb on size and 1 week on time */ … … 449 449 path = talloc_asprintf(ctx, "%s/%s", KEY_EVENTLOG, elogname ); 450 450 if (!path) { 451 return false;451 goto done; 452 452 } 453 453 … … 459 459 ( "sync_eventlog_params: Failed to open key [%s] (%s)\n", 460 460 path, dos_errstr( wresult ) ) ); 461 return false;461 goto done; 462 462 } 463 463 … … 466 466 DEBUG(4, ("Failed to query value \"Retention\": %s\n", 467 467 dos_errstr(wresult))); 468 ret = false;469 468 goto done; 470 469 } … … 475 474 DEBUG(4, ("Failed to query value \"MaxSize\": %s\n", 476 475 dos_errstr(wresult))); 477 ret = false;478 476 goto done; 479 477 } -
branches/samba-3.2.x/source/rpc_server/srv_lsa_nt.c
r138 r228 435 435 436 436 if(!se_access_check(psd, p->pipe_user.nt_user_token, des_access, &acc_granted, &status)) { 437 if ( geteuid() != 0) {437 if (p->pipe_user.ut.uid != sec_initial_uid()) { 438 438 return status; 439 439 } … … 1531 1531 account_pol.tdb was already opened as root, this is all we have */ 1532 1532 1533 if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) ) 1533 if ( p->pipe_user.ut.uid != sec_initial_uid() 1534 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) ) 1534 1535 return NT_STATUS_ACCESS_DENIED; 1535 1536 … … 1617 1618 return NT_STATUS_INVALID_HANDLE; 1618 1619 1620 if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION)) 1621 return NT_STATUS_ACCESS_DENIED; 1622 1619 1623 if ( !get_privileges_for_sids( &mask, &info->sid, 1 ) ) 1620 1624 return NT_STATUS_OBJECT_NAME_NOT_FOUND; … … 1677 1681 return NT_STATUS_INVALID_HANDLE; 1678 1682 1683 if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION)) 1684 return NT_STATUS_ACCESS_DENIED; 1685 1679 1686 if (!lookup_sid(p->mem_ctx, &info->sid, NULL, NULL, NULL)) 1680 1687 return NT_STATUS_ACCESS_DENIED; … … 1711 1718 account_pol.tdb was already opened as root, this is all we have */ 1712 1719 1713 if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) ) 1720 if ( p->pipe_user.ut.uid != sec_initial_uid() 1721 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) ) 1714 1722 return NT_STATUS_ACCESS_DENIED; 1715 1723 … … 1820 1828 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION)) 1821 1829 return NT_STATUS_ACCESS_DENIED; 1822 1823 1830 1824 1831 switch (r->in.sec_info) { … … 2079 2086 return NT_STATUS_INVALID_HANDLE; 2080 2087 2088 if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION)) 2089 return NT_STATUS_ACCESS_DENIED; 2090 2081 2091 /* according to an NT4 PDC, you can add privileges to SIDs even without 2082 2092 call_lsa_create_account() first. And you can use any arbitrary SID. */ … … 2120 2130 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info)) 2121 2131 return NT_STATUS_INVALID_HANDLE; 2132 2133 if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION)) 2134 return NT_STATUS_ACCESS_DENIED; 2122 2135 2123 2136 name = r->in.name->string; -
branches/samba-3.2.x/source/rpc_server/srv_samr_nt.c
r136 r228 6 6 * Copyright (C) Paul Ashton 1997, 7 7 * Copyright (C) Marc Jacobsen 1999, 8 * Copyright (C) Jeremy Allison 2001-200 5,8 * Copyright (C) Jeremy Allison 2001-2008, 9 9 * Copyright (C) Jean François Micouleau 1998-2001, 10 10 * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002, … … 250 250 251 251 /******************************************************************* 252 Map any MAXIMUM_ALLOWED_ACCESS request to a valid access set. 253 ********************************************************************/ 254 255 static void map_max_allowed_access(const NT_USER_TOKEN *token, 256 uint32_t *pacc_requested) 257 { 258 if (!((*pacc_requested) & MAXIMUM_ALLOWED_ACCESS)) { 259 return; 260 } 261 *pacc_requested &= ~MAXIMUM_ALLOWED_ACCESS; 262 263 /* At least try for generic read. */ 264 *pacc_requested = GENERIC_READ_ACCESS; 265 266 /* root gets anything. */ 267 if (geteuid() == sec_initial_uid()) { 268 *pacc_requested |= GENERIC_ALL_ACCESS; 269 return; 270 } 271 272 /* Full Access for 'BUILTIN\Administrators' and 'BUILTIN\Account Operators */ 273 274 if (is_sid_in_token(token, &global_sid_Builtin_Administrators) || 275 is_sid_in_token(token, &global_sid_Builtin_Account_Operators)) { 276 *pacc_requested |= GENERIC_ALL_ACCESS; 277 return; 278 } 279 280 /* Full access for DOMAIN\Domain Admins. */ 281 if ( IS_DC ) { 282 DOM_SID domadmin_sid; 283 sid_copy( &domadmin_sid, get_global_sam_sid() ); 284 sid_append_rid( &domadmin_sid, DOMAIN_GROUP_RID_ADMINS ); 285 if (is_sid_in_token(token, &domadmin_sid)) { 286 *pacc_requested |= GENERIC_ALL_ACCESS; 287 return; 288 } 289 } 290 /* TODO ! Check privileges. */ 291 } 292 293 /******************************************************************* 252 294 Fetch or create a dispinfo struct. 253 295 ********************************************************************/ … … 587 629 588 630 /*check if access can be granted as requested by client. */ 631 map_max_allowed_access(p->pipe_user.nt_user_token, &des_access); 589 632 590 633 make_samr_object_sd( p->mem_ctx, &psd, &sd_size, &dom_generic_mapping, NULL, 0 ); … … 826 869 DEBUG(10,("_samr_QuerySecurity: querying security on SID: %s\n", 827 870 sid_string_dbg(&pol_sid))); 871 872 status = access_check_samr_function(acc_granted, 873 STD_RIGHT_READ_CONTROL_ACCESS, 874 "_samr_QuerySecurity"); 875 if (!NT_STATUS_IS_OK(status)) { 876 return status; 877 } 828 878 829 879 /* Check what typ of SID is beeing queried (e.g Domain SID, User SID, Group SID) */ … … 1155 1205 return NT_STATUS_INVALID_HANDLE; 1156 1206 1207 DEBUG(5,("_samr_EnumDomainAliases: sid %s\n", 1208 sid_string_dbg(&info->sid))); 1209 1157 1210 status = access_check_samr_function(info->acc_granted, 1158 1211 SA_RIGHT_DOMAIN_ENUM_ACCOUNTS, … … 1161 1214 return status; 1162 1215 } 1163 1164 DEBUG(5,("_samr_EnumDomainAliases: sid %s\n",1165 sid_string_dbg(&info->sid)));1166 1216 1167 1217 samr_array = TALLOC_ZERO_P(p->mem_ctx, struct samr_SamArray); … … 1430 1480 if (!find_policy_by_hnd(p, r->in.domain_handle, (void **)(void *)&info)) 1431 1481 return NT_STATUS_INVALID_HANDLE; 1482 1483 status = access_check_samr_function(info->acc_granted, 1484 SA_RIGHT_DOMAIN_ENUM_ACCOUNTS, 1485 "_samr_QueryDisplayInfo"); 1486 if (!NT_STATUS_IS_OK(status)) { 1487 return status; 1488 } 1432 1489 1433 1490 /* … … 1592 1649 total_data_size=num_account*struct_size; 1593 1650 1594 if ( num_account) {1651 if (max_entries <= num_account) { 1595 1652 status = STATUS_MORE_ENTRIES; 1596 1653 } else { … … 1794 1851 uint32 acc_granted; 1795 1852 struct samr_Ids rids, types; 1853 uint32_t num_mapped = 0; 1796 1854 1797 1855 DEBUG(5,("_samr_LookupNames: %d\n", __LINE__)); … … 1841 1899 1842 1900 if (type[i] != SID_NAME_UNKNOWN) { 1843 status = NT_STATUS_OK;1901 num_mapped++; 1844 1902 } 1903 } 1904 1905 if (num_mapped == num_rids) { 1906 status = NT_STATUS_OK; 1907 } else if (num_mapped == 0) { 1908 status = NT_STATUS_NONE_MAPPED; 1909 } else { 1910 status = STATUS_SOME_UNMAPPED; 1845 1911 } 1846 1912 … … 2063 2129 if (!get_lsa_policy_samr_sid(p, r->in.domain_handle, &pol_sid, &acc_granted, NULL)) 2064 2130 return NT_STATUS_INVALID_HANDLE; 2131 2132 status = access_check_samr_function(acc_granted, 2133 SA_RIGHT_DOMAIN_ENUM_ACCOUNTS, 2134 "_samr__LookupRids"); 2135 if (!NT_STATUS_IS_OK(status)) { 2136 return status; 2137 } 2065 2138 2066 2139 if (num_rids > 1000) { … … 2158 2231 2159 2232 /* check if access can be granted as requested by client. */ 2233 2234 map_max_allowed_access(p->pipe_user.nt_user_token, &des_access); 2160 2235 2161 2236 make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &usr_generic_mapping, &sid, SAMR_USR_RIGHTS_WRITE_PW); … … 2634 2709 return NT_STATUS_INVALID_HANDLE; 2635 2710 2711 status = access_check_samr_function(info->acc_granted, 2712 SA_RIGHT_DOMAIN_OPEN_ACCOUNT, 2713 "_samr_QueryUserInfo"); 2714 if (!NT_STATUS_IS_OK(status)) { 2715 return status; 2716 } 2717 2636 2718 domain_sid = info->sid; 2637 2719 … … 2839 2921 2840 2922 /******************************************************************* 2841 samr_QueryDomainInfo_internal2923 _samr_QueryDomainInfo 2842 2924 ********************************************************************/ 2843 2925 2844 static NTSTATUS samr_QueryDomainInfo_internal(const char *fn_name, 2845 pipes_struct *p, 2846 struct policy_handle *handle, 2847 uint32_t level, 2848 union samr_DomainInfo **dom_info_ptr) 2926 NTSTATUS _samr_QueryDomainInfo(pipes_struct *p, 2927 struct samr_QueryDomainInfo *r) 2849 2928 { 2850 2929 NTSTATUS status = NT_STATUS_OK; … … 2868 2947 uint32 num_users=0, num_groups=0, num_aliases=0; 2869 2948 2870 DEBUG(5,(" %s: %d\n", fn_name, __LINE__));2949 DEBUG(5,("_samr_QueryDomainInfo: %d\n", __LINE__)); 2871 2950 2872 2951 dom_info = TALLOC_ZERO_P(p->mem_ctx, union samr_DomainInfo); … … 2875 2954 } 2876 2955 2877 *dom_info_ptr = dom_info;2878 2879 2956 /* find the policy handle. open a policy on it. */ 2880 if (!find_policy_by_hnd(p, handle, (void **)(void *)&info)) {2957 if (!find_policy_by_hnd(p, r->in.domain_handle, (void **)(void *)&info)) { 2881 2958 return NT_STATUS_INVALID_HANDLE; 2882 2959 } 2883 2960 2884 switch (level) { 2961 status = access_check_samr_function(info->acc_granted, 2962 SA_RIGHT_SAM_OPEN_DOMAIN, 2963 "_samr_QueryDomainInfo" ); 2964 2965 if ( !NT_STATUS_IS_OK(status) ) 2966 return status; 2967 2968 switch (r->in.level) { 2885 2969 case 0x01: 2886 2970 … … 2910 2994 unix_to_nt_time_abs(&nt_expire, u_expire); 2911 2995 unix_to_nt_time_abs(&nt_min_age, u_min_age); 2996 2997 if (lp_check_password_script() && *lp_check_password_script()) { 2998 password_properties |= DOMAIN_PASSWORD_COMPLEX; 2999 } 2912 3000 2913 3001 init_samr_DomInfo1(&dom_info->info1, … … 3054 3142 } 3055 3143 3056 DEBUG(5,("%s: %d\n", fn_name, __LINE__)); 3144 *r->out.info = dom_info; 3145 3146 DEBUG(5,("_samr_QueryDomainInfo: %d\n", __LINE__)); 3057 3147 3058 3148 return status; 3059 }3060 3061 /*******************************************************************3062 _samr_QueryDomainInfo3063 ********************************************************************/3064 3065 NTSTATUS _samr_QueryDomainInfo(pipes_struct *p,3066 struct samr_QueryDomainInfo *r)3067 {3068 return samr_QueryDomainInfo_internal("_samr_QueryDomainInfo",3069 p,3070 r->in.domain_handle,3071 r->in.level,3072 r->out.info);3073 3149 } 3074 3150 … … 3218 3294 sid_compose(&sid, get_global_sam_sid(), *r->out.rid); 3219 3295 3296 map_max_allowed_access(p->pipe_user.nt_user_token, &des_access); 3297 3220 3298 make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &usr_generic_mapping, 3221 3299 &sid, SAMR_USR_RIGHTS_WRITE_PW); … … 3279 3357 user level access control on shares) --jerry */ 3280 3358 3281 if (des_access == MAXIMUM_ALLOWED_ACCESS) { 3282 /* Map to max possible knowing we're filtered below. */ 3283 des_access = GENERIC_ALL_ACCESS; 3284 } 3359 map_max_allowed_access(p->pipe_user.nt_user_token, &des_access); 3285 3360 3286 3361 se_map_generic( &des_access, &sam_generic_mapping ); … … 3318 3393 } 3319 3394 3395 map_max_allowed_access(p->pipe_user.nt_user_token, &des_access); 3396 3320 3397 make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &sam_generic_mapping, NULL, 0); 3321 3398 se_map_generic(&des_access, &sam_generic_mapping); … … 3366 3443 return NT_STATUS_ACCESS_DENIED; 3367 3444 } 3445 3446 map_max_allowed_access(p->pipe_user.nt_user_token, &des_access); 3368 3447 3369 3448 make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &sam_generic_mapping, NULL, 0); … … 3415 3494 return NT_STATUS_ACCESS_DENIED; 3416 3495 } 3496 3497 map_max_allowed_access(p->pipe_user.nt_user_token, &des_access); 3417 3498 3418 3499 make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &sam_generic_mapping, NULL, 0); … … 3582 3663 3583 3664 /*check if access can be granted as requested by client. */ 3665 3666 map_max_allowed_access(p->pipe_user.nt_user_token, &des_access); 3584 3667 3585 3668 make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &ali_generic_mapping, NULL, 0); … … 4068 4151 4069 4152 /******************************************************************* 4070 samr_SetUserInfo _internal4153 samr_SetUserInfo 4071 4154 ********************************************************************/ 4072 4155 4073 static NTSTATUS samr_SetUserInfo_internal(const char *fn_name, 4074 pipes_struct *p, 4075 struct policy_handle *user_handle, 4076 uint16_t level, 4077 union samr_UserInfo *info) 4156 NTSTATUS _samr_SetUserInfo(pipes_struct *p, 4157 struct samr_SetUserInfo *r) 4078 4158 { 4079 4159 NTSTATUS status; 4080 4160 struct samu *pwd = NULL; 4081 4161 DOM_SID sid; 4082 POLICY_HND *pol = user_handle; 4083 uint16_t switch_value = level; 4162 POLICY_HND *pol = r->in.user_handle; 4163 union samr_UserInfo *info = r->in.info; 4164 uint16_t switch_value = r->in.level; 4084 4165 uint32_t acc_granted; 4085 4166 uint32_t acc_required; … … 4089 4170 DISP_INFO *disp_info = NULL; 4090 4171 4091 DEBUG(5,(" %s: %d\n", fn_name, __LINE__));4172 DEBUG(5,("_samr_SetUserInfo: %d\n", __LINE__)); 4092 4173 4093 4174 /* find the policy handle. open a policy on it. */ … … 4119 4200 status = access_check_samr_function(acc_granted, 4120 4201 acc_required, 4121 fn_name);4202 "_samr_SetUserInfo"); 4122 4203 if (!NT_STATUS_IS_OK(status)) { 4123 4204 return status; 4124 4205 } 4125 4206 4126 DEBUG(5, (" %s: sid:%s, level:%d\n",4127 fn_name,sid_string_dbg(&sid), switch_value));4207 DEBUG(5, ("_samr_SetUserInfo: sid:%s, level:%d\n", 4208 sid_string_dbg(&sid), switch_value)); 4128 4209 4129 4210 if (info == NULL) { 4130 DEBUG(5, (" %s: NULL info level\n", fn_name));4211 DEBUG(5, ("_samr_SetUserInfo: NULL info level\n")); 4131 4212 return NT_STATUS_INVALID_INFO_CLASS; 4132 4213 } … … 4162 4243 } 4163 4244 4164 DEBUG(5, ("%s: %s does%s possess sufficient rights\n", 4165 fn_name, 4245 DEBUG(5, ("_samr_SetUserInfo: %s does%s possess sufficient rights\n", 4166 4246 uidtoname(p->pipe_user.ut.uid), 4167 4247 has_enough_rights ? "" : " not")); … … 4290 4370 4291 4371 /******************************************************************* 4292 _samr_SetUserInfo4293 ********************************************************************/4294 4295 NTSTATUS _samr_SetUserInfo(pipes_struct *p,4296 struct samr_SetUserInfo *r)4297 {4298 return samr_SetUserInfo_internal("_samr_SetUserInfo",4299 p,4300 r->in.user_handle,4301 r->in.level,4302 r->in.info);4303 }4304 4305 /*******************************************************************4306 4372 _samr_SetUserInfo2 4307 4373 ********************************************************************/ … … 4310 4376 struct samr_SetUserInfo2 *r) 4311 4377 { 4312 return samr_SetUserInfo_internal("_samr_SetUserInfo2", 4313 p, 4314 r->in.user_handle, 4315 r->in.level, 4316 r->in.info); 4378 struct samr_SetUserInfo q; 4379 4380 q.in.user_handle = r->in.user_handle; 4381 q.in.level = r->in.level; 4382 q.in.info = r->in.info; 4383 4384 return _samr_SetUserInfo(p, &q); 4317 4385 } 4318 4386 … … 4816 4884 if (!close_policy_hnd(p, r->in.user_handle)) 4817 4885 return NT_STATUS_OBJECT_NAME_INVALID; 4886 4887 ZERO_STRUCTP(r->out.user_handle); 4818 4888 4819 4889 force_flush_samr_cache(disp_info); … … 5475 5545 5476 5546 /*check if access can be granted as requested by client. */ 5547 map_max_allowed_access(p->pipe_user.nt_user_token, &des_access); 5548 5477 5549 make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &grp_generic_mapping, NULL, 0); 5478 5550 se_map_generic(&des_access,&grp_generic_mapping); … … 5587 5659 struct samr_QueryDomainInfo2 *r) 5588 5660 { 5589 return samr_QueryDomainInfo_internal("_samr_QueryDomainInfo2", 5590 p, 5591 r->in.domain_handle, 5592 r->in.level, 5593 r->out.info); 5661 struct samr_QueryDomainInfo q; 5662 5663 q.in.domain_handle = r->in.domain_handle; 5664 q.in.level = r->in.level; 5665 5666 q.out.info = r->out.info; 5667 5668 return _samr_QueryDomainInfo(p, &q); 5594 5669 } 5595 5670 … … 5601 5676 struct samr_SetDomainInfo *r) 5602 5677 { 5678 struct samr_info *info = NULL; 5603 5679 time_t u_expire, u_min_age; 5604 5680 time_t u_logout; 5605 5681 time_t u_lock_duration, u_reset_time; 5682 NTSTATUS result; 5606 5683 5607 5684 DEBUG(5,("_samr_SetDomainInfo: %d\n", __LINE__)); 5608 5685 5609 5686 /* find the policy handle. open a policy on it. */ 5610 if (!find_policy_by_hnd(p, r->in.domain_handle, NULL))5687 if (!find_policy_by_hnd(p, r->in.domain_handle, (void **)(void *)&info)) 5611 5688 return NT_STATUS_INVALID_HANDLE; 5689 5690 /* We do have different access bits for info 5691 * levels here, but we're really just looking for 5692 * GENERIC_RIGHTS_DOMAIN_WRITE access. Unfortunately 5693 * this maps to different specific bits. So 5694 * assume if we have SA_RIGHT_DOMAIN_SET_INFO_1 5695 * set we are ok. */ 5696 5697 result = access_check_samr_function(info->acc_granted, 5698 SA_RIGHT_DOMAIN_SET_INFO_1, 5699 "_samr_SetDomainInfo"); 5700 5701 if (!NT_STATUS_IS_OK(result)) 5702 return result; 5612 5703 5613 5704 DEBUG(5,("_samr_SetDomainInfo: level: %d\n", r->in.level)); … … 5668 5759 uint32_t num_account = 0; 5669 5760 struct samr_displayentry *entries = NULL; 5761 NTSTATUS status; 5670 5762 5671 5763 DEBUG(5,("_samr_GetDisplayEnumerationIndex: %d\n", __LINE__)); … … 5674 5766 if (!find_policy_by_hnd(p, r->in.domain_handle, (void **)(void *)&info)) { 5675 5767 return NT_STATUS_INVALID_HANDLE; 5768 } 5769 5770 status = access_check_samr_function(info->acc_granted, 5771 SA_RIGHT_DOMAIN_ENUM_ACCOUNTS, 5772 "_samr_GetDisplayEnumerationIndex"); 5773 if (!NT_STATUS_IS_OK(status)) { 5774 return status; 5676 5775 } 5677 5776 -
branches/samba-3.2.x/source/rpc_server/srv_srvsvc_nt.c
r137 r228 1690 1690 DEBUG(5,("_srvsvc_NetShareAdd: %d\n", __LINE__)); 1691 1691 1692 *r->out.parm_error = 0; 1692 if (r->out.parm_error) { 1693 *r->out.parm_error = 0; 1694 } 1693 1695 1694 1696 get_current_user(&user,p);
Note:
See TracChangeset
for help on using the changeset viewer.