1 /* pam_rootok module */
4 * $Id: pam_rootok.c,v 1.1.1.1 2000/06/20 22:11:56 agmorgan Exp $
5 * $FreeBSD: src/contrib/libpam/modules/pam_rootok/pam_rootok.c,v 1.3.2.2 2001/06/11 15:28:25 markm Exp $
7 * Written by Andrew Morgan <morgan@linux.kernel.org> 1996/3/11
18 * here, we make a definition for the externally accessible function
19 * in this file (this definition is required for static a module
20 * but strongly encouraged generally) it is used to instruct the
21 * modules include file to define the function prototypes.
26 #include <security/pam_modules.h>
30 static void _pam_log(int err, const char *format, ...)
34 va_start(args, format);
35 openlog("PAM-rootok", LOG_CONS|LOG_PID, LOG_AUTH);
36 vsyslog(err, format, args);
42 /* argument parsing */
44 #define PAM_DEBUG_ARG 01
46 static int _pam_parse(int argc, const char **argv)
50 /* step through arguments */
51 for (ctrl=0; argc-- > 0; ++argv) {
55 if (!strcmp(*argv,"debug"))
56 ctrl |= PAM_DEBUG_ARG;
58 _pam_log(LOG_ERR,"pam_parse: unknown option; %s",*argv);
65 /* --- authentication management functions (only) --- */
68 int pam_sm_authenticate(pam_handle_t *pamh,int flags,int argc
72 int retval = PAM_AUTH_ERR;
74 ctrl = _pam_parse(argc, argv);
78 if (ctrl & PAM_DEBUG_ARG) {
79 _pam_log(LOG_DEBUG, "authetication %s"
80 , retval==PAM_SUCCESS ? "succeeded":"failed" );
87 int pam_sm_setcred(pam_handle_t *pamh,int flags,int argc
94 /* end of module definition */
96 PAM_MODULE_ENTRY("pam_rootok");