diff options
-rw-r--r-- | source3/include/rpc_srvsvc.h | 39 | ||||
-rw-r--r-- | source3/rpc_parse/parse_srv.c | 289 |
2 files changed, 0 insertions, 328 deletions
diff --git a/source3/include/rpc_srvsvc.h b/source3/include/rpc_srvsvc.h index 4d840d034d..0d24ec5653 100644 --- a/source3/include/rpc_srvsvc.h +++ b/source3/include/rpc_srvsvc.h @@ -217,43 +217,4 @@ typedef struct r_net_conn_enum_info /***************************/ -typedef struct { - uint32 id; /* file index */ - uint32 perms; /* file permissions. don't know what format */ - uint32 num_locks; /* file locks */ - UNISTR2 *path; /* file name */ - UNISTR2 *user; /* file owner */ -} FILE_INFO_3; - -typedef struct { - uint32 level; /* switch value */ - uint32 ptr_file_info; /* pointer to file info union */ - - uint32 num_entries; - uint32 ptr_entries; - uint32 num_entries2; - union { - FILE_INFO_3 *info3; - } file; - -} SRV_FILE_INFO_CTR; - -typedef struct { - UNISTR2 *servername; - UNISTR2 *qualifier; - UNISTR2 *username; - uint32 level; - SRV_FILE_INFO_CTR ctr; - uint32 preferred_len; /* preferred maximum length (0xffff ffff) */ - ENUM_HND enum_hnd; -} SRV_Q_NET_FILE_ENUM; - -typedef struct { - uint32 level; - SRV_FILE_INFO_CTR ctr; - uint32 total_entries; - ENUM_HND enum_hnd; - WERROR status; -} SRV_R_NET_FILE_ENUM; - #endif /* _RPC_SRVSVC_H */ diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index b18484893c..975525430e 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -698,292 +698,3 @@ bool srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_str return True; } - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_file_info3_str(const char *desc, FILE_INFO_3 *sh1, prs_struct *ps, int depth) -{ - if (sh1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_file_info3_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if ( sh1->path ) { - if(!smb_io_unistr2("", sh1->path, True, ps, depth)) - return False; - } - - if ( sh1->user ) { - if(!smb_io_unistr2("", sh1->user, True, ps, depth)) - return False; - } - - return True; -} - -/******************************************************************* - Inits a FILE_INFO_3 structure -********************************************************************/ - -void init_srv_file_info3( FILE_INFO_3 *fl3, uint32 id, uint32 perms, uint32 num_locks, - const char *user_name, const char *path_name ) -{ - fl3->id = id; - fl3->perms = perms; - fl3->num_locks = num_locks; - - if ( path_name ) { - if ( (fl3->path = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) - return; - init_unistr2(fl3->path, path_name, UNI_STR_TERMINATE); - } - - if ( user_name ) { - if ( (fl3->user = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) - return; - init_unistr2(fl3->user, user_name, UNI_STR_TERMINATE); - } - - return; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) -{ - uint32 uni_p; - - if (fl3 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_file_info3"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("id ", ps, depth, &fl3->id)) - return False; - if(!prs_uint32("perms ", ps, depth, &fl3->perms)) - return False; - if(!prs_uint32("num_locks ", ps, depth, &fl3->num_locks)) - return False; - - uni_p = fl3->path ? 1 : 0; - if(!prs_uint32("ptr", ps, depth, &uni_p)) - return False; - if (UNMARSHALLING(ps)) { - if ( (fl3->path = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) { - return False; - } - } - - uni_p = fl3->user ? 1 : 0; - if(!prs_uint32("ptr", ps, depth, &uni_p)) - return False; - if (UNMARSHALLING(ps)) { - if ( (fl3->user = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) { - return False; - } - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) -{ - if (ctr == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_file_ctr"); - depth++; - - if (UNMARSHALLING(ps)) { - ZERO_STRUCTP(ctr); - } - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("level", ps, depth, &ctr->level)) - return False; - - if(!prs_uint32("ptr_file_info", ps, depth, &ctr->ptr_file_info)) - return False; - if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries)) - return False; - if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries)) - return False; - - if (ctr->ptr_entries == 0) - return True; - - if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2)) - return False; - - switch (ctr->level) { - case 3: { - FILE_INFO_3 *info3 = ctr->file.info3; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info3 = PRS_ALLOC_MEM(ps, FILE_INFO_3, num_entries))) - return False; - ctr->file.info3 = info3; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_file_info3("", &ctr->file.info3[i], ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_file_info3_str("", &ctr->file.info3[i], ps, depth)) - return False; - } - break; - } - default: - DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(5,depth), ctr->level)); - break; - } - - return True; -} - -/******************************************************************* - Inits a SRV_Q_NET_FILE_ENUM structure. -********************************************************************/ - -void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, - const char *srv_name, const char *qual_name, - const char *user_name, - uint32 file_level, SRV_FILE_INFO_CTR *ctr, - uint32 preferred_len, - ENUM_HND *hnd) -{ - uint32 ptr; - - if ( srv_name ) { - if ( (q_n->servername = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) - return; - init_buf_unistr2(q_n->servername, &ptr, srv_name); - } - - if ( qual_name ) { - if ( (q_n->qualifier = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) - return; - init_buf_unistr2(q_n->qualifier, &ptr, qual_name); - } - - if ( user_name ) { - if ( (q_n->username = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) - return; - init_buf_unistr2(q_n->username, &ptr, user_name); - } - - q_n->level = q_n->ctr.level = file_level; - - q_n->preferred_len = preferred_len; - q_n->ctr.ptr_file_info = 1; - q_n->ctr.num_entries = 0; - q_n->ctr.num_entries2 = 0; - - memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_file_enum"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_pointer("servername", ps, depth, (void*)&q_u->servername, - sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_pointer("qualifier", ps, depth, (void*)&q_u->qualifier, - sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_pointer("username", ps, depth, (void*)&q_u->username, - sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("level", ps, depth, &q_u->level)) - return False; - - if (q_u->level != (uint32)-1) { - if(!srv_io_srv_file_ctr("file_ctr", &q_u->ctr, ps, depth)) - return False; - } - - if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len)) - return False; - - if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_file_enum"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("level", ps, depth, &r_n->level)) - return False; - - if (r_n->level != 0) { - if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth)) - return False; - } - - if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) - return False; - if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) - return False; - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} |