1 /* pam_rootok module */
6 * Written by Andrew Morgan <morgan@linux.kernel.org> 1996/3/11
17 * here, we make a definition for the externally accessible function
18 * in this file (this definition is required for static a module
19 * but strongly encouraged generally) it is used to instruct the
20 * modules include file to define the function prototypes.
25 #include <security/pam_modules.h>
29 static void _pam_log(int err, const char *format, ...)
33 va_start(args, format);
34 openlog("PAM-rootok", LOG_CONS|LOG_PID, LOG_AUTH);
35 vsyslog(err, format, args);
41 /* argument parsing */
43 #define PAM_DEBUG_ARG 01
45 static int _pam_parse(int argc, const char **argv)
49 /* step through arguments */
50 for (ctrl=0; argc-- > 0; ++argv) {
54 if (!strcmp(*argv,"debug"))
55 ctrl |= PAM_DEBUG_ARG;
57 _pam_log(LOG_ERR,"pam_parse: unknown option; %s",*argv);
64 /* --- authentication management functions (only) --- */
67 int pam_sm_authenticate(pam_handle_t *pamh,int flags,int argc
71 int retval = PAM_AUTH_ERR;
73 ctrl = _pam_parse(argc, argv);
77 if (ctrl & PAM_DEBUG_ARG) {
78 _pam_log(LOG_DEBUG, "authetication %s"
79 , retval==PAM_SUCCESS ? "succeeded":"failed" );
86 int pam_sm_setcred(pam_handle_t *pamh,int flags,int argc
95 /* static module data */
97 struct pam_module _pam_rootok_modstruct = {
109 /* end of module definition */