diff options
author | Damien Miller <djm@mindrot.org> | 1999-12-21 09:51:36 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 1999-12-21 09:51:36 +1100 |
commit | 368cf64d5c7cee6eb85d9240ea04ccf43273b5fc (patch) | |
tree | 19b5ce1233714df994e9e1699e791d269c577d2c | |
parent | fdb7caf293e860fda343f9cc98ff3342ed997b73 (diff) |
Made utmpx optional
-rw-r--r-- | acconfig.h | 11 | ||||
-rw-r--r-- | bsd-login.c | 6 | ||||
-rw-r--r-- | configure.in | 6 | ||||
-rw-r--r-- | login.c | 6 |
4 files changed, 19 insertions, 10 deletions
diff --git a/acconfig.h b/acconfig.h index 35d4fb4bb..bbb992816 100644 --- a/acconfig.h +++ b/acconfig.h | |||
@@ -27,6 +27,9 @@ | |||
27 | /* Define is utmpx.h has a ut_host field */ | 27 | /* Define is utmpx.h has a ut_host field */ |
28 | #undef HAVE_HOST_IN_UTMPX | 28 | #undef HAVE_HOST_IN_UTMPX |
29 | 29 | ||
30 | /* Define if you want to use utmpx */ | ||
31 | #undef USE_UTMPX | ||
32 | |||
30 | /* Define is libutil has login() function */ | 33 | /* Define is libutil has login() function */ |
31 | #undef HAVE_LIBUTIL_LOGIN | 34 | #undef HAVE_LIBUTIL_LOGIN |
32 | 35 | ||
@@ -91,7 +94,7 @@ | |||
91 | # include <utmp.h> /* For _PATH_XXX */ | 94 | # include <utmp.h> /* For _PATH_XXX */ |
92 | #endif | 95 | #endif |
93 | 96 | ||
94 | #ifdef HAVE_UTMPX_H | 97 | #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) |
95 | # include <utmpx.h> /* For _PATH_XXX */ | 98 | # include <utmpx.h> /* For _PATH_XXX */ |
96 | #endif | 99 | #endif |
97 | 100 | ||
@@ -183,7 +186,7 @@ enum | |||
183 | #endif | 186 | #endif |
184 | 187 | ||
185 | /* Use utmpx if supported */ | 188 | /* Use utmpx if supported */ |
186 | #ifdef HAVE_UTMPX_H | 189 | #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) |
187 | # define UTMP_STR utmpx | 190 | # define UTMP_STR utmpx |
188 | #else | 191 | #else |
189 | # ifdef HAVE_UTMP_H | 192 | # ifdef HAVE_UTMP_H |
@@ -192,7 +195,7 @@ enum | |||
192 | #endif | 195 | #endif |
193 | 196 | ||
194 | #ifndef _PATH_UTMP | 197 | #ifndef _PATH_UTMP |
195 | # ifdef UTMPX_FILE | 198 | # if defined(UTMPX_FILE) && defined(USE_UTMPX) |
196 | # define _PATH_UTMP UTMPX_FILE | 199 | # define _PATH_UTMP UTMPX_FILE |
197 | # else | 200 | # else |
198 | # ifdef UTMP_FILE | 201 | # ifdef UTMP_FILE |
@@ -204,7 +207,7 @@ enum | |||
204 | #endif | 207 | #endif |
205 | 208 | ||
206 | #ifndef _PATH_WTMP | 209 | #ifndef _PATH_WTMP |
207 | # ifdef WTMPX_FILE | 210 | # if defined(WTMPX_FILE) && defined(USE_UTMPX) |
208 | # define _PATH_WTMP WTMPX_FILE | 211 | # define _PATH_WTMP WTMPX_FILE |
209 | # else | 212 | # else |
210 | # ifdef WTMP_FILE | 213 | # ifdef WTMP_FILE |
diff --git a/bsd-login.c b/bsd-login.c index a2ec74142..c0f4c1ab0 100644 --- a/bsd-login.c +++ b/bsd-login.c | |||
@@ -45,7 +45,7 @@ static char *rcsid = "$OpenBSD: login.c,v 1.5 1998/07/13 02:11:12 millert Exp $" | |||
45 | #include <fcntl.h> | 45 | #include <fcntl.h> |
46 | #include <unistd.h> | 46 | #include <unistd.h> |
47 | #include <stdlib.h> | 47 | #include <stdlib.h> |
48 | #ifdef HAVE_UTMPX_H | 48 | #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) |
49 | # include <utmpx.h> | 49 | # include <utmpx.h> |
50 | #endif | 50 | #endif |
51 | #ifdef HAVE_UTMP_H | 51 | #ifdef HAVE_UTMP_H |
@@ -64,7 +64,7 @@ login(utp) | |||
64 | 64 | ||
65 | #ifndef UT_LINESIZE | 65 | #ifndef UT_LINESIZE |
66 | # define UT_LINESIZE (sizeof(old_ut.ut_line)) | 66 | # define UT_LINESIZE (sizeof(old_ut.ut_line)) |
67 | # ifdef HAVE_UTMPX_H | 67 | # if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) |
68 | # define UT_NAMESIZE (sizeof(old_ut.ut_user)) | 68 | # define UT_NAMESIZE (sizeof(old_ut.ut_user)) |
69 | # else | 69 | # else |
70 | # define UT_NAMESIZE (sizeof(old_ut.ut_name)) | 70 | # define UT_NAMESIZE (sizeof(old_ut.ut_name)) |
@@ -72,7 +72,7 @@ login(utp) | |||
72 | # ifdef HAVE_HOST_IN_UTMP | 72 | # ifdef HAVE_HOST_IN_UTMP |
73 | # define UT_HOSTSIZE (sizeof(old_ut.ut_host)) | 73 | # define UT_HOSTSIZE (sizeof(old_ut.ut_host)) |
74 | # endif | 74 | # endif |
75 | # ifdef HAVE_HOST_IN_UTMPX | 75 | # if defined(HAVE_HOST_IN_UTMPX) && defined(USE_UTMPX) |
76 | # define UT_HOSTSIZE (sizeof(old_ut.ut_host)) | 76 | # define UT_HOSTSIZE (sizeof(old_ut.ut_host)) |
77 | # endif | 77 | # endif |
78 | #endif | 78 | #endif |
diff --git a/configure.in b/configure.in index 19372e2d5..86d6a3241 100644 --- a/configure.in +++ b/configure.in | |||
@@ -290,6 +290,12 @@ AC_ARG_WITH(md5-passwords, | |||
290 | [AC_DEFINE(HAVE_MD5_PASSWORDS)] | 290 | [AC_DEFINE(HAVE_MD5_PASSWORDS)] |
291 | ) | 291 | ) |
292 | 292 | ||
293 | dnl Check whether to enable utmpx support | ||
294 | AC_ARG_WITH(utmpx, | ||
295 | [ --with-utmpx Enable utmpx support], | ||
296 | [AC_DEFINE(USE_UTMPX)] | ||
297 | ) | ||
298 | |||
293 | dnl Check for the path to xauth | 299 | dnl Check for the path to xauth |
294 | AC_PATH_PROG(xauth_path, xauth) | 300 | AC_PATH_PROG(xauth_path, xauth) |
295 | AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path") | 301 | AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path") |
@@ -18,9 +18,9 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "includes.h" | 20 | #include "includes.h" |
21 | RCSID("$Id: login.c,v 1.6 1999/12/08 23:16:55 damien Exp $"); | 21 | RCSID("$Id: login.c,v 1.7 1999/12/20 22:51:36 damien Exp $"); |
22 | 22 | ||
23 | #ifdef HAVE_UTMPX_H | 23 | #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) |
24 | # include <utmpx.h> | 24 | # include <utmpx.h> |
25 | #endif | 25 | #endif |
26 | #ifdef HAVE_UTMP_H | 26 | #ifdef HAVE_UTMP_H |
@@ -94,7 +94,7 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid, | |||
94 | /* Construct an utmp/wtmp entry. */ | 94 | /* Construct an utmp/wtmp entry. */ |
95 | memset(&u, 0, sizeof(u)); | 95 | memset(&u, 0, sizeof(u)); |
96 | strncpy(u.ut_line, ttyname + 5, sizeof(u.ut_line)); | 96 | strncpy(u.ut_line, ttyname + 5, sizeof(u.ut_line)); |
97 | #ifdef HAVE_UTMPX_H | 97 | #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) |
98 | u.ut_tv.tv_sec = time(NULL); | 98 | u.ut_tv.tv_sec = time(NULL); |
99 | strncpy(u.ut_user, user, sizeof(u.ut_name)); | 99 | strncpy(u.ut_user, user, sizeof(u.ut_name)); |
100 | #else | 100 | #else |