+2010-07-08 Markus Gutschke <markus@shellinabox.com>
+
+ * Added support for systems that have utmpx.h, but don't implement
+ updwtmpx().
+
2010-07-02 Markus Gutschke <markus@shellinabox.com>
* Fixed a NULL pointer dereference that can occur when hostnames
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
+/* Define to 1 if you have support for updwtmp */
+#define HAVE_UPDWTMP 1
+
+/* Define to 1 if you have support for updwtmpx */
+#define HAVE_UPDWTMPX 1
+
/* Define to 1 if you have the <util.h> header file. */
/* #undef HAVE_UTIL_H */
#define STDC_HEADERS 1
/* Most recent revision number in the version control system */
-#define VCS_REVISION "206"
+#define VCS_REVISION "207"
/* Version number of package */
#define VERSION "2.10"
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define to 1 if you have support for updwtmp */
+#undef HAVE_UPDWTMP
+
+/* Define to 1 if you have support for updwtmpx */
+#undef HAVE_UPDWTMPX
+
/* Define to 1 if you have the <util.h> header file. */
#undef HAVE_UTIL_H
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-VCS_REVISION=206
+VCS_REVISION=207
cat >>confdefs.h <<_ACEOF
$as_echo "#define HAVE_ISNAN 1" >>confdefs.h
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <utmp.h>
+int
+main ()
+{
+updwtmp(0, 0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+$as_echo "#define HAVE_UPDWTMP 1" >>confdefs.h
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <utmpx.h>
+int
+main ()
+{
+updwtmpx(0, 0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+$as_echo "#define HAVE_UPDWTMPX 1" >>confdefs.h
+
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
dnl This is the one location where the authoritative version number is stored
AC_INIT(shellinabox, 2.10, markus@shellinabox.com)
-VCS_REVISION=206
+VCS_REVISION=207
AC_SUBST(VCS_REVISION)
AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}",
[Most recent revision number in the version control system])
[AC_DEFINE(HAVE_ISNAN, 1,
Define to 1 if you have support for isnan)])
+dnl Even if utmpx.h exists, not all systems have support for updwtmpx()
+AC_TRY_LINK([#include <utmp.h>],
+ [updwtmp(0, 0);],
+ [AC_DEFINE(HAVE_UPDWTMP, 1,
+ Define to 1 if you have support for updwtmp)])
+AC_TRY_LINK([#include <utmpx.h>],
+ [updwtmpx(0, 0);],
+ [AC_DEFINE(HAVE_UPDWTMPX, 1,
+ Define to 1 if you have support for updwtmpx)])
+
dnl On some systems, calling /bin/login does not work. Disable the LOGIN
dnl feature, if the user tells us that it does not do the right thing.
AC_ARG_ENABLE(login,
};
VT100.prototype.about = function() {
- alert("VT100 Terminal Emulator " + "2.10 (revision 206)" +
+ alert("VT100 Terminal Emulator " + "2.10 (revision 207)" +
"\nCopyright 2008-2010 by Markus Gutschke\n" +
"For more information check http://shellinabox.com");
};
return utmp;
}
+#if defined(HAVE_UPDWTMP) && !defined(HAVE_UPDWTMPX)
+#define min(a,b) ({ typeof(a) _a=(a); typeof(b) _b=(b); _a < _b ? _a : _b; })
+#define updwtmpx x_updwtmpx
+
+static void updwtmpx(const char *wtmpx_file, const struct utmpx *utx) {
+ struct utmp ut = { 0 };
+ ut.ut_type = utx->ut_type;
+ ut.ut_pid = utx->ut_pid;
+ ut.ut_session = utx->ut_session;
+ ut.ut_tv.tv_sec = utx->ut_tv.tv_sec;
+ ut.ut_tv.tv_usec = utx->ut_tv.tv_usec;
+ memcpy(&ut.ut_line, &utx->ut_line,
+ min(sizeof(ut.ut_line), sizeof(utx->ut_line)));
+ memcpy(&ut.ut_id, &utx->ut_id,
+ min(sizeof(ut.ut_id), sizeof(utx->ut_id)));
+ memcpy(&ut.ut_user, &utx->ut_user,
+ min(sizeof(ut.ut_user), sizeof(utx->ut_user)));
+ memcpy(&ut.ut_host, &utx->ut_host,
+ min(sizeof(ut.ut_host), sizeof(utx->ut_host)));
+ memcpy(&ut.ut_exit, &utx->ut_exit,
+ min(sizeof(ut.ut_exit), sizeof(utx->ut_exit)));
+ memcpy(&ut.ut_addr_v6, &utx->ut_addr_v6,
+ min(sizeof(ut.ut_addr_v6), sizeof(utx->ut_addr_v6)));
+ updwtmp(wtmpx_file, &ut);
+}
+#endif
+
void destroyUtmp(struct Utmp *utmp) {
if (utmp) {
if (utmp->pty >= 0) {
setutxent();
pututxline(&utmp->utmpx);
endutxent();
+
+#if defined(HAVE_UPDWTMP) || defined(HAVE_UPDWTMPX)
if (!utmp->useLogin) {
updwtmpx("/var/log/wtmp", &utmp->utmpx);
}
+#endif
// Switch back to the lower privileges
check(!setresgid(r_gid, e_gid, s_gid));
setutxent();
pututxline(&utmp->utmpx);
endutxent();
+
+#if defined(HAVE_UPDWTMP) || defined(HAVE_UPDWTMPX)
updwtmpx("/var/log/wtmp", &utmp->utmpx);
+#endif
}
#endif
}
pututxline(&utmpx);
endutxent();
+
+#if defined(HAVE_UPDWTMP) || defined(HAVE_UPDWTMPX)
if (!utmp->useLogin) {
memset(&utmpx.ut_user, 0, sizeof(utmpx.ut_user));
strncat(&utmpx.ut_user[0], "LOGIN", sizeof(utmpx.ut_user));
updwtmpx("/var/log/wtmp", &utmpx);
}
+#endif
#endif
// Create session. We might have to fork another process as PAM wants us
};
ShellInABox.prototype.about = function() {
- alert("Shell In A Box version " + "2.10 (revision 206)" +
+ alert("Shell In A Box version " + "2.10 (revision 207)" +
"\nCopyright 2008-2010 by Markus Gutschke\n" +
"For more information check http://shellinabox.com" +
(typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ?
};
VT100.prototype.about = function() {
- alert("VT100 Terminal Emulator " + "2.10 (revision 206)" +
+ alert("VT100 Terminal Emulator " + "2.10 (revision 207)" +
"\nCopyright 2008-2010 by Markus Gutschke\n" +
"For more information check http://shellinabox.com");
};