static int pipe_enum_fn | ( | TDB_CONTEXT * | the_tdb, | |
TDB_DATA | kbuf, | |||
TDB_DATA | dbuf, | |||
void * | p | |||
) | [static] |
srv_srvsvc_nt.c の 51 行で定義されています。
参照先 file_enum_count::count・file_enum_count::ctx・TDB_DATA::dptr・TDB_DATA::dsize・fullpath()・file_enum_count::info・init_srv_file_info3()・pipe_open_rec::name・pipe_open_rec::pid・pipe_open_rec::pnum・process_exists()・procid_to_pid()・snprintf()・pipe_open_rec::uid・uidtoname().
参照元 net_enum_pipes().
00052 { 00053 struct pipe_open_rec prec; 00054 struct file_enum_count *fenum = (struct file_enum_count *)p; 00055 00056 if (dbuf.dsize != sizeof(struct pipe_open_rec)) 00057 return 0; 00058 00059 memcpy(&prec, dbuf.dptr, sizeof(struct pipe_open_rec)); 00060 00061 if ( process_exists(prec.pid) ) { 00062 FILE_INFO_3 *f; 00063 int i = fenum->count; 00064 pstring fullpath; 00065 00066 snprintf( fullpath, sizeof(fullpath), "\\PIPE\\%s", prec.name ); 00067 00068 f = TALLOC_REALLOC_ARRAY( fenum->ctx, fenum->info, FILE_INFO_3, i+1 ); 00069 if ( !f ) { 00070 DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1)); 00071 return 1; 00072 } 00073 fenum->info = f; 00074 00075 00076 init_srv_file_info3( &fenum->info[i], 00077 (uint32)((procid_to_pid(&prec.pid)<<16) & prec.pnum), 00078 (FILE_READ_DATA|FILE_WRITE_DATA), 00079 0, 00080 uidtoname( prec.uid ), 00081 fullpath ); 00082 00083 fenum->count++; 00084 } 00085 00086 return 0; 00087 }
static WERROR net_enum_pipes | ( | TALLOC_CTX * | ctx, | |
FILE_INFO_3 ** | info, | |||
uint32 * | count, | |||
uint32 | resume | |||
) | [static] |
srv_srvsvc_nt.c の 92 行で定義されています。
参照先 conn_tdb_ctx()・file_enum_count::count・file_enum_count::ctx・file_enum_count::info・pipe_enum_fn()・tdb_errorstr()・tdb_traverse().
参照元 net_file_enum_3().
00094 { 00095 struct file_enum_count fenum; 00096 TDB_CONTEXT *conn_tdb = conn_tdb_ctx(); 00097 00098 if ( !conn_tdb ) { 00099 DEBUG(0,("net_enum_pipes: Failed to retrieve the connections tdb handle!\n")); 00100 return WERR_ACCESS_DENIED; 00101 } 00102 00103 fenum.ctx = ctx; 00104 fenum.count = *count; 00105 fenum.info = *info; 00106 00107 if (tdb_traverse(conn_tdb, pipe_enum_fn, &fenum) == -1) { 00108 DEBUG(0,("net_enum_pipes: traverse of connections.tdb failed with error %s.\n", 00109 tdb_errorstr(conn_tdb) )); 00110 return WERR_NOMEM; 00111 } 00112 00113 *info = fenum.info; 00114 *count = fenum.count; 00115 00116 return WERR_OK;}
static void enum_file_fn | ( | const struct share_mode_entry * | e, | |
const char * | sharepath, | |||
const char * | fname, | |||
void * | state | |||
) | [static] |
srv_srvsvc_nt.c の 124 行で定義されています。
参照先 brl_get_locks()・file_enum_count::count・file_enum_count::ctx・share_mode_entry::dev・files_struct::dev・f_enum_cnt・byte_range_lock::fsp・fullpath()・file_enum_count::info・init_srv_file_info3()・share_mode_entry::inode・files_struct::inode・byte_range_lock::num_locks・share_mode_entry::pid・process_exists()・pstr_sprintf()・share_mode_entry::share_access・share_mode_entry::share_file_id・string_replace()・share_mode_entry::uid・uidtoname().
参照元 net_enum_files().
00126 { 00127 struct file_enum_count *fenum = &f_enum_cnt; 00128 00129 /* If the pid was not found delete the entry from connections.tdb */ 00130 00131 if ( process_exists(e->pid) ) { 00132 FILE_INFO_3 *f; 00133 int i = fenum->count; 00134 files_struct fsp; 00135 struct byte_range_lock *brl; 00136 int num_locks = 0; 00137 pstring fullpath; 00138 uint32 permissions; 00139 00140 f = TALLOC_REALLOC_ARRAY( fenum->ctx, fenum->info, FILE_INFO_3, i+1 ); 00141 if ( !f ) { 00142 DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1)); 00143 return; 00144 } 00145 fenum->info = f; 00146 00147 /* need to count the number of locks on a file */ 00148 00149 ZERO_STRUCT( fsp ); 00150 fsp.dev = e->dev; 00151 fsp.inode = e->inode; 00152 00153 if ( (brl = brl_get_locks(NULL,&fsp)) != NULL ) { 00154 num_locks = brl->num_locks; 00155 TALLOC_FREE( brl ); 00156 } 00157 00158 if ( strcmp( fname, "." ) == 0 ) { 00159 pstr_sprintf( fullpath, "C:%s", sharepath ); 00160 } else { 00161 pstr_sprintf( fullpath, "C:%s/%s", sharepath, fname ); 00162 } 00163 string_replace( fullpath, '/', '\\' ); 00164 00165 /* mask out create (what ever that is) */ 00166 permissions = e->share_access & (FILE_READ_DATA|FILE_WRITE_DATA); 00167 00168 /* now fill in the FILE_INFO_3 struct */ 00169 init_srv_file_info3( &fenum->info[i], 00170 e->share_file_id, 00171 permissions, 00172 num_locks, 00173 uidtoname(e->uid), 00174 fullpath ); 00175 00176 fenum->count++; 00177 } 00178 00179 return; 00180 00181 }
static WERROR net_enum_files | ( | TALLOC_CTX * | ctx, | |
FILE_INFO_3 ** | info, | |||
uint32 * | count, | |||
uint32 | resume | |||
) | [static] |
srv_srvsvc_nt.c の 186 行で定義されています。
参照先 file_enum_count::count・file_enum_count::ctx・enum_file_fn()・f_enum_cnt・file_enum_count::info・share_mode_forall().
参照元 net_file_enum_3().
00188 { 00189 f_enum_cnt.ctx = ctx; 00190 f_enum_cnt.count = *count; 00191 f_enum_cnt.info = *info; 00192 00193 share_mode_forall( enum_file_fn, NULL ); 00194 00195 *info = f_enum_cnt.info; 00196 *count = f_enum_cnt.count; 00197 00198 return WERR_OK; 00199 }
static uint32 get_share_type | ( | int | snum | ) | [static] |
srv_srvsvc_nt.c の 204 行で定義されています。
参照先 strequal()・STYPE_DISKTREE・STYPE_IPC・STYPE_PRINTQ・type.
参照元 init_srv_share_info_1()・init_srv_share_info_2()・init_srv_share_info_501()・init_srv_share_info_502().
00205 { 00206 /* work out the share type */ 00207 uint32 type = STYPE_DISKTREE; 00208 00209 if (lp_print_ok(snum)) 00210 type = STYPE_PRINTQ; 00211 if (strequal(lp_fstype(snum), "IPC")) 00212 type = STYPE_IPC; 00213 if (lp_administrative_share(snum)) 00214 type |= STYPE_HIDDEN; 00215 00216 return type; 00217 }
static void init_srv_share_info_0 | ( | pipes_struct * | p, | |
SRV_SHARE_INFO_0 * | sh0, | |||
int | snum | |||
) | [static] |
srv_srvsvc_nt.c の 223 行で定義されています。
参照先 share_info_0_info::info_0・share_info_0_info::info_0_str・init_srv_share_info0()・init_srv_share_info0_str().
参照元 init_srv_r_net_share_get_info()・init_srv_share_info_ctr().
00224 { 00225 pstring net_name; 00226 00227 pstrcpy(net_name, lp_servicename(snum)); 00228 00229 init_srv_share_info0(&sh0->info_0, net_name); 00230 init_srv_share_info0_str(&sh0->info_0_str, net_name); 00231 }
static void init_srv_share_info_1 | ( | pipes_struct * | p, | |
SRV_SHARE_INFO_1 * | sh1, | |||
int | snum | |||
) | [static] |
srv_srvsvc_nt.c の 237 行で定義されています。
参照先 pipes_struct::conn・get_share_type()・share_info_1_info::info_1・share_info_1_info::info_1_str・init_srv_share_info1()・init_srv_share_info1_str()・standard_sub_conn().
参照元 init_srv_r_net_share_get_info()・init_srv_share_info_ctr().
00238 { 00239 pstring remark; 00240 00241 char *net_name = lp_servicename(snum); 00242 pstrcpy(remark, lp_comment(snum)); 00243 standard_sub_conn(p->conn, remark,sizeof(remark)); 00244 00245 init_srv_share_info1(&sh1->info_1, net_name, get_share_type(snum), remark); 00246 init_srv_share_info1_str(&sh1->info_1_str, net_name, remark); 00247 }
static void init_srv_share_info_2 | ( | pipes_struct * | p, | |
SRV_SHARE_INFO_2 * | sh2, | |||
int | snum | |||
) | [static] |
srv_srvsvc_nt.c の 253 行で定義されています。
参照先 pipes_struct::conn・count_current_connections()・get_share_type()・share_info_2_info::info_2・share_info_2_info::info_2_str・init_srv_share_info2()・init_srv_share_info2_str()・standard_sub_conn()・string_replace().
参照元 init_srv_r_net_share_get_info()・init_srv_share_info_ctr().
00254 { 00255 pstring remark; 00256 pstring path; 00257 pstring passwd; 00258 int max_connections = lp_max_connections(snum); 00259 uint32 max_uses = max_connections!=0 ? max_connections : 0xffffffff; 00260 int count = 0; 00261 char *net_name = lp_servicename(snum); 00262 00263 pstrcpy(remark, lp_comment(snum)); 00264 standard_sub_conn(p->conn, remark,sizeof(remark)); 00265 pstrcpy(path, "C:"); 00266 pstrcat(path, lp_pathname(snum)); 00267 00268 /* 00269 * Change / to \\ so that win2k will see it as a valid path. This was added to 00270 * enable use of browsing in win2k add share dialog. 00271 */ 00272 00273 string_replace(path, '/', '\\'); 00274 00275 pstrcpy(passwd, ""); 00276 00277 count = count_current_connections( net_name, False ); 00278 init_srv_share_info2(&sh2->info_2, net_name, get_share_type(snum), 00279 remark, 0, max_uses, count, path, passwd); 00280 00281 init_srv_share_info2_str(&sh2->info_2_str, net_name, remark, path, passwd); 00282 }
static void map_generic_share_sd_bits | ( | SEC_DESC * | psd | ) | [static] |
srv_srvsvc_nt.c の 288 行で定義されています。
参照先 security_ace_info::access_mask・security_acl_info::aces・security_descriptor_info::dacl・file_generic_mapping・security_acl_info::num_aces・se_map_generic().
参照元 _srv_net_share_add()・_srv_net_share_set_info().
00289 { 00290 int i; 00291 SEC_ACL *ps_dacl = NULL; 00292 00293 if (!psd) 00294 return; 00295 00296 ps_dacl = psd->dacl; 00297 if (!ps_dacl) 00298 return; 00299 00300 for (i = 0; i < ps_dacl->num_aces; i++) { 00301 SEC_ACE *psa = &ps_dacl->aces[i]; 00302 uint32 orig_mask = psa->access_mask; 00303 00304 se_map_generic(&psa->access_mask, &file_generic_mapping); 00305 psa->access_mask |= orig_mask; 00306 } 00307 }
static void init_srv_share_info_501 | ( | pipes_struct * | p, | |
SRV_SHARE_INFO_501 * | sh501, | |||
int | snum | |||
) | [static] |
srv_srvsvc_nt.c の 313 行で定義されています。
参照先 pipes_struct::conn・get_share_type()・share_info_501_info::info_501・share_info_501_info::info_501_str・init_srv_share_info501()・init_srv_share_info501_str()・standard_sub_conn().
参照元 init_srv_r_net_share_get_info()・init_srv_share_info_ctr().
00314 { 00315 pstring remark; 00316 00317 const char *net_name = lp_servicename(snum); 00318 pstrcpy(remark, lp_comment(snum)); 00319 standard_sub_conn(p->conn, remark, sizeof(remark)); 00320 00321 init_srv_share_info501(&sh501->info_501, net_name, get_share_type(snum), remark, (lp_csc_policy(snum) << 4)); 00322 init_srv_share_info501_str(&sh501->info_501_str, net_name, remark); 00323 }
static void init_srv_share_info_502 | ( | pipes_struct * | p, | |
SRV_SHARE_INFO_502 * | sh502, | |||
int | snum | |||
) | [static] |
srv_srvsvc_nt.c の 329 行で定義されています。
参照先 pipes_struct::conn・ctx・get_share_security()・get_share_type()・share_info_502_info::info_502・share_info_502_info::info_502_str・init_srv_share_info502()・init_srv_share_info502_str()・pipes_struct::mem_ctx・standard_sub_conn()・string_replace().
参照元 init_srv_r_net_share_get_info()・init_srv_share_info_ctr().
00330 { 00331 pstring net_name; 00332 pstring remark; 00333 pstring path; 00334 pstring passwd; 00335 SEC_DESC *sd; 00336 size_t sd_size; 00337 TALLOC_CTX *ctx = p->mem_ctx; 00338 00339 00340 ZERO_STRUCTP(sh502); 00341 00342 pstrcpy(net_name, lp_servicename(snum)); 00343 pstrcpy(remark, lp_comment(snum)); 00344 standard_sub_conn(p->conn, remark,sizeof(remark)); 00345 pstrcpy(path, "C:"); 00346 pstrcat(path, lp_pathname(snum)); 00347 00348 /* 00349 * Change / to \\ so that win2k will see it as a valid path. This was added to 00350 * enable use of browsing in win2k add share dialog. 00351 */ 00352 00353 string_replace(path, '/', '\\'); 00354 00355 pstrcpy(passwd, ""); 00356 00357 sd = get_share_security(ctx, lp_servicename(snum), &sd_size); 00358 00359 init_srv_share_info502(&sh502->info_502, net_name, get_share_type(snum), remark, 0, 0xffffffff, 1, path, passwd, sd, sd_size); 00360 init_srv_share_info502_str(&sh502->info_502_str, net_name, remark, path, passwd, sd, sd_size); 00361 }
static void init_srv_share_info_1004 | ( | pipes_struct * | p, | |
SRV_SHARE_INFO_1004 * | sh1004, | |||
int | snum | |||
) | [static] |
srv_srvsvc_nt.c の 367 行で定義されています。
参照先 pipes_struct::conn・ptr_info_1004_info::info_1004・ptr_info_1004_info::info_1004_str・init_srv_share_info1004()・init_srv_share_info1004_str()・standard_sub_conn().
参照元 init_srv_r_net_share_get_info()・init_srv_share_info_ctr().
00368 { 00369 pstring remark; 00370 00371 pstrcpy(remark, lp_comment(snum)); 00372 standard_sub_conn(p->conn, remark, sizeof(remark)); 00373 00374 ZERO_STRUCTP(sh1004); 00375 00376 init_srv_share_info1004(&sh1004->info_1004, remark); 00377 init_srv_share_info1004_str(&sh1004->info_1004_str, remark); 00378 }
static void init_srv_share_info_1005 | ( | pipes_struct * | p, | |
SRV_SHARE_INFO_1005 * | sh1005, | |||
int | snum | |||
) | [static] |
srv_srvsvc_nt.c の 384 行で定義されています。
参照先 share_info_1005_info::share_info_flags.
参照元 init_srv_r_net_share_get_info()・init_srv_share_info_ctr().
00385 { 00386 sh1005->share_info_flags = 0; 00387 00388 if(lp_host_msdfs() && lp_msdfs_root(snum)) 00389 sh1005->share_info_flags |= 00390 SHARE_1005_IN_DFS | SHARE_1005_DFS_ROOT; 00391 sh1005->share_info_flags |= 00392 lp_csc_policy(snum) << SHARE_1005_CSC_POLICY_SHIFT; 00393 }
static void init_srv_share_info_1006 | ( | pipes_struct * | p, | |
SRV_SHARE_INFO_1006 * | sh1006, | |||
int | snum | |||
) | [static] |
srv_srvsvc_nt.c の 398 行で定義されています。
参照先 share_info_1006_info::max_uses.
参照元 init_srv_r_net_share_get_info()・init_srv_share_info_ctr().
00399 { 00400 sh1006->max_uses = -1; 00401 }
static void init_srv_share_info_1007 | ( | pipes_struct * | p, | |
SRV_SHARE_INFO_1007 * | sh1007, | |||
int | snum | |||
) | [static] |
srv_srvsvc_nt.c の 407 行で定義されています。
参照先 flags・ptr_info_1007_info::info_1007・ptr_info_1007_info::info_1007_str・init_srv_share_info1007()・init_srv_share_info1007_str().
参照元 init_srv_r_net_share_get_info()・init_srv_share_info_ctr().
00408 { 00409 pstring alternate_directory_name = ""; 00410 uint32 flags = 0; 00411 00412 ZERO_STRUCTP(sh1007); 00413 00414 init_srv_share_info1007(&sh1007->info_1007, flags, alternate_directory_name); 00415 init_srv_share_info1007_str(&sh1007->info_1007_str, alternate_directory_name); 00416 }
static void init_srv_share_info_1501 | ( | pipes_struct * | p, | |
SRV_SHARE_INFO_1501 * | sh1501, | |||
int | snum | |||
) | [static] |
srv_srvsvc_nt.c の 422 行で定義されています。
参照先 ctx・get_share_security()・make_sec_desc_buf()・pipes_struct::mem_ctx・share_info_1501_info::sdb.
参照元 init_srv_r_net_share_get_info()・init_srv_share_info_ctr().
00423 { 00424 SEC_DESC *sd; 00425 size_t sd_size; 00426 TALLOC_CTX *ctx = p->mem_ctx; 00427 00428 ZERO_STRUCTP(sh1501); 00429 00430 sd = get_share_security(ctx, lp_servicename(snum), &sd_size); 00431 00432 sh1501->sdb = make_sec_desc_buf(p->mem_ctx, sd_size, sd); 00433 }
static BOOL is_hidden_share | ( | int | snum | ) | [static] |
srv_srvsvc_nt.c の 439 行で定義されています。
参照元 init_srv_share_info_ctr().
00440 { 00441 const char *net_name = lp_servicename(snum); 00442 00443 return (net_name[strlen(net_name) - 1] == '$') ? True : False; 00444 }
static BOOL init_srv_share_info_ctr | ( | pipes_struct * | p, | |
SRV_SHARE_INFO_CTR * | ctr, | |||
uint32 | info_level, | |||
uint32 * | resume_hnd, | |||
uint32 * | total_entries, | |||
BOOL | all_shares | |||
) | [static] |
srv_srvsvc_nt.c の 450 行で定義されています。
参照先 become_root()・ctx・srv_share_info_ctr_info::info0・srv_share_info_ctr_info::info1・srv_share_info_ctr_info::info1004・srv_share_info_ctr_info::info1005・srv_share_info_ctr_info::info1006・srv_share_info_ctr_info::info1007・srv_share_info_ctr_info::info1501・srv_share_info_ctr_info::info2・srv_share_info_ctr_info::info501・srv_share_info_ctr_info::info502・srv_share_info_ctr_info::info_level・init_srv_share_info_0()・init_srv_share_info_1()・init_srv_share_info_1004()・init_srv_share_info_1005()・init_srv_share_info_1006()・init_srv_share_info_1007()・init_srv_share_info_1501()・init_srv_share_info_2()・init_srv_share_info_501()・init_srv_share_info_502()・is_hidden_share()・lp_snum_ok()・pipes_struct::mem_ctx・srv_share_info_ctr_info::num_entries・srv_share_info_ctr_info::num_entries2・srv_share_info_ctr_info::ptr_entries・srv_share_info_ctr_info::ptr_share_info・srv_share_info_ctr_info::share・srv_share_info_ctr_info::switch_value・unbecome_root().
参照元 init_srv_r_net_share_enum().
00452 { 00453 int num_entries = 0; 00454 int num_services = 0; 00455 int snum; 00456 TALLOC_CTX *ctx = p->mem_ctx; 00457 00458 DEBUG(5,("init_srv_share_info_ctr\n")); 00459 00460 ZERO_STRUCTPN(ctr); 00461 00462 ctr->info_level = ctr->switch_value = info_level; 00463 *resume_hnd = 0; 00464 00465 /* Ensure all the usershares are loaded. */ 00466 become_root(); 00467 num_services = load_usershare_shares(); 00468 unbecome_root(); 00469 00470 /* Count the number of entries. */ 00471 for (snum = 0; snum < num_services; snum++) { 00472 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) 00473 num_entries++; 00474 } 00475 00476 *total_entries = num_entries; 00477 ctr->num_entries2 = ctr->num_entries = num_entries; 00478 ctr->ptr_share_info = ctr->ptr_entries = 1; 00479 00480 if (!num_entries) 00481 return True; 00482 00483 switch (info_level) { 00484 case 0: 00485 { 00486 SRV_SHARE_INFO_0 *info0 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_0, num_entries); 00487 int i = 0; 00488 00489 if (!info0) { 00490 return False; 00491 } 00492 00493 for (snum = *resume_hnd; snum < num_services; snum++) { 00494 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) { 00495 init_srv_share_info_0(p, &info0[i++], snum); 00496 } 00497 } 00498 00499 ctr->share.info0 = info0; 00500 break; 00501 00502 } 00503 00504 case 1: 00505 { 00506 SRV_SHARE_INFO_1 *info1 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_1, num_entries); 00507 int i = 0; 00508 00509 if (!info1) { 00510 return False; 00511 } 00512 00513 for (snum = *resume_hnd; snum < num_services; snum++) { 00514 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) { 00515 init_srv_share_info_1(p, &info1[i++], snum); 00516 } 00517 } 00518 00519 ctr->share.info1 = info1; 00520 break; 00521 } 00522 00523 case 2: 00524 { 00525 SRV_SHARE_INFO_2 *info2 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_2, num_entries); 00526 int i = 0; 00527 00528 if (!info2) { 00529 return False; 00530 } 00531 00532 for (snum = *resume_hnd; snum < num_services; snum++) { 00533 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) { 00534 init_srv_share_info_2(p, &info2[i++], snum); 00535 } 00536 } 00537 00538 ctr->share.info2 = info2; 00539 break; 00540 } 00541 00542 case 501: 00543 { 00544 SRV_SHARE_INFO_501 *info501 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_501, num_entries); 00545 int i = 0; 00546 00547 if (!info501) { 00548 return False; 00549 } 00550 00551 for (snum = *resume_hnd; snum < num_services; snum++) { 00552 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) { 00553 init_srv_share_info_501(p, &info501[i++], snum); 00554 } 00555 } 00556 00557 ctr->share.info501 = info501; 00558 break; 00559 } 00560 00561 case 502: 00562 { 00563 SRV_SHARE_INFO_502 *info502 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_502, num_entries); 00564 int i = 0; 00565 00566 if (!info502) { 00567 return False; 00568 } 00569 00570 for (snum = *resume_hnd; snum < num_services; snum++) { 00571 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) { 00572 init_srv_share_info_502(p, &info502[i++], snum); 00573 } 00574 } 00575 00576 ctr->share.info502 = info502; 00577 break; 00578 } 00579 00580 /* here for completeness but not currently used with enum (1004 - 1501)*/ 00581 00582 case 1004: 00583 { 00584 SRV_SHARE_INFO_1004 *info1004 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_1004, num_entries); 00585 int i = 0; 00586 00587 if (!info1004) { 00588 return False; 00589 } 00590 00591 for (snum = *resume_hnd; snum < num_services; snum++) { 00592 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) { 00593 init_srv_share_info_1004(p, &info1004[i++], snum); 00594 } 00595 } 00596 00597 ctr->share.info1004 = info1004; 00598 break; 00599 } 00600 00601 case 1005: 00602 { 00603 SRV_SHARE_INFO_1005 *info1005 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_1005, num_entries); 00604 int i = 0; 00605 00606 if (!info1005) { 00607 return False; 00608 } 00609 00610 for (snum = *resume_hnd; snum < num_services; snum++) { 00611 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) { 00612 init_srv_share_info_1005(p, &info1005[i++], snum); 00613 } 00614 } 00615 00616 ctr->share.info1005 = info1005; 00617 break; 00618 } 00619 00620 case 1006: 00621 { 00622 SRV_SHARE_INFO_1006 *info1006 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_1006, num_entries); 00623 int i = 0; 00624 00625 if (!info1006) { 00626 return False; 00627 } 00628 00629 for (snum = *resume_hnd; snum < num_services; snum++) { 00630 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) { 00631 init_srv_share_info_1006(p, &info1006[i++], snum); 00632 } 00633 } 00634 00635 ctr->share.info1006 = info1006; 00636 break; 00637 } 00638 00639 case 1007: 00640 { 00641 SRV_SHARE_INFO_1007 *info1007 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_1007, num_entries); 00642 int i = 0; 00643 00644 if (!info1007) { 00645 return False; 00646 } 00647 00648 for (snum = *resume_hnd; snum < num_services; snum++) { 00649 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) { 00650 init_srv_share_info_1007(p, &info1007[i++], snum); 00651 } 00652 } 00653 00654 ctr->share.info1007 = info1007; 00655 break; 00656 } 00657 00658 case 1501: 00659 { 00660 SRV_SHARE_INFO_1501 *info1501 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_1501, num_entries); 00661 int i = 0; 00662 00663 if (!info1501) { 00664 return False; 00665 } 00666 00667 for (snum = *resume_hnd; snum < num_services; snum++) { 00668 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) { 00669 init_srv_share_info_1501(p, &info1501[i++], snum); 00670 } 00671 } 00672 00673 ctr->share.info1501 = info1501; 00674 break; 00675 } 00676 default: 00677 DEBUG(5,("init_srv_share_info_ctr: unsupported switch value %d\n", info_level)); 00678 return False; 00679 } 00680 00681 return True; 00682 }
static void init_srv_r_net_share_enum | ( | pipes_struct * | p, | |
SRV_R_NET_SHARE_ENUM * | r_n, | |||
uint32 | info_level, | |||
uint32 | resume_hnd, | |||
BOOL | all | |||
) | [static] |
srv_srvsvc_nt.c の 688 行で定義されています。
参照先 r_net_share_enum_info::ctr・r_net_share_enum_info::enum_hnd・init_enum_hnd()・init_srv_share_info_ctr()・r_net_share_enum_info::status・r_net_share_enum_info::total_entries.
参照元 _srv_net_share_enum()・_srv_net_share_enum_all().
00690 { 00691 DEBUG(5,("init_srv_r_net_share_enum: %d\n", __LINE__)); 00692 00693 if (init_srv_share_info_ctr(p, &r_n->ctr, info_level, 00694 &resume_hnd, &r_n->total_entries, all)) { 00695 r_n->status = WERR_OK; 00696 } else { 00697 r_n->status = WERR_UNKNOWN_LEVEL; 00698 } 00699 00700 init_enum_hnd(&r_n->enum_hnd, resume_hnd); 00701 }
static void init_srv_r_net_share_get_info | ( | pipes_struct * | p, | |
SRV_R_NET_SHARE_GET_INFO * | r_n, | |||
char * | share_name, | |||
uint32 | info_level | |||
) | [static] |
srv_srvsvc_nt.c の 707 行で定義されています。
参照先 find_service()・r_net_share_get_info_info::info・srv_share_info::info0・srv_share_info::info1・srv_share_info::info1004・srv_share_info::info1005・srv_share_info::info1006・srv_share_info::info1007・srv_share_info::info1501・srv_share_info::info2・srv_share_info::info501・srv_share_info::info502・init_srv_share_info_0()・init_srv_share_info_1()・init_srv_share_info_1004()・init_srv_share_info_1005()・init_srv_share_info_1006()・init_srv_share_info_1007()・init_srv_share_info_1501()・init_srv_share_info_2()・init_srv_share_info_501()・init_srv_share_info_502()・srv_share_info::ptr_share_ctr・srv_share_info::share・r_net_share_get_info_info::status・status・srv_share_info::switch_value.
参照元 _srv_net_share_get_info().
00709 { 00710 WERROR status = WERR_OK; 00711 int snum; 00712 00713 DEBUG(5,("init_srv_r_net_share_get_info: %d\n", __LINE__)); 00714 00715 r_n->info.switch_value = info_level; 00716 00717 snum = find_service(share_name); 00718 00719 if (snum >= 0) { 00720 switch (info_level) { 00721 case 0: 00722 init_srv_share_info_0(p, &r_n->info.share.info0, snum); 00723 break; 00724 case 1: 00725 init_srv_share_info_1(p, &r_n->info.share.info1, snum); 00726 break; 00727 case 2: 00728 init_srv_share_info_2(p, &r_n->info.share.info2, snum); 00729 break; 00730 case 501: 00731 init_srv_share_info_501(p, &r_n->info.share.info501, snum); 00732 break; 00733 case 502: 00734 init_srv_share_info_502(p, &r_n->info.share.info502, snum); 00735 break; 00736 00737 /* here for completeness */ 00738 case 1004: 00739 init_srv_share_info_1004(p, &r_n->info.share.info1004, snum); 00740 break; 00741 case 1005: 00742 init_srv_share_info_1005(p, &r_n->info.share.info1005, snum); 00743 break; 00744 00745 /* here for completeness 1006 - 1501 */ 00746 case 1006: 00747 init_srv_share_info_1006(p, &r_n->info.share.info1006, snum); 00748 break; 00749 case 1007: 00750 init_srv_share_info_1007(p, &r_n->info.share.info1007, snum); 00751 break; 00752 case 1501: 00753 init_srv_share_info_1501(p, &r_n->info.share.info1501, snum); 00754 break; 00755 default: 00756 DEBUG(5,("init_srv_net_share_get_info: unsupported switch value %d\n", info_level)); 00757 status = WERR_UNKNOWN_LEVEL; 00758 break; 00759 } 00760 } else { 00761 status = WERR_INVALID_NAME; 00762 } 00763 00764 r_n->info.ptr_share_ctr = W_ERROR_IS_OK(status) ? 1 : 0; 00765 r_n->status = status; 00766 }
static void init_srv_sess_info_0 | ( | SRV_SESS_INFO_0 * | ss0, | |
uint32 * | snum, | |||
uint32 * | stot | |||
) | [static] |
srv_srvsvc_nt.c の 772 行で定義されています。
参照先 SRV_SESS_INFO_0::info_0・init_srv_sess_info0()・list_sessions()・SRV_SESS_INFO_0::num_entries_read・SRV_SESS_INFO_0::num_entries_read2・SRV_SESS_INFO_0::ptr_sess_info・sessionid::remote_machine.
00773 { 00774 struct sessionid *session_list; 00775 uint32 num_entries = 0; 00776 (*stot) = list_sessions(&session_list); 00777 00778 if (ss0 == NULL) { 00779 if (snum) { 00780 (*snum) = 0; 00781 } 00782 SAFE_FREE(session_list); 00783 return; 00784 } 00785 00786 DEBUG(5,("init_srv_sess_0_ss0\n")); 00787 00788 if (snum) { 00789 for (; (*snum) < (*stot) && num_entries < MAX_SESS_ENTRIES; (*snum)++) { 00790 init_srv_sess_info0( &ss0->info_0[num_entries], session_list[(*snum)].remote_machine); 00791 num_entries++; 00792 } 00793 00794 ss0->num_entries_read = num_entries; 00795 ss0->ptr_sess_info = num_entries > 0 ? 1 : 0; 00796 ss0->num_entries_read2 = num_entries; 00797 00798 if ((*snum) >= (*stot)) { 00799 (*snum) = 0; 00800 } 00801 00802 } else { 00803 ss0->num_entries_read = 0; 00804 ss0->ptr_sess_info = 0; 00805 ss0->num_entries_read2 = 0; 00806 } 00807 SAFE_FREE(session_list); 00808 }
static void sess_file_fn | ( | const struct share_mode_entry * | e, | |
const char * | sharepath, | |||
const char * | fname, | |||
void * | state | |||
) | [static] |
srv_srvsvc_nt.c の 816 行で定義されています。
参照先 sess_file_count::count・sess_file_count::pid・share_mode_entry::pid・procid_to_pid()・s_file_cnt・share_mode_entry::uid・sess_file_count::uid.
参照元 net_count_files().
00818 { 00819 struct sess_file_count *sess = &s_file_cnt; 00820 00821 if ( (procid_to_pid(&e->pid) == sess->pid) && (sess->uid == e->uid) ) { 00822 sess->count++; 00823 } 00824 00825 return; 00826 }
static int net_count_files | ( | uid_t | uid, | |
pid_t | pid | |||
) | [static] |
srv_srvsvc_nt.c の 831 行で定義されています。
参照先 sess_file_count::count・sess_file_count::pid・s_file_cnt・sess_file_fn()・share_mode_forall()・sess_file_count::uid.
00832 { 00833 s_file_cnt.count = 0; 00834 s_file_cnt.uid = uid; 00835 s_file_cnt.pid = pid; 00836 00837 share_mode_forall( sess_file_fn, NULL ); 00838 00839 return s_file_cnt.count; 00840 }
static void init_srv_sess_info_1 | ( | SRV_SESS_INFO_1 * | ss1, | |
uint32 * | snum, | |||
uint32 * | stot | |||
) | [static] |
srv_srvsvc_nt.c の 846 行で定義されています。
参照先 SRV_SESS_INFO_1::info_1・init_srv_sess_info1()・list_sessions()・net_count_files()・SRV_SESS_INFO_1::num_entries_read・SRV_SESS_INFO_1::num_entries_read2・sessionid::pid・SRV_SESS_INFO_1::ptr_sess_info・strequal()・sys_getpwnam()・username.
00847 { 00848 struct sessionid *session_list; 00849 uint32 num_entries = 0; 00850 time_t now = time(NULL); 00851 00852 if ( !snum ) { 00853 ss1->num_entries_read = 0; 00854 ss1->ptr_sess_info = 0; 00855 ss1->num_entries_read2 = 0; 00856 00857 (*stot) = 0; 00858 00859 return; 00860 } 00861 00862 if (ss1 == NULL) { 00863 (*snum) = 0; 00864 return; 00865 } 00866 00867 (*stot) = list_sessions(&session_list); 00868 00869 00870 for (; (*snum) < (*stot) && num_entries < MAX_SESS_ENTRIES; (*snum)++) { 00871 uint32 num_files; 00872 uint32 connect_time; 00873 struct passwd *pw = sys_getpwnam(session_list[*snum].username); 00874 BOOL guest; 00875 00876 if ( !pw ) { 00877 DEBUG(10,("init_srv_sess_info_1: failed to find owner: %s\n", 00878 session_list[*snum].username)); 00879 continue; 00880 } 00881 00882 connect_time = (uint32)(now - session_list[*snum].connect_start); 00883 num_files = net_count_files(pw->pw_uid, session_list[*snum].pid); 00884 guest = strequal( session_list[*snum].username, lp_guestaccount() ); 00885 00886 init_srv_sess_info1( &ss1->info_1[num_entries], 00887 session_list[*snum].remote_machine, 00888 session_list[*snum].username, 00889 num_files, 00890 connect_time, 00891 0, 00892 guest); 00893 num_entries++; 00894 } 00895 00896 ss1->num_entries_read = num_entries; 00897 ss1->ptr_sess_info = num_entries > 0 ? 1 : 0; 00898 ss1->num_entries_read2 = num_entries; 00899 00900 if ((*snum) >= (*stot)) { 00901 (*snum) = 0; 00902 } 00903 00904 SAFE_FREE(session_list); 00905 }
static WERROR init_srv_sess_info_ctr | ( | SRV_SESS_INFO_CTR * | ctr, | |
int | switch_value, | |||
uint32 * | resume_hnd, | |||
uint32 * | total_entries | |||
) | [static] |
srv_srvsvc_nt.c の 911 行で定義されています。
参照先 SRV_SESS_INFO_CTR::info0・SRV_SESS_INFO_CTR::info1・init_srv_sess_info_0()・init_srv_sess_info_1()・SRV_SESS_INFO_CTR::ptr_sess_ctr・SRV_SESS_INFO_CTR::sess・status・SRV_SESS_INFO_CTR::switch_value.
参照元 init_srv_r_net_sess_enum().
00913 { 00914 WERROR status = WERR_OK; 00915 DEBUG(5,("init_srv_sess_info_ctr: %d\n", __LINE__)); 00916 00917 ctr->switch_value = switch_value; 00918 00919 switch (switch_value) { 00920 case 0: 00921 init_srv_sess_info_0(&(ctr->sess.info0), resume_hnd, total_entries); 00922 ctr->ptr_sess_ctr = 1; 00923 break; 00924 case 1: 00925 init_srv_sess_info_1(&(ctr->sess.info1), resume_hnd, total_entries); 00926 ctr->ptr_sess_ctr = 1; 00927 break; 00928 default: 00929 DEBUG(5,("init_srv_sess_info_ctr: unsupported switch value %d\n", switch_value)); 00930 (*resume_hnd) = 0; 00931 (*total_entries) = 0; 00932 ctr->ptr_sess_ctr = 0; 00933 status = WERR_UNKNOWN_LEVEL; 00934 break; 00935 } 00936 00937 return status; 00938 }
static void init_srv_r_net_sess_enum | ( | SRV_R_NET_SESS_ENUM * | r_n, | |
uint32 | resume_hnd, | |||
int | sess_level, | |||
int | switch_value | |||
) | [static] |
srv_srvsvc_nt.c の 944 行で定義されています。
参照先 SRV_R_NET_SESS_ENUM::ctr・SRV_R_NET_SESS_ENUM::enum_hnd・init_enum_hnd()・init_srv_sess_info_ctr()・SRV_R_NET_SESS_ENUM::sess_level・SRV_R_NET_SESS_ENUM::status・SRV_R_NET_SESS_ENUM::total_entries.
参照元 _srv_net_sess_enum().
00946 { 00947 DEBUG(5,("init_srv_r_net_sess_enum: %d\n", __LINE__)); 00948 00949 r_n->sess_level = sess_level; 00950 00951 if (sess_level == -1) 00952 r_n->status = WERR_UNKNOWN_LEVEL; 00953 else 00954 r_n->status = init_srv_sess_info_ctr(r_n->ctr, switch_value, &resume_hnd, &r_n->total_entries); 00955 00956 if (!W_ERROR_IS_OK(r_n->status)) 00957 resume_hnd = 0; 00958 00959 init_enum_hnd(&r_n->enum_hnd, resume_hnd); 00960 }
static void init_srv_conn_info_0 | ( | SRV_CONN_INFO_0 * | ss0, | |
uint32 * | snum, | |||
uint32 * | stot | |||
) | [static] |
srv_srvsvc_nt.c の 966 行で定義されています。
参照先 srv_conn_info_0_info::info_0・init_srv_conn_info0()・srv_conn_info_0_info::num_entries_read・srv_conn_info_0_info::num_entries_read2・srv_conn_info_0_info::ptr_conn_info.
00967 { 00968 uint32 num_entries = 0; 00969 (*stot) = 1; 00970 00971 if (ss0 == NULL) { 00972 (*snum) = 0; 00973 return; 00974 } 00975 00976 DEBUG(5,("init_srv_conn_0_ss0\n")); 00977 00978 if (snum) { 00979 for (; (*snum) < (*stot) && num_entries < MAX_CONN_ENTRIES; (*snum)++) { 00980 00981 init_srv_conn_info0(&ss0->info_0[num_entries], (*stot)); 00982 00983 /* move on to creating next connection */ 00984 /* move on to creating next conn */ 00985 num_entries++; 00986 } 00987 00988 ss0->num_entries_read = num_entries; 00989 ss0->ptr_conn_info = num_entries > 0 ? 1 : 0; 00990 ss0->num_entries_read2 = num_entries; 00991 00992 if ((*snum) >= (*stot)) { 00993 (*snum) = 0; 00994 } 00995 00996 } else { 00997 ss0->num_entries_read = 0; 00998 ss0->ptr_conn_info = 0; 00999 ss0->num_entries_read2 = 0; 01000 01001 (*stot) = 0; 01002 } 01003 }
static void init_srv_conn_1_info | ( | CONN_INFO_1 * | se1, | |
CONN_INFO_1_STR * | str1, | |||
uint32 | id, | |||
uint32 | type, | |||
uint32 | num_opens, | |||
uint32 | num_users, | |||
uint32 | open_time, | |||
const char * | usr_name, | |||
const char * | net_name | |||
) | [static] |
srv_srvsvc_nt.c の 1009 行で定義されています。
参照先 init_srv_conn_info1()・init_srv_conn_info1_str().
01013 { 01014 init_srv_conn_info1(se1 , id, type, num_opens, num_users, open_time, usr_name, net_name); 01015 init_srv_conn_info1_str(str1, usr_name, net_name); 01016 }
static void init_srv_conn_info_1 | ( | SRV_CONN_INFO_1 * | ss1, | |
uint32 * | snum, | |||
uint32 * | stot | |||
) | [static] |
srv_srvsvc_nt.c の 1022 行で定義されています。
参照先 srv_conn_info_1_info::info_1・srv_conn_info_1_info::info_1_str・init_srv_conn_1_info()・srv_conn_info_1_info::num_entries_read・srv_conn_info_1_info::num_entries_read2・srv_conn_info_1_info::ptr_conn_info.
01023 { 01024 uint32 num_entries = 0; 01025 (*stot) = 1; 01026 01027 if (ss1 == NULL) { 01028 (*snum) = 0; 01029 return; 01030 } 01031 01032 DEBUG(5,("init_srv_conn_1_ss1\n")); 01033 01034 if (snum) { 01035 for (; (*snum) < (*stot) && num_entries < MAX_CONN_ENTRIES; (*snum)++) { 01036 init_srv_conn_1_info(&ss1->info_1[num_entries], 01037 &ss1->info_1_str[num_entries], 01038 (*stot), 0x3, 1, 1, 3,"dummy_user", "IPC$"); 01039 01040 /* move on to creating next connection */ 01041 /* move on to creating next conn */ 01042 num_entries++; 01043 } 01044 01045 ss1->num_entries_read = num_entries; 01046 ss1->ptr_conn_info = num_entries > 0 ? 1 : 0; 01047 ss1->num_entries_read2 = num_entries; 01048 01049 01050 if ((*snum) >= (*stot)) { 01051 (*snum) = 0; 01052 } 01053 01054 } else { 01055 ss1->num_entries_read = 0; 01056 ss1->ptr_conn_info = 0; 01057 ss1->num_entries_read2 = 0; 01058 01059 (*stot) = 0; 01060 } 01061 }
static WERROR init_srv_conn_info_ctr | ( | SRV_CONN_INFO_CTR * | ctr, | |
int | switch_value, | |||
uint32 * | resume_hnd, | |||
uint32 * | total_entries | |||
) | [static] |
srv_srvsvc_nt.c の 1067 行で定義されています。
参照先 srv_conn_info_ctr_info::conn・srv_conn_info_ctr_info::info0・srv_conn_info_ctr_info::info1・init_srv_conn_info_0()・init_srv_conn_info_1()・srv_conn_info_ctr_info::ptr_conn_ctr・status・srv_conn_info_ctr_info::switch_value.
参照元 init_srv_r_net_conn_enum().
01069 { 01070 WERROR status = WERR_OK; 01071 DEBUG(5,("init_srv_conn_info_ctr: %d\n", __LINE__)); 01072 01073 ctr->switch_value = switch_value; 01074 01075 switch (switch_value) { 01076 case 0: 01077 init_srv_conn_info_0(&ctr->conn.info0, resume_hnd, total_entries); 01078 ctr->ptr_conn_ctr = 1; 01079 break; 01080 case 1: 01081 init_srv_conn_info_1(&ctr->conn.info1, resume_hnd, total_entries); 01082 ctr->ptr_conn_ctr = 1; 01083 break; 01084 default: 01085 DEBUG(5,("init_srv_conn_info_ctr: unsupported switch value %d\n", switch_value)); 01086 (*resume_hnd = 0); 01087 (*total_entries) = 0; 01088 ctr->ptr_conn_ctr = 0; 01089 status = WERR_UNKNOWN_LEVEL; 01090 break; 01091 } 01092 01093 return status; 01094 }
static void init_srv_r_net_conn_enum | ( | SRV_R_NET_CONN_ENUM * | r_n, | |
uint32 | resume_hnd, | |||
int | conn_level, | |||
int | switch_value | |||
) | [static] |
srv_srvsvc_nt.c の 1100 行で定義されています。
参照先 r_net_conn_enum_info::conn_level・r_net_conn_enum_info::ctr・r_net_conn_enum_info::enum_hnd・init_enum_hnd()・init_srv_conn_info_ctr()・r_net_conn_enum_info::status・r_net_conn_enum_info::total_entries.
参照元 _srv_net_conn_enum().
01102 { 01103 DEBUG(5,("init_srv_r_net_conn_enum: %d\n", __LINE__)); 01104 01105 r_n->conn_level = conn_level; 01106 if (conn_level == -1) 01107 r_n->status = WERR_UNKNOWN_LEVEL; 01108 else 01109 r_n->status = init_srv_conn_info_ctr(r_n->ctr, switch_value, &resume_hnd, &r_n->total_entries); 01110 01111 if (!W_ERROR_IS_OK(r_n->status)) 01112 resume_hnd = 0; 01113 01114 init_enum_hnd(&r_n->enum_hnd, resume_hnd); 01115 }
static WERROR net_file_enum_3 | ( | SRV_R_NET_FILE_ENUM * | r, | |
uint32 | resume_hnd | |||
) | [static] |
srv_srvsvc_nt.c の 1121 行で定義されています。
参照先 SRV_R_NET_FILE_ENUM::ctr・ctx・SRV_R_NET_FILE_ENUM::enum_hnd・SRV_FILE_INFO_CTR::file・get_talloc_ctx()・SRV_FILE_INFO_CTR::info3・init_enum_hnd()・SRV_FILE_INFO_CTR::level・SRV_R_NET_FILE_ENUM::level・net_enum_files()・net_enum_pipes()・SRV_FILE_INFO_CTR::num_entries・SRV_FILE_INFO_CTR::num_entries2・SRV_FILE_INFO_CTR::ptr_entries・SRV_FILE_INFO_CTR::ptr_file_info・SRV_R_NET_FILE_ENUM::status・SRV_R_NET_FILE_ENUM::total_entries.
参照元 _srv_net_file_enum().
01122 { 01123 TALLOC_CTX *ctx = get_talloc_ctx(); 01124 SRV_FILE_INFO_CTR *ctr = &r->ctr; 01125 01126 /* TODO -- Windows enumerates 01127 (b) active pipes 01128 (c) open directories and files */ 01129 01130 r->status = net_enum_files( ctx, &ctr->file.info3, &ctr->num_entries, resume_hnd ); 01131 if ( !W_ERROR_IS_OK(r->status)) 01132 goto done; 01133 01134 r->status = net_enum_pipes( ctx, &ctr->file.info3, &ctr->num_entries, resume_hnd ); 01135 if ( !W_ERROR_IS_OK(r->status)) 01136 goto done; 01137 01138 r->level = ctr->level = 3; 01139 r->total_entries = ctr->num_entries; 01140 /* ctr->num_entries = r->total_entries - resume_hnd; */ 01141 ctr->num_entries2 = ctr->num_entries; 01142 ctr->ptr_file_info = 1; 01143 01144 r->status = WERR_OK; 01145 01146 done: 01147 if ( ctr->num_entries > 0 ) 01148 ctr->ptr_entries = 1; 01149 01150 init_enum_hnd(&r->enum_hnd, 0); 01151 01152 return r->status; 01153 }
WERROR _srv_net_file_enum | ( | pipes_struct * | p, | |
SRV_Q_NET_FILE_ENUM * | q_u, | |||
SRV_R_NET_FILE_ENUM * | r_u | |||
) |
srv_srvsvc_nt.c の 1158 行で定義されています。
参照先 SRV_Q_NET_FILE_ENUM::enum_hnd・get_enum_hnd()・SRV_Q_NET_FILE_ENUM::level・net_file_enum_3().
01159 { 01160 switch ( q_u->level ) { 01161 case 3: 01162 return net_file_enum_3( r_u, get_enum_hnd(&q_u->enum_hnd) ); 01163 default: 01164 return WERR_UNKNOWN_LEVEL; 01165 } 01166 01167 return WERR_OK; 01168 }
WERROR _srv_net_srv_get_info | ( | pipes_struct * | p, | |
SRV_Q_NET_SRV_GET_INFO * | q_u, | |||
SRV_R_NET_SRV_GET_INFO * | r_u | |||
) |
srv_srvsvc_nt.c の 1174 行で定義されています。
参照先 global_myname・init_srv_info_100()・init_srv_info_101()・init_srv_info_102()・init_srv_r_net_srv_get_info()・pipes_struct::mem_ctx・pipe_access_check()・srv_info_ctr_info::srv・r_net_srv_get_info::status・status・string_truncate()・srv_info_ctr_info::sv100・srv_info_ctr_info::sv101・srv_info_ctr_info::sv102・q_net_srv_get_info::switch_value.
参照元 api_srv_net_srv_get_info().
01175 { 01176 WERROR status = WERR_OK; 01177 SRV_INFO_CTR *ctr = TALLOC_P(p->mem_ctx, SRV_INFO_CTR); 01178 01179 if (!ctr) 01180 return WERR_NOMEM; 01181 01182 ZERO_STRUCTP(ctr); 01183 01184 DEBUG(5,("srv_net_srv_get_info: %d\n", __LINE__)); 01185 01186 if (!pipe_access_check(p)) { 01187 DEBUG(3, ("access denied to srv_net_srv_get_info\n")); 01188 return WERR_ACCESS_DENIED; 01189 } 01190 01191 switch (q_u->switch_value) { 01192 01193 /* Technically level 102 should only be available to 01194 Administrators but there isn't anything super-secret 01195 here, as most of it is made up. */ 01196 01197 case 102: 01198 init_srv_info_102(&ctr->srv.sv102, 01199 500, global_myname(), 01200 string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH), 01201 lp_major_announce_version(), lp_minor_announce_version(), 01202 lp_default_server_announce(), 01203 0xffffffff, /* users */ 01204 0xf, /* disc */ 01205 0, /* hidden */ 01206 240, /* announce */ 01207 3000, /* announce delta */ 01208 100000, /* licenses */ 01209 "c:\\"); /* user path */ 01210 break; 01211 case 101: 01212 init_srv_info_101(&ctr->srv.sv101, 01213 500, global_myname(), 01214 lp_major_announce_version(), lp_minor_announce_version(), 01215 lp_default_server_announce(), 01216 string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH)); 01217 break; 01218 case 100: 01219 init_srv_info_100(&ctr->srv.sv100, 500, global_myname()); 01220 break; 01221 default: 01222 status = WERR_UNKNOWN_LEVEL; 01223 break; 01224 } 01225 01226 /* set up the net server get info structure */ 01227 init_srv_r_net_srv_get_info(r_u, q_u->switch_value, ctr, status); 01228 01229 DEBUG(5,("srv_net_srv_get_info: %d\n", __LINE__)); 01230 01231 return r_u->status; 01232 }
WERROR _srv_net_srv_set_info | ( | pipes_struct * | p, | |
SRV_Q_NET_SRV_SET_INFO * | q_u, | |||
SRV_R_NET_SRV_SET_INFO * | r_u | |||
) |
srv_srvsvc_nt.c の 1238 行で定義されています。
参照先 init_srv_r_net_srv_set_info()・r_net_srv_set_info::status・status.
参照元 api_srv_net_srv_set_info().
01239 { 01240 WERROR status = WERR_OK; 01241 01242 DEBUG(5,("srv_net_srv_set_info: %d\n", __LINE__)); 01243 01244 /* Set up the net server set info structure. */ 01245 01246 init_srv_r_net_srv_set_info(r_u, 0x0, status); 01247 01248 DEBUG(5,("srv_net_srv_set_info: %d\n", __LINE__)); 01249 01250 return r_u->status; 01251 }
WERROR _srv_net_conn_enum | ( | pipes_struct * | p, | |
SRV_Q_NET_CONN_ENUM * | q_u, | |||
SRV_R_NET_CONN_ENUM * | r_u | |||
) |
srv_srvsvc_nt.c の 1257 行で定義されています。
参照先 q_net_conn_enum_info::conn_level・q_net_conn_enum_info::ctr・r_net_conn_enum_info::ctr・q_net_conn_enum_info::enum_hnd・get_enum_hnd()・init_srv_r_net_conn_enum()・pipes_struct::mem_ctx・r_net_conn_enum_info::status・srv_conn_info_ctr_info::switch_value.
01258 { 01259 DEBUG(5,("srv_net_conn_enum: %d\n", __LINE__)); 01260 01261 r_u->ctr = TALLOC_P(p->mem_ctx, SRV_CONN_INFO_CTR); 01262 if (!r_u->ctr) 01263 return WERR_NOMEM; 01264 01265 ZERO_STRUCTP(r_u->ctr); 01266 01267 /* set up the */ 01268 init_srv_r_net_conn_enum(r_u, 01269 get_enum_hnd(&q_u->enum_hnd), 01270 q_u->conn_level, 01271 q_u->ctr->switch_value); 01272 01273 DEBUG(5,("srv_net_conn_enum: %d\n", __LINE__)); 01274 01275 return r_u->status; 01276 }
WERROR _srv_net_sess_enum | ( | pipes_struct * | p, | |
SRV_Q_NET_SESS_ENUM * | q_u, | |||
SRV_R_NET_SESS_ENUM * | r_u | |||
) |
srv_srvsvc_nt.c の 1282 行で定義されています。
参照先 SRV_Q_NET_SESS_ENUM::ctr・SRV_R_NET_SESS_ENUM::ctr・SRV_Q_NET_SESS_ENUM::enum_hnd・get_enum_hnd()・init_srv_r_net_sess_enum()・pipes_struct::mem_ctx・SRV_Q_NET_SESS_ENUM::sess_level・SRV_R_NET_SESS_ENUM::status・SRV_SESS_INFO_CTR::switch_value.
01283 { 01284 DEBUG(5,("_srv_net_sess_enum: %d\n", __LINE__)); 01285 01286 r_u->ctr = TALLOC_P(p->mem_ctx, SRV_SESS_INFO_CTR); 01287 if (!r_u->ctr) 01288 return WERR_NOMEM; 01289 01290 ZERO_STRUCTP(r_u->ctr); 01291 01292 /* set up the */ 01293 init_srv_r_net_sess_enum(r_u, 01294 get_enum_hnd(&q_u->enum_hnd), 01295 q_u->sess_level, 01296 q_u->ctr->switch_value); 01297 01298 DEBUG(5,("_srv_net_sess_enum: %d\n", __LINE__)); 01299 01300 return r_u->status; 01301 }
WERROR _srv_net_sess_del | ( | pipes_struct * | p, | |
SRV_Q_NET_SESS_DEL * | q_u, | |||
SRV_R_NET_SESS_DEL * | r_u | |||
) |
srv_srvsvc_nt.c の 1307 行で定義されています。
参照先 become_root()・get_current_user()・list_sessions()・message_send_pid()・nt_token_check_domain_rid()・current_user::nt_user_token・pid_to_procid()・pipes_struct::pipe_user・remote_machine・rpcstr_pull_unistr2_fstring()・sec_initial_uid()・r_net_sess_del::status・strequal()・_unix_token::uid・unbecome_root()・q_net_sess_del::uni_cli_name・q_net_sess_del::uni_user_name・username・current_user::ut.
01308 { 01309 struct sessionid *session_list; 01310 struct current_user user; 01311 int num_sessions, snum; 01312 fstring username; 01313 fstring machine; 01314 BOOL not_root = False; 01315 01316 rpcstr_pull_unistr2_fstring(username, &q_u->uni_user_name); 01317 rpcstr_pull_unistr2_fstring(machine, &q_u->uni_cli_name); 01318 01319 /* strip leading backslashes if any */ 01320 while (machine[0] == '\\') { 01321 memmove(machine, &machine[1], strlen(machine)); 01322 } 01323 01324 num_sessions = list_sessions(&session_list); 01325 01326 DEBUG(5,("_srv_net_sess_del: %d\n", __LINE__)); 01327 01328 r_u->status = WERR_ACCESS_DENIED; 01329 01330 get_current_user(&user, p); 01331 01332 /* fail out now if you are not root or not a domain admin */ 01333 01334 if ((user.ut.uid != sec_initial_uid()) && 01335 ( ! nt_token_check_domain_rid(p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS))) { 01336 01337 goto done; 01338 } 01339 01340 for (snum = 0; snum < num_sessions; snum++) { 01341 01342 if ((strequal(session_list[snum].username, username) || username[0] == '\0' ) && 01343 strequal(session_list[snum].remote_machine, machine)) { 01344 01345 if (user.ut.uid != sec_initial_uid()) { 01346 not_root = True; 01347 become_root(); 01348 } 01349 01350 if (NT_STATUS_IS_OK(message_send_pid(pid_to_procid(session_list[snum].pid), MSG_SHUTDOWN, NULL, 0, False))) 01351 r_u->status = WERR_OK; 01352 01353 if (not_root) 01354 unbecome_root(); 01355 } 01356 } 01357 01358 DEBUG(5,("_srv_net_sess_del: %d\n", __LINE__)); 01359 01360 01361 done: 01362 SAFE_FREE(session_list); 01363 01364 return r_u->status; 01365 }
WERROR _srv_net_share_enum_all | ( | pipes_struct * | p, | |
SRV_Q_NET_SHARE_ENUM * | q_u, | |||
SRV_R_NET_SHARE_ENUM * | r_u | |||
) |
srv_srvsvc_nt.c の 1371 行で定義されています。
参照先 q_net_share_enum_info::ctr・q_net_share_enum_info::enum_hnd・get_enum_hnd()・srv_share_info_ctr_info::info_level・init_srv_r_net_share_enum()・pipe_access_check()・r_net_share_enum_info::status.
参照元 api_srv_net_share_enum_all().
01372 { 01373 DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__)); 01374 01375 if (!pipe_access_check(p)) { 01376 DEBUG(3, ("access denied to srv_net_share_enum_all\n")); 01377 return WERR_ACCESS_DENIED; 01378 } 01379 01380 /* Create the list of shares for the response. */ 01381 init_srv_r_net_share_enum(p, r_u, 01382 q_u->ctr.info_level, 01383 get_enum_hnd(&q_u->enum_hnd), True); 01384 01385 DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__)); 01386 01387 return r_u->status; 01388 }
WERROR _srv_net_share_enum | ( | pipes_struct * | p, | |
SRV_Q_NET_SHARE_ENUM * | q_u, | |||
SRV_R_NET_SHARE_ENUM * | r_u | |||
) |
srv_srvsvc_nt.c の 1394 行で定義されています。
参照先 q_net_share_enum_info::ctr・q_net_share_enum_info::enum_hnd・get_enum_hnd()・srv_share_info_ctr_info::info_level・init_srv_r_net_share_enum()・pipe_access_check()・r_net_share_enum_info::status.
01395 { 01396 DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__)); 01397 01398 if (!pipe_access_check(p)) { 01399 DEBUG(3, ("access denied to srv_net_share_enum\n")); 01400 return WERR_ACCESS_DENIED; 01401 } 01402 01403 /* Create the list of shares for the response. */ 01404 init_srv_r_net_share_enum(p, r_u, 01405 q_u->ctr.info_level, 01406 get_enum_hnd(&q_u->enum_hnd), False); 01407 01408 DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__)); 01409 01410 return r_u->status; 01411 }
WERROR _srv_net_share_get_info | ( | pipes_struct * | p, | |
SRV_Q_NET_SHARE_GET_INFO * | q_u, | |||
SRV_R_NET_SHARE_GET_INFO * | r_u | |||
) |
srv_srvsvc_nt.c の 1417 行で定義されています。
参照先 q_net_share_get_info_info::info_level・init_srv_r_net_share_get_info()・r_net_share_get_info_info::status・q_net_share_get_info_info::uni_share_name・unistr2_to_ascii().
参照元 api_srv_net_share_get_info().
01418 { 01419 fstring share_name; 01420 01421 DEBUG(5,("_srv_net_share_get_info: %d\n", __LINE__)); 01422 01423 /* Create the list of shares for the response. */ 01424 unistr2_to_ascii(share_name, &q_u->uni_share_name, sizeof(share_name)); 01425 init_srv_r_net_share_get_info(p, r_u, share_name, q_u->info_level); 01426 01427 DEBUG(5,("_srv_net_share_get_info: %d\n", __LINE__)); 01428 01429 return r_u->status; 01430 }
char* valid_share_pathname | ( | char * | dos_pathname | ) |
srv_srvsvc_nt.c の 1436 行で定義されています。
参照先 unix_clean_name().
参照元 _srv_net_share_add()・_srv_net_share_set_info()・validate_reg_filename().
01437 { 01438 char *ptr; 01439 01440 /* Convert any '\' paths to '/' */ 01441 unix_format(dos_pathname); 01442 unix_clean_name(dos_pathname); 01443 01444 /* NT is braindead - it wants a C: prefix to a pathname ! So strip it. */ 01445 ptr = dos_pathname; 01446 if (strlen(dos_pathname) > 2 && ptr[1] == ':' && ptr[0] != '/') 01447 ptr += 2; 01448 01449 /* Only absolute paths allowed. */ 01450 if (*ptr != '/') 01451 return NULL; 01452 01453 return ptr; 01454 }
WERROR _srv_net_share_set_info | ( | pipes_struct * | p, | |
SRV_Q_NET_SHARE_SET_INFO * | q_u, | |||
SRV_R_NET_SHARE_SET_INFO * | r_u | |||
) |
srv_srvsvc_nt.c の 1460 行で定義されています。
参照先 become_root()・conn_tdb_ctx()・dyn_CONFIGFILE・find_service()・get_current_user()・get_share_security()・q_net_share_set_info_info::info・srv_share_info::info1004・srv_share_info::info1005・srv_share_info::info1501・srv_share_info::info2・srv_share_info::info501・srv_share_info::info502・ptr_info_1004_info::info_1004_str・share_info_2_info::info_2・share_info_2_info::info_2_str・share_info_501_info::info_501・share_info_501_info::info_501_str・share_info_502_info::info_502・share_info_502_info::info_502_str・q_net_share_set_info_info::info_level・map_generic_share_sd_bits()・ptr_share_info2::max_uses・pipes_struct::mem_ctx・message_send_all()・current_user::nt_user_token・r_net_share_set_info::parm_error・pipes_struct::pipe_user・str_share_info502::sd・share_info_1501_info::sdb・sec_desc_buf_info::sec・sec_desc_equal()・sec_initial_uid()・set_share_security()・srv_share_info::share・share_info_1005_info::share_info_flags・smbrun()・strequal()・string_replace()・STYPE_DISKTREE・ptr_share_info502::type・ptr_share_info501::type・ptr_share_info2::type・type・_unix_token::uid・unbecome_root()・str_share_info502::uni_path・str_share_info2::uni_path・str_share_info1004::uni_remark・str_share_info502::uni_remark・str_share_info501::uni_remark・str_share_info2::uni_remark・q_net_share_set_info_info::uni_share_name・unistr2_to_ascii()・user_has_privileges()・current_user::ut・valid_share_pathname().
参照元 api_srv_net_share_set_info().
01461 { 01462 struct current_user user; 01463 pstring command; 01464 fstring share_name; 01465 fstring comment; 01466 pstring pathname; 01467 int type; 01468 int snum; 01469 int ret; 01470 char *path; 01471 SEC_DESC *psd = NULL; 01472 SE_PRIV se_diskop = SE_DISK_OPERATOR; 01473 BOOL is_disk_op = False; 01474 int max_connections = 0; 01475 01476 DEBUG(5,("_srv_net_share_set_info: %d\n", __LINE__)); 01477 01478 unistr2_to_ascii(share_name, &q_u->uni_share_name, sizeof(share_name)); 01479 01480 r_u->parm_error = 0; 01481 01482 if ( strequal(share_name,"IPC$") 01483 || ( lp_enable_asu_support() && strequal(share_name,"ADMIN$") ) 01484 || strequal(share_name,"global") ) 01485 { 01486 return WERR_ACCESS_DENIED; 01487 } 01488 01489 snum = find_service(share_name); 01490 01491 /* Does this share exist ? */ 01492 if (snum < 0) 01493 return WERR_NET_NAME_NOT_FOUND; 01494 01495 /* No change to printer shares. */ 01496 if (lp_print_ok(snum)) 01497 return WERR_ACCESS_DENIED; 01498 01499 get_current_user(&user,p); 01500 01501 is_disk_op = user_has_privileges( p->pipe_user.nt_user_token, &se_diskop ); 01502 01503 /* fail out now if you are not root and not a disk op */ 01504 01505 if ( user.ut.uid != sec_initial_uid() && !is_disk_op ) 01506 return WERR_ACCESS_DENIED; 01507 01508 switch (q_u->info_level) { 01509 case 1: 01510 pstrcpy(pathname, lp_pathname(snum)); 01511 unistr2_to_ascii(comment, &q_u->info.share.info2.info_2_str.uni_remark, sizeof(comment)); 01512 type = q_u->info.share.info2.info_2.type; 01513 psd = NULL; 01514 break; 01515 case 2: 01516 unistr2_to_ascii(comment, &q_u->info.share.info2.info_2_str.uni_remark, sizeof(comment)); 01517 unistr2_to_ascii(pathname, &q_u->info.share.info2.info_2_str.uni_path, sizeof(pathname)); 01518 type = q_u->info.share.info2.info_2.type; 01519 max_connections = (q_u->info.share.info2.info_2.max_uses == 0xffffffff) ? 0 : q_u->info.share.info2.info_2.max_uses; 01520 psd = NULL; 01521 break; 01522 #if 0 01523 /* not supported on set but here for completeness */ 01524 case 501: 01525 unistr2_to_ascii(comment, &q_u->info.share.info501.info_501_str.uni_remark, sizeof(comment)); 01526 type = q_u->info.share.info501.info_501.type; 01527 psd = NULL; 01528 break; 01529 #endif 01530 case 502: 01531 unistr2_to_ascii(comment, &q_u->info.share.info502.info_502_str.uni_remark, sizeof(comment)); 01532 unistr2_to_ascii(pathname, &q_u->info.share.info502.info_502_str.uni_path, sizeof(pathname)); 01533 type = q_u->info.share.info502.info_502.type; 01534 psd = q_u->info.share.info502.info_502_str.sd; 01535 map_generic_share_sd_bits(psd); 01536 break; 01537 case 1004: 01538 pstrcpy(pathname, lp_pathname(snum)); 01539 unistr2_to_ascii(comment, &q_u->info.share.info1004.info_1004_str.uni_remark, sizeof(comment)); 01540 type = STYPE_DISKTREE; 01541 break; 01542 case 1005: 01543 /* XP re-sets the csc policy even if it wasn't changed by the 01544 user, so we must compare it to see if it's what is set in 01545 smb.conf, so that we can contine other ops like setting 01546 ACLs on a share */ 01547 if (((q_u->info.share.info1005.share_info_flags & 01548 SHARE_1005_CSC_POLICY_MASK) >> 01549 SHARE_1005_CSC_POLICY_SHIFT) == lp_csc_policy(snum)) 01550 return WERR_OK; 01551 else { 01552 DEBUG(3, ("_srv_net_share_set_info: client is trying to change csc policy from the network; must be done with smb.conf\n")); 01553 return WERR_ACCESS_DENIED; 01554 } 01555 case 1006: 01556 case 1007: 01557 return WERR_ACCESS_DENIED; 01558 case 1501: 01559 pstrcpy(pathname, lp_pathname(snum)); 01560 fstrcpy(comment, lp_comment(snum)); 01561 psd = q_u->info.share.info1501.sdb->sec; 01562 map_generic_share_sd_bits(psd); 01563 type = STYPE_DISKTREE; 01564 break; 01565 default: 01566 DEBUG(5,("_srv_net_share_set_info: unsupported switch value %d\n", q_u->info_level)); 01567 return WERR_UNKNOWN_LEVEL; 01568 } 01569 01570 /* We can only modify disk shares. */ 01571 if (type != STYPE_DISKTREE) 01572 return WERR_ACCESS_DENIED; 01573 01574 /* Check if the pathname is valid. */ 01575 if (!(path = valid_share_pathname( pathname ))) 01576 return WERR_OBJECT_PATH_INVALID; 01577 01578 /* Ensure share name, pathname and comment don't contain '"' characters. */ 01579 string_replace(share_name, '"', ' '); 01580 string_replace(path, '"', ' '); 01581 string_replace(comment, '"', ' '); 01582 01583 DEBUG(10,("_srv_net_share_set_info: change share command = %s\n", 01584 lp_change_share_cmd() ? lp_change_share_cmd() : "NULL" )); 01585 01586 /* Only call modify function if something changed. */ 01587 01588 if (strcmp(path, lp_pathname(snum)) || strcmp(comment, lp_comment(snum)) 01589 || (lp_max_connections(snum) != max_connections) ) 01590 { 01591 if (!lp_change_share_cmd() || !*lp_change_share_cmd()) { 01592 DEBUG(10,("_srv_net_share_set_info: No change share command\n")); 01593 return WERR_ACCESS_DENIED; 01594 } 01595 01596 slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" \"%s\" %d", 01597 lp_change_share_cmd(), dyn_CONFIGFILE, share_name, path, comment, max_connections ); 01598 01599 DEBUG(10,("_srv_net_share_set_info: Running [%s]\n", command )); 01600 01601 /********* BEGIN SeDiskOperatorPrivilege BLOCK *********/ 01602 01603 if ( is_disk_op ) 01604 become_root(); 01605 01606 if ( (ret = smbrun(command, NULL)) == 0 ) { 01607 /* Tell everyone we updated smb.conf. */ 01608 message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL, 0, False, NULL); 01609 } 01610 01611 if ( is_disk_op ) 01612 unbecome_root(); 01613 01614 /********* END SeDiskOperatorPrivilege BLOCK *********/ 01615 01616 DEBUG(3,("_srv_net_share_set_info: Running [%s] returned (%d)\n", command, ret )); 01617 01618 if ( ret != 0 ) 01619 return WERR_ACCESS_DENIED; 01620 } else { 01621 DEBUG(10,("_srv_net_share_set_info: No change to share name (%s)\n", share_name )); 01622 } 01623 01624 /* Replace SD if changed. */ 01625 if (psd) { 01626 SEC_DESC *old_sd; 01627 size_t sd_size; 01628 01629 old_sd = get_share_security(p->mem_ctx, lp_servicename(snum), &sd_size); 01630 01631 if (old_sd && !sec_desc_equal(old_sd, psd)) { 01632 if (!set_share_security(share_name, psd)) 01633 DEBUG(0,("_srv_net_share_set_info: Failed to change security info in share %s.\n", 01634 share_name )); 01635 } 01636 } 01637 01638 DEBUG(5,("_srv_net_share_set_info: %d\n", __LINE__)); 01639 01640 return WERR_OK; 01641 }
WERROR _srv_net_share_add | ( | pipes_struct * | p, | |
SRV_Q_NET_SHARE_ADD * | q_u, | |||
SRV_R_NET_SHARE_ADD * | r_u | |||
) |
srv_srvsvc_nt.c の 1648 行で定義されています。
参照先 become_root()・conn_tdb_ctx()・dyn_CONFIGFILE・find_service()・get_current_user()・q_net_share_add::info・srv_share_info::info2・srv_share_info::info502・share_info_2_info::info_2・share_info_2_info::info_2_str・share_info_502_info::info_502・share_info_502_info::info_502_str・q_net_share_add::info_level・map_generic_share_sd_bits()・ptr_share_info2::max_uses・message_send_all()・current_user::nt_user_token・r_net_share_add::parm_error・pipes_struct::pipe_user・str_share_info502::sd・sec_initial_uid()・set_share_security()・srv_share_info::share・smbrun()・strequal()・string_replace()・STYPE_DISKTREE・ptr_share_info502::type・ptr_share_info2::type・type・_unix_token::uid・unbecome_root()・str_share_info502::uni_netname・str_share_info2::uni_netname・str_share_info502::uni_path・str_share_info2::uni_path・str_share_info502::uni_remark・str_share_info2::uni_remark・unistr2_to_ascii()・user_has_privileges()・current_user::ut・valid_share_pathname()・validate_net_name().
01649 { 01650 struct current_user user; 01651 pstring command; 01652 fstring share_name; 01653 fstring comment; 01654 pstring pathname; 01655 int type; 01656 int snum; 01657 int ret; 01658 char *path; 01659 SEC_DESC *psd = NULL; 01660 SE_PRIV se_diskop = SE_DISK_OPERATOR; 01661 BOOL is_disk_op; 01662 int max_connections = 0; 01663 01664 DEBUG(5,("_srv_net_share_add: %d\n", __LINE__)); 01665 01666 r_u->parm_error = 0; 01667 01668 get_current_user(&user,p); 01669 01670 is_disk_op = user_has_privileges( p->pipe_user.nt_user_token, &se_diskop ); 01671 01672 if (user.ut.uid != sec_initial_uid() && !is_disk_op ) 01673 return WERR_ACCESS_DENIED; 01674 01675 if (!lp_add_share_cmd() || !*lp_add_share_cmd()) { 01676 DEBUG(10,("_srv_net_share_add: No add share command\n")); 01677 return WERR_ACCESS_DENIED; 01678 } 01679 01680 switch (q_u->info_level) { 01681 case 0: 01682 /* No path. Not enough info in a level 0 to do anything. */ 01683 return WERR_ACCESS_DENIED; 01684 case 1: 01685 /* Not enough info in a level 1 to do anything. */ 01686 return WERR_ACCESS_DENIED; 01687 case 2: 01688 unistr2_to_ascii(share_name, &q_u->info.share.info2.info_2_str.uni_netname, sizeof(share_name)); 01689 unistr2_to_ascii(comment, &q_u->info.share.info2.info_2_str.uni_remark, sizeof(share_name)); 01690 unistr2_to_ascii(pathname, &q_u->info.share.info2.info_2_str.uni_path, sizeof(share_name)); 01691 max_connections = (q_u->info.share.info2.info_2.max_uses == 0xffffffff) ? 0 : q_u->info.share.info2.info_2.max_uses; 01692 type = q_u->info.share.info2.info_2.type; 01693 break; 01694 case 501: 01695 /* No path. Not enough info in a level 501 to do anything. */ 01696 return WERR_ACCESS_DENIED; 01697 case 502: 01698 unistr2_to_ascii(share_name, &q_u->info.share.info502.info_502_str.uni_netname, sizeof(share_name)); 01699 unistr2_to_ascii(comment, &q_u->info.share.info502.info_502_str.uni_remark, sizeof(share_name)); 01700 unistr2_to_ascii(pathname, &q_u->info.share.info502.info_502_str.uni_path, sizeof(share_name)); 01701 type = q_u->info.share.info502.info_502.type; 01702 psd = q_u->info.share.info502.info_502_str.sd; 01703 map_generic_share_sd_bits(psd); 01704 break; 01705 01706 /* none of the following contain share names. NetShareAdd does not have a separate parameter for the share name */ 01707 01708 case 1004: 01709 case 1005: 01710 case 1006: 01711 case 1007: 01712 return WERR_ACCESS_DENIED; 01713 case 1501: 01714 /* DFS only level. */ 01715 return WERR_ACCESS_DENIED; 01716 default: 01717 DEBUG(5,("_srv_net_share_add: unsupported switch value %d\n", q_u->info_level)); 01718 return WERR_UNKNOWN_LEVEL; 01719 } 01720 01721 /* check for invalid share names */ 01722 01723 if ( !validate_net_name( share_name, INVALID_SHARENAME_CHARS, sizeof(share_name) ) ) { 01724 DEBUG(5,("_srv_net_name_validate: Bad sharename \"%s\"\n", share_name)); 01725 return WERR_INVALID_NAME; 01726 } 01727 01728 if ( strequal(share_name,"IPC$") || strequal(share_name,"global") 01729 || ( lp_enable_asu_support() && strequal(share_name,"ADMIN$") ) ) 01730 { 01731 return WERR_ACCESS_DENIED; 01732 } 01733 01734 snum = find_service(share_name); 01735 01736 /* Share already exists. */ 01737 if (snum >= 0) 01738 return WERR_ALREADY_EXISTS; 01739 01740 /* We can only add disk shares. */ 01741 if (type != STYPE_DISKTREE) 01742 return WERR_ACCESS_DENIED; 01743 01744 /* Check if the pathname is valid. */ 01745 if (!(path = valid_share_pathname( pathname ))) 01746 return WERR_OBJECT_PATH_INVALID; 01747 01748 /* Ensure share name, pathname and comment don't contain '"' characters. */ 01749 string_replace(share_name, '"', ' '); 01750 string_replace(path, '"', ' '); 01751 string_replace(comment, '"', ' '); 01752 01753 slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" \"%s\" %d", 01754 lp_add_share_cmd(), 01755 dyn_CONFIGFILE, 01756 share_name, 01757 path, 01758 comment, 01759 max_connections); 01760 01761 DEBUG(10,("_srv_net_share_add: Running [%s]\n", command )); 01762 01763 /********* BEGIN SeDiskOperatorPrivilege BLOCK *********/ 01764 01765 if ( is_disk_op ) 01766 become_root(); 01767 01768 if ( (ret = smbrun(command, NULL)) == 0 ) { 01769 /* Tell everyone we updated smb.conf. */ 01770 message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL, 0, False, NULL); 01771 } 01772 01773 if ( is_disk_op ) 01774 unbecome_root(); 01775 01776 /********* END SeDiskOperatorPrivilege BLOCK *********/ 01777 01778 DEBUG(3,("_srv_net_share_add: Running [%s] returned (%d)\n", command, ret )); 01779 01780 if ( ret != 0 ) 01781 return WERR_ACCESS_DENIED; 01782 01783 if (psd) { 01784 if (!set_share_security(share_name, psd)) { 01785 DEBUG(0,("_srv_net_share_add: Failed to add security info to share %s.\n", share_name )); 01786 } 01787 } 01788 01789 /* 01790 * We don't call reload_services() here, the message will 01791 * cause this to be done before the next packet is read 01792 * from the client. JRA. 01793 */ 01794 01795 DEBUG(5,("_srv_net_share_add: %d\n", __LINE__)); 01796 01797 return WERR_OK; 01798 }
WERROR _srv_net_share_del | ( | pipes_struct * | p, | |
SRV_Q_NET_SHARE_DEL * | q_u, | |||
SRV_R_NET_SHARE_DEL * | r_u | |||
) |
srv_srvsvc_nt.c の 1805 行で定義されています。
参照先 become_root()・conn_tdb_ctx()・delete_share_security()・dyn_CONFIGFILE・find_service()・get_current_user()・lp_killservice()・pipes_struct::mem_ctx・message_send_all()・current_user::nt_user_token・pipes_struct::pipe_user・sec_initial_uid()・share_params::service・smbrun()・strequal()・_unix_token::uid・unbecome_root()・q_net_share_del::uni_share_name・unistr2_to_ascii()・user_has_privileges()・current_user::ut.
参照元 _srv_net_share_del_sticky()・api_srv_net_share_del().
01806 { 01807 struct current_user user; 01808 pstring command; 01809 fstring share_name; 01810 int ret; 01811 int snum; 01812 SE_PRIV se_diskop = SE_DISK_OPERATOR; 01813 BOOL is_disk_op; 01814 struct share_params *params; 01815 01816 DEBUG(5,("_srv_net_share_del: %d\n", __LINE__)); 01817 01818 unistr2_to_ascii(share_name, &q_u->uni_share_name, sizeof(share_name)); 01819 01820 if ( strequal(share_name,"IPC$") 01821 || ( lp_enable_asu_support() && strequal(share_name,"ADMIN$") ) 01822 || strequal(share_name,"global") ) 01823 { 01824 return WERR_ACCESS_DENIED; 01825 } 01826 01827 if (!(params = get_share_params(p->mem_ctx, share_name))) { 01828 return WERR_NO_SUCH_SHARE; 01829 } 01830 01831 snum = find_service(share_name); 01832 01833 /* No change to printer shares. */ 01834 if (lp_print_ok(snum)) 01835 return WERR_ACCESS_DENIED; 01836 01837 get_current_user(&user,p); 01838 01839 is_disk_op = user_has_privileges( p->pipe_user.nt_user_token, &se_diskop ); 01840 01841 if (user.ut.uid != sec_initial_uid() && !is_disk_op ) 01842 return WERR_ACCESS_DENIED; 01843 01844 if (!lp_delete_share_cmd() || !*lp_delete_share_cmd()) { 01845 DEBUG(10,("_srv_net_share_del: No delete share command\n")); 01846 return WERR_ACCESS_DENIED; 01847 } 01848 01849 slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\"", 01850 lp_delete_share_cmd(), dyn_CONFIGFILE, lp_servicename(snum)); 01851 01852 DEBUG(10,("_srv_net_share_del: Running [%s]\n", command )); 01853 01854 /********* BEGIN SeDiskOperatorPrivilege BLOCK *********/ 01855 01856 if ( is_disk_op ) 01857 become_root(); 01858 01859 if ( (ret = smbrun(command, NULL)) == 0 ) { 01860 /* Tell everyone we updated smb.conf. */ 01861 message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL, 0, False, NULL); 01862 } 01863 01864 if ( is_disk_op ) 01865 unbecome_root(); 01866 01867 /********* END SeDiskOperatorPrivilege BLOCK *********/ 01868 01869 DEBUG(3,("_srv_net_share_del: Running [%s] returned (%d)\n", command, ret )); 01870 01871 if ( ret != 0 ) 01872 return WERR_ACCESS_DENIED; 01873 01874 /* Delete the SD in the database. */ 01875 delete_share_security(params); 01876 01877 lp_killservice(params->service); 01878 01879 return WERR_OK; 01880 }
WERROR _srv_net_share_del_sticky | ( | pipes_struct * | p, | |
SRV_Q_NET_SHARE_DEL * | q_u, | |||
SRV_R_NET_SHARE_DEL * | r_u | |||
) |
srv_srvsvc_nt.c の 1882 行で定義されています。
参照先 _srv_net_share_del().
参照元 api_srv_net_share_del_sticky().
01883 { 01884 DEBUG(5,("_srv_net_share_del_stick: %d\n", __LINE__)); 01885 01886 return _srv_net_share_del(p, q_u, r_u); 01887 }
WERROR _srv_net_remote_tod | ( | pipes_struct * | p, | |
SRV_Q_NET_REMOTE_TOD * | q_u, | |||
SRV_R_NET_REMOTE_TOD * | r_u | |||
) |
srv_srvsvc_nt.c の 1893 行で定義されています。
参照先 get_time_zone()・gmtime()・init_time_of_day_info()・pipes_struct::mem_ctx・r_net_remote_tod::ptr_srv_tod・r_net_remote_tod::status・t・r_net_remote_tod::tod.
01894 { 01895 TIME_OF_DAY_INFO *tod; 01896 struct tm *t; 01897 time_t unixdate = time(NULL); 01898 01899 /* We do this call first as if we do it *after* the gmtime call 01900 it overwrites the pointed-to values. JRA */ 01901 01902 uint32 zone = get_time_zone(unixdate)/60; 01903 01904 DEBUG(5,("_srv_net_remote_tod: %d\n", __LINE__)); 01905 01906 if ( !(tod = TALLOC_ZERO_P(p->mem_ctx, TIME_OF_DAY_INFO)) ) 01907 return WERR_NOMEM; 01908 01909 r_u->tod = tod; 01910 r_u->ptr_srv_tod = 0x1; 01911 r_u->status = WERR_OK; 01912 01913 DEBUG(5,("_srv_net_remote_tod: %d\n", __LINE__)); 01914 01915 t = gmtime(&unixdate); 01916 01917 /* set up the */ 01918 init_time_of_day_info(tod, 01919 unixdate, 01920 0, 01921 t->tm_hour, 01922 t->tm_min, 01923 t->tm_sec, 01924 0, 01925 zone, 01926 10000, 01927 t->tm_mday, 01928 t->tm_mon + 1, 01929 1900+t->tm_year, 01930 t->tm_wday); 01931 01932 DEBUG(5,("_srv_net_remote_tod: %d\n", __LINE__)); 01933 01934 return r_u->status; 01935 }
WERROR _srv_net_file_query_secdesc | ( | pipes_struct * | p, | |
SRV_Q_NET_FILE_QUERY_SECDESC * | q_u, | |||
SRV_R_NET_FILE_QUERY_SECDESC * | r_u | |||
) |
srv_srvsvc_nt.c の 1941 行で定義されています。
参照先 become_root()・become_user()・check_name()・close_cnum()・close_file()・current_user::conn・security_descriptor_info::dacl・data_blob()・errno・files_struct::fsp_name・get_current_user()・make_connection()・NORMAL_CLOSE・ntstatus_to_werror()・open_directory()・open_file_stat()・r_net_file_query_secdesc::ptr_response・r_net_file_query_secdesc::ptr_secdesc・security_acl_info::revision・r_net_file_query_secdesc::sec_desc・r_net_file_query_secdesc::size_response・r_net_file_query_secdesc::size_secdesc・r_net_file_query_secdesc::status・unbecome_root()・unbecome_user()・q_net_file_query_secdesc::uni_file_name・q_net_file_query_secdesc::uni_qual_name・unistr2_to_ascii()・unix_convert()・current_user::vuid.
参照元 api_srv_net_file_query_secdesc().
01943 { 01944 SEC_DESC *psd = NULL; 01945 size_t sd_size; 01946 DATA_BLOB null_pw; 01947 pstring filename; 01948 pstring qualname; 01949 files_struct *fsp = NULL; 01950 SMB_STRUCT_STAT st; 01951 NTSTATUS nt_status; 01952 struct current_user user; 01953 connection_struct *conn = NULL; 01954 BOOL became_user = False; 01955 01956 ZERO_STRUCT(st); 01957 01958 r_u->status = WERR_OK; 01959 01960 unistr2_to_ascii(qualname, &q_u->uni_qual_name, sizeof(qualname)); 01961 01962 /* Null password is ok - we are already an authenticated user... */ 01963 null_pw = data_blob(NULL, 0); 01964 01965 get_current_user(&user, p); 01966 01967 become_root(); 01968 conn = make_connection(qualname, null_pw, "A:", user.vuid, &nt_status); 01969 unbecome_root(); 01970 01971 if (conn == NULL) { 01972 DEBUG(3,("_srv_net_file_query_secdesc: Unable to connect to %s\n", qualname)); 01973 r_u->status = ntstatus_to_werror(nt_status); 01974 goto error_exit; 01975 } 01976 01977 if (!become_user(conn, conn->vuid)) { 01978 DEBUG(0,("_srv_net_file_query_secdesc: Can't become connected user!\n")); 01979 r_u->status = WERR_ACCESS_DENIED; 01980 goto error_exit; 01981 } 01982 became_user = True; 01983 01984 unistr2_to_ascii(filename, &q_u->uni_file_name, sizeof(filename)); 01985 nt_status = unix_convert(conn, filename, False, NULL, &st); 01986 if (!NT_STATUS_IS_OK(nt_status)) { 01987 DEBUG(3,("_srv_net_file_query_secdesc: bad pathname %s\n", filename)); 01988 r_u->status = WERR_ACCESS_DENIED; 01989 goto error_exit; 01990 } 01991 01992 nt_status = check_name(conn, filename); 01993 if (!NT_STATUS_IS_OK(nt_status)) { 01994 DEBUG(3,("_srv_net_file_query_secdesc: can't access %s\n", filename)); 01995 r_u->status = WERR_ACCESS_DENIED; 01996 goto error_exit; 01997 } 01998 01999 nt_status = open_file_stat(conn, filename, &st, &fsp); 02000 if ( !NT_STATUS_IS_OK(nt_status)) { 02001 /* Perhaps it is a directory */ 02002 if (errno == EISDIR) 02003 nt_status = open_directory(conn, filename, &st, 02004 READ_CONTROL_ACCESS, 02005 FILE_SHARE_READ|FILE_SHARE_WRITE, 02006 FILE_OPEN, 02007 0, 02008 FILE_ATTRIBUTE_DIRECTORY, 02009 NULL, &fsp); 02010 02011 if (!NT_STATUS_IS_OK(nt_status)) { 02012 DEBUG(3,("_srv_net_file_query_secdesc: Unable to open file %s\n", filename)); 02013 r_u->status = ntstatus_to_werror(nt_status); 02014 goto error_exit; 02015 } 02016 } 02017 02018 sd_size = SMB_VFS_GET_NT_ACL(fsp, fsp->fsp_name, (OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION), &psd); 02019 02020 if (sd_size == 0) { 02021 DEBUG(3,("_srv_net_file_query_secdesc: Unable to get NT ACL for file %s\n", filename)); 02022 r_u->status = WERR_ACCESS_DENIED; 02023 goto error_exit; 02024 } 02025 02026 r_u->ptr_response = 1; 02027 r_u->size_response = sd_size; 02028 r_u->ptr_secdesc = 1; 02029 r_u->size_secdesc = sd_size; 02030 r_u->sec_desc = psd; 02031 02032 psd->dacl->revision = (uint16) NT4_ACL_REVISION; 02033 02034 close_file(fsp, NORMAL_CLOSE); 02035 unbecome_user(); 02036 close_cnum(conn, user.vuid); 02037 return r_u->status; 02038 02039 error_exit: 02040 02041 if(fsp) { 02042 close_file(fsp, NORMAL_CLOSE); 02043 } 02044 02045 if (became_user) 02046 unbecome_user(); 02047 02048 if (conn) 02049 close_cnum(conn, user.vuid); 02050 02051 return r_u->status; 02052 }
WERROR _srv_net_file_set_secdesc | ( | pipes_struct * | p, | |
SRV_Q_NET_FILE_SET_SECDESC * | q_u, | |||
SRV_R_NET_FILE_SET_SECDESC * | r_u | |||
) |
srv_srvsvc_nt.c の 2058 行で定義されています。
参照先 become_root()・become_user()・check_name()・close_cnum()・close_file()・current_user::conn・data_blob()・errno・files_struct::fsp_name・get_current_user()・make_connection()・NORMAL_CLOSE・ntstatus_to_werror()・open_directory()・open_file_stat()・q_net_file_set_secdesc::sec_desc・q_net_file_set_secdesc::sec_info・r_net_file_set_secdesc::status・unbecome_root()・unbecome_user()・q_net_file_set_secdesc::uni_file_name・q_net_file_set_secdesc::uni_qual_name・unistr2_to_ascii()・unix_convert()・current_user::vuid.
参照元 api_srv_net_file_set_secdesc().
02060 { 02061 BOOL ret; 02062 pstring filename; 02063 pstring qualname; 02064 DATA_BLOB null_pw; 02065 files_struct *fsp = NULL; 02066 SMB_STRUCT_STAT st; 02067 NTSTATUS nt_status; 02068 struct current_user user; 02069 connection_struct *conn = NULL; 02070 BOOL became_user = False; 02071 02072 ZERO_STRUCT(st); 02073 02074 r_u->status = WERR_OK; 02075 02076 unistr2_to_ascii(qualname, &q_u->uni_qual_name, sizeof(qualname)); 02077 02078 /* Null password is ok - we are already an authenticated user... */ 02079 null_pw = data_blob(NULL, 0); 02080 02081 get_current_user(&user, p); 02082 02083 become_root(); 02084 conn = make_connection(qualname, null_pw, "A:", user.vuid, &nt_status); 02085 unbecome_root(); 02086 02087 if (conn == NULL) { 02088 DEBUG(3,("_srv_net_file_set_secdesc: Unable to connect to %s\n", qualname)); 02089 r_u->status = ntstatus_to_werror(nt_status); 02090 goto error_exit; 02091 } 02092 02093 if (!become_user(conn, conn->vuid)) { 02094 DEBUG(0,("_srv_net_file_set_secdesc: Can't become connected user!\n")); 02095 r_u->status = WERR_ACCESS_DENIED; 02096 goto error_exit; 02097 } 02098 became_user = True; 02099 02100 unistr2_to_ascii(filename, &q_u->uni_file_name, sizeof(filename)); 02101 nt_status = unix_convert(conn, filename, False, NULL, &st); 02102 if (!NT_STATUS_IS_OK(nt_status)) { 02103 DEBUG(3,("_srv_net_file_set_secdesc: bad pathname %s\n", filename)); 02104 r_u->status = WERR_ACCESS_DENIED; 02105 goto error_exit; 02106 } 02107 02108 nt_status = check_name(conn, filename); 02109 if (!NT_STATUS_IS_OK(nt_status)) { 02110 DEBUG(3,("_srv_net_file_set_secdesc: can't access %s\n", filename)); 02111 r_u->status = WERR_ACCESS_DENIED; 02112 goto error_exit; 02113 } 02114 02115 02116 nt_status = open_file_stat(conn, filename, &st, &fsp); 02117 02118 if ( !NT_STATUS_IS_OK(nt_status) ) { 02119 /* Perhaps it is a directory */ 02120 if (errno == EISDIR) 02121 nt_status = open_directory(conn, filename, &st, 02122 FILE_READ_ATTRIBUTES, 02123 FILE_SHARE_READ|FILE_SHARE_WRITE, 02124 FILE_OPEN, 02125 0, 02126 FILE_ATTRIBUTE_DIRECTORY, 02127 NULL, &fsp); 02128 02129 if ( !NT_STATUS_IS_OK(nt_status) ) { 02130 DEBUG(3,("_srv_net_file_set_secdesc: Unable to open file %s\n", filename)); 02131 r_u->status = ntstatus_to_werror(nt_status); 02132 goto error_exit; 02133 } 02134 } 02135 02136 ret = SMB_VFS_SET_NT_ACL(fsp, fsp->fsp_name, q_u->sec_info, q_u->sec_desc); 02137 02138 if (ret == False) { 02139 DEBUG(3,("_srv_net_file_set_secdesc: Unable to set NT ACL on file %s\n", filename)); 02140 r_u->status = WERR_ACCESS_DENIED; 02141 goto error_exit; 02142 } 02143 02144 close_file(fsp, NORMAL_CLOSE); 02145 unbecome_user(); 02146 close_cnum(conn, user.vuid); 02147 return r_u->status; 02148 02149 error_exit: 02150 02151 if(fsp) { 02152 close_file(fsp, NORMAL_CLOSE); 02153 } 02154 02155 if (became_user) { 02156 unbecome_user(); 02157 } 02158 02159 if (conn) { 02160 close_cnum(conn, user.vuid); 02161 } 02162 02163 return r_u->status; 02164 }
static uint32 get_server_disk_count | ( | void | ) | [static] |
srv_srvsvc_nt.c の 2176 行で定義されています。
参照先 server_disks.
02177 { 02178 return sizeof(server_disks)/sizeof(server_disks[0]); 02179 }
static uint32 init_server_disk_enum | ( | uint32 * | resume | ) | [static] |
srv_srvsvc_nt.c の 2181 行で定義されています。
参照元 _srv_net_disk_enum()・next_server_disk_enum().
02182 { 02183 uint32 server_disk_count = get_server_disk_count(); 02184 02185 /*resume can be an offset into the list for now*/ 02186 02187 if(*resume & 0x80000000) 02188 *resume = 0; 02189 02190 if(*resume > server_disk_count) 02191 *resume = server_disk_count; 02192 02193 return server_disk_count - *resume; 02194 }
static const char* next_server_disk_enum | ( | uint32 * | resume | ) | [static] |
srv_srvsvc_nt.c の 2196 行で定義されています。
参照先 init_server_disk_enum()・server_disks.
参照元 _srv_net_disk_enum().
02197 { 02198 const char *disk; 02199 02200 if(init_server_disk_enum(resume) == 0) 02201 return NULL; 02202 02203 disk = server_disks[*resume]; 02204 02205 (*resume)++; 02206 02207 DEBUG(10, ("next_server_disk_enum: reporting disk %s. resume handle %d.\n", disk, *resume)); 02208 02209 return disk; 02210 }
WERROR _srv_net_disk_enum | ( | pipes_struct * | p, | |
SRV_Q_NET_DISK_ENUM * | q_u, | |||
SRV_R_NET_DISK_ENUM * | r_u | |||
) |
srv_srvsvc_nt.c の 2212 行で定義されています。
参照先 ctx・net_srv_disk_enum::disk_enum_ctr・disk_enum_container::disk_info・disk_enum_container::disk_info_ptr・disk_info::disk_name・disk_enum_container::entries_read・net_srv_disk_enum::enum_hnd・get_enum_hnd()・init_enum_hnd()・init_server_disk_enum()・init_unistr3()・pipes_struct::mem_ctx・next_server_disk_enum()・net_srv_disk_enum::status・net_srv_disk_enum::total_entries・disk_enum_container::unknown.
02213 { 02214 uint32 i; 02215 const char *disk_name; 02216 TALLOC_CTX *ctx = p->mem_ctx; 02217 uint32 resume=get_enum_hnd(&q_u->enum_hnd); 02218 02219 r_u->status=WERR_OK; 02220 02221 r_u->total_entries = init_server_disk_enum(&resume); 02222 02223 r_u->disk_enum_ctr.unknown = 0; 02224 02225 if(!(r_u->disk_enum_ctr.disk_info = TALLOC_ARRAY(ctx, DISK_INFO, MAX_SERVER_DISK_ENTRIES))) { 02226 return WERR_NOMEM; 02227 } 02228 02229 r_u->disk_enum_ctr.disk_info_ptr = r_u->disk_enum_ctr.disk_info ? 1 : 0; 02230 02231 /*allow one DISK_INFO for null terminator*/ 02232 02233 for(i = 0; i < MAX_SERVER_DISK_ENTRIES -1 && (disk_name = next_server_disk_enum(&resume)); i++) { 02234 02235 r_u->disk_enum_ctr.entries_read++; 02236 02237 /*copy disk name into a unicode string*/ 02238 02239 init_unistr3(&r_u->disk_enum_ctr.disk_info[i].disk_name, disk_name); 02240 } 02241 02242 /* add a terminating null string. Is this there if there is more data to come? */ 02243 02244 r_u->disk_enum_ctr.entries_read++; 02245 02246 init_unistr3(&r_u->disk_enum_ctr.disk_info[i].disk_name, ""); 02247 02248 init_enum_hnd(&r_u->enum_hnd, resume); 02249 02250 return r_u->status; 02251 }
WERROR _srv_net_name_validate | ( | pipes_struct * | p, | |
SRV_Q_NET_NAME_VALIDATE * | q_u, | |||
SRV_R_NET_NAME_VALIDATE * | r_u | |||
) |
srv_srvsvc_nt.c の 2256 行で定義されています。
参照先 UNISTR2::buffer・rpcstr_pull()・SRV_Q_NET_NAME_VALIDATE::sharename・SRV_Q_NET_NAME_VALIDATE::type・UNISTR2::uni_str_len・validate_net_name().
参照元 api_srv_net_name_validate().
02257 { 02258 fstring sharename; 02259 02260 switch ( q_u->type ) { 02261 case 0x9: 02262 rpcstr_pull(sharename, q_u->sharename.buffer, sizeof(sharename), q_u->sharename.uni_str_len*2, 0); 02263 if ( !validate_net_name( sharename, INVALID_SHARENAME_CHARS, sizeof(sharename) ) ) { 02264 DEBUG(5,("_srv_net_name_validate: Bad sharename \"%s\"\n", sharename)); 02265 return WERR_INVALID_NAME; 02266 } 02267 break; 02268 02269 default: 02270 return WERR_UNKNOWN_LEVEL; 02271 } 02272 02273 return WERR_OK; 02274 }
WERROR _srv_net_file_close | ( | pipes_struct * | p, | |
SRV_Q_NET_FILE_CLOSE * | q_u, | |||
SRV_R_NET_FILE_CLOSE * | r_u | |||
) |
struct file_enum_count f_enum_cnt [static] |
struct sess_file_count s_file_cnt [static] |
const char* server_disks[] = {"C:"} [static] |