If you use samba-tool to add users to a group, it always returns that the members were added - even if the given account doesn't exist. Also the return code of 0 is wrong in that case. # samba-tool group addmembers existingGroup notExistingUser Added members to group existingGroup # echo $? 0 This should both be avoided, to allow sucessfull scripting around samba-tool.
BTW: It's the same for 'removemembers': # samba-tool group removemembers existingGroup notExistingUser Removed members from group existingGroup # echo $? 0
Created attachment 10346 [details] Patch for master The attached small patch solves the request here for the add/remove situation. Can you please check, if it's OK? # samba-tool group addmembers existingGroup notExistingUser ERROR(exception): Failed to add members "notExistingUser" to group "existingGroup" - Unable to find "notExistingUser". Operation cancelled. File "/usr/local/samba/lib64/python2.7/site-packages/samba/netcmd/group.py", line 217, in run add_members_operation=True) File "/usr/local/samba/lib64/python2.7/site-packages/samba/samdb.py", line 263, in add_remove_group_members raise Exception('Unable to find "%s". Operation cancelled.' % member) # echo $? 255
This was fixed in 4.4.0.