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 $
6 * $DragonFly: src/contrib/libpam/modules/pam_rootok/Attic/pam_rootok.c,v 1.2 2003/06/17 04:24:03 dillon Exp $
8 * Written by Andrew Morgan <morgan@linux.kernel.org> 1996/3/11
19 * here, we make a definition for the externally accessible function
20 * in this file (this definition is required for static a module
21 * but strongly encouraged generally) it is used to instruct the
22 * modules include file to define the function prototypes.
27 #include <security/pam_modules.h>
31 static void _pam_log(int err, const char *format, ...)
35 va_start(args, format);
36 openlog("PAM-rootok", LOG_CONS|LOG_PID, LOG_AUTH);
37 vsyslog(err, format, args);
43 /* argument parsing */
45 #define PAM_DEBUG_ARG 01
47 static int _pam_parse(int argc, const char **argv)
51 /* step through arguments */
52 for (ctrl=0; argc-- > 0; ++argv) {
56 if (!strcmp(*argv,"debug"))
57 ctrl |= PAM_DEBUG_ARG;
59 _pam_log(LOG_ERR,"pam_parse: unknown option; %s",*argv);
66 /* --- authentication management functions (only) --- */
69 int pam_sm_authenticate(pam_handle_t *pamh,int flags,int argc
73 int retval = PAM_AUTH_ERR;
75 ctrl = _pam_parse(argc, argv);
79 if (ctrl & PAM_DEBUG_ARG) {
80 _pam_log(LOG_DEBUG, "authetication %s"
81 , retval==PAM_SUCCESS ? "succeeded":"failed" );
88 int pam_sm_setcred(pam_handle_t *pamh,int flags,int argc
95 /* end of module definition */
97 PAM_MODULE_ENTRY("pam_rootok");