2 Unix SMB/CIFS implementation.
4 Windows NT Domain nsswitch module
6 Copyright (C) Tim Potter 2000
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 3 of the License, or (at your option) any later version.
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "winbind_client.h"
29 static pthread_mutex_t winbind_nss_mutex = PTHREAD_MUTEX_INITIALIZER;
32 /* Maximum number of users to pass back over the unix domain socket
33 per call. This is not a static limit on the total number of users
34 or groups returned in total. */
36 #define MAX_GETPWENT_USERS 250
37 #define MAX_GETGRENT_USERS 250
39 NSS_STATUS _nss_winbind_setpwent(void);
40 NSS_STATUS _nss_winbind_endpwent(void);
41 NSS_STATUS _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
42 size_t buflen, int *errnop);
43 NSS_STATUS _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result,
44 char *buffer, size_t buflen, int *errnop);
45 NSS_STATUS _nss_winbind_getpwnam_r(const char *name, struct passwd *result,
46 char *buffer, size_t buflen, int *errnop);
47 NSS_STATUS _nss_winbind_setgrent(void);
48 NSS_STATUS _nss_winbind_endgrent(void);
49 NSS_STATUS _nss_winbind_getgrent_r(struct group *result, char *buffer,
50 size_t buflen, int *errnop);
51 NSS_STATUS _nss_winbind_getgrlst_r(struct group *result, char *buffer,
52 size_t buflen, int *errnop);
53 NSS_STATUS _nss_winbind_getgrnam_r(const char *name, struct group *result,
54 char *buffer, size_t buflen, int *errnop);
55 NSS_STATUS _nss_winbind_getgrgid_r(gid_t gid, struct group *result, char *buffer,
56 size_t buflen, int *errnop);
57 NSS_STATUS _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
58 long int *size, gid_t **groups,
59 long int limit, int *errnop);
61 /*************************************************************************
62 ************************************************************************/
65 static const char *nss_err_str(NSS_STATUS ret)
68 case NSS_STATUS_TRYAGAIN:
69 return "NSS_STATUS_TRYAGAIN";
70 case NSS_STATUS_SUCCESS:
71 return "NSS_STATUS_SUCCESS";
72 case NSS_STATUS_NOTFOUND:
73 return "NSS_STATUS_NOTFOUND";
74 case NSS_STATUS_UNAVAIL:
75 return "NSS_STATUS_UNAVAIL";
76 #ifdef NSS_STATUS_RETURN
77 case NSS_STATUS_RETURN:
78 return "NSS_STATUS_RETURN";
81 return "UNKNOWN RETURN CODE!!!!!!!";
86 /* Prototypes from wb_common.c */
88 /* Allocate some space from the nss static buffer. The buffer and buflen
89 are the pointers passed in by the C library to the _nss_ntdom_*
92 static char *get_static(char **buffer, size_t *buflen, size_t len)
96 /* Error check. We return false if things aren't set up right, or
97 there isn't enough buffer space left. */
99 if ((buffer == NULL) || (buflen == NULL) || (*buflen < len)) {
103 /* Return an index into the static buffer */
112 /* I've copied the strtok() replacement function next_token_Xalloc() from
113 lib/util_str.c as I really don't want to have to link in any other
114 objects if I can possibly avoid it. */
116 static bool next_token_alloc(const char **ptr,
133 /* default to simple separators */
138 /* find the first non sep char */
139 while (*s && strchr(sep,*s)) {
148 /* When restarting we need to go from here. */
151 /* Work out the length needed. */
152 for (quoted = false; *s &&
153 (quoted || !strchr(sep,*s)); s++) {
161 /* We started with len = 1 so we have space for the nul. */
162 *pp_buff = (char *)malloc(len);
167 /* copy over the token */
170 for (quoted = false; *s &&
171 (quoted || !strchr(sep,*s)); s++) {
179 *ptr = (*s) ? s+1 : s;
185 /* Fill a pwent structure from a winbindd_response structure. We use
186 the static data passed to us by libc to put strings and stuff in.
187 Return NSS_STATUS_TRYAGAIN if we run out of memory. */
189 static NSS_STATUS fill_pwent(struct passwd *result,
190 struct winbindd_pw *pw,
191 char **buffer, size_t *buflen)
195 if ((result->pw_name =
196 get_static(buffer, buflen, strlen(pw->pw_name) + 1)) == NULL) {
200 return NSS_STATUS_TRYAGAIN;
203 strcpy(result->pw_name, pw->pw_name);
207 if ((result->pw_passwd =
208 get_static(buffer, buflen, strlen(pw->pw_passwd) + 1)) == NULL) {
212 return NSS_STATUS_TRYAGAIN;
215 strcpy(result->pw_passwd, pw->pw_passwd);
219 result->pw_uid = pw->pw_uid;
220 result->pw_gid = pw->pw_gid;
224 if ((result->pw_gecos =
225 get_static(buffer, buflen, strlen(pw->pw_gecos) + 1)) == NULL) {
229 return NSS_STATUS_TRYAGAIN;
232 strcpy(result->pw_gecos, pw->pw_gecos);
236 if ((result->pw_dir =
237 get_static(buffer, buflen, strlen(pw->pw_dir) + 1)) == NULL) {
241 return NSS_STATUS_TRYAGAIN;
244 strcpy(result->pw_dir, pw->pw_dir);
248 if ((result->pw_shell =
249 get_static(buffer, buflen, strlen(pw->pw_shell) + 1)) == NULL) {
253 return NSS_STATUS_TRYAGAIN;
256 strcpy(result->pw_shell, pw->pw_shell);
258 /* The struct passwd for Solaris has some extra fields which must
259 be initialised or nscd crashes. */
261 #if HAVE_PASSWD_PW_COMMENT
262 result->pw_comment = "";
265 #if HAVE_PASSWD_PW_AGE
269 return NSS_STATUS_SUCCESS;
272 /* Fill a grent structure from a winbindd_response structure. We use
273 the static data passed to us by libc to put strings and stuff in.
274 Return NSS_STATUS_TRYAGAIN if we run out of memory. */
276 static NSS_STATUS fill_grent(struct group *result, struct winbindd_gr *gr,
277 const char *gr_mem, char **buffer, size_t *buflen)
285 if ((result->gr_name =
286 get_static(buffer, buflen, strlen(gr->gr_name) + 1)) == NULL) {
290 return NSS_STATUS_TRYAGAIN;
293 strcpy(result->gr_name, gr->gr_name);
297 if ((result->gr_passwd =
298 get_static(buffer, buflen, strlen(gr->gr_passwd) + 1)) == NULL) {
301 return NSS_STATUS_TRYAGAIN;
304 strcpy(result->gr_passwd, gr->gr_passwd);
308 result->gr_gid = gr->gr_gid;
310 /* Group membership */
316 /* this next value is a pointer to a pointer so let's align it */
318 /* Calculate number of extra bytes needed to align on pointer size boundry */
319 if ((i = (unsigned long)(*buffer) % sizeof(char*)) != 0)
320 i = sizeof(char*) - i;
322 if ((tst = get_static(buffer, buflen, ((gr->num_gr_mem + 1) *
323 sizeof(char *)+i))) == NULL) {
327 return NSS_STATUS_TRYAGAIN;
329 result->gr_mem = (char **)(tst + i);
331 if (gr->num_gr_mem == 0) {
335 *(result->gr_mem) = NULL;
336 return NSS_STATUS_SUCCESS;
339 /* Start looking at extra data */
343 while(next_token_alloc((const char **)&gr_mem, &name, ",")) {
344 /* Allocate space for member */
345 if (((result->gr_mem)[i] =
346 get_static(buffer, buflen, strlen(name) + 1)) == NULL) {
349 return NSS_STATUS_TRYAGAIN;
351 strcpy((result->gr_mem)[i], name);
358 (result->gr_mem)[i] = NULL;
360 return NSS_STATUS_SUCCESS;
367 static struct winbindd_response getpwent_response;
369 static int ndx_pw_cache; /* Current index into pwd cache */
370 static int num_pw_cache; /* Current size of pwd cache */
372 /* Rewind "file pointer" to start of ntdom password database */
375 _nss_winbind_setpwent(void)
379 fprintf(stderr, "[%5d]: setpwent\n", getpid());
383 pthread_mutex_lock(&winbind_nss_mutex);
386 if (num_pw_cache > 0) {
387 ndx_pw_cache = num_pw_cache = 0;
388 winbindd_free_response(&getpwent_response);
391 ret = winbindd_request_response(NULL, WINBINDD_SETPWENT, NULL, NULL);
393 fprintf(stderr, "[%5d]: setpwent returns %s (%d)\n", getpid(),
394 nss_err_str(ret), ret);
398 pthread_mutex_unlock(&winbind_nss_mutex);
403 /* Close ntdom password database "file pointer" */
406 _nss_winbind_endpwent(void)
410 fprintf(stderr, "[%5d]: endpwent\n", getpid());
414 pthread_mutex_lock(&winbind_nss_mutex);
417 if (num_pw_cache > 0) {
418 ndx_pw_cache = num_pw_cache = 0;
419 winbindd_free_response(&getpwent_response);
422 ret = winbindd_request_response(NULL, WINBINDD_ENDPWENT, NULL, NULL);
424 fprintf(stderr, "[%5d]: endpwent returns %s (%d)\n", getpid(),
425 nss_err_str(ret), ret);
429 pthread_mutex_unlock(&winbind_nss_mutex);
435 /* Fetch the next password entry from ntdom password database */
438 _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
439 size_t buflen, int *errnop)
442 struct winbindd_request request;
443 static int called_again;
446 fprintf(stderr, "[%5d]: getpwent\n", getpid());
450 pthread_mutex_lock(&winbind_nss_mutex);
453 /* Return an entry from the cache if we have one, or if we are
454 called again because we exceeded our static buffer. */
456 if ((ndx_pw_cache < num_pw_cache) || called_again) {
460 /* Else call winbindd to get a bunch of entries */
462 if (num_pw_cache > 0) {
463 winbindd_free_response(&getpwent_response);
466 ZERO_STRUCT(request);
467 ZERO_STRUCT(getpwent_response);
469 request.data.num_entries = MAX_GETPWENT_USERS;
471 ret = winbindd_request_response(NULL, WINBINDD_GETPWENT, &request,
474 if (ret == NSS_STATUS_SUCCESS) {
475 struct winbindd_pw *pw_cache;
480 num_pw_cache = getpwent_response.data.num_entries;
482 /* Return a result */
486 pw_cache = (struct winbindd_pw *)
487 getpwent_response.extra_data.data;
489 /* Check data is valid */
491 if (pw_cache == NULL) {
492 ret = NSS_STATUS_NOTFOUND;
496 ret = fill_pwent(result, &pw_cache[ndx_pw_cache],
499 /* Out of memory - try again */
501 if (ret == NSS_STATUS_TRYAGAIN) {
503 *errnop = errno = ERANGE;
508 called_again = false;
511 /* If we've finished with this lot of results free cache */
513 if (ndx_pw_cache == num_pw_cache) {
514 ndx_pw_cache = num_pw_cache = 0;
515 winbindd_free_response(&getpwent_response);
520 fprintf(stderr, "[%5d]: getpwent returns %s (%d)\n", getpid(),
521 nss_err_str(ret), ret);
525 pthread_mutex_unlock(&winbind_nss_mutex);
530 /* Return passwd struct from uid */
533 _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result, char *buffer,
534 size_t buflen, int *errnop)
537 static struct winbindd_response response;
538 struct winbindd_request request;
539 static int keep_response;
542 fprintf(stderr, "[%5d]: getpwuid_r %d\n", getpid(), (unsigned int)uid);
546 pthread_mutex_lock(&winbind_nss_mutex);
549 /* If our static buffer needs to be expanded we are called again */
550 if (!keep_response || uid != response.data.pw.pw_uid) {
552 /* Call for the first time */
554 ZERO_STRUCT(response);
555 ZERO_STRUCT(request);
557 request.data.uid = uid;
559 ret = winbindd_request_response(NULL, WINBINDD_GETPWUID, &request, &response);
561 if (ret == NSS_STATUS_SUCCESS) {
562 ret = fill_pwent(result, &response.data.pw,
565 if (ret == NSS_STATUS_TRYAGAIN) {
566 keep_response = true;
567 *errnop = errno = ERANGE;
574 /* We've been called again */
576 ret = fill_pwent(result, &response.data.pw, &buffer, &buflen);
578 if (ret == NSS_STATUS_TRYAGAIN) {
579 *errnop = errno = ERANGE;
583 keep_response = false;
587 winbindd_free_response(&response);
592 fprintf(stderr, "[%5d]: getpwuid %d returns %s (%d)\n", getpid(),
593 (unsigned int)uid, nss_err_str(ret), ret);
597 pthread_mutex_unlock(&winbind_nss_mutex);
603 /* Return passwd struct from username */
605 _nss_winbind_getpwnam_r(const char *name, struct passwd *result, char *buffer,
606 size_t buflen, int *errnop)
609 static struct winbindd_response response;
610 struct winbindd_request request;
611 static int keep_response;
614 fprintf(stderr, "[%5d]: getpwnam_r %s\n", getpid(), name);
618 pthread_mutex_lock(&winbind_nss_mutex);
621 /* If our static buffer needs to be expanded we are called again */
623 if (!keep_response || strcmp(name,response.data.pw.pw_name) != 0) {
625 /* Call for the first time */
627 ZERO_STRUCT(response);
628 ZERO_STRUCT(request);
630 strncpy(request.data.username, name,
631 sizeof(request.data.username) - 1);
632 request.data.username
633 [sizeof(request.data.username) - 1] = '\0';
635 ret = winbindd_request_response(NULL, WINBINDD_GETPWNAM, &request, &response);
637 if (ret == NSS_STATUS_SUCCESS) {
638 ret = fill_pwent(result, &response.data.pw, &buffer,
641 if (ret == NSS_STATUS_TRYAGAIN) {
642 keep_response = true;
643 *errnop = errno = ERANGE;
650 /* We've been called again */
652 ret = fill_pwent(result, &response.data.pw, &buffer, &buflen);
654 if (ret == NSS_STATUS_TRYAGAIN) {
655 keep_response = true;
656 *errnop = errno = ERANGE;
660 keep_response = false;
664 winbindd_free_response(&response);
667 fprintf(stderr, "[%5d]: getpwnam %s returns %s (%d)\n", getpid(),
668 name, nss_err_str(ret), ret);
672 pthread_mutex_unlock(&winbind_nss_mutex);
679 * NSS group functions
682 static struct winbindd_response getgrent_response;
684 static int ndx_gr_cache; /* Current index into grp cache */
685 static int num_gr_cache; /* Current size of grp cache */
687 /* Rewind "file pointer" to start of ntdom group database */
690 _nss_winbind_setgrent(void)
694 fprintf(stderr, "[%5d]: setgrent\n", getpid());
698 pthread_mutex_lock(&winbind_nss_mutex);
701 if (num_gr_cache > 0) {
702 ndx_gr_cache = num_gr_cache = 0;
703 winbindd_free_response(&getgrent_response);
706 ret = winbindd_request_response(NULL, WINBINDD_SETGRENT, NULL, NULL);
708 fprintf(stderr, "[%5d]: setgrent returns %s (%d)\n", getpid(),
709 nss_err_str(ret), ret);
713 pthread_mutex_unlock(&winbind_nss_mutex);
719 /* Close "file pointer" for ntdom group database */
722 _nss_winbind_endgrent(void)
726 fprintf(stderr, "[%5d]: endgrent\n", getpid());
730 pthread_mutex_lock(&winbind_nss_mutex);
733 if (num_gr_cache > 0) {
734 ndx_gr_cache = num_gr_cache = 0;
735 winbindd_free_response(&getgrent_response);
738 ret = winbindd_request_response(NULL, WINBINDD_ENDGRENT, NULL, NULL);
740 fprintf(stderr, "[%5d]: endgrent returns %s (%d)\n", getpid(),
741 nss_err_str(ret), ret);
745 pthread_mutex_unlock(&winbind_nss_mutex);
751 /* Get next entry from ntdom group database */
754 winbind_getgrent(enum winbindd_cmd cmd,
755 struct group *result,
756 char *buffer, size_t buflen, int *errnop)
759 static struct winbindd_request request;
760 static int called_again;
764 fprintf(stderr, "[%5d]: getgrent\n", getpid());
768 pthread_mutex_lock(&winbind_nss_mutex);
771 /* Return an entry from the cache if we have one, or if we are
772 called again because we exceeded our static buffer. */
774 if ((ndx_gr_cache < num_gr_cache) || called_again) {
778 /* Else call winbindd to get a bunch of entries */
780 if (num_gr_cache > 0) {
781 winbindd_free_response(&getgrent_response);
784 ZERO_STRUCT(request);
785 ZERO_STRUCT(getgrent_response);
787 request.data.num_entries = MAX_GETGRENT_USERS;
789 ret = winbindd_request_response(NULL, cmd, &request,
792 if (ret == NSS_STATUS_SUCCESS) {
793 struct winbindd_gr *gr_cache;
799 num_gr_cache = getgrent_response.data.num_entries;
801 /* Return a result */
805 gr_cache = (struct winbindd_gr *)
806 getgrent_response.extra_data.data;
808 /* Check data is valid */
810 if (gr_cache == NULL) {
811 ret = NSS_STATUS_NOTFOUND;
815 /* Fill group membership. The offset into the extra data
816 for the group membership is the reported offset plus the
817 size of all the winbindd_gr records returned. */
819 mem_ofs = gr_cache[ndx_gr_cache].gr_mem_ofs +
820 num_gr_cache * sizeof(struct winbindd_gr);
822 ret = fill_grent(result, &gr_cache[ndx_gr_cache],
823 ((char *)getgrent_response.extra_data.data)+mem_ofs,
826 /* Out of memory - try again */
828 if (ret == NSS_STATUS_TRYAGAIN) {
830 *errnop = errno = ERANGE;
835 called_again = false;
838 /* If we've finished with this lot of results free cache */
840 if (ndx_gr_cache == num_gr_cache) {
841 ndx_gr_cache = num_gr_cache = 0;
842 winbindd_free_response(&getgrent_response);
847 fprintf(stderr, "[%5d]: getgrent returns %s (%d)\n", getpid(),
848 nss_err_str(ret), ret);
852 pthread_mutex_unlock(&winbind_nss_mutex);
860 _nss_winbind_getgrent_r(struct group *result,
861 char *buffer, size_t buflen, int *errnop)
863 return winbind_getgrent(WINBINDD_GETGRENT, result, buffer, buflen, errnop);
867 _nss_winbind_getgrlst_r(struct group *result,
868 char *buffer, size_t buflen, int *errnop)
870 return winbind_getgrent(WINBINDD_GETGRLST, result, buffer, buflen, errnop);
873 /* Return group struct from group name */
876 _nss_winbind_getgrnam_r(const char *name,
877 struct group *result, char *buffer,
878 size_t buflen, int *errnop)
881 static struct winbindd_response response;
882 struct winbindd_request request;
883 static int keep_response;
886 fprintf(stderr, "[%5d]: getgrnam %s\n", getpid(), name);
890 pthread_mutex_lock(&winbind_nss_mutex);
893 /* If our static buffer needs to be expanded we are called again */
894 /* Or if the stored response group name differs from the request. */
896 if (!keep_response || strcmp(name,response.data.gr.gr_name) != 0) {
898 /* Call for the first time */
900 ZERO_STRUCT(request);
901 ZERO_STRUCT(response);
903 strncpy(request.data.groupname, name,
904 sizeof(request.data.groupname));
905 request.data.groupname
906 [sizeof(request.data.groupname) - 1] = '\0';
908 ret = winbindd_request_response(NULL, WINBINDD_GETGRNAM,
909 &request, &response);
911 if (ret == NSS_STATUS_SUCCESS) {
912 ret = fill_grent(result, &response.data.gr,
913 (char *)response.extra_data.data,
916 if (ret == NSS_STATUS_TRYAGAIN) {
917 keep_response = true;
918 *errnop = errno = ERANGE;
925 /* We've been called again */
927 ret = fill_grent(result, &response.data.gr,
928 (char *)response.extra_data.data, &buffer,
931 if (ret == NSS_STATUS_TRYAGAIN) {
932 keep_response = true;
933 *errnop = errno = ERANGE;
937 keep_response = false;
941 winbindd_free_response(&response);
944 fprintf(stderr, "[%5d]: getgrnam %s returns %s (%d)\n", getpid(),
945 name, nss_err_str(ret), ret);
949 pthread_mutex_unlock(&winbind_nss_mutex);
955 /* Return group struct from gid */
958 _nss_winbind_getgrgid_r(gid_t gid,
959 struct group *result, char *buffer,
960 size_t buflen, int *errnop)
963 static struct winbindd_response response;
964 struct winbindd_request request;
965 static int keep_response;
968 fprintf(stderr, "[%5d]: getgrgid %d\n", getpid(), gid);
972 pthread_mutex_lock(&winbind_nss_mutex);
975 /* If our static buffer needs to be expanded we are called again */
976 /* Or if the stored response group name differs from the request. */
978 if (!keep_response || gid != response.data.gr.gr_gid) {
980 /* Call for the first time */
982 ZERO_STRUCT(request);
983 ZERO_STRUCT(response);
985 request.data.gid = gid;
987 ret = winbindd_request_response(NULL, WINBINDD_GETGRGID,
988 &request, &response);
990 if (ret == NSS_STATUS_SUCCESS) {
992 ret = fill_grent(result, &response.data.gr,
993 (char *)response.extra_data.data,
996 if (ret == NSS_STATUS_TRYAGAIN) {
997 keep_response = true;
998 *errnop = errno = ERANGE;
1005 /* We've been called again */
1007 ret = fill_grent(result, &response.data.gr,
1008 (char *)response.extra_data.data, &buffer,
1011 if (ret == NSS_STATUS_TRYAGAIN) {
1012 keep_response = true;
1013 *errnop = errno = ERANGE;
1017 keep_response = false;
1021 winbindd_free_response(&response);
1024 fprintf(stderr, "[%5d]: getgrgid %d returns %s (%d)\n", getpid(),
1025 (unsigned int)gid, nss_err_str(ret), ret);
1029 pthread_mutex_unlock(&winbind_nss_mutex);
1034 /* Initialise supplementary groups */
1037 _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
1038 long int *size, gid_t **groups, long int limit,
1042 struct winbindd_request request;
1043 struct winbindd_response response;
1047 fprintf(stderr, "[%5d]: initgroups %s (%d)\n", getpid(),
1052 pthread_mutex_lock(&winbind_nss_mutex);
1055 ZERO_STRUCT(request);
1056 ZERO_STRUCT(response);
1058 strncpy(request.data.username, user,
1059 sizeof(request.data.username) - 1);
1061 ret = winbindd_request_response(NULL, WINBINDD_GETGROUPS,
1062 &request, &response);
1064 if (ret == NSS_STATUS_SUCCESS) {
1065 int num_gids = response.data.num_entries;
1066 gid_t *gid_list = (gid_t *)response.extra_data.data;
1069 fprintf(stderr, "[%5d]: initgroups %s: got NSS_STATUS_SUCCESS "
1070 "and %d gids\n", getpid(),
1073 if (gid_list == NULL) {
1074 ret = NSS_STATUS_NOTFOUND;
1078 /* Copy group list to client */
1080 for (i = 0; i < num_gids; i++) {
1083 fprintf(stderr, "[%5d]: initgroups %s (%d): "
1084 "processing gid %d \n", getpid(),
1085 user, group, gid_list[i]);
1088 /* Skip primary group */
1090 if (gid_list[i] == group) {
1094 /* Skip groups without a mapping */
1095 if (gid_list[i] == (uid_t)-1) {
1099 /* Filled buffer ? If so, resize. */
1101 if (*start == *size) {
1105 newsize = 2 * (*size);
1107 if (*size == limit) {
1110 if (newsize > limit) {
1115 newgroups = (gid_t *)
1117 newsize * sizeof(**groups));
1120 ret = NSS_STATUS_NOTFOUND;
1123 *groups = newgroups;
1129 (*groups)[*start] = gid_list[i];
1134 /* Back to your regularly scheduled programming */
1138 fprintf(stderr, "[%5d]: initgroups %s returns %s (%d)\n", getpid(),
1139 user, nss_err_str(ret), ret);
1143 pthread_mutex_unlock(&winbind_nss_mutex);