summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2010-08-12 18:37:43 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2010-08-12 18:37:43 +0000
commit8009b2d5052a7507fbe4b97fafad38fa616bf4a0 (patch)
treee722f7652337e769c691788b3d545e73f9d128b7
parentAdd rc script (diff)
- Fix sparc64 compilation [1]
- Fix utmpx on current [2] PR: ports/149243 [1] Submitted by: Olivier Cochard-labbé <olivier _at_ cochard.me> [1] Tested by: gahr@ Approved by: rene@ (mentor vacation) Obtained from: upstream svn [2]
Notes
Notes: svn path=/head/; revision=259141
-rw-r--r--www/shellinabox/Makefile1
-rw-r--r--www/shellinabox/files/patch-Makefile.in10
-rw-r--r--www/shellinabox/files/patch-config.h.in15
-rw-r--r--www/shellinabox/files/patch-shellinabox__launcher.c74
4 files changed, 100 insertions, 0 deletions
diff --git a/www/shellinabox/Makefile b/www/shellinabox/Makefile
index e4ba89287dce..ba78f432c6b4 100644
--- a/www/shellinabox/Makefile
+++ b/www/shellinabox/Makefile
@@ -7,6 +7,7 @@
PORTNAME= shellinabox
PORTVERSION= 2.10
+PORTREVISION= 1
CATEGORIES= www
MASTER_SITES= ${MASTER_SITE_GOOGLE_CODE}
DISTNAME= ${PORTNAME}-${PORTVERSION}
diff --git a/www/shellinabox/files/patch-Makefile.in b/www/shellinabox/files/patch-Makefile.in
new file mode 100644
index 000000000000..eebebc7ddde6
--- /dev/null
+++ b/www/shellinabox/files/patch-Makefile.in
@@ -0,0 +1,10 @@
+--- ./Makefile.in.orig 2009-11-21 23:47:39.000000000 +0100
++++ ./Makefile.in 2010-08-12 15:05:47.001428510 +0200
+@@ -372,6 +372,7 @@
+ i[0-9]86) echo '-O elf32-i386 -B i386';; \
+ x86_64) echo '-O elf64-x86-64 -B i386:x86-64';; \
+ arm*) echo '-O elf32-littlearm -B arm';; \
++ sparc64) echo '-O elf64-sparc -B sparc';; \
+ esac
+
+ renamesymbols = \
diff --git a/www/shellinabox/files/patch-config.h.in b/www/shellinabox/files/patch-config.h.in
new file mode 100644
index 000000000000..8099bbb7e3b9
--- /dev/null
+++ b/www/shellinabox/files/patch-config.h.in
@@ -0,0 +1,15 @@
+--- ./config.h.in.orig 2009-11-21 23:47:44.000000000 +0100
++++ ./config.h.in 2010-08-12 14:11:16.292619989 +0200
+@@ -105,6 +105,12 @@
+ /* Define to 1 if you have the <utmp.h> header file. */
+ #undef HAVE_UTMP_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 zlib development files are installed */
+ #undef HAVE_ZLIB
+
diff --git a/www/shellinabox/files/patch-shellinabox__launcher.c b/www/shellinabox/files/patch-shellinabox__launcher.c
new file mode 100644
index 000000000000..27ebf55e25ed
--- /dev/null
+++ b/www/shellinabox/files/patch-shellinabox__launcher.c
@@ -0,0 +1,74 @@
+--- ./shellinabox/launcher.c.orig 2009-11-21 23:20:39.000000000 +0100
++++ ./shellinabox/launcher.c 2010-08-12 14:11:16.296619939 +0200
+@@ -495,6 +495,33 @@
+ 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) {
+@@ -518,9 +545,12 @@
+ 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));
+@@ -1027,7 +1057,9 @@
+ setutxent();
+ pututxline(&utmp->utmpx);
+ endutxent();
++#if defined(HAVE_UPDWTMP) || defined(HAVE_UPDWTMPX)
+ updwtmpx("/var/log/wtmp", &utmp->utmpx);
++#endif
+ }
+ #endif
+
+@@ -1308,12 +1340,14 @@
+ }
+ 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
+ // to close the session when the child terminates. And we must retain