s3-winbind: Don't fail on users without a uid.
authorAndreas Schneider <asn@samba.org>
Mon, 14 Nov 2011 09:01:31 +0000 (10:01 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 15 Nov 2011 15:52:04 +0000 (16:52 +0100)
This fixes bug #8608.

If you join samba with idmap_ad backend to an AD. When you try to
enumerate users with 'getent passwd' and the user doesn't have a uid
set, then getent is aborted cause of NT_STATUS_NONE_MAPPED. If we can't
map a user we should not stop but continue enumerating users.

This normally happens with the default user 'krbtgt' with idmap_ad but
could also happen with other backends.

Autobuild-User: Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date: Tue Nov 15 16:52:04 CET 2011 on sn-devel-104

source3/winbindd/wb_next_pwent.c

index da4754cc9fceb603bd47804d338d816561479e84..a52a566e7bdf9983458825f42a8b81dd126f3cd2 100644 (file)
@@ -148,7 +148,25 @@ static void wb_next_pwent_fill_done(struct tevent_req *subreq)
 
        status = wb_fill_pwent_recv(subreq);
        TALLOC_FREE(subreq);
-       if (tevent_req_nterror(req, status)) {
+       /*
+        * When you try to enumerate users with 'getent passwd' and the user
+        * doesn't have a uid set we should just move on.
+        */
+       if (NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) {
+               state->gstate->next_user += 1;
+
+               subreq = wb_fill_pwent_send(state,
+                                           state->ev,
+                                           &state->gstate->users[state->gstate->next_user],
+                                           state->pw);
+               if (tevent_req_nomem(subreq, req)) {
+                       tevent_req_post(req, state->ev);
+                       return;
+               }
+               tevent_req_set_callback(subreq, wb_next_pwent_fill_done, req);
+
+               return;
+       } else if (tevent_req_nterror(req, status)) {
                return;
        }
        state->gstate->next_user += 1;