aboutsummaryrefslogtreecommitdiff
path: root/sysutils/su2
diff options
context:
space:
mode:
authorChris Rees <crees@FreeBSD.org>2012-02-17 17:59:24 +0000
committerChris Rees <crees@FreeBSD.org>2012-02-17 17:59:24 +0000
commit32624d403beeaf8db8d34ef0afc473b37c299917 (patch)
tree21184d08d895761032707e727302475007ed0acd /sysutils/su2
parent8c5c548ed6d8b8c0d8fdd4e41bf0fad8df954012 (diff)
downloadports-32624d403beeaf8db8d34ef0afc473b37c299917.tar.gz
ports-32624d403beeaf8db8d34ef0afc473b37c299917.zip
Notes
Diffstat (limited to 'sysutils/su2')
-rw-r--r--sysutils/su2/Makefile15
-rw-r--r--sysutils/su2/files/patch-su2-c74
2 files changed, 80 insertions, 9 deletions
diff --git a/sysutils/su2/Makefile b/sysutils/su2/Makefile
index c2d265f2821e..3f620bbb1102 100644
--- a/sysutils/su2/Makefile
+++ b/sysutils/su2/Makefile
@@ -7,24 +7,21 @@
PORTNAME= su2
PORTVERSION= 1.3
+PORTREVISION= 1
CATEGORIES= sysutils security
MASTER_SITES= ftp://ftp.ccs.neu.edu/pub/sysadmin/
MAINTAINER= ports@FreeBSD.org
COMMENT= An enhanced su, allows users to su with own password + more
-NO_CDROM= "Don't sell for profit"
+NO_CDROM= Don't sell for profit
MAN1= su2.1
PLIST_FILES= bin/su2
-.include <bsd.port.pre.mk>
-
-.if ${OSVERSION} > 900007
-BROKEN= fails to build with new utmpx
-.endif
-
post-patch:
- ${REINPLACE_CMD} -e 's,/etc/super,${PREFIX}/etc/super,g' ${WRKSRC}/su2.man
+ ${REINPLACE_CMD} -e '/^CC=gcc/d' ${WRKSRC}/Makefile
+ ${REINPLACE_CMD} -e 's,/etc/super,${PREFIX}/etc/super,g' \
+ ${WRKSRC}/su2.man
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/sysutils/su2/files/patch-su2-c b/sysutils/su2/files/patch-su2-c
new file mode 100644
index 000000000000..8dae9239b519
--- /dev/null
+++ b/sysutils/su2/files/patch-su2-c
@@ -0,0 +1,74 @@
+--- su2.c.orig 2012-02-08 01:48:13.000000000 +0400
++++ su2.c 2012-02-08 02:22:42.000000000 +0400
+@@ -151,7 +151,12 @@
+ #include <fcntl.h>
+ #include <stdio.h>
+ #include <time.h>
++#include <osreldate.h>
++#if defined(__FreeBSD_version) && __FreeBSD_version >= 900007
++#include <utmpx.h>
++#else
+ #include <utmp.h>
++#endif
+ #include <signal.h>
+ #ifdef IOCTL
+ #include <sys/ioctl.h>
+@@ -383,7 +388,12 @@
+ if (FullTTY == (char *) 0)
+ FullTTY = "/dev/TTY??";
+
+- TTY = strrchr (FullTTY, '/') + 1;
++ TTY = FullTTY + strlen(FullTTY);
++ while (TTY > FullTTY) {
++ if (TTY[-1] == '/' && (TTY[0] > 57 || TTY[0] < 48))
++ break;
++ TTY--;
++ }
+
+ Debug (1, "-> FullTTY=\"%s\"\n", FullTTY);
+ Debug (1, "-> TTY=\"%s\"\n", TTY);
+@@ -1315,7 +1325,11 @@
+ * Copies name into an internal static buffer.
+ */
+
++#if __FreeBSD_version >= 900007
++#define MAXNAME sizeof(((struct utmpx *)nptr)->ut_user)
++#else
+ #define MAXNAME sizeof(((struct utmp *)nptr)->ut_name)
++#endif
+
+ #ifdef BROKENCUSERID
+ char *mycuserid ()
+@@ -1432,6 +1446,24 @@
+ ModifyUtmp (NewUserName)
+ register char *NewUserName;
+ {
++#if __FreeBSD_version >= 900007
++ struct utmpx ut, *utr;
++
++ strncpy(ut.ut_line, TTY, sizeof(ut.ut_line));
++ setutxent();
++ if ((utr = getutxline(&ut)) == NULL) {
++ endutxent();
++ (void) fprintf (stderr, "Terminal %s not found\n", ut.ut_line);
++ return (1);
++ }
++ strncpy(utr->ut_user, NewUserName, sizeof(utr->ut_user));
++ if (pututxline(utr) == NULL) {
++ endutxent();
++ (void) fprintf (stderr, "pututxline failed\n");
++ return (1);
++ }
++ endutxent();
++#else
+ register int fd; /* /etc/utmp file */
+ register int i; /* index */
+ #ifdef hpux
+@@ -1482,6 +1514,7 @@
+
+ (void) write (fd, (char *) & Utmp, sizeof (Utmp));
+ (void) close (fd);
++#endif
+ return (0);
+ }
+