s3-winbind: Do not return NO_MEMORY if we have an empty user list
authorAndreas Schneider <asn@samba.org>
Wed, 2 Nov 2016 16:19:09 +0000 (17:19 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 3 Nov 2016 04:36:17 +0000 (05:36 +0100)
The domain child for the MACHINE ACCOUNT might fail with
NT_STATUS_NO_MEMORY because an emtpy user list is returned.

*pnum_info is already set to 0 at the beginngin so we should just
declare victory here!

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12405

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Nov  3 05:36:17 CET 2016 on sn-devel-144

source3/winbindd/winbindd_rpc.c

index 386396a1e19174e7ee30bc46282507ff6b58ef95..7b355bafe916312f6b158effb94b5592fd583ec8 100644 (file)
@@ -88,6 +88,10 @@ NTSTATUS rpc_query_user_list(TALLOC_CTX *mem_ctx,
                num_dom_users = disp_info.info1.count;
 
                num_info += num_dom_users;
+               /* If there are no user to enumerate we're done */
+               if (num_info == 0) {
+                       return NT_STATUS_OK;
+               }
 
                info = talloc_realloc(mem_ctx,
                                            info,