Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/openpam/dist/lib don't use %m in openpam_log, b...



details:   https://anonhg.NetBSD.org/src/rev/2cb64f9684a6
branches:  trunk
changeset: 772426:2cb64f9684a6
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jan 03 18:56:49 2012 +0000

description:
don't use %m in openpam_log, because it does not necessarily call syslog()
to process the message.

diffstat:

 external/bsd/openpam/dist/lib/openpam_check_owner_perms.c |  7 ++++---
 external/bsd/openpam/dist/lib/openpam_configure.c         |  9 +++++----
 external/bsd/openpam/dist/lib/openpam_dynamic.c           |  7 ++++---
 external/bsd/openpam/dist/lib/openpam_ttyconv.c           |  6 +++---
 4 files changed, 16 insertions(+), 13 deletions(-)

diffs (125 lines):

diff -r a426d8dad673 -r 2cb64f9684a6 external/bsd/openpam/dist/lib/openpam_check_owner_perms.c
--- a/external/bsd/openpam/dist/lib/openpam_check_owner_perms.c Tue Jan 03 17:49:57 2012 +0000
+++ b/external/bsd/openpam/dist/lib/openpam_check_owner_perms.c Tue Jan 03 18:56:49 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: openpam_check_owner_perms.c,v 1.3 2011/12/25 23:18:56 christos Exp $   */
+/*     $NetBSD: openpam_check_owner_perms.c,v 1.4 2012/01/03 18:56:49 christos Exp $   */
 
 /*-
  * Copyright (c) 2011 Dag-Erling Smørgrav
@@ -65,7 +65,7 @@
        arbitrator = geteuid();
        if (fstat(fd, &sb) != 0) {
                serrno = errno;
-               openpam_log(PAM_LOG_ERROR, "%s: %m", name);
+               openpam_log(PAM_LOG_ERROR, "%s: %s", name, strerror(errno));
                errno = serrno;
                return (-1);
        }
@@ -108,7 +108,8 @@
        while (len > 0) {
                if (stat(pathbuf, &sb) != 0) {
                        serrno = errno;
-                       openpam_log(PAM_LOG_ERROR, "%s: %m", pathbuf);
+                       openpam_log(PAM_LOG_ERROR, "%s: %s", pathbuf,
+                           strerror(errno));
                        errno = serrno;
                        return (-1);
                }
diff -r a426d8dad673 -r 2cb64f9684a6 external/bsd/openpam/dist/lib/openpam_configure.c
--- a/external/bsd/openpam/dist/lib/openpam_configure.c Tue Jan 03 17:49:57 2012 +0000
+++ b/external/bsd/openpam/dist/lib/openpam_configure.c Tue Jan 03 18:56:49 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: openpam_configure.c,v 1.3 2011/12/25 23:18:56 christos Exp $   */
+/*     $NetBSD: openpam_configure.c,v 1.4 2012/01/03 18:56:49 christos Exp $   */
 
 /*-
  * Copyright (c) 2001-2003 Networks Associates Technology, Inc.
@@ -370,7 +370,7 @@
 
        if ((f = fopen(filename, "r")) == NULL) {
                openpam_log(errno == ENOENT ? PAM_LOG_DEBUG : PAM_LOG_NOTICE,
-                   "%s: %m", filename);
+                   "%s: %s", filename, strerror(errno));
                return (PAM_SUCCESS);
        }
        if (openpam_check_desc_owner_perms(filename, fileno(f)) != 0) {
@@ -496,7 +496,7 @@
        fclose(f);
        return (PAM_SUCCESS);
 syserr:
-       openpam_log(PAM_LOG_ERROR, "%s: %m", filename);
+       openpam_log(PAM_LOG_ERROR, "%s: %s", filename, strerror(errno));
 fail:
        if (this && this->optc) {
                while (this->optc--)
@@ -546,7 +546,8 @@
                len = strlen(*path);
                if ((*path)[len - 1] == '/') {
                        if (asprintf(&filename, "%s%s", *path, service) < 0) {
-                               openpam_log(PAM_LOG_ERROR, "asprintf(): %m");
+                               openpam_log(PAM_LOG_ERROR, "asprintf(): %s",
+                                   strerror(errno));
                                return (PAM_BUF_ERR);
                        }
                        ret = openpam_parse_chain(pamh, service, facility,
diff -r a426d8dad673 -r 2cb64f9684a6 external/bsd/openpam/dist/lib/openpam_dynamic.c
--- a/external/bsd/openpam/dist/lib/openpam_dynamic.c   Tue Jan 03 17:49:57 2012 +0000
+++ b/external/bsd/openpam/dist/lib/openpam_dynamic.c   Tue Jan 03 18:56:49 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: openpam_dynamic.c,v 1.2 2011/12/25 22:27:55 christos Exp $     */
+/*     $NetBSD: openpam_dynamic.c,v 1.3 2012/01/03 18:56:49 christos Exp $     */
 
 /*-
  * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
@@ -82,7 +82,7 @@
 {
        const pam_module_t *dlmodule;
        pam_module_t *module;
-       const char *prefix;
+       const char *prefix, *epath = path;
        char *vpath;
        void *dlh;
        int i, serrno;
@@ -98,6 +98,7 @@
        /* try versioned module first, then unversioned module */
        if (asprintf(&vpath, "%s/%s.%d", prefix, path, LIB_MAJ) < 0)
                goto err;
+       epath = vpath;
        if ((dlh = try_dlopen(vpath)) == NULL && errno == ENOENT) {
                *strrchr(vpath, '.') = '\0';
                dlh = try_dlopen(vpath);
@@ -126,7 +127,7 @@
                dlclose(dlh);
        FREE(module);
 err:
-       openpam_log(PAM_LOG_ERROR, "%m");
+       openpam_log(PAM_LOG_ERROR, "%s: %s", epath, strerror(errno));
        return (NULL);
 }
 
diff -r a426d8dad673 -r 2cb64f9684a6 external/bsd/openpam/dist/lib/openpam_ttyconv.c
--- a/external/bsd/openpam/dist/lib/openpam_ttyconv.c   Tue Jan 03 17:49:57 2012 +0000
+++ b/external/bsd/openpam/dist/lib/openpam_ttyconv.c   Tue Jan 03 18:56:49 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: openpam_ttyconv.c,v 1.2 2011/12/25 22:27:55 christos Exp $     */
+/*     $NetBSD: openpam_ttyconv.c,v 1.3 2012/01/03 18:56:49 christos Exp $     */
 
 /*-
  * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
@@ -151,13 +151,13 @@
 
        fd = fileno(infp);
        if (tcgetattr(fd, &tattr) != 0) {
-               openpam_log(PAM_LOG_ERROR, "tcgetattr(): %m");
+               openpam_log(PAM_LOG_ERROR, "tcgetattr(): %s", strerror(errno));
                return (NULL);
        }
        lflag = tattr.c_lflag;
        tattr.c_lflag &= ~ECHO;
        if (tcsetattr(fd, TCSAFLUSH, &tattr) != 0) {
-               openpam_log(PAM_LOG_ERROR, "tcsetattr(): %m");
+               openpam_log(PAM_LOG_ERROR, "tcsetattr(): %s", strerror(errno));
                return (NULL);
        }
        ret = prompt(msg, infp, outfp, errfp);



Home | Main Index | Thread Index | Old Index