1 /* pam_rootok module */
4 * $Id: pam_rootok.c,v 1.5 1997/02/15 17:32:47 morgan Exp $
6 * Written by Andrew Morgan <morgan@parc.power.net> 1996/3/11
8 * $Log: pam_rootok.c,v $
9 * Revision 1.5 1997/02/15 17:32:47 morgan
10 * removed fixed syslog buffer
12 * Revision 1.4 1996/12/01 03:10:14 morgan
15 * Revision 1.3 1996/06/02 08:11:01 morgan
16 * updated for new static protocol
26 * here, we make a definition for the externally accessible function
27 * in this file (this definition is required for static a module
28 * but strongly encouraged generally) it is used to instruct the
29 * modules include file to define the function prototypes.
34 #include <security/pam_modules.h>
38 static void _pam_log(int err, const char *format, ...)
42 va_start(args, format);
43 openlog("PAM-rootok", LOG_CONS|LOG_PID, LOG_AUTH);
44 vsyslog(err, format, args);
50 /* argument parsing */
52 #define PAM_DEBUG_ARG 01
54 static int _pam_parse(int argc, const char **argv)
58 /* step through arguments */
59 for (ctrl=0; argc-- > 0; ++argv) {
63 if (!strcmp(*argv,"debug"))
64 ctrl |= PAM_DEBUG_ARG;
66 _pam_log(LOG_ERR,"pam_parse: unknown option; %s",*argv);
73 /* --- authentication management functions (only) --- */
76 int pam_sm_authenticate(pam_handle_t *pamh,int flags,int argc
80 int retval = PAM_AUTH_ERR;
82 ctrl = _pam_parse(argc, argv);
86 if (ctrl & PAM_DEBUG_ARG) {
87 _pam_log(LOG_DEBUG, "authetication %s"
88 , retval==PAM_SUCCESS ? "succeeded":"failed" );
95 int pam_sm_setcred(pam_handle_t *pamh,int flags,int argc
104 /* static module data */
106 struct pam_module _pam_rootok_modstruct = {
118 /* end of module definition */