The Samba-Bugzilla – Attachment 7612 Details for
Bug 8966
[patch] Fix net rpc share allowedusers to work with 2008r2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch "net rpc allowedusers" to work with 2008r2
net-rpc-share-allowedusers-make-work-with-2008r2.patch (text/plain), 2.59 KB, created by
Olly Betts
on 2012-05-31 07:37:09 UTC
(
hide
)
Description:
patch "net rpc allowedusers" to work with 2008r2
Filename:
MIME Type:
Creator:
Olly Betts
Created:
2012-05-31 07:37:09 UTC
Size:
2.59 KB
patch
obsolete
>Description: Fix net rpc share allowedusers to work with 2008r2 > The RAP NetShareEnum command was removed in 2008r2, so use the RPC equivalent > instead. >Author: Olly Betts <olly@survex.com> > >--- > >--- samba-3.4.7~dfsg.orig/source3/utils/net_rpc.c >+++ samba-3.4.7~dfsg/source3/utils/net_rpc.c >@@ -4334,28 +4334,6 @@ static void show_userlist(struct rpc_pip > return; > } > >-struct share_list { >- int num_shares; >- char **shares; >-}; >- >-static void collect_share(const char *name, uint32 m, >- const char *comment, void *state) >-{ >- struct share_list *share_list = (struct share_list *)state; >- >- if (m != STYPE_DISKTREE) >- return; >- >- share_list->num_shares += 1; >- share_list->shares = SMB_REALLOC_ARRAY(share_list->shares, char *, share_list->num_shares); >- if (!share_list->shares) { >- share_list->num_shares = 0; >- return; >- } >- share_list->shares[share_list->num_shares-1] = SMB_STRDUP(name); >-} >- > /** > * List shares on a remote RPC server, including the security descriptors. > * >@@ -4381,16 +4359,18 @@ static NTSTATUS rpc_share_allowedusers_i > int argc, > const char **argv) > { >- int ret; > bool r; >- uint32 i; > FILE *f; >+ NET_API_STATUS status; >+ struct SHARE_INFO_1 *i1 = NULL; >+ uint32_t entries_read = 0; >+ uint32_t total_entries = 0; >+ uint32_t resume_handle = 0; >+ uint32_t i, level = 1; > > struct user_token *tokens = NULL; > int num_tokens = 0; > >- struct share_list share_list; >- > if (argc == 0) { > f = stdin; > } else { >@@ -4415,20 +4395,24 @@ static NTSTATUS rpc_share_allowedusers_i > for (i=0; i<num_tokens; i++) > collect_alias_memberships(&tokens[i].token); > >- share_list.num_shares = 0; >- share_list.shares = NULL; >- >- ret = cli_RNetShareEnum(cli, collect_share, &share_list); >- >- if (ret == -1) { >- DEBUG(0, ("Error returning browse list: %s\n", >- cli_errstr(cli))); >+ status = NetShareEnum(c->opt_host, >+ level, >+ (uint8_t **)(void *)&i1, >+ (uint32_t)-1, >+ &entries_read, >+ &total_entries, >+ &resume_handle); >+ if (status != 0) { > goto done; > } > >- for (i = 0; i < share_list.num_shares; i++) { >- char *netname = share_list.shares[i]; >- >+ for (i = 0; i < entries_read; i++) { >+ struct SHARE_INFO_1 *r = &i1[i]; >+ const char *netname; >+ if (r->shi1_type != STYPE_DISKTREE) continue; >+ netname = r->shi1_netname; >+ /* FIXME: Do we need to check for a $ suffix as well as >+ * STYPE_DISKTREE? */ > if (netname[strlen(netname)-1] == '$') > continue; > >@@ -4442,7 +4426,6 @@ static NTSTATUS rpc_share_allowedusers_i > free_user_token(&tokens[i].token); > } > SAFE_FREE(tokens); >- SAFE_FREE(share_list.shares); > > return NT_STATUS_OK; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 8966
: 7612 |
7620
|
7905
|
7906