Welcome sudosh3 to the ports collection.

This commit is contained in:
Cy Schubert 2009-12-15 07:17:46 +00:00
parent 7359628e1d
commit e8c5235a66
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=245851
5 changed files with 150 additions and 93 deletions

View File

@ -5,18 +5,16 @@
# $FreeBSD$
#
PORTNAME= sudosh2
PORTVERSION= 1.0.2
PORTNAME= sudosh3
PORTVERSION= 3.2.0
CATEGORIES= security
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/v${PORTVERSION}
MASTER_SITES= SF/${PORTNAME}
DISTNAME= ${PORTNAME}-${PORTVERSION}
EXTRACT_SUFX= .tbz2
MAINTAINER= cy@FreeBSD.org
COMMENT= Second version of the sudo shell
COMMENT= Third version of the sudo shell
CONFLICTS= sudosh-*
USE_BZIP2= yes
RUN_DEPENDS= sudo:${PORTSDIR}/security/sudo
GNU_CONFIGURE= yes
@ -35,4 +33,9 @@ MAN1= sudosh.1
MAN5= sudosh.conf.5
MAN8= sudosh-replay.8
.include <bsd.port.mk>
.include <bsd.port.pre.mk>
post-install:
@${TEST} -f ${PREFIX}/etc/sudosh.conf || ${CP} -p ${PREFIX}/etc/sudosh.conf.sample ${PREFIX}/etc/sudosh.conf
.include <bsd.port.post.mk>

View File

@ -1,3 +1,3 @@
MD5 (sudosh2-1.0.2.tbz2) = 594525a29be7fd328b80f3291eac4aca
SHA256 (sudosh2-1.0.2.tbz2) = 70298502c3f1998118d90b2b5298a6ca2595ebca3e695e7871f68d792d2b3299
SIZE (sudosh2-1.0.2.tbz2) = 167113
MD5 (sudosh3-3.2.0.tar.gz) = 73c097d7eec6400a25f10bd121c8e07c
SHA256 (sudosh3-3.2.0.tar.gz) = 8a1099da9a6115db2cf70112aa48600bd056c868e98ac27e80b07bfab4b7b362
SIZE (sudosh3-3.2.0.tar.gz) = 244867

View File

@ -0,0 +1,10 @@
--- src/Makefile.am.orig 2008-01-30 14:55:46.000000000 -0800
+++ src/Makefile.am 2009-12-14 22:24:48.000000000 -0800
@@ -8,6 +8,6 @@
install-sudosh.conf:
test -z "$(sysconfdir)" || $(mkdir_p) "$(DESTDIR)$(sysconfdir)"
- test -f $(sysconfdir)/sudosh.conf || $(INSTALL) -o 0 -g 0 -m 0444 '$(srcdir)/sudosh.conf' '$(sysconfdir)/sudosh.conf'
+ test -f $(sysconfdir)/sudosh.conf.sample || $(INSTALL) -o 0 -g 0 -m 0444 '$(srcdir)/sudosh.conf' '$(sysconfdir)/sudosh.conf.sample'
install: install-am install-sudosh.conf

View File

@ -1,11 +1,68 @@
--- src/Makefile.in.orig Sun Jun 12 19:33:29 2005
+++ src/Makefile.in Wed Oct 26 06:59:17 2005
@@ -427,7 +427,8 @@
--- src/Makefile.in.orig 2008-02-22 13:11:02.000000000 -0800
+++ src/Makefile.in 2009-12-14 21:26:23.000000000 -0800
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
install-sudosh.conf:
test -z "$(sysconfdir)" || $(mkdir_p) "$(DESTDIR)$(sysconfdir)"
test -f $(sysconfdir)/sudosh.conf || $(INSTALL) -o 0 -g 0 -m 0444 '$(srcdir)/sudosh.conf' '$(sysconfdir)/sudosh.conf'
+ $(INSTALL) -o 0 -g 0 -m 0444 '$(srcdir)/sudosh.conf' '$(sysconfdir)/sudosh.conf.sample'
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -55,7 +55,7 @@
string.$(OBJEXT) parse.$(OBJEXT) util.$(OBJEXT)
sudosh_replay_OBJECTS = $(am_sudosh_replay_OBJECTS)
sudosh_replay_LDADD = $(LDADD)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -165,6 +165,7 @@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
sudosh_SOURCES = sudosh.c rand.c parse.c string.c getopt.h struct.h super.h util.c
@@ -268,8 +269,8 @@
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
install: install-am install-sudosh.conf
# Tell versions [3.59,3.63) of GNU make to not export all variables.
@@ -281,8 +282,8 @@
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -292,13 +293,12 @@
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
- here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique

View File

@ -1,6 +1,6 @@
--- src/sudosh.c.orig Sun Jun 12 19:35:07 2005
+++ src/sudosh.c Fri Jan 5 14:14:05 2007
@@ -28,6 +28,13 @@
--- src/sudosh.c.orig 2009-11-27 02:19:58.000000000 -0800
+++ src/sudosh.c 2009-12-14 17:30:23.000000000 -0800
@@ -27,6 +27,13 @@
#define WRITE(a, b, c) do_write(a, b, c, __FILE__, __LINE__)
@ -11,10 +11,10 @@
+#include <sys/param.h>
+#endif
+
static struct termios termorig;
static struct winsize winorig;
typedef enum {false=0, true=1} bool;
@@ -545,19 +552,43 @@
static struct termios termorig;
@@ -443,12 +450,32 @@
{
char *sname;
@ -25,22 +25,19 @@
+ struct winsize win;
+
+ sname = sname_area;
+ if (tcgetattr(STDIN_FILENO, &tt) == -1)
+ {
+ if (tcgetattr(STDIN_FILENO, &tt) == -1) {
+ perror ("tcgetattr");
+ return -1;
+ }
+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &win) == -1)
+ {
+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &win) == -1) {
+ perror ("ioctl");
+ return -1;
+ }
+ if (openpty(&p->mfd, &p->sfd, sname, &tt, &win) == -1) {
+#else
if ((p->mfd = open ("/dev/ptmx", O_RDWR)) == -1)
{
if ((p->mfd = open ("/dev/ptc", O_RDWR)) == -1)
{
if ((p->mfd = open ("/dev/ptmx", O_RDWR)) == -1) {
if ((p->mfd = open ("/dev/ptc", O_RDWR)) == -1) {
+#endif
perror ("Cannot open cloning master pty");
return -1;
@ -49,16 +46,8 @@
+#endif
}
+#if !defined(__FreeBSD_version) || (defined(__FreeBSD_version) && __FreeBSD_version >= 500000)
(void) unlockpt (p->mfd);
(void) grantpt (p->mfd);
sname = (char *) ptsname (p->mfd);
+#endif
if ((p->sfd = open (sname, O_RDWR)) == -1)
{
@@ -619,9 +650,14 @@
@@ -515,9 +542,14 @@
for (i = 3; i < 100; ++i)
close (i);
@ -73,7 +62,7 @@
(void) ioctl (0, TIOCSWINSZ, &winorig);
setuid (getuid ());
@@ -663,6 +699,13 @@
@@ -671,12 +703,20 @@
{
static struct termios termnew;
@ -85,18 +74,17 @@
+ }
+#else
#ifdef TCGETS
if (ioctl (ttyfd, TCGETS, &termorig) == -1)
{
@@ -670,6 +713,7 @@
if (ioctl (ttyfd, TCGETS, &termorig) == -1) {
perror ("ioctl TCGETS failed");
exit (EXIT_FAILURE);
}
#endif
+#endif
if (ioctl (ttyfd, TIOCGWINSZ, &winorig) == -1)
{
@@ -677,6 +721,11 @@
exit (EXIT_FAILURE);
if (ioctl (ttyfd, TIOCGWINSZ, &winorig) == -1) {
// perror ("ioctl TIOCGWINSZ failed");
@@ -685,6 +725,11 @@
winorig.ws_col = 80;
}
+#ifdef __FreeBSD__
@ -107,23 +95,22 @@
termnew.c_cc[VEOF] = 1;
termnew.c_iflag = BRKINT | ISTRIP | IXON | IXANY;
termnew.c_oflag = 0;
@@ -686,13 +735,19 @@
@@ -694,13 +739,18 @@
#ifdef TCSETS
(void) ioctl (ttyfd, TCSETS, &termnew);
#endif
+#endif
}
static void
bye (int signum)
static void bye (int signum)
{
+
+#ifdef __FreeBSD__
+ (void) tcsetattr(0, TCSADRAIN, &termorig);
+#else
#ifdef TCSETS
(void) ioctl (0, TCSETS, &termorig);
+#endif
#endif
+#endif
close (timing.fd);
close (script.fd);