Your message dated Tue, 19 Jun 2018 21:45:55 +0200 with message-id <CAFX5sbymnMvRvP5+UNWhDy=THveJfuq=5fhj+acp9arhib+...@mail.gmail.com> and subject line Closing wheezy only bugs has caused the Debian Bug report #711011, regarding samba-common-bin: net rpc share allowedusers does not work with Windows 2008r2 (wheezy-only) to be marked as done.
This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact [email protected] immediately.) -- 711011: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=711011 Debian Bug Tracking System Contact [email protected] with problems
--- Begin Message ---Package: samba-common-bin Version: 2:3.6.6-6 Severity: normal Tags: patch Please include the attached patch that allows net rpc share allowedusers to work with Windows 2008r2 servers. The patch has been committed upstream[1], has been backported to Ubuntu lucid[2] and has been used in production for quite a long time before that. I've tested the patch against wheezy samba and it fixes the issue on our systems. If you won't have time for this before Sunday's stable-NEW freeze, please let me know so that I can upload an NMU. 1. https://bugzilla.samba.org/show_bug.cgi?id=8966 2. https://bugs.launchpad.net/ubuntu/+source/samba/+bug/1061244 -- bye, pabs http://wiki.debian.org/PaulWiseDescription: Fix net rpc share allowedusers to work with 2008r2 The RAP NetShareEnum command was removed in 2008r2, so use the RPC equivalent instead. Bug: https://bugzilla.samba.org/show_bug.cgi?id=8966 Author: Jeremy Allison <[email protected]> diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 49b405f..fe9053b 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -4913,28 +4913,6 @@ static void show_userlist(struct rpc_pipe_client *pipe_hnd, 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. * @@ -4960,16 +4938,21 @@ static NTSTATUS rpc_share_allowedusers_internals(struct net_context *c, int argc, const char **argv) { - int ret; bool r; - uint32 i; FILE *f; + NTSTATUS nt_status = NT_STATUS_OK; + uint32_t total_entries = 0; + uint32_t resume_handle = 0; + uint32_t preferred_len = 0xffffffff; + uint32_t i; + struct dcerpc_binding_handle *b = NULL; + struct srvsvc_NetShareInfoCtr info_ctr; + struct srvsvc_NetShareCtr1 ctr1; + WERROR result; struct user_token *tokens = NULL; int num_tokens = 0; - struct share_list share_list; - if (argc == 0) { f = stdin; } else { @@ -4994,22 +4977,47 @@ static NTSTATUS rpc_share_allowedusers_internals(struct net_context *c, for (i=0; i<num_tokens; i++) collect_alias_memberships(&tokens[i].token); - share_list.num_shares = 0; - share_list.shares = NULL; + ZERO_STRUCT(info_ctr); + ZERO_STRUCT(ctr1); - ret = cli_RNetShareEnum(cli, collect_share, &share_list); + info_ctr.level = 1; + info_ctr.ctr.ctr1 = &ctr1; - if (ret == -1) { - DEBUG(0, ("Error returning browse list: %s\n", - cli_errstr(cli))); + b = pipe_hnd->binding_handle; + + /* Issue the NetShareEnum RPC call and retrieve the response */ + nt_status = dcerpc_srvsvc_NetShareEnumAll(b, + talloc_tos(), + pipe_hnd->desthost, + &info_ctr, + preferred_len, + &total_entries, + &resume_handle, + &result); + + /* Was it successful? */ + if (!NT_STATUS_IS_OK(nt_status)) { + /* Nope. Go clean up. */ + goto done; + } + + if (!W_ERROR_IS_OK(result)) { + /* Nope. Go clean up. */ + nt_status = werror_to_ntstatus(result); goto done; } - for (i = 0; i < share_list.num_shares; i++) { - char *netname = share_list.shares[i]; + if (total_entries == 0) { + goto done; + } + + /* For each returned entry... */ + for (i = 0; i < info_ctr.ctr.ctr1->count; i++) { + const char *netname = info_ctr.ctr.ctr1->array[i].name; - if (netname[strlen(netname)-1] == '$') + if (info_ctr.ctr.ctr1->array[i].type != STYPE_DISKTREE) { continue; + } d_printf("%s\n", netname); @@ -5021,9 +5035,8 @@ static NTSTATUS rpc_share_allowedusers_internals(struct net_context *c, free_user_token(&tokens[i].token); } SAFE_FREE(tokens); - SAFE_FREE(share_list.shares); - return NT_STATUS_OK; + return nt_status; } static int rpc_share_allowedusers(struct net_context *c, int argc,
--- End Message ---
--- Begin Message ---Hi, I'm closing bugs that are wheezy only (EOL). Please reopen if you are still experiencing it in newer releases. Regards -- Mathieu Parent NB: Query on UDD: select id, severity, title from bugs where bugs.source='samba' and not affects_unstable and not affects_testing and not affects_stable and not affects_oldstable and status!='done' ORDER BY id; #893689 was removed from the list.
--- End Message ---

