nss-pam-ldapd commit: r1448 - nss-pam-ldapd/pam
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
nss-pam-ldapd commit: r1448 - nss-pam-ldapd/pam
- From: Commits of the nss-pam-ldapd project <nss-pam-ldapd-commits [at] lists.arthurdejong.org>
- To: nss-pam-ldapd-commits [at] lists.arthurdejong.org
- Reply-to: nss-pam-ldapd-users [at] lists.arthurdejong.org
- Subject: nss-pam-ldapd commit: r1448 - nss-pam-ldapd/pam
- Date: Sat, 30 Apr 2011 23:01:52 +0200 (CEST)
Author: arthur
Date: Sat Apr 30 23:01:51 2011
New Revision: 1448
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1448
Log:
split setting up of configuration into separate function
Modified:
nss-pam-ldapd/pam/pam.c
Modified: nss-pam-ldapd/pam/pam.c
==============================================================================
--- nss-pam-ldapd/pam/pam.c Sat Apr 30 21:54:10 2011 (r1447)
+++ nss-pam-ldapd/pam/pam.c Sat Apr 30 23:01:51 2011 (r1448)
@@ -146,13 +146,10 @@
uid_t minimum_uid;
};
-static int init(pam_handle_t *pamh,int flags,int argc,const char **argv,
- struct pld_cfg *cfg,struct pld_ctx **ctx,const char **username,
- const char **service)
+static void cfg_init(pam_handle_t *pamh,int flags,int argc,const char **argv,
+ struct pld_cfg *cfg)
{
int i;
- int rc;
- struct passwd *pwent;
/* initialise config with defaults */
cfg->nullok=0;
cfg->no_warn=0;
@@ -187,6 +184,13 @@
/* check flags */
if (flags&PAM_SILENT)
cfg->no_warn=1;
+}
+
+static int init(pam_handle_t *pamh,struct pld_cfg *cfg,struct pld_ctx **ctx,
+ const char **username,const char **service)
+{
+ int rc;
+ struct passwd *pwent;
/* get user name */
rc=pam_get_user(pamh,username,NULL);
if (rc!=PAM_SUCCESS)
@@ -258,7 +262,7 @@
gid_t dummy_gid;
PAM_REQUEST(NSLCD_ACTION_PASSWD_BYNAME,
/* log debug message */
- pam_syslog(pamh,LOG_DEBUG,"nslcd authentication; user=%s",username),
+ pam_syslog(pamh,LOG_DEBUG,"nslcd account check; user=%s",username),
/* write the request parameters */
WRITE_STRING(fp,username),
/* read the result entry */
@@ -378,9 +382,10 @@
const char *username,*service;
char *passwd=NULL;
/* set up configuration */
- rc=init(pamh,flags,argc,argv,&cfg,&ctx,&username,&service);
+ cfg_init(pamh,flags,argc,argv,&cfg);
+ rc=init(pamh,&cfg,&ctx,&username,&service);
if (rc!=PAM_SUCCESS)
- return rc;
+ return remap_pam_rc(rc,&cfg);
/* get the password */
rc=pam_get_authtok(pamh,PAM_AUTHTOK,(const char **)&passwd,NULL);
if (rc!=PAM_SUCCESS)
@@ -441,9 +446,10 @@
const char *username,*service;
const char *ruser=NULL,*rhost=NULL,*tty=NULL;
/* set up configuration */
- rc=init(pamh,flags,argc,argv,&cfg,&ctx,&username,&service);
+ cfg_init(pamh,flags,argc,argv,&cfg);
+ rc=init(pamh,&cfg,&ctx,&username,&service);
if (rc!=PAM_SUCCESS)
- return rc;
+ return remap_pam_rc(rc,&cfg);
/* get more PAM information */
pam_get_item(pamh,PAM_RUSER,(const void **)&ruser);
pam_get_item(pamh,PAM_RHOST,(const void **)&rhost);
@@ -499,9 +505,10 @@
const char *username,*service;
const char *tty=NULL,*rhost=NULL,*ruser=NULL;
/* set up configuration */
- rc=init(pamh,flags,argc,argv,&cfg,&ctx,&username,&service);
+ cfg_init(pamh,flags,argc,argv,&cfg);
+ rc=init(pamh,&cfg,&ctx,&username,&service);
if (rc!=PAM_SUCCESS)
- return rc;
+ return remap_pam_rc(rc,&cfg);
/* get more PAM information */
pam_get_item(pamh,PAM_TTY,(const void **)&tty);
pam_get_item(pamh,PAM_RHOST,(const void **)&rhost);
@@ -546,9 +553,10 @@
struct passwd *pwent;
uid_t myuid;
/* set up configuration */
- rc=init(pamh,flags,argc,argv,&cfg,&ctx,&username,&service);
+ cfg_init(pamh,flags,argc,argv,&cfg);
+ rc=init(pamh,&cfg,&ctx,&username,&service);
if (rc!=PAM_SUCCESS)
- return rc;
+ return remap_pam_rc(rc,&cfg);
/* see if we are dealing with an LDAP user first */
if (ctx->dn==NULL)
{
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits
- nss-pam-ldapd commit: r1448 - nss-pam-ldapd/pam,
Commits of the nss-pam-ldapd project