/* * $Id$ * * $Log$ * Revision 1.1 2000/06/20 22:11:13 agmorgan * Initial revision * * Revision 1.2 1999/11/08 05:39:53 morgan * removed void main def which was making gcc complain * * Revision 1.1.1.1 1998/07/12 05:17:14 morgan * Linux PAM sources pre-0.66 * * Revision 1.7 1996/12/01 03:16:53 morgan * added setcred closing function * * Revision 1.6 1996/11/10 19:51:40 morgan * minor change to avoid gcc warning * * Revision 1.5 1996/07/07 23:53:05 morgan * added optional fail delay (non-standard Linux-PAM) * * Revision 1.4 1996/05/02 04:44:18 morgan * moved conversation to a libmisc library routine. * * */ /* Andrew Morgan (morgan@parc.power.net) -- a self contained `blank' * application * * I am not very proud of this code. It makes use of a possibly ill- * defined pamh pointer to call pam_strerror() with. The reason that * I was sloppy with this is historical (pam_strerror, prior to 0.59, * did not require a pamh argument) and if this program is used as a * model for anything, I should wish that you will take this error into * account. */ #include #include #include #include /* ------ some local (static) functions ------- */ static void bail_out(pam_handle_t *pamh, int really, int code, const char *fn) { fprintf(stderr,"==> called %s()\n got: `%s'\n", fn, pam_strerror(pamh, code)); if (really && code) exit (1); } /* ------ some static data objects ------- */ static struct pam_conv conv = { misc_conv, NULL }; /* ------- the application itself -------- */ int main(int argc, char **argv) { pam_handle_t *pamh=NULL; char *username=NULL; int retcode; /* did the user call with a username as an argument ? */ if (argc > 2) { fprintf(stderr,"usage: %s [username]\n",argv[0]); } else if (argc == 2) { username = argv[1]; } /* initialize the Linux-PAM library */ retcode = pam_start("blank", username, &conv, &pamh); bail_out(pamh,1,retcode,"pam_start"); /* test the environment stuff */ { #define MAXENV 15 const char *greek[MAXENV] = { "a=alpha", "b=beta", "c=gamma", "d=delta", "e=epsilon", "f=phi", "g=psi", "h=eta", "i=iota", "j=mu", "k=nu", "l=zeta", "h=", "d", "k=xi" }; char **env; int i; for (i=0; i