Bug 12828 - net command fails due to incorrectly return code
Summary: net command fails due to incorrectly return code
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Tools (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
Depends on:
Reported: 2017-06-07 12:42 UTC by David Mulder
Modified: 2017-06-16 09:48 UTC (History)
2 users (show)

See Also:

debug (1.91 KB, text/plain)
2017-06-07 12:42 UTC, David Mulder
no flags Details
patch fix (1.59 KB, patch)
2017-06-07 12:45 UTC, David Mulder
no flags Details
cherry-picked commit to v4-6-test (1.98 KB, patch)
2017-06-08 12:26 UTC, David Mulder
jra: review+
ddiss: review+

Note You need to log in before you can comment on or make changes to this bug.
Description David Mulder 2017-06-07 12:42:21 UTC
Created attachment 13262 [details]

The problem is that messaging_init_internal() is returning NT_STATUS_INTERNAL_ERROR rather than translate the ERRNO via map_nt_error_from_unix(). The returned NTSTATUS code is then not handled correctly by the net command.

> net usershare add test_share /home/dmulder/test_share/ 

Failed to init messaging context
> echo $?


1. Prepare a AD server
2. Install SLED12SP3 Beta3, join the windows domain
3. Login as a AD user
4. Start YaST2 Windows Domain Membership -> 
   enable 'Allow Users to Share Their Directories' ->
   enter  Enter "Your_DOMAIN_name\domain users" into the 'Permitted Group' ->
   click OK
5. Right-click on a folder in your home directory then click 'Sharing Options'
6. Check 'Share this folder' -> click 'Create Share'
7. Got a error msg (see the screenshot)
   'net usershare' returned error 1: Failed to init messaging context
Comment 1 David Mulder 2017-06-07 12:45:44 UTC
Created attachment 13263 [details]
patch fix
Comment 2 David Disseldorp 2017-06-08 11:53:09 UTC
@dmulder: please cherry pick the master commit (git cherry-pick -x 08a21f3539fef76a22189b1751fd2a081937a057) into the v4-6-test and v4-5-test branches and attach the resultant patches here for review.
Comment 3 David Mulder 2017-06-08 12:26:19 UTC
Created attachment 13264 [details]
cherry-picked commit to v4-6-test
Comment 4 David Mulder 2017-06-08 12:27:45 UTC
The bug wasn't present in v4-5-test, so it can't be cherry-picked to that branch.
I've attached a patch for v4-6-test.
Comment 5 Jeremy Allison 2017-06-08 23:06:22 UTC
Comment on attachment 13264 [details]
cherry-picked commit to v4-6-test

LGTM. Jeremy.
Comment 6 David Disseldorp 2017-06-08 23:19:22 UTC
@Karolin: please merge for 4.6.next - thanks!
Comment 7 Karolin Seeger 2017-06-12 06:57:33 UTC
Pushed to autobuild-v4-6-test.
Comment 8 Karolin Seeger 2017-06-16 09:48:45 UTC
(In reply to Karolin Seeger from comment #7)
Pushed to v4-6-test.
Closing out bug report.