summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordamien <damien>2000-05-20 04:53:09 +0000
committerdamien <damien>2000-05-20 04:53:09 +0000
commit4a90a8007fcf0bdf4dd00b5cc1eb16f8b7be4043 (patch)
treebb0c3fc2f3cb9cbf4a27e27ddc9a6a2f70aa7898
parent50aea5ed6ca7b085e00c78bca0efcb342542c22e (diff)
downloadopenssh-4a90a8007fcf0bdf4dd00b5cc1eb16f8b7be4043.tar.gz
- Don't touch utmp if USE_UTMPX defined
-rw-r--r--ChangeLog1
-rw-r--r--acconfig.h1
-rw-r--r--bsd-login.c14
-rw-r--r--configure.in1
4 files changed, 15 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a4e0d739..9f7f21c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
20000520
- Xauth fix from Markus Friedl <markus.friedl@informatik.uni-erlangen.de>
+ - Don't touch utmp if USE_UTMPX defined
20000518
- Include Andre Lucas' fixprogs script. Forgot to "cvs add" it yesterday
diff --git a/acconfig.h b/acconfig.h
index 9a2c1af5..b3e11fe9 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -50,6 +50,7 @@
#undef HAVE_SYSLEN_IN_UTMPX
#undef HAVE_PID_IN_UTMP
#undef HAVE_TYPE_IN_UTMP
+#undef HAVE_TYPE_IN_UTMPX
#undef HAVE_TV_IN_UTMP
#undef HAVE_ID_IN_UTMP
diff --git a/bsd-login.c b/bsd-login.c
index 6a80928e..de49214c 100644
--- a/bsd-login.c
+++ b/bsd-login.c
@@ -73,7 +73,7 @@ struct utmp * utp;
int t = 0;
struct utmp * u;
-#ifdef HAVE_TYPE_IN_UTMP
+#if defined(HAVE_TYPE_IN_UTMP) || defined(HAVE_TYPE_IN_UTMPX)
setutent();
while((u = getutent()) != NULL) {
@@ -123,16 +123,26 @@ login(utp)
*/
tty = find_tty_slot(utp);
+#ifdef USE_UTMPX
+ fd = open(_PATH_UTMPX, O_RDWR|O_CREAT, 0644);
+ if (fd == -1) {
+ log("Couldn't open %s: %s", _PATH_UTMPX, strerror(errno));
+#else /* USE_UTMPX */
fd = open(_PATH_UTMP, O_RDWR|O_CREAT, 0644);
if (fd == -1) {
log("Couldn't open %s: %s", _PATH_UTMP, strerror(errno));
+#endif /* USE_UTMPX */
} else {
/* If no tty was found... */
if (tty == -1) {
/* ... append it to utmp on login */
-#ifdef HAVE_TYPE_IN_UTMP
+#if defined(HAVE_TYPE_IN_UTMP) || defined(HAVE_TYPE_IN_UTMPX)
if (utp->ut_type == USER_PROCESS) {
+#ifdef USE_UTMPX
+ if ((fd = open(_PATH_UTMPX, O_WRONLY|O_APPEND, 0)) >= 0) {
+#else /* USE_UTMPX */
if ((fd = open(_PATH_UTMP, O_WRONLY|O_APPEND, 0)) >= 0) {
+#endif /* USE_UTMPX */
(void)write(fd, utp, sizeof(struct utmp));
(void)close(fd);
}
diff --git a/configure.in b/configure.in
index ba36417a..43749046 100644
--- a/configure.in
+++ b/configure.in
@@ -494,6 +494,7 @@ OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
+OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)