diff options
author | Jim McDonough <jmcd@samba.org> | 2002-05-31 17:02:09 +0000 |
---|---|---|
committer | Jim McDonough <jmcd@samba.org> | 2002-05-31 17:02:09 +0000 |
commit | e422b271da0c07f5c5cfd41df01bb2910d484abc (patch) | |
tree | 8f856496c72439f343b2469e836fe91fbf99d6c5 /source3/libsmb | |
parent | 8787088f2e45f84706f543562c79e0794a2e75ca (diff) | |
download | samba-e422b271da0c07f5c5cfd41df01bb2910d484abc.tar.gz samba-e422b271da0c07f5c5cfd41df01bb2910d484abc.tar.bz2 samba-e422b271da0c07f5c5cfd41df01bb2910d484abc.zip |
Update netfileenum on both client and server sides to do an arbitrary number
of files. This was done to better enable net rpc file. Perhaps we can start
giving back real info this way, too.
(This used to be commit b3fea72ee9abd2441a49c35442c54819e4ba16ba)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/cli_srvsvc.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/source3/libsmb/cli_srvsvc.c b/source3/libsmb/cli_srvsvc.c index bc2058fdbd..8e1c6e0c9d 100644 --- a/source3/libsmb/cli_srvsvc.c +++ b/source3/libsmb/cli_srvsvc.c @@ -4,6 +4,7 @@ Copyright (C) Andrew Tridgell 1994-2000 Copyright (C) Luke Kenneth Casson Leighton 1996-2000 Copyright (C) Tim Potter 2001 + Copyright (C) Jim McDonough 2002 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -242,6 +243,7 @@ WERROR cli_srvsvc_net_file_enum(struct cli_state *cli, TALLOC_CTX *mem_ctx, SRV_Q_NET_FILE_ENUM q; SRV_R_NET_FILE_ENUM r; WERROR result = W_ERROR(ERRgeneral); + int i; ZERO_STRUCT(q); ZERO_STRUCT(r); @@ -272,6 +274,46 @@ WERROR cli_srvsvc_net_file_enum(struct cli_state *cli, TALLOC_CTX *mem_ctx, if (!W_ERROR_IS_OK(result)) goto done; + /* copy the data over to the ctr */ + + ZERO_STRUCTP(ctr); + + ctr->switch_value = file_level; + + ctr->num_entries = ctr->num_entries2 = r.ctr.num_entries; + + switch(file_level) { + case 3: + ctr->file.info3 = (SRV_FILE_INFO_3 *)talloc( + mem_ctx, sizeof(SRV_FILE_INFO_3) * ctr->num_entries); + + memset(ctr->file.info3, 0, + sizeof(SRV_FILE_INFO_3) * ctr->num_entries); + + for (i = 0; i < r.ctr.num_entries; i++) { + SRV_FILE_INFO_3 *info3 = &ctr->file.info3[i]; + char *s; + + /* Copy pointer crap */ + + memcpy(&info3->info_3, &r.ctr.file.info3[i].info_3, + sizeof(FILE_INFO_3)); + + /* Duplicate strings */ + + s = unistr2_tdup(mem_ctx, &r.ctr.file.info3[i].info_3_str.uni_path_name); + if (s) + init_unistr2(&info3->info_3_str.uni_path_name, s, strlen(s) + 1); + + s = unistr2_tdup(mem_ctx, &r.ctr.file.info3[i].info_3_str.uni_user_name); + if (s) + init_unistr2(&info3->info_3_str.uni_user_name, s, strlen(s) + 1); + + } + + break; + } + done: prs_mem_free(&qbuf); prs_mem_free(&rbuf); |