Bugzilla – Attachment 1805 Details for
Bug 1732
Proper utmpx support for FreeBSD HEAD
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
OpenSSH + FreeBSD's utmpx
openssh.diff (text/plain), 4.30 KB, created by
Ed Schouten
on 2010-03-06 22:00:08 AEDT
(
hide
)
Description:
OpenSSH + FreeBSD's utmpx
Filename:
MIME Type:
Creator:
Ed Schouten
Created:
2010-03-06 22:00:08 AEDT
Size:
4.30 KB
patch
obsolete
>Index: configure.ac >=================================================================== >RCS file: /cvs/openssh/configure.ac,v >retrieving revision 1.434 >diff -u -r1.434 configure.ac >--- configure.ac 9 Jan 2010 23:26:58 -0000 1.434 >+++ configure.ac 13 Jan 2010 21:00:38 -0000 >@@ -1522,8 +1522,8 @@ > AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent) > AC_CHECK_FUNCS(utmpname) > dnl Checks for utmpx functions >-AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline ) >-AC_CHECK_FUNCS(setutxent utmpxname) >+AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline getutxuser pututxline) >+AC_CHECK_FUNCS(setutxdb setutxent utmpxname) > dnl Checks for lastlog functions > AC_CHECK_FUNCS(getlastlogxbyname) > >@@ -4115,34 +4115,6 @@ > [Define if you want to specify the path to your wtmp file]) > fi > >- >-dnl utmpx detection - I don't know any system so perverse as to require >-dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out >-dnl there, though. >-AC_MSG_CHECKING([if your system defines UTMPX_FILE]) >-AC_TRY_COMPILE([ >-#include <sys/types.h> >-#include <utmp.h> >-#ifdef HAVE_UTMPX_H >-#include <utmpx.h> >-#endif >-#ifdef HAVE_PATHS_H >-# include <paths.h> >-#endif >- ], >- [ char *utmpx = UTMPX_FILE; ], >- [ AC_MSG_RESULT(yes) ], >- [ AC_MSG_RESULT(no) >- system_utmpx_path=no ] >-) >-if test -z "$conf_utmpx_location"; then >- if test x"$system_utmpx_path" = x"no" ; then >- AC_DEFINE(DISABLE_UTMPX) >- fi >-else >- AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location", >- [Define if you want to specify the path to your utmpx file]) >-fi > > dnl wtmpx detection > AC_MSG_CHECKING([if your system defines WTMPX_FILE]) >Index: defines.h >=================================================================== >RCS file: /cvs/openssh/defines.h,v >retrieving revision 1.158 >diff -u -r1.158 defines.h >--- defines.h 9 Jan 2010 11:33:37 -0000 1.158 >+++ defines.h 13 Jan 2010 21:00:38 -0000 >@@ -674,7 +674,7 @@ > #else > /* Simply select your favourite login types. */ > /* Can't do if-else because some systems use several... <sigh> */ >-# if defined(UTMPX_FILE) && !defined(DISABLE_UTMPX) >+# if !defined(DISABLE_UTMPX) > # define USE_UTMPX > # endif > # if defined(UTMP_FILE) && !defined(DISABLE_UTMP) >Index: loginrec.c >=================================================================== >RCS file: /cvs/openssh/loginrec.c,v >retrieving revision 1.85 >diff -u -r1.85 loginrec.c >--- loginrec.c 9 Jan 2010 07:18:04 -0000 1.85 >+++ loginrec.c 13 Jan 2010 21:00:39 -0000 >@@ -207,6 +207,7 @@ > > int getlast_entry(struct logininfo *li); > int lastlog_get_entry(struct logininfo *li); >+int utmpx_get_entry(struct logininfo *li); > int wtmp_get_entry(struct logininfo *li); > int wtmpx_get_entry(struct logininfo *li); > >@@ -508,6 +509,10 @@ > #ifdef USE_LASTLOG > return(lastlog_get_entry(li)); > #else /* !USE_LASTLOG */ >+#if defined(USE_UTMPX) && defined(HAVE_SETUTXDB) && \ >+ defined(UTXDB_LASTLOGIN) && defined(HAVE_GETUTXUSER) >+ return (utmpx_get_entry(li)); >+#endif > > #if defined(DISABLE_LASTLOG) > /* On some systems we shouldn't even try to obtain last login >@@ -1607,6 +1612,32 @@ > } > #endif /* HAVE_GETLASTLOGXBYNAME */ > #endif /* USE_LASTLOG */ >+ >+#if defined(USE_UTMPX) && defined(HAVE_SETUTXDB) && \ >+ defined(UTXDB_LASTLOGIN) && defined(HAVE_GETUTXUSER) >+int >+utmpx_get_entry(struct logininfo *li) >+{ >+ struct utmpx *utx; >+ >+ if (setutxdb(UTXDB_LASTLOGIN, NULL) != 0) >+ return (0); >+ utx = getutxuser(li->username); >+ if (utx == NULL) { >+ endutxent(); >+ return (0); >+ } >+ >+ line_fullname(li->line, utx->ut_line, >+ MIN_SIZEOF(li->line, utx->ut_line)); >+ strlcpy(li->hostname, utx->ut_host, >+ MIN_SIZEOF(li->hostname, utx->ut_host)); >+ li->tv_sec = utx->ut_tv.tv_sec; >+ li->tv_usec = utx->ut_tv.tv_usec; >+ endutxent(); >+ return (1); >+} >+#endif /* USE_UTMPX && HAVE_SETUTXDB && UTXDB_LASTLOGIN && HAVE_GETUTXUSER */ > > #ifdef USE_BTMP > /* >Index: logintest.c >=================================================================== >RCS file: /cvs/openssh/logintest.c,v >retrieving revision 1.15 >diff -u -r1.15 logintest.c >--- logintest.c 24 Jul 2006 04:51:01 -0000 1.15 >+++ logintest.c 13 Jan 2010 21:00:39 -0000 >@@ -264,7 +264,7 @@ > printf("\tUSE_UTMP (UTMP_FILE=%s)\n", UTMP_FILE); > #endif > #ifdef USE_UTMPX >- printf("\tUSE_UTMPX (UTMPX_FILE=%s)\n", UTMPX_FILE); >+ printf("\tUSE_UTMPX\n"); > #endif > #ifdef USE_WTMP > printf("\tUSE_WTMP (WTMP_FILE=%s)\n", WTMP_FILE);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1732
: 1805