[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Developing PAM modules?



what exactly you want it to do?
you return PAM_IGNORE in every function

----- Original Message ----- 
From: "Jason Gerfen" <jason gerfen scl utah edu>
To: "Pluggable Authentication Modules" <pam-list redhat com>
Sent: Wednesday, June 02, 2004 6:06 PM
Subject: Developing PAM modules?


> I have been trying to get a working PAM module written.  It doesn't do 
> anything real fancy just creates a file so I know that I am working with 
> the functions correctly, as of yet I have not been able to get it to do 
> anything.
> 
> [SNIP]
> #include <stdio.h>
> 
> #define PAM_SM_AUTH
> #define PAM_SM_ACCOUNT
> #define PAM_SM_SESSION
> #define PAM_SM_PASSWORD
> 
> #include <pam_modules.h>
> 
> PAM_EXTERN
> int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc,
>                                                 const char **argv)
> {
>    const char *user;
>    const char prompt;
> 
>    pam_get_user(pamh, &user, &prompt);
> 
>    FILE *fp;
>    int i;
> 
>    fp = fopen("/tmp/log", "a");
> 
>    fprintf(fp, "\nSample code\n\n");
>    for(i = 1; i <= 10; i++)
>     fprintf(fp, "i = %d\n", i);
>    fclose(fp);
> 
>    return PAM_IGNORE;
> }
> 
> PAM_EXTERN
> int pam_sm_setcred(pam_handle_t *pamh, int flags, int argc,
>            const char **argv)
> {
>    return PAM_IGNORE;
> }
> 
> PAM_EXTERN
> int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, int argc,
>              const char **argv)
> {
>    return PAM_IGNORE;
> }
> 
> PAM_EXTERN
> int pam_sm_cauthtok(pam_handle_t *pamh, int flags, int argc,
>             const char **argv)
> {
>    return PAM_IGNORE;
> }
> 
> PAM_EXTERN
> int pam_sm_open_session(pam_handle_t *pamh, int flags, int argc,
>             const char **argv)
> {
>    return PAM_IGNORE;
> }
> 
> PAM_EXTERN
> int pam_sm_close_session(pam_handle_t *pamh, int flags, int argc,
>              const char **argv)
> {
>    return PAM_IGNORE;
> }
> 
> #ifdef PAM_STATIC
> 
> struct pam_module _pam_permit_modstruct = {
>    "pam_permit",
>    pam_sm_authenticate,
>    pam_sm_setcred,
>    pam_sm_acct_mgmt,
>    pam_sm_open_session,
>    pam_sm_close_session,
>    pam_sm_chauthtok
> };
> 
> #endif
> [/SNIP]
> 
> Am I missing something?  The PAM module writters guide is kinda vague on 
> details, and I have only been able to google up a couple of tutorials on 
> this subject so any help, pointers, howto's are definately appreciated.
> 
> -- 
> Jason Gerfen
> 
> "...Sometimes I just yell at myself. And it
>  makes me sad, sometimes I make myself cry..."
> ~ My nephew Dawsyn
> 
> 
> 
> _______________________________________________
> Pam-list mailing list
> Pam-list redhat com
> https://www.redhat.com/mailman/listinfo/pam-list
> 
> __________ NOD32 1.779 (20040602) Information __________
> 
> This message was checked by NOD32 antivirus system.
> http://www.nod32.com
> 
> 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]