(root)/
Linux-PAM-1.5.3/
modules/
pam_permit/
pam_permit.c
       1  /*
       2   * pam_permit module
       3   *
       4   * Written by Andrew Morgan <morgan@parc.power.net> 1996/3/11
       5   */
       6  
       7  #include "config.h"
       8  #include <stdio.h>
       9  
      10  #include <security/pam_modules.h>
      11  #include <security/_pam_macros.h>
      12  
      13  #define DEFAULT_USER "nobody"
      14  
      15  /* --- authentication management functions --- */
      16  
      17  int
      18  pam_sm_authenticate(pam_handle_t *pamh, int flags UNUSED,
      19  		    int argc UNUSED, const char **argv UNUSED)
      20  {
      21      int retval;
      22      const char *user=NULL;
      23  
      24      /*
      25       * authentication requires we know who the user wants to be
      26       */
      27      retval = pam_get_user(pamh, &user, NULL);
      28      if (retval != PAM_SUCCESS) {
      29  	D(("get user returned error: %s", pam_strerror(pamh,retval)));
      30  	return retval;
      31      }
      32      if (*user == '\0') {
      33  	D(("username not known"));
      34  	retval = pam_set_item(pamh, PAM_USER, (const void *) DEFAULT_USER);
      35  	if (retval != PAM_SUCCESS)
      36  	    return PAM_USER_UNKNOWN;
      37      }
      38      user = NULL;                                            /* clean up */
      39  
      40      return PAM_SUCCESS;
      41  }
      42  
      43  int
      44  pam_sm_setcred(pam_handle_t *pamh UNUSED, int flags UNUSED,
      45  	       int argc UNUSED, const char **argv UNUSED)
      46  {
      47       return PAM_SUCCESS;
      48  }
      49  
      50  /* --- account management functions --- */
      51  
      52  int
      53  pam_sm_acct_mgmt(pam_handle_t *pamh UNUSED, int flags UNUSED,
      54  		 int argc UNUSED, const char **argv UNUSED)
      55  {
      56       return PAM_SUCCESS;
      57  }
      58  
      59  /* --- password management --- */
      60  
      61  int
      62  pam_sm_chauthtok(pam_handle_t *pamh UNUSED, int flags UNUSED,
      63  		 int argc UNUSED, const char **argv UNUSED)
      64  {
      65       return PAM_SUCCESS;
      66  }
      67  
      68  /* --- session management --- */
      69  
      70  int
      71  pam_sm_open_session(pam_handle_t *pamh UNUSED, int flags UNUSED,
      72  		    int argc UNUSED, const char **argv UNUSED)
      73  {
      74      return PAM_SUCCESS;
      75  }
      76  
      77  int
      78  pam_sm_close_session(pam_handle_t *pamh UNUSED, int flags UNUSED,
      79  		     int argc UNUSED, const char **argv UNUSED)
      80  {
      81       return PAM_SUCCESS;
      82  }
      83  
      84  /* end of module definition */