The branch, v3-2-test has been updated via fcdc09674571b8e81233acc9e8dc8651b66cd21d (commit) via 6c6700ed7148b73b2ce52fc00020c7e253a577d3 (commit) from e9c56250eb7a2dc4e69962c5b48875834941ccfc (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log ----------------------------------------------------------------- commit fcdc09674571b8e81233acc9e8dc8651b66cd21d Author: Günther Deschner <[EMAIL PROTECTED]> Date: Wed Mar 19 01:31:09 2008 +0100 Remove unused marshalling for SRV_NET_FILE_ENUM. Guenther commit 6c6700ed7148b73b2ce52fc00020c7e253a577d3 Author: Günther Deschner <[EMAIL PROTECTED]> Date: Wed Mar 19 01:25:59 2008 +0100 Use pidl for _srvsvc_NetFileEnum. Guenther ----------------------------------------------------------------------- Summary of changes: source/include/rpc_srvsvc.h | 39 ----- source/rpc_parse/parse_srv.c | 289 ------------------------------------- source/rpc_server/srv_srvsvc_nt.c | 169 +++++++++------------- 3 files changed, 71 insertions(+), 426 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/rpc_srvsvc.h b/source/include/rpc_srvsvc.h index 4d840d0..0d24ec5 100644 --- a/source/include/rpc_srvsvc.h +++ b/source/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/source/rpc_parse/parse_srv.c b/source/rpc_parse/parse_srv.c index b184848..9755254 100644 --- a/source/rpc_parse/parse_srv.c +++ b/source/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; -} diff --git a/source/rpc_server/srv_srvsvc_nt.c b/source/rpc_server/srv_srvsvc_nt.c index 56d3159..053f57e 100644 --- a/source/rpc_server/srv_srvsvc_nt.c +++ b/source/rpc_server/srv_srvsvc_nt.c @@ -34,8 +34,7 @@ extern const struct generic_mapping file_generic_mapping; struct file_enum_count { TALLOC_CTX *ctx; const char *username; - int count; - FILE_INFO_3 *info; + struct srvsvc_NetFileCtr3 *ctr3; }; struct sess_file_count { @@ -52,8 +51,8 @@ static int pipe_enum_fn( struct db_record *rec, void *p) { struct pipe_open_rec prec; struct file_enum_count *fenum = (struct file_enum_count *)p; - FILE_INFO_3 *f; - int i = fenum->count; + struct srvsvc_NetFileInfo3 *f; + int i = fenum->ctr3->count; char *fullpath = NULL; const char *username; @@ -78,21 +77,22 @@ static int pipe_enum_fn( struct db_record *rec, void *p) return 1; } - f = TALLOC_REALLOC_ARRAY( fenum->ctx, fenum->info, FILE_INFO_3, i+1 ); + f = TALLOC_REALLOC_ARRAY(fenum->ctx, fenum->ctr3->array, + struct srvsvc_NetFileInfo3, i+1); if ( !f ) { DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1)); return 1; } - fenum->info = f; + fenum->ctr3->array = f; - init_srv_file_info3( - &fenum->info[i], - (uint32)((procid_to_pid(&prec.pid)<<16) & prec.pnum), - (FILE_READ_DATA|FILE_WRITE_DATA), - 0, username, fullpath); + init_srvsvc_NetFileInfo3(&fenum->ctr3->array[i], + (uint32_t)((procid_to_pid(&prec.pid)<<16) & prec.pnum), + (FILE_READ_DATA|FILE_WRITE_DATA), + 0, + fullpath, + username); - TALLOC_FREE(fullpath); - fenum->count++; + fenum->ctr3->count++; return 0; } @@ -100,16 +100,16 @@ static int pipe_enum_fn( struct db_record *rec, void *p) /******************************************************************* ********************************************************************/ -static WERROR net_enum_pipes( TALLOC_CTX *ctx, const char *username, - FILE_INFO_3 **info, - uint32 *count, uint32 resume ) +static WERROR net_enum_pipes(TALLOC_CTX *ctx, + const char *username, + struct srvsvc_NetFileCtr3 **ctr3, + uint32_t resume ) { struct file_enum_count fenum; fenum.ctx = ctx; fenum.username = username; - fenum.count = *count; - fenum.info = *info; + fenum.ctr3 = *ctr3; if (connections_traverse(pipe_enum_fn, &fenum) == -1) { DEBUG(0,("net_enum_pipes: traverse of connections.tdb " @@ -117,8 +117,7 @@ static WERROR net_enum_pipes( TALLOC_CTX *ctx, const char *username, return WERR_NOMEM; } - *info = fenum.info; - *count = fenum.count; + *ctr3 = fenum.ctr3; return WERR_OK; } @@ -133,8 +132,8 @@ static void enum_file_fn( const struct share_mode_entry *e, struct file_enum_count *fenum = (struct file_enum_count *)private_data; - FILE_INFO_3 *f; - int i = fenum->count; + struct srvsvc_NetFileInfo3 *f; + int i = fenum->ctr3->count; files_struct fsp; struct byte_range_lock *brl; int num_locks = 0; @@ -155,12 +154,13 @@ static void enum_file_fn( const struct share_mode_entry *e, return; } - f = TALLOC_REALLOC_ARRAY( fenum->ctx, fenum->info, FILE_INFO_3, i+1 ); + f = TALLOC_REALLOC_ARRAY(fenum->ctx, fenum->ctr3->array, + struct srvsvc_NetFileInfo3, i+1); if ( !f ) { DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1)); return; } - fenum->info = f; + fenum->ctr3->array = f; /* need to count the number of locks on a file */ @@ -186,36 +186,33 @@ static void enum_file_fn( const struct share_mode_entry *e, /* mask out create (what ever that is) */ permissions = e->share_access & (FILE_READ_DATA|FILE_WRITE_DATA); - /* now fill in the FILE_INFO_3 struct */ - init_srv_file_info3( &fenum->info[i], - e->share_file_id, - permissions, - num_locks, - username, - fullpath ); - - TALLOC_FREE(fullpath); - fenum->count++; + /* now fill in the srvsvc_NetFileInfo3 struct */ + init_srvsvc_NetFileInfo3(&fenum->ctr3->array[i], + e->share_file_id, + permissions, + num_locks, + username, + fullpath); + fenum->ctr3->count++; } /******************************************************************* ********************************************************************/ -static WERROR net_enum_files( TALLOC_CTX *ctx, const char *username, - FILE_INFO_3 **info, - uint32 *count, uint32 resume ) +static WERROR net_enum_files(TALLOC_CTX *ctx, + const char *username, + struct srvsvc_NetFileCtr3 **ctr3, + uint32_t resume) { struct file_enum_count f_enum_cnt; f_enum_cnt.ctx = ctx; f_enum_cnt.username = username; -- Samba Shared Repository