--- samba-3.0.2a/source/nsswitch/winbindd.h Fri Jan 16 18:47:53 2004 +++ samba-3.0.2a/source/nsswitch/winbindd.h Sat Mar 27 20:11:06 2004 @@ -46,6 +46,8 @@ struct winbindd_request request; /* Request from client */ struct winbindd_response response; /* Respose to client */ + BOOL getpwent_initialized; /* Has getpwent_state been initialized? */ + BOOL getgrent_initialized; /* Has getgrent_state been initialized? */ struct getent_state *getpwent_state; /* State for getpwent() */ struct getent_state *getgrent_state; /* State for getgrent() */ }; --- samba-3.0.2a/source/nsswitch/winbindd_group.c Fri Jan 16 18:47:53 2004 +++ samba-3.0.2a/source/nsswitch/winbindd_group.c Sat Mar 27 20:21:54 2004 @@ -456,6 +456,8 @@ DLIST_ADD(state->getgrent_state, domain_state); } + state->getgrent_initialized = True; + return WINBINDD_OK; } @@ -466,6 +468,7 @@ DEBUG(3, ("[%5lu]: endgrent\n", (unsigned long)state->pid)); free_getent_state(state->getgrent_state); + state->getgrent_initialized = False; state->getgrent_state = NULL; return WINBINDD_OK; @@ -615,6 +618,9 @@ state->response.data.num_entries = 0; group_list = (struct winbindd_gr *)state->response.extra_data; + + if (!state->getgrent_initialized) + winbindd_setgrent(state); if (!(ent = state->getgrent_state)) return WINBINDD_ERROR; --- samba-3.0.2a/source/nsswitch/winbindd_user.c Fri Jan 16 18:47:53 2004 +++ samba-3.0.2a/source/nsswitch/winbindd_user.c Sat Mar 27 20:21:51 2004 @@ -360,6 +360,8 @@ DLIST_ADD(state->getpwent_state, domain_state); } + state->getpwent_initialized = True; + return WINBINDD_OK; } @@ -370,6 +372,7 @@ DEBUG(3, ("[%5lu]: endpwent\n", (unsigned long)state->pid)); free_getent_state(state->getpwent_state); + state->getpwent_initialized = False; state->getpwent_state = NULL; return WINBINDD_OK; @@ -501,6 +504,9 @@ sizeof(struct winbindd_pw)); user_list = (struct winbindd_pw *)state->response.extra_data; + + if (!state->getpwent_initialized) + winbindd_setpwent(state); if (!(ent = state->getpwent_state)) return WINBINDD_ERROR;