| 1 | /* |
| 2 | ** Copyright 1998 - 2000 Double Precision, Inc. See COPYING for |
| 3 | ** distribution information. |
| 4 | */ |
| 5 | |
| 6 | #if HAVE_CONFIG_H |
| 7 | #include "courier_auth_config.h" |
| 8 | #endif |
| 9 | #include <stdio.h> |
| 10 | #include <stdlib.h> |
| 11 | #include <string.h> |
| 12 | #include <errno.h> |
| 13 | #include <pwd.h> |
| 14 | #if HAVE_UNISTD_H |
| 15 | #include <unistd.h> |
| 16 | #endif |
| 17 | |
| 18 | #include "auth.h" |
| 19 | #include "authstaticlist.h" |
| 20 | |
| 21 | static const char rcsid[]="$Id: authpwdenumerate.c,v 1.3 2004/11/14 02:58:16 mrsam Exp $"; |
| 22 | |
| 23 | |
| 24 | void auth_pwd_enumerate( void(*cb_func)(const char *name, |
| 25 | uid_t uid, |
| 26 | gid_t gid, |
| 27 | const char *homedir, |
| 28 | const char *maildir, |
| 29 | const char *options, |
| 30 | void *void_arg), |
| 31 | void *void_arg) |
| 32 | { |
| 33 | struct passwd *pw; |
| 34 | |
| 35 | setpwent(); |
| 36 | |
| 37 | while ( (pw=getpwent()) != NULL) |
| 38 | { |
| 39 | if (pw->pw_uid < 100) |
| 40 | continue; |
| 41 | |
| 42 | (*cb_func)(pw->pw_name, pw->pw_uid, |
| 43 | pw->pw_gid, |
| 44 | pw->pw_dir, |
| 45 | NULL, |
| 46 | NULL, |
| 47 | void_arg); |
| 48 | } |
| 49 | endpwent(); |
| 50 | (*cb_func)(NULL, 0, 0, NULL, NULL, NULL, void_arg); |
| 51 | } |