diff options
author | Damien Miller <djm@mindrot.org> | 2000-05-20 14:53:09 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-05-20 14:53:09 +1000 |
commit | ad1bc5f986ac31ea3f429d2c49d7f34bd78e32fc (patch) | |
tree | d57ecfd942c6359a560e0a74ad52ea366b148d20 | |
parent | d999ae26b7bad888b7a9b375faa38c1d6a8db1ce (diff) |
- Don't touch utmp if USE_UTMPX defined
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | acconfig.h | 1 | ||||
-rw-r--r-- | bsd-login.c | 14 | ||||
-rw-r--r-- | configure.in | 1 |
4 files changed, 15 insertions, 2 deletions
@@ -1,5 +1,6 @@ | |||
1 | 20000520 | 1 | 20000520 |
2 | - Xauth fix from Markus Friedl <markus.friedl@informatik.uni-erlangen.de> | 2 | - Xauth fix from Markus Friedl <markus.friedl@informatik.uni-erlangen.de> |
3 | - Don't touch utmp if USE_UTMPX defined | ||
3 | 4 | ||
4 | 20000518 | 5 | 20000518 |
5 | - Include Andre Lucas' fixprogs script. Forgot to "cvs add" it yesterday | 6 | - Include Andre Lucas' fixprogs script. Forgot to "cvs add" it yesterday |
diff --git a/acconfig.h b/acconfig.h index 9a2c1af5d..b3e11fe9c 100644 --- a/acconfig.h +++ b/acconfig.h | |||
@@ -50,6 +50,7 @@ | |||
50 | #undef HAVE_SYSLEN_IN_UTMPX | 50 | #undef HAVE_SYSLEN_IN_UTMPX |
51 | #undef HAVE_PID_IN_UTMP | 51 | #undef HAVE_PID_IN_UTMP |
52 | #undef HAVE_TYPE_IN_UTMP | 52 | #undef HAVE_TYPE_IN_UTMP |
53 | #undef HAVE_TYPE_IN_UTMPX | ||
53 | #undef HAVE_TV_IN_UTMP | 54 | #undef HAVE_TV_IN_UTMP |
54 | #undef HAVE_ID_IN_UTMP | 55 | #undef HAVE_ID_IN_UTMP |
55 | 56 | ||
diff --git a/bsd-login.c b/bsd-login.c index 6a80928e0..de49214c0 100644 --- a/bsd-login.c +++ b/bsd-login.c | |||
@@ -73,7 +73,7 @@ struct utmp * utp; | |||
73 | int t = 0; | 73 | int t = 0; |
74 | struct utmp * u; | 74 | struct utmp * u; |
75 | 75 | ||
76 | #ifdef HAVE_TYPE_IN_UTMP | 76 | #if defined(HAVE_TYPE_IN_UTMP) || defined(HAVE_TYPE_IN_UTMPX) |
77 | setutent(); | 77 | setutent(); |
78 | 78 | ||
79 | while((u = getutent()) != NULL) { | 79 | while((u = getutent()) != NULL) { |
@@ -123,16 +123,26 @@ login(utp) | |||
123 | */ | 123 | */ |
124 | tty = find_tty_slot(utp); | 124 | tty = find_tty_slot(utp); |
125 | 125 | ||
126 | #ifdef USE_UTMPX | ||
127 | fd = open(_PATH_UTMPX, O_RDWR|O_CREAT, 0644); | ||
128 | if (fd == -1) { | ||
129 | log("Couldn't open %s: %s", _PATH_UTMPX, strerror(errno)); | ||
130 | #else /* USE_UTMPX */ | ||
126 | fd = open(_PATH_UTMP, O_RDWR|O_CREAT, 0644); | 131 | fd = open(_PATH_UTMP, O_RDWR|O_CREAT, 0644); |
127 | if (fd == -1) { | 132 | if (fd == -1) { |
128 | log("Couldn't open %s: %s", _PATH_UTMP, strerror(errno)); | 133 | log("Couldn't open %s: %s", _PATH_UTMP, strerror(errno)); |
134 | #endif /* USE_UTMPX */ | ||
129 | } else { | 135 | } else { |
130 | /* If no tty was found... */ | 136 | /* If no tty was found... */ |
131 | if (tty == -1) { | 137 | if (tty == -1) { |
132 | /* ... append it to utmp on login */ | 138 | /* ... append it to utmp on login */ |
133 | #ifdef HAVE_TYPE_IN_UTMP | 139 | #if defined(HAVE_TYPE_IN_UTMP) || defined(HAVE_TYPE_IN_UTMPX) |
134 | if (utp->ut_type == USER_PROCESS) { | 140 | if (utp->ut_type == USER_PROCESS) { |
141 | #ifdef USE_UTMPX | ||
142 | if ((fd = open(_PATH_UTMPX, O_WRONLY|O_APPEND, 0)) >= 0) { | ||
143 | #else /* USE_UTMPX */ | ||
135 | if ((fd = open(_PATH_UTMP, O_WRONLY|O_APPEND, 0)) >= 0) { | 144 | if ((fd = open(_PATH_UTMP, O_WRONLY|O_APPEND, 0)) >= 0) { |
145 | #endif /* USE_UTMPX */ | ||
136 | (void)write(fd, utp, sizeof(struct utmp)); | 146 | (void)write(fd, utp, sizeof(struct utmp)); |
137 | (void)close(fd); | 147 | (void)close(fd); |
138 | } | 148 | } |
diff --git a/configure.in b/configure.in index ba36417aa..43749046c 100644 --- a/configure.in +++ b/configure.in | |||
@@ -494,6 +494,7 @@ OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX) | |||
494 | OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX) | 494 | OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX) |
495 | OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP) | 495 | OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP) |
496 | OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP) | 496 | OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP) |
497 | OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX) | ||
497 | OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP) | 498 | OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP) |
498 | OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP) | 499 | OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP) |
499 | OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP) | 500 | OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP) |