Bug 8966 - [patch] Fix net rpc share allowedusers to work with 2008r2
Summary: [patch] Fix net rpc share allowedusers to work with 2008r2
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: Client Tools (show other bugs)
Version: 3.6.3
Hardware: All Windows 2008 R2
: P5 normal
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-31 07:37 UTC by Olly Betts
Modified: 2012-10-04 08:56 UTC (History)
0 users

See Also:


Attachments
patch "net rpc allowedusers" to work with 2008r2 (2.59 KB, patch)
2012-05-31 07:37 UTC, Olly Betts
no flags Details
Modified patch for 3.6.x. (3.33 KB, patch)
2012-06-02 00:12 UTC, Jeremy Allison
no flags Details
Patch updated not to ignore hidden shares (3.42 KB, patch)
2012-09-19 06:11 UTC, Olly Betts
vl: review+
Details
interdiff between Jeremy's patch and mine to show the difference clearly (332 bytes, patch)
2012-09-19 06:13 UTC, Olly Betts
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olly Betts 2012-05-31 07:37:09 UTC
Created attachment 7612 [details]
patch "net rpc allowedusers" to work with 2008r2

The RAP NetShareEnum command was removed in 2008r2, so this patch updates "net rpc share allowedusers" to use the RPC equivalent instead.

I've been running this in production with various versions of samba since at least last July, and it seems to work well with both 2008r2 and older versions of Windows.
Comment 1 Jeremy Allison 2012-06-02 00:12:26 UTC
Created attachment 7620 [details]
Modified patch for 3.6.x.

Can you test this patch instead to see if it still does what you want ?

Instead of using NetShareEnum() which opens a new pipe I used dcerpc_srvsvc_NetShareEnumAll() which should use the existing one.

Please let me know if this fixes it for you ?

Cheers,

Jeremy.
Comment 2 Olly Betts 2012-06-02 00:20:08 UTC
Sure, I'll give that a try.
Comment 3 Olly Betts 2012-06-08 05:33:13 UTC
I've now tested the "Modified patch for 3.6.x" against a variety of servers, both 2008r2 and others, and it looks good.
Comment 4 Olly Betts 2012-09-19 06:11:50 UTC
Created attachment 7905 [details]
Patch updated not to ignore hidden shares

The current patch ignores hidden shares, which I've found unhelpful.

I asked on #samba-technical if this was done for a good reason:

ojwb: net rpc allowedusers carefully checks for hidden shares and excludes them, like so: if (netname[strlen(netname)-1] == '$') continue;
ojwb: is there a good reason for doing that?
vl: ojwb: I don't think so.
ojwb is testing with the check removed - i'll send in a patch if that works

Removing that check has the desired effect, so here's an amended patch with the check removed.
Comment 5 Olly Betts 2012-09-19 06:13:42 UTC
Created attachment 7906 [details]
interdiff between Jeremy's patch and mine to show the difference clearly
Comment 6 Jeremy Allison 2012-10-01 17:15:19 UTC
Comment on attachment 7905 [details]
Patch updated not to ignore hidden shares

Patch applies cleanly to 3.6.next and 4.0.0rc2 and has already gone into master.

Let's get it in a release !

:-).

Jeremy.
Comment 7 Jeremy Allison 2012-10-02 16:49:08 UTC
Re-assigning to Karolin for inclusion in 3.6.next and 4.0.0rc3.
Jeremy.
Comment 8 Karolin Seeger 2012-10-04 08:56:34 UTC
Pushed to autibuild-v4-0-test and v3-6-test.
Closing out bug report.

Thanks!