Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libpam/modules avoid using %m in format.
details: https://anonhg.NetBSD.org/src/rev/5d96d4da58f9
branches: trunk
changeset: 772427:5d96d4da58f9
user: christos <christos%NetBSD.org@localhost>
date: Tue Jan 03 19:02:54 2012 +0000
description:
avoid using %m in format.
diffstat:
lib/libpam/modules/pam_chroot/pam_chroot.c | 9 +++++----
lib/libpam/modules/pam_exec/pam_exec.c | 10 +++++-----
lib/libpam/modules/pam_ftpusers/pam_ftpusers.c | 7 ++++---
lib/libpam/modules/pam_lastlog/pam_lastlog.c | 14 ++++++++------
lib/libpam/modules/pam_login_access/login_access.c | 6 +++---
lib/libpam/modules/pam_ssh/pam_ssh.c | 16 ++++++++--------
6 files changed, 33 insertions(+), 29 deletions(-)
diffs (241 lines):
diff -r 2cb64f9684a6 -r 5d96d4da58f9 lib/libpam/modules/pam_chroot/pam_chroot.c
--- a/lib/libpam/modules/pam_chroot/pam_chroot.c Tue Jan 03 18:56:49 2012 +0000
+++ b/lib/libpam/modules/pam_chroot/pam_chroot.c Tue Jan 03 19:02:54 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pam_chroot.c,v 1.4 2005/04/19 03:15:34 christos Exp $ */
+/* $NetBSD: pam_chroot.c,v 1.5 2012/01/03 19:02:54 christos Exp $ */
/*-
* Copyright (c) 2003 Networks Associates Technology, Inc.
@@ -38,7 +38,7 @@
#ifdef __FreeBSD__
__FBSDID("$FreeBSD: src/lib/libpam/modules/pam_chroot/pam_chroot.c,v 1.3 2003/04/30 00:40:24 des Exp $");
#else
-__RCSID("$NetBSD: pam_chroot.c,v 1.4 2005/04/19 03:15:34 christos Exp $");
+__RCSID("$NetBSD: pam_chroot.c,v 1.5 2012/01/03 19:02:54 christos Exp $");
#endif
#include <sys/param.h>
@@ -46,6 +46,7 @@
#include <pwd.h>
#include <stdio.h>
#include <string.h>
+#include <errno.h>
#include <unistd.h>
#define PAM_SM_SESSION
@@ -96,11 +97,11 @@
openpam_log(PAM_LOG_DEBUG, "chrooting %s to %s", dir, user);
if (chroot(dir) == -1) {
- openpam_log(PAM_LOG_ERROR, "chroot(): %m");
+ openpam_log(PAM_LOG_ERROR, "chroot(): %s", strerror(errno));
return (PAM_SESSION_ERR);
}
if (chdir(cwd) == -1) {
- openpam_log(PAM_LOG_ERROR, "chdir(): %m");
+ openpam_log(PAM_LOG_ERROR, "chdir(): %s", strerror(errno));
return (PAM_SESSION_ERR);
}
pam_setenv(pamh, "HOME", cwd, 1);
diff -r 2cb64f9684a6 -r 5d96d4da58f9 lib/libpam/modules/pam_exec/pam_exec.c
--- a/lib/libpam/modules/pam_exec/pam_exec.c Tue Jan 03 18:56:49 2012 +0000
+++ b/lib/libpam/modules/pam_exec/pam_exec.c Tue Jan 03 19:02:54 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pam_exec.c,v 1.5 2011/02/03 02:05:59 christos Exp $ */
+/* $NetBSD: pam_exec.c,v 1.6 2012/01/03 19:02:54 christos Exp $ */
/*-
* Copyright (c) 2001,2003 Networks Associates Technology, Inc.
@@ -38,7 +38,7 @@
#ifdef __FreeBSD__
__FBSDID("$FreeBSD: src/lib/libpam/modules/pam_exec/pam_exec.c,v 1.4 2005/02/01 10:37:07 des Exp $");
#else
-__RCSID("$NetBSD: pam_exec.c,v 1.5 2011/02/03 02:05:59 christos Exp $");
+__RCSID("$NetBSD: pam_exec.c,v 1.6 2012/01/03 19:02:54 christos Exp $");
#endif
#include <sys/types.h>
@@ -128,15 +128,15 @@
}
openpam_free_envlist(envlist);
if (pid == -1) {
- openpam_log(PAM_LOG_ERROR, "vfork(): %m");
+ openpam_log(PAM_LOG_ERROR, "vfork(): %s", strerror(errno));
return (PAM_SYSTEM_ERR);
}
if (waitpid(pid, &status, 0) == -1) {
- openpam_log(PAM_LOG_ERROR, "waitpid(): %m");
+ openpam_log(PAM_LOG_ERROR, "waitpid(): %s", strerror(errno));
return (PAM_SYSTEM_ERR);
}
if (childerr != 0) {
- openpam_log(PAM_LOG_ERROR, "execve(): %m");
+ openpam_log(PAM_LOG_ERROR, "execve(): %s", strerror(errno));
return (PAM_SYSTEM_ERR);
}
if (WIFSIGNALED(status)) {
diff -r 2cb64f9684a6 -r 5d96d4da58f9 lib/libpam/modules/pam_ftpusers/pam_ftpusers.c
--- a/lib/libpam/modules/pam_ftpusers/pam_ftpusers.c Tue Jan 03 18:56:49 2012 +0000
+++ b/lib/libpam/modules/pam_ftpusers/pam_ftpusers.c Tue Jan 03 19:02:54 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pam_ftpusers.c,v 1.5 2005/04/19 13:04:38 christos Exp $ */
+/* $NetBSD: pam_ftpusers.c,v 1.6 2012/01/03 19:02:55 christos Exp $ */
/*-
* Copyright (c) 2001 Networks Associates Technology, Inc.
@@ -38,7 +38,7 @@
#ifdef __FreeBSD__
__FBSDID("$FreeBSD: src/lib/libpam/modules/pam_ftpusers/pam_ftpusers.c,v 1.1 2002/05/08 00:30:10 des Exp $");
#else
-__RCSID("$NetBSD: pam_ftpusers.c,v 1.5 2005/04/19 13:04:38 christos Exp $");
+__RCSID("$NetBSD: pam_ftpusers.c,v 1.6 2012/01/03 19:02:55 christos Exp $");
#endif
#include <ctype.h>
@@ -46,6 +46,7 @@
#include <paths.h>
#include <pwd.h>
#include <stdio.h>
+#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -80,7 +81,7 @@
found = 0;
ulen = strlen(user);
if ((f = fopen(_PATH_FTPUSERS, "r")) == NULL) {
- PAM_LOG("%s: %m", _PATH_FTPUSERS);
+ PAM_LOG("%s: %s", _PATH_FTPUSERS, strerror(errno));
goto done;
}
while (!found && (line = fgetln(f, &len)) != NULL) {
diff -r 2cb64f9684a6 -r 5d96d4da58f9 lib/libpam/modules/pam_lastlog/pam_lastlog.c
--- a/lib/libpam/modules/pam_lastlog/pam_lastlog.c Tue Jan 03 18:56:49 2012 +0000
+++ b/lib/libpam/modules/pam_lastlog/pam_lastlog.c Tue Jan 03 19:02:54 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pam_lastlog.c,v 1.13 2009/01/26 04:01:14 lukem Exp $ */
+/* $NetBSD: pam_lastlog.c,v 1.14 2012/01/03 19:02:55 christos Exp $ */
/*-
* Copyright (c) 1980, 1987, 1988, 1991, 1993, 1994
@@ -47,7 +47,7 @@
#ifdef __FreeBSD__
__FBSDID("$FreeBSD: src/lib/libpam/modules/pam_lastlog/pam_lastlog.c,v 1.20 2004/01/26 19:28:37 des Exp $");
#else
-__RCSID("$NetBSD: pam_lastlog.c,v 1.13 2009/01/26 04:01:14 lukem Exp $");
+__RCSID("$NetBSD: pam_lastlog.c,v 1.14 2012/01/03 19:02:55 christos Exp $");
#endif
#include <sys/param.h>
@@ -60,6 +60,7 @@
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
+#include <errno.h>
#include <time.h>
#include <unistd.h>
#include <stdarg.h>
@@ -291,10 +292,10 @@
(void)strncpy(utmpx.ut_id, tty, sizeof(utmpx.ut_id));
}
if (pututxline(&utmpx) == NULL)
- logit(LOG_NOTICE, "Cannot update utmpx %m");
+ logit(LOG_NOTICE, "Cannot update utmpx: %s", strerror(errno));
endutxent();
if (updwtmpx(_PATH_WTMPX, &utmpx) != 0)
- logit(LOG_NOTICE, "Cannot update wtmpx %m");
+ logit(LOG_NOTICE, "Cannot update wtmpx: %s", strerror(errno));
}
static void
@@ -323,7 +324,7 @@
(void)memset(&ll.ll_ss, 0, sizeof(ll.ll_ss));
if (updlastlogx(_PATH_LASTLOGX, pwd->pw_uid, &ll) != 0)
- logit(LOG_NOTICE, "Cannot update lastlogx %m");
+ logit(LOG_NOTICE, "Cannot update lastlogx: %s", strerror(errno));
PAM_LOG("Login recorded in %s", _PATH_LASTLOGX);
}
#endif
@@ -352,7 +353,8 @@
int fd;
if ((fd = open(_PATH_LASTLOG, O_RDWR, 0)) == -1) {
- logit(LOG_NOTICE, "Cannot open `%s' %m", _PATH_LASTLOG);
+ logit(LOG_NOTICE, "Cannot open `%s': %s", _PATH_LASTLOG,
+ strerror(errno));
return;
}
(void)lseek(fd, (off_t)(pwd->pw_uid * sizeof(ll)), SEEK_SET);
diff -r 2cb64f9684a6 -r 5d96d4da58f9 lib/libpam/modules/pam_login_access/login_access.c
--- a/lib/libpam/modules/pam_login_access/login_access.c Tue Jan 03 18:56:49 2012 +0000
+++ b/lib/libpam/modules/pam_login_access/login_access.c Tue Jan 03 19:02:54 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: login_access.c,v 1.5 2006/11/03 18:55:40 christos Exp $ */
+/* $NetBSD: login_access.c,v 1.6 2012/01/03 19:02:55 christos Exp $ */
/*
* This module implements a simple but effective form of login access
@@ -19,7 +19,7 @@
#ifdef __FreeBSD__
__FBSDID("$FreeBSD: src/lib/libpam/modules/pam_login_access/login_access.c,v 1.12 2004/03/05 08:10:18 markm Exp $");
#else
-__RCSID("$NetBSD: login_access.c,v 1.5 2006/11/03 18:55:40 christos Exp $");
+__RCSID("$NetBSD: login_access.c,v 1.6 2012/01/03 19:02:55 christos Exp $");
#endif
#include <sys/types.h>
@@ -122,7 +122,7 @@
}
(void) fclose(fp);
} else if (errno != ENOENT) {
- logit(LOG_ERR, "cannot open %s: %m", _PATH_LOGACCESS);
+ logit(LOG_ERR, "cannot open %s: %s", _PATH_LOGACCESS, strerror(errno));
}
return (match == 0 || (line[0] == '+'));
}
diff -r 2cb64f9684a6 -r 5d96d4da58f9 lib/libpam/modules/pam_ssh/pam_ssh.c
--- a/lib/libpam/modules/pam_ssh/pam_ssh.c Tue Jan 03 18:56:49 2012 +0000
+++ b/lib/libpam/modules/pam_ssh/pam_ssh.c Tue Jan 03 19:02:54 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pam_ssh.c,v 1.20 2011/12/16 17:37:14 drochner Exp $ */
+/* $NetBSD: pam_ssh.c,v 1.21 2012/01/03 19:02:55 christos Exp $ */
/*-
* Copyright (c) 2003 Networks Associates Technology, Inc.
@@ -38,7 +38,7 @@
#ifdef __FreeBSD__
__FBSDID("$FreeBSD: src/lib/libpam/modules/pam_ssh/pam_ssh.c,v 1.40 2004/02/10 10:13:21 des Exp $");
#else
-__RCSID("$NetBSD: pam_ssh.c,v 1.20 2011/12/16 17:37:14 drochner Exp $");
+__RCSID("$NetBSD: pam_ssh.c,v 1.21 2012/01/03 19:02:55 christos Exp $");
#endif
#include <sys/param.h>
@@ -306,19 +306,19 @@
#endif
/* child: drop privs, close fds and start agent */
if (setgid(pwd->pw_gid) == -1) {
- openpam_log(PAM_LOG_DEBUG, "%s: Cannot setgid %d (%m)",
- __func__, (int)pwd->pw_gid);
+ openpam_log(PAM_LOG_DEBUG, "%s: Cannot setgid %d (%s)",
+ __func__, (int)pwd->pw_gid, strerror(errno));
goto done;
}
if (initgroups(pwd->pw_name, pwd->pw_gid) == -1) {
openpam_log(PAM_LOG_DEBUG,
- "%s: Cannot initgroups for %s (%m)",
- __func__, pwd->pw_name);
+ "%s: Cannot initgroups for %s (%s)",
+ __func__, pwd->pw_name, strerror(errno));
goto done;
}
if (setuid(pwd->pw_uid) == -1) {
- openpam_log(PAM_LOG_DEBUG, "%s: Cannot setuid %d (%m)",
- __func__, (int)pwd->pw_uid);
+ openpam_log(PAM_LOG_DEBUG, "%s: Cannot setuid %d (%s)",
+ __func__, (int)pwd->pw_uid, strerror(errno));
goto done;
}
(void)close(STDIN_FILENO);
Home |
Main Index |
Thread Index |
Old Index