diff options
author | Andrew Tridgell <tridge@samba.org> | 2002-07-14 22:15:20 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2002-07-14 22:15:20 +0000 |
commit | 13157d1494b99bf85632120c27286ba4d877a68f (patch) | |
tree | c1b5a22d91285a0423f664a1f158de804fddee0a /source3/nsswitch/winbind_nss.c | |
parent | 3d1b9bfb29db307e63033d4a94391a250e401238 (diff) | |
download | samba-13157d1494b99bf85632120c27286ba4d877a68f.tar.gz samba-13157d1494b99bf85632120c27286ba4d877a68f.tar.bz2 samba-13157d1494b99bf85632120c27286ba4d877a68f.zip |
this is a trick to work around the fact that posix does not supply
a getgr*() function that lists groups without numerating all the
group members. Instead of definiing a new nss method (which might
cause problems) I added an environment variable WINBIND_GETGRLST
that tells winbind not to fill in the group members in a gergrent()
request. This can speed up group listing by a factor of 20 or more
(on my test system with 50000 groups it reduces the time from an hour
to 2 minutes)
(This used to be commit e3f73256d31ab9914daae49f41e984a534996870)
Diffstat (limited to 'source3/nsswitch/winbind_nss.c')
-rw-r--r-- | source3/nsswitch/winbind_nss.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source3/nsswitch/winbind_nss.c b/source3/nsswitch/winbind_nss.c index a396e5551b..681bcd2bf7 100644 --- a/source3/nsswitch/winbind_nss.c +++ b/source3/nsswitch/winbind_nss.c @@ -238,6 +238,7 @@ winbind_callback(nsd_file_t **rqp, int fd) free_response(&response); return(do_list(1,rq)); case WINBINDD_GETGRENT: + case WINBINDD_GETGRLST: nsd_logprintf(NSD_LOG_MIN, "callback (winbind) - %d GETGRENT responses\n", response.data.num_entries); @@ -1060,6 +1061,7 @@ _nss_winbind_getgrent_r(struct group *result, NSS_STATUS ret; static struct winbindd_request request; static int called_again; + enum winbindd_cmd cmd; #ifdef DEBUG_NSS fprintf(stderr, "[%5d]: getgrent\n", getpid()); @@ -1083,7 +1085,17 @@ _nss_winbind_getgrent_r(struct group *result, request.data.num_entries = MAX_GETGRENT_USERS; - ret = winbindd_request(WINBINDD_GETGRENT, &request, + /* this is a hack to work around the fact that posix doesn't + define a 'list groups' call and listing all group members can + be *very* expensive. We use an environment variable to give + us a saner call (tridge) */ + if (getenv("WINBIND_GETGRLST")) { + cmd = WINBINDD_GETGRLST; + } else { + cmd = WINBINDD_GETGRENT; + } + + ret = winbindd_request(cmd, &request, &getgrent_response); if (ret == NSS_STATUS_SUCCESS) { |