Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpam/modules/pam_group Don't print an error if we are ...



details:   https://anonhg.NetBSD.org/src/rev/114e99ab8092
branches:  trunk
changeset: 580032:114e99ab8092
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Apr 05 18:24:17 2005 +0000

description:
Don't print an error if we are doing authentication.

diffstat:

 lib/libpam/modules/pam_group/pam_group.c |  23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diffs (60 lines):

diff -r 9a4b93a733af -r 114e99ab8092 lib/libpam/modules/pam_group/pam_group.c
--- a/lib/libpam/modules/pam_group/pam_group.c  Tue Apr 05 18:23:36 2005 +0000
+++ b/lib/libpam/modules/pam_group/pam_group.c  Tue Apr 05 18:24:17 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pam_group.c,v 1.6 2005/03/31 15:11:54 thorpej Exp $    */
+/*     $NetBSD: pam_group.c,v 1.7 2005/04/05 18:24:17 christos Exp $   */
 
 /*-
  * Copyright (c) 2003 Networks Associates Technology, Inc.
@@ -38,7 +38,7 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: src/lib/libpam/modules/pam_group/pam_group.c,v 1.4 2003/12/11 13:55:15 des Exp $");
 #else
-__RCSID("$NetBSD: pam_group.c,v 1.6 2005/03/31 15:11:54 thorpej Exp $");
+__RCSID("$NetBSD: pam_group.c,v 1.7 2005/04/05 18:24:17 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -71,7 +71,7 @@
        char *const *list;
        struct passwd *pwd, pwres;
        struct group *grp;
-       int pam_err;
+       int pam_err, auth;
        char *promptresp = NULL;
        char pwbuf[1024];
 
@@ -88,6 +88,8 @@
            || ruser == NULL || (pwd = getpwnam(ruser)) == NULL)
                return (PAM_AUTH_ERR);
 
+       auth = openpam_get_option(pamh, "authenticate") != NULL;
+
        /* get regulating group */
        if ((group = openpam_get_option(pamh, "group")) == NULL)
                group = "wheel";
@@ -108,14 +110,17 @@
  not_found:
        if (openpam_get_option(pamh, "deny"))
                return (PAM_SUCCESS);
-       pam_err = pam_prompt(pamh, PAM_ERROR_MSG, &promptresp,
-           "%s: You are not listed in the correct secondary group"
-           " (%s) to %s %s.", getprogname(), group, getprogname(), user);
-       if (pam_err == PAM_SUCCESS && promptresp)
-               free(promptresp);
+       if (!auth) {
+               pam_err = pam_prompt(pamh, PAM_ERROR_MSG, &promptresp,
+                   "%s: You are not listed in the correct secondary group"
+                   " (%s) to %s %s.", getprogname(), group, getprogname(),
+                   user);
+               if (pam_err == PAM_SUCCESS && promptresp)
+                       free(promptresp);
+       }
        return (PAM_AUTH_ERR);
  found:
-       if (openpam_get_option(pamh, "authenticate"))
+       if (auth)
                if ((pam_err = authenticate(pamh, pwd, flags)) != PAM_SUCCESS)
                        return pam_err;
 



Home | Main Index | Thread Index | Old Index