Import of pkgsrc-2013Q2

This commit is contained in:
2013-09-26 17:14:40 +02:00
commit 785076ae39
74991 changed files with 4380255 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
OpenSSH is based on the last free version of Tatu Ylonen's SSH with
all patent-encumbered algorithms removed (to external libraries), all
known security bugs fixed, new features reintroduced and many other
clean-ups. More information about SSH itself can be found in the file
README.Ylonen. OpenSSH has been created by Aaron Campbell, Bob Beck,
Markus Friedl, Niels Provos, Theo de Raadt, and Dug Song.
This port consists of the re-introduction of autoconf support, PAM
support (for Linux and Solaris), EGD[1] support, SOCKS support (using
the Dante [6] libraries and replacements for OpenBSD library functions
that are (regrettably) absent from other unices. This port has been
best tested on Linux, Solaris, HPUX, NetBSD and Irix. Support for AIX,
SCO, NeXT and other Unices is underway. This version actively tracks
changes in the OpenBSD CVS repository.
+36
View File
@@ -0,0 +1,36 @@
# $NetBSD: INSTALL,v 1.10 2003/08/30 20:23:06 jlam Exp $
DIRS="/etc /etc/ssh ${PKG_PREFIX}/etc ${PKG_PREFIX}/etc/ssh"
FILES="sshd.conf sshd_config"
case ${STAGE} in
POST-INSTALL)
for dir in $DIRS; do
if [ "@PKG_SYSCONFDIR@" != "$dir" ]; then
for file in $FILES; do
path=$dir/$file
if [ -f $path ]; then
${CAT} <<EOF
===========================================================================
*===* NOTICE *===*
WARNING: previous configuration file $path found.
The config files for ${PKGNAME} must be located in:
@PKG_SYSCONFDIR@
You will need to ensure your configuration files and/or keys are
placed in the correct directory before using ${PKGNAME}.
===========================================================================
EOF
exit
fi
done
fi
done
;;
esac
+20
View File
@@ -0,0 +1,20 @@
===========================================================================
$NetBSD: MESSAGE.Interix,v 1.1 2005/03/07 23:29:49 tv Exp $
OpenSSH on Interix has some important caveats:
* Hostname resolution uses the BIND resolver library rather than Windows
native lookup services. This requires that /etc/resolv.conf be set up
properly with a "nameserver" line; see resolv.conf(5). In most
installations, this was generated automatically when Services for UNIX
was installed (based on the name server in use at that time).
* Currently, UsePrivilegeSeparation does not work properly, so it defaults
to "no" on Interix.
* Network drives and encrypted local files may not be accessible after
logging in through sshd thanks to the way the Windows security API works.
A workaround is to "exec su USERNAME" after logging in, which will use
the password to create a proper Windows access credential key.
===========================================================================
+9
View File
@@ -0,0 +1,9 @@
===========================================================================
$NetBSD: MESSAGE.pam,v 1.3 2003/10/08 18:54:42 reed Exp $
To authenticate for SSH using PAM, add the contents of the file:
${EGDIR}/sshd.pam
to your PAM configuration file (or PAM configuration directory).
===========================================================================
+8
View File
@@ -0,0 +1,8 @@
===========================================================================
$NetBSD: MESSAGE.urandom,v 1.1 2002/02/05 04:17:31 jlam Exp $
You will need a working /dev/urandom. Please make sure you have a kernel
compiled from a config file containing the line:
pseudo-device rnd
===========================================================================
+201
View File
@@ -0,0 +1,201 @@
# $NetBSD: Makefile,v 1.212 2013/05/31 12:41:52 wiz Exp $
DISTNAME= openssh-6.2p1
PKGNAME= openssh-6.2.1
PKGREVISION= 1
SVR4_PKGNAME= ossh
CATEGORIES= security
MASTER_SITES= ftp://ftp.openssh.com/pub/OpenBSD/OpenSSH/portable/ \
ftp://ftp3.usa.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \
ftp://gd.tuwien.ac.at/opsys/OpenBSD/OpenSSH/portable/ \
ftp://ftp.freenet.de/pub/ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \
ftp://ftp.jaist.ac.jp/pub/OpenBSD/OpenSSH/portable/ \
ftp://ftp.belnet.be/packages/openbsd/OpenSSH/portable/
# Don't delete the last entry -- it's there if the pkgsrc version is not
# up-to-date and the mirrors already removed the old distfile.
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://www.openssh.com/
COMMENT= Open Source Secure shell client and server (remote login program)
CONFLICTS= sftp-[0-9]*
CONFLICTS+= ssh-[0-9]* ssh6-[0-9]*
CONFLICTS+= ssh2-[0-9]* ssh2-nox11-[0-9]*
CONFLICTS+= openssh+gssapi-[0-9]*
CONFLICTS+= lsh>2.0
USE_TOOLS+= perl
CRYPTO= yes
# retain the following line, for IPv6-ready pkgsrc webpage
BUILD_DEFS+= IPV6_READY
PKG_GROUPS_VARS+= OPENSSH_GROUP
PKG_USERS_VARS+= OPENSSH_USER
BUILD_DEFS+= OPENSSH_CHROOT
BUILD_DEFS+= VARBASE
INSTALL_TARGET= install-nokeys
PLIST_SRC= # empty
.include "options.mk"
.if ${OPSYS} == "Interix"
# OpenSSH on Interix has some important caveats
MESSAGE_SRC= ${.CURDIR}/MESSAGE.Interix
BUILDLINK_PASSTHRU_DIRS+= /usr/local/lib/bind
CONFIGURE_ENV+= ac_cv_func_openpty=no
CONFIGURE_ENV+= ac_cv_type_struct_timespec=yes
CPPFLAGS+= -DIOV_MAX=16 # default is INT_MAX, way too large
.if exists(/usr/local/include/bind/resolv.h)
CPPFLAGS+= -I/usr/local/include/bind
BUILDLINK_PASSTHRU_DIRS+= /usr/local/include/bind
.elif exists(/usr/local/bind/include/resolv.h)
CPPFLAGS+= -I/usr/local/bind/include
BUILDLINK_PASSTHRU_DIRS+= /usr/local/bind/include
.endif
LDFLAGS+= -L/usr/local/lib/bind
LIBS+= -lbind -ldb -lcrypt
.else # not Interix
PKG_GROUPS= ${OPENSSH_GROUP}
PKG_USERS= ${OPENSSH_USER}:${OPENSSH_GROUP}
PKG_GECOS.${OPENSSH_USER}= sshd privsep pseudo-user
PKG_HOME.${OPENSSH_USER}= ${OPENSSH_CHROOT}
.endif
SSH_PID_DIR= ${VARBASE}/run # default directory for PID files
PKG_SYSCONFSUBDIR= ssh
GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --with-mantype=man
CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR:Q}
CONFIGURE_ARGS+= --with-pid-dir=${SSH_PID_DIR:Q}
CONFIGURE_ARGS+= --with-ssl-dir=${SSLBASE:Q}
CONFIGURE_ARGS+= --with-tcp-wrappers=${BUILDLINK_PREFIX.tcp_wrappers}
.if ${OPSYS} != "Interix"
CONFIGURE_ARGS+= --with-privsep-path=${OPENSSH_CHROOT:Q}
CONFIGURE_ARGS+= --with-privsep-user=${OPENSSH_USER:Q}
.endif
# pkgsrc already enforces a "secure" version of zlib via dependencies,
# so skip this bogus version check.
CONFIGURE_ARGS+= --without-zlib-version-check
# the openssh configure script finds and uses ${LD} if defined and
# defaults to ${CC} if not. we override LD here, since running the
# linker directly results in undefined symbols for obvious reasons.
#
CONFIGURE_ENV+= LD=${CC:Q}
# Enable S/Key support on NetBSD, Darwin, and Solaris.
.if (${OPSYS} == "NetBSD") || (${OPSYS} == "Darwin") || (${OPSYS} == "SunOS")
. include "../../security/skey/buildlink3.mk"
CONFIGURE_ARGS+= --with-skey=${BUILDLINK_PREFIX.skey}
.else
CONFIGURE_ARGS+= --without-skey
.endif
.if (${OPSYS} == "NetBSD")
. if exists(/usr/include/utmpx.h)
# if we have utmpx et al do not try to use login()
CONFIGURE_ARGS+= --disable-libutil
. endif
#
# NetBSD current after 2011/03/12 has incompatible strnvis(3) and
# prior version don't have it. So, disable use of strnvis(3) now.
#
CONFIGURE_ENV+= ac_cv_func_strnvis=no
.endif
.if (${OPSYS} == "SunOS") && (${OS_VERSION} == "5.8" || ${OS_VERSION} == "5.9")
CONFIGURE_ARGS+= --disable-utmp --disable-wtmp
.endif
.if ${OPSYS} == "Linux"
CONFIGURE_ARGS+= --enable-md5-password
.endif
# The ssh-askpass program is in ${X11BASE}/bin or ${X11PREFIX}/bin depending
# on if it's part of the X11 distribution, or if it's installed from pkgsrc
# (security/ssh-askpass).
#
.if exists(${X11BASE}/bin/ssh-askpass)
ASKPASS_PROGRAM= ${X11BASE}/bin/ssh-askpass
.else
ASKPASS_PROGRAM= ${X11PREFIX}/bin/ssh-askpass
.endif
CONFIGURE_ENV+= ASKPASS_PROGRAM=${ASKPASS_PROGRAM:Q}
MAKE_ENV+= ASKPASS_PROGRAM=${ASKPASS_PROGRAM:Q}
# do the same for xauth
.if exists(${X11BASE}/bin/xauth)
CONFIGURE_ARGS+= --with-xauth=${X11BASE}/bin/xauth
.else
CONFIGURE_ARGS+= --with-xauth=${X11PREFIX}/bin/xauth
.endif
CONFS= ssh_config sshd_config moduli
.if exists(/dev/urandom)
. if ${OPSYS} == "NetBSD"
MESSAGE_SRC+= ${.CURDIR}/MESSAGE.urandom
. endif
.else
CONFIGURE_ARGS+= --without-random
CONFS+= ssh_prng_cmds
PLIST_SRC+= ${.CURDIR}/PLIST.prng
.endif
EGDIR= ${PREFIX}/share/examples/${PKGBASE}
CONF_FILES= # empty
.for f in ${CONFS}
CONF_FILES+= ${EGDIR}/${f} ${PKG_SYSCONFDIR}/${f}
.endfor
OWN_DIRS= ${OPENSSH_CHROOT}
RCD_SCRIPTS= sshd
RCD_SCRIPT_SRC.sshd= ${WRKDIR}/sshd.sh
PLIST_SRC+= ${.CURDIR}/PLIST
FILES_SUBST+= SSH_PID_DIR=${SSH_PID_DIR:Q}
SUBST_CLASSES+= patch
SUBST_STAGE.patch= pre-configure
SUBST_FILES.patch= session.c
SUBST_SED.patch= -e '/channel_input_port_forward_request/s/0/ROOTUID/'
SUBST_MESSAGE.patch= More patch a file.
.include "../../devel/zlib/buildlink3.mk"
.include "../../security/openssl/buildlink3.mk"
.include "../../security/tcp_wrappers/buildlink3.mk"
#
# type of key "ecdsa" isn't always supported depends on OpenSSL.
#
post-configure:
if ${EGREP} -q '^\#define[ ]+OPENSSL_HAS_ECC' \
${WRKSRC}/config.h; then \
${SED} -e '/HAVE_ECDSA/s/.*//' \
${FILESDIR}/sshd.sh > ${WRKDIR}/sshd.sh; \
else \
${SED} -e '/HAVE_ECDSA_START/,/HAVE_ECDSA_STOP/d' \
${FILESDIR}/sshd.sh > ${WRKDIR}/sshd.sh; \
fi
post-install:
${INSTALL_DATA_DIR} ${DESTDIR}${EGDIR}
cd ${WRKSRC}; for file in ${CONFS}; do \
${INSTALL_DATA} $${file}.out ${DESTDIR}${EGDIR}/$${file}; \
done
.if !empty(PKG_OPTIONS:Mpam) && ${OPSYS} == "Linux"
${INSTALL_DATA} ${WRKSRC}/contrib/sshd.pam.generic \
${DESTDIR}${EGDIR}/sshd.pam
.endif
.include "../../mk/bsd.pkg.mk"
+32
View File
@@ -0,0 +1,32 @@
@comment $NetBSD: PLIST,v 1.14 2010/06/11 20:41:41 martti Exp $
bin/scp
bin/sftp
bin/slogin
bin/ssh
bin/ssh-add
bin/ssh-agent
bin/ssh-keygen
bin/ssh-keyscan
libexec/sftp-server
libexec/ssh-keysign
libexec/ssh-pkcs11-helper
man/man1/scp.1
man/man1/sftp.1
man/man1/slogin.1
man/man1/ssh-add.1
man/man1/ssh-agent.1
man/man1/ssh-keygen.1
man/man1/ssh-keyscan.1
man/man1/ssh.1
man/man5/moduli.5
man/man5/ssh_config.5
man/man5/sshd_config.5
man/man8/sftp-server.8
man/man8/ssh-keysign.8
man/man8/ssh-pkcs11-helper.8
man/man8/sshd.8
sbin/sshd
share/examples/openssh/moduli
share/examples/openssh/ssh_config
share/examples/openssh/sshd_config
share/examples/rc.d/sshd
+1
View File
@@ -0,0 +1 @@
@comment $NetBSD: PLIST.pam,v 1.2 2012/01/09 05:25:36 manu Exp $
+3
View File
@@ -0,0 +1,3 @@
@comment $NetBSD: PLIST.prng,v 1.2 2002/08/30 08:04:31 grant Exp $
libexec/ssh-rand-helper
share/examples/openssh/ssh_prng_cmds
+31
View File
@@ -0,0 +1,31 @@
$NetBSD: distinfo,v 1.84 2013/05/01 19:58:25 imil Exp $
SHA1 (openssh-6.2p1-hpn13v14.diff) = 71bbd99961b8b7665a481cf0a4bc9604e55d75b3
RMD160 (openssh-6.2p1-hpn13v14.diff) = b859fbdf4395534621cc5ffae0cce39621582927
Size (openssh-6.2p1-hpn13v14.diff) = 61437 bytes
SHA1 (openssh-6.2p1.tar.gz) = 8824708c617cc781b2bb29fa20bd905fd3d2a43d
RMD160 (openssh-6.2p1.tar.gz) = 3651a43c8d466646e760cb1cbc9097dbba5151ca
Size (openssh-6.2p1.tar.gz) = 1182181 bytes
SHA1 (patch-Makefile.in) = 514edd12500e89059d3bda7f5ac8c651001fd7c6
SHA1 (patch-atomicio.c) = 6bb3c3ca1491693918ce1ac7481e0852c90e0b4e
SHA1 (patch-auth-passwd.c) = de9f5487fe1f5848cc702e549bce949fd75d70cd
SHA1 (patch-auth-rhosts.c) = ab8dd3e375accc5bed3e15b158a85a1b1f9a2e3e
SHA1 (patch-auth.c) = ee757e5c80a14398c4835a1c1502cdaa03ca8655
SHA1 (patch-auth1.c) = 97693bbd970cf036892099493f0f64e59a252a35
SHA1 (patch-auth2.c) = bb638fda90e80cd2f74702e01dc3320da01e4e80
SHA1 (patch-config.h.in) = 805a5ba9be430a7123dc958d43c401d6f57d0bf5
SHA1 (patch-configure) = d8977e444ffd2217229726161ebf0b5868d9f650
SHA1 (patch-configure.ac) = b981b8b2e28edc4fa461c9c487f3f7e82412b826
SHA1 (patch-defines.h) = e2aebe7dcf0927d8afcca7a96c4001a6e0130cc2
SHA1 (patch-includes.h) = f7fad7b3599d677a5991b140c66e3a67bedbe13b
SHA1 (patch-loginrec.c) = 0305a5b552c88ac99d8f894d3cda9686e0b0ccdd
SHA1 (patch-openbsd-compat_bsd-openpty.c) = a1318cf691f0ad844a8761a77e3bb32a9e20c695
SHA1 (patch-openbsd-compat_openbsd-compat.h) = 17690feb6962bd27fef96bd6fb1acfa60e9af9dc
SHA1 (patch-openbsd-compat_port-tun.c) = 8288e2b9336ea1fcc1129d8a2ab5e55816b2ccbf
SHA1 (patch-platform.c) = fcb85cca516d992ec50dfb259b9cc8ddbb032b5c
SHA1 (patch-scp.c) = 0460cee3ad2626c71ce0a6e484fb4ed9ae559d1f
SHA1 (patch-session.c) = aba585358f22db8b37b6673526af96765c65dc49
SHA1 (patch-ssh.c) = eecce1698455567f9e48b498fe937d235890c315
SHA1 (patch-sshd.c) = faf9ff468a0938e20f7cf18192c47dec46763e8c
SHA1 (patch-sshpty.c) = 9f08f899919d05567998087a060b90800c2c7b11
SHA1 (patch-uidswap.c) = 4c7c4e1621dc54a180bcba9a81d58f114a819eb0
+114
View File
@@ -0,0 +1,114 @@
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: sshd.sh,v 1.13 2011/05/17 03:26:52 taca Exp $
#
# PROVIDE: sshd
# REQUIRE: DAEMON LOGIN
if [ -f /etc/rc.subr ]
then
. /etc/rc.subr
fi
name="sshd"
rcvar=$name
command="@PREFIX@/sbin/${name}"
keygen_command="@PREFIX@/bin/ssh-keygen"
pidfile="@SSH_PID_DIR@/${name}.pid"
required_files="@PKG_SYSCONFDIR@/sshd_config"
extra_commands="keygen reload"
sshd_keygen()
{
(
umask 022
if [ -f @PKG_SYSCONFDIR@/ssh_host_key ]; then
@ECHO@ "You already have an RSA host key in @PKG_SYSCONFDIR@/ssh_host_key"
@ECHO@ "Skipping protocol version 1 RSA Key Generation"
else
${keygen_command} -t rsa1 -b 1024 -f @PKG_SYSCONFDIR@/ssh_host_key -N ''
fi
if [ -f @PKG_SYSCONFDIR@/ssh_host_dsa_key ]; then
@ECHO@ "You already have a DSA host key in @PKG_SYSCONFDIR@/ssh_host_dsa_key"
@ECHO@ "Skipping protocol version 2 DSA Key Generation"
else
${keygen_command} -t dsa -f @PKG_SYSCONFDIR@/ssh_host_dsa_key -N ''
fi
if [ -f @PKG_SYSCONFDIR@/ssh_host_rsa_key ]; then
@ECHO@ "You already have a RSA host key in @PKG_SYSCONFDIR@/ssh_host_rsa_key"
@ECHO@ "Skipping protocol version 2 RSA Key Generation"
else
${keygen_command} -t rsa -f @PKG_SYSCONFDIR@/ssh_host_rsa_key -N ''
fi
/* HAVE_ECDSA_START */
if [ -f @PKG_SYSCONFDIR@/ssh_host_ecdsa_key ]; then
@ECHO@ "You already have a ECDSA host key in @PKG_SYSCONFDIR@/ssh_host_ecdsa_key"
@ECHO@ "Skipping protocol version 2 ECDSA Key Generation"
else
${keygen_command} -t ecdsa -f @PKG_SYSCONFDIR@/ssh_host_ecdsa_key -N ''
fi
/* HAVE_ECDSA_STOP */
)
}
sshd_precmd()
{
if [ ! -f @PKG_SYSCONFDIR@/ssh_host_key -o \
! -f @PKG_SYSCONFDIR@/ssh_host_dsa_key -o \
! -f @PKG_SYSCONFDIR@/ssh_host_rsa_key -o \
! -f @PKG_SYSCONFDIR@/ssh_host_ecdsa_key ]; then
if [ -f /etc/rc.subr -a -f /etc/rc.conf -a -f /etc/rc.d/DAEMON ]
then
run_rc_command keygen
else
eval ${keygen_cmd}
fi
fi
}
keygen_cmd=sshd_keygen
start_precmd=sshd_precmd
if [ -f /etc/rc.subr -a -f /etc/rc.conf -a -f /etc/rc.d/DAEMON ]
then
load_rc_config $name
run_rc_command "$1"
else
case ${1:-start} in
start)
if [ -x ${command} -a -f ${required_files} ]
then
@ECHO@ "Starting ${name}."
eval ${start_precmd}
eval ${command} ${sshd_flags} ${command_args}
fi
;;
stop)
if [ -f ${pidfile} ]; then
pid=`@HEAD@ -1 ${pidfile}`
@ECHO@ "Stopping ${name}."
kill -TERM ${pid}
else
@ECHO@ "${name} not running?"
fi
;;
restart)
( $0 stop )
sleep 1
$0 start
;;
status)
if [ -f ${pidfile} ]; then
pid=`@HEAD@ -1 ${pidfile}`
@ECHO@ "${name} is running as pid ${pid}."
else
@ECHO@ "${name} is not running."
fi
;;
keygen)
eval ${keygen_cmd}
;;
esac
fi
+30
View File
@@ -0,0 +1,30 @@
# $NetBSD: options.mk,v 1.25 2013/05/01 19:58:25 imil Exp $
.include "../../mk/bsd.prefs.mk"
PKG_OPTIONS_VAR= PKG_OPTIONS.openssh
PKG_SUPPORTED_OPTIONS= kerberos hpn-patch pam
.include "../../mk/bsd.options.mk"
.if !empty(PKG_OPTIONS:Mkerberos)
. include "../../mk/krb5.buildlink3.mk"
CONFIGURE_ARGS+= --with-kerberos5=${KRB5BASE:Q}
. if ${KRB5_TYPE} == "mit-krb5"
CONFIGURE_ENV+= ac_cv_search_k_hasafs=no
. endif
.endif
.if !empty(PKG_OPTIONS:Mhpn-patch)
PATCHFILES= openssh-6.2p1-hpn13v14.diff
PATCH_SITES= ftp://ftp.NetBSD.org/pub/NetBSD/misc/imil/openssh/
PATCH_DIST_STRIP= -p1
.endif
.if !empty(PKG_OPTIONS:Mpam)
.include "../../mk/pam.buildlink3.mk"
CONFIGURE_ARGS+= --with-pam
PLIST_SRC+= ${.CURDIR}/PLIST.pam
MESSAGE_SRC+= ${.CURDIR}/MESSAGE.pam
MESSAGE_SUBST+= EGDIR=${EGDIR}
.endif
@@ -0,0 +1,24 @@
$NetBSD: patch-Makefile.in,v 1.1 2013/05/01 19:58:26 imil Exp $
Removed install-sysconf as we handle that phase through post-install
--- Makefile.in.orig 2013-03-07 15:37:13.000000000 +0000
+++ Makefile.in
@@ -22,7 +22,7 @@ top_srcdir=@top_srcdir@
DESTDIR=
VPATH=@srcdir@
SSH_PROGRAM=@bindir@/ssh
-ASKPASS_PROGRAM=$(libexecdir)/ssh-askpass
+#ASKPASS_PROGRAM=$(libexecdir)/ssh-askpass
SFTP_SERVER=$(libexecdir)/sftp-server
SSH_KEYSIGN=$(libexecdir)/ssh-keysign
SSH_PKCS11_HELPER=$(libexecdir)/ssh-pkcs11-helper
@@ -242,7 +242,7 @@ distprep: catman-do
-rm -rf autom4te.cache
install: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf host-key check-config
-install-nokeys: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf
+install-nokeys: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files
install-nosysconf: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files
check-config:
+19
View File
@@ -0,0 +1,19 @@
$NetBSD: patch-atomicio.c,v 1.2 2013/05/01 19:58:26 imil Exp $
Check for vwrite instead of read to avoid read being renamed by SSP issues
--- atomicio.c.orig 2010-09-24 12:15:11.000000000 +0000
+++ atomicio.c
@@ -57,7 +57,11 @@ atomicio6(ssize_t (*f) (int, void *, siz
struct pollfd pfd;
pfd.fd = fd;
- pfd.events = f == read ? POLLIN : POLLOUT;
+ /*
+ * check for vwrite instead of read to avoid read being renamed
+ * by SSP issues
+ */
+ pfd.events = f == vwrite ? POLLOUT : POLLIN;
while (n > pos) {
res = (f) (fd, s + pos, n - pos);
switch (res) {
@@ -0,0 +1,28 @@
$NetBSD: patch-auth-passwd.c,v 1.1 2013/05/01 19:58:26 imil Exp $
Replace uid 0 with ROOTUID macro
--- auth-passwd.c.orig 2012-04-25 23:51:28.000000000 +0000
+++ auth-passwd.c
@@ -87,7 +87,7 @@ auth_password(Authctxt *authctxt, const
#endif
#ifndef HAVE_CYGWIN
- if (pw->pw_uid == 0 && options.permit_root_login != PERMIT_YES)
+ if (pw->pw_uid == ROOTUID && options.permit_root_login != PERMIT_YES)
ok = 0;
#endif
if (*password == '\0' && options.permit_empty_passwd == 0)
@@ -122,7 +122,12 @@ auth_password(Authctxt *authctxt, const
authctxt->force_pwchange = 1;
}
#endif
+
+#ifdef HAVE_INTERIX
+ result = (!setuser(pw->pw_name, password, SU_CHECK));
+#else
result = sys_auth_passwd(authctxt, password);
+#endif
if (authctxt->force_pwchange)
disable_forwarding();
return (result && ok);
@@ -0,0 +1,33 @@
$NetBSD: patch-auth-rhosts.c,v 1.1 2013/05/01 19:58:26 imil Exp $
Replace uid 0 with ROOTUID macro
--- auth-rhosts.c.orig 2010-03-07 12:05:17.000000000 +0000
+++ auth-rhosts.c
@@ -230,7 +230,7 @@ auth_rhosts2_raw(struct passwd *pw, cons
return 0;
/* If not logging in as superuser, try /etc/hosts.equiv and shosts.equiv. */
- if (pw->pw_uid != 0) {
+ if (pw->pw_uid != ROOTUID) {
if (check_rhosts_file(_PATH_RHOSTS_EQUIV, hostname, ipaddr,
client_user, pw->pw_name)) {
auth_debug_add("Accepted for %.100s [%.100s] by /etc/hosts.equiv.",
@@ -256,7 +256,7 @@ auth_rhosts2_raw(struct passwd *pw, cons
return 0;
}
if (options.strict_modes &&
- ((st.st_uid != 0 && st.st_uid != pw->pw_uid) ||
+ ((st.st_uid != ROOTUID && st.st_uid != pw->pw_uid) ||
(st.st_mode & 022) != 0)) {
logit("Rhosts authentication refused for %.100s: "
"bad ownership or modes for home directory.", pw->pw_name);
@@ -283,7 +283,7 @@ auth_rhosts2_raw(struct passwd *pw, cons
* allowing access to their account by anyone.
*/
if (options.strict_modes &&
- ((st.st_uid != 0 && st.st_uid != pw->pw_uid) ||
+ ((st.st_uid != ROOTUID && st.st_uid != pw->pw_uid) ||
(st.st_mode & 022) != 0)) {
logit("Rhosts authentication refused for %.100s: bad modes for %.200s",
pw->pw_name, buf);
+15
View File
@@ -0,0 +1,15 @@
$NetBSD: patch-auth.c,v 1.1 2013/05/01 19:58:26 imil Exp $
Replace uid 0 with ROOTUID macro
--- auth.c.orig 2013-03-12 00:31:05.000000000 +0000
+++ auth.c
@@ -385,7 +385,7 @@ check_key_in_hostfiles(struct passwd *pw
user_hostfile = tilde_expand_filename(userfile, pw->pw_uid);
if (options.strict_modes &&
(stat(user_hostfile, &st) == 0) &&
- ((st.st_uid != 0 && st.st_uid != pw->pw_uid) ||
+ ((st.st_uid != ROOTUID && st.st_uid != pw->pw_uid) ||
(st.st_mode & 022) != 0)) {
logit("Authentication refused for %.100s: "
"bad owner or modes for %.200s",
+26
View File
@@ -0,0 +1,26 @@
$NetBSD: patch-auth1.c,v 1.1 2013/05/01 19:58:26 imil Exp $
Replace uid 0 with ROOTUID macro
--- auth1.c.orig 2012-12-02 22:53:20.000000000 +0000
+++ auth1.c
@@ -321,7 +321,7 @@ do_authloop(Authctxt *authctxt)
#ifndef HAVE_CYGWIN
/* Special handling for root */
- if (authenticated && authctxt->pw->pw_uid == 0 &&
+ if (authenticated && authctxt->pw->pw_uid == ROOTUID &&
!auth_root_allowed(meth->name)) {
authenticated = 0;
# ifdef SSH_AUDIT_EVENTS
@@ -425,8 +425,8 @@ do_authentication(Authctxt *authctxt)
* If we are not running as root, the user must have the same uid as
* the server.
*/
-#ifndef HAVE_CYGWIN
- if (!use_privsep && getuid() != 0 && authctxt->pw &&
+#if !defined(HAVE_CYGWIN) && !defined(HAVE_INTERIX)
+ if (!use_privsep && getuid() != ROOTUID && authctxt->pw &&
authctxt->pw->pw_uid != getuid())
packet_disconnect("Cannot change user when server not running as root.");
#endif
+15
View File
@@ -0,0 +1,15 @@
$NetBSD: patch-auth2.c,v 1.1 2013/05/01 19:58:26 imil Exp $
Replace uid 0 with ROOTUID macro
--- auth2.c.orig 2012-12-02 22:53:20.000000000 +0000
+++ auth2.c
@@ -307,7 +307,7 @@ userauth_finish(Authctxt *authctxt, int
fatal("INTERNAL ERROR: authenticated and postponed");
/* Special handling for root */
- if (authenticated && authctxt->pw->pw_uid == 0 &&
+ if (authenticated && authctxt->pw->pw_uid == ROOTUID &&
!auth_root_allowed(method)) {
authenticated = 0;
#ifdef SSH_AUDIT_EVENTS
@@ -0,0 +1,26 @@
$NetBSD: patch-config.h.in,v 1.1 2013/05/01 19:58:26 imil Exp $
Added Interix and define new path to if_tun.h
--- config.h.in.orig 2013-03-21 23:38:18.000000000 +0000
+++ config.h.in
@@ -561,6 +561,9 @@
/* define if you have int64_t data type */
#undef HAVE_INT64_T
+/* Define if you are on Interix */
+#undef HAVE_INTERIX
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -699,6 +702,9 @@
/* Define to 1 if you have the <net/if_tun.h> header file. */
#undef HAVE_NET_IF_TUN_H
+/* Define to 1 if you have the <net/tun/if_tun.h> header file. */
+#undef HAVE_NET_TUN_IF_TUN_H
+
/* Define if you are on NeXT */
#undef HAVE_NEXT
+103
View File
@@ -0,0 +1,103 @@
$NetBSD: patch-configure,v 1.1 2013/05/01 19:58:26 imil Exp $
Various fixes regarding portability
--- configure.orig 2013-03-21 23:38:28.000000000 +0000
+++ configure
@@ -5993,6 +5993,9 @@ if test "${with_rpath+set}" = set; then
fi
+# pkgsrc handles any rpath settings this package needs
+need_dash_r=
+
# Allow user to specify flags
# Check whether --with-cflags was given.
@@ -6076,6 +6079,7 @@ for ac_header in \
maillock.h \
ndir.h \
net/if_tun.h \
+ net/tun/if_tun.h \
netdb.h \
netgroup.h \
pam/pam_appl.h \
@@ -6786,6 +6790,36 @@ $as_echo "#define HAVE_SECUREWARE 1" >>c
;;
esac
;;
+*-*-interix*)
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_INTERIX 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define DISABLE_FD_PASSING 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define DISABLE_SHADOW 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define IP_TOS_IS_BROKEN 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define MISSING_HOWMANY 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define NO_IPPORT_RESERVED_CONCEPT 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define USE_PIPES 1
+_ACEOF
+
+ ;;
*-*-irix5*)
PATH="$PATH:/usr/etc"
@@ -6987,7 +7021,7 @@ fi
$as_echo "#define SSH_TUN_PREPEND_AF 1" >>confdefs.h
;;
-*-*-freebsd*)
+*-*-freebsd*|*-*-dragonfly*)
check_for_libcrypt_later=1
$as_echo "#define LOCKED_PASSWD_PREFIX \"*LOCKED*\"" >>confdefs.h
@@ -17033,12 +17067,18 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test -z "$conf_wtmpx_location"; then
if test x"$system_wtmpx_path" = x"no" ; then
- $as_echo "#define DISABLE_WTMPX 1" >>confdefs.h
-
+ for f in /var/log/wtmpx; do
+ if test -f $f ; then
+ conf_wtmpx_location=$f
+ fi
+ done
+ if test -z "$conf_wtmpx_location"; then
+ $as_echo "#define DISABLE_WTMPX 1" >>confdefs.h
+ fi
fi
-else
-
-cat >>confdefs.h <<_ACEOF
+fi
+if test -n "$conf_wtmpx_location"; then
+ cat >>confdefs.h <<_ACEOF
#define CONF_WTMPX_FILE "$conf_wtmpx_location"
_ACEOF
@@ -18441,7 +18481,7 @@ echo "OpenSSH has been configured with t
echo " User binaries: $B"
echo " System binaries: $C"
echo " Configuration files: $D"
-echo " Askpass program: $E"
+echo " Askpass program: ${ASKPASS_PROGRAM}"
echo " Manual pages: $F"
echo " PID file: $G"
echo " Privilege separation chroot path: $H"
@@ -0,0 +1,69 @@
$NetBSD: patch-configure.ac,v 1.1 2013/05/01 19:58:26 imil Exp $
Various fixes regarding portability
--- configure.ac.orig 2013-03-20 01:55:15.000000000 +0000
+++ configure.ac
@@ -241,6 +241,9 @@ AC_ARG_WITH([rpath],
]
)
+# pkgsrc handles any rpath settings this package needs
+need_dash_r=
+
# Allow user to specify flags
AC_ARG_WITH([cflags],
[ --with-cflags Specify additional flags to pass to compiler],
@@ -309,6 +312,7 @@ AC_CHECK_HEADERS([ \
maillock.h \
ndir.h \
net/if_tun.h \
+ net/tun/if_tun.h \
netdb.h \
netgroup.h \
pam/pam_appl.h \
@@ -603,6 +607,15 @@ main() { if (NSVersionOfRunTimeLibrary("
;;
esac
;;
+*-*-interix*)
+ AC_DEFINE(HAVE_INTERIX)
+ AC_DEFINE(DISABLE_FD_PASSING)
+ AC_DEFINE(DISABLE_SHADOW)
+ AC_DEFINE(IP_TOS_IS_BROKEN)
+ AC_DEFINE(MISSING_HOWMANY)
+ AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
+ AC_DEFINE(USE_PIPES)
+ ;;
*-*-irix5*)
PATH="$PATH:/usr/etc"
AC_DEFINE([BROKEN_INET_NTOA], [1],
@@ -4460,9 +4473,17 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
])
if test -z "$conf_wtmpx_location"; then
if test x"$system_wtmpx_path" = x"no" ; then
- AC_DEFINE([DISABLE_WTMPX])
+ for f in /var/log/wtmpx; do
+ if test -f $f ; then
+ conf_wtmpx_location=$f
+ fi
+ done
+ if test -z "$conf_wtmpx_location"; then
+ AC_DEFINE(DISABLE_WTMPX)
+ fi
fi
-else
+fi
+if test -n "$conf_wtmpx_location"; then
AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
[Define if you want to specify the path to your wtmpx file])
fi
@@ -4547,7 +4568,7 @@ echo "OpenSSH has been configured with t
echo " User binaries: $B"
echo " System binaries: $C"
echo " Configuration files: $D"
-echo " Askpass program: $E"
+echo " Askpass program: ${ASKPASS_PROGRAM}"
echo " Manual pages: $F"
echo " PID file: $G"
echo " Privilege separation chroot path: $H"
+47
View File
@@ -0,0 +1,47 @@
$NetBSD: patch-defines.h,v 1.1 2013/05/01 19:58:26 imil Exp $
Define ROOTUID, UTMPX_FILE and WTMPX_FILE
--- defines.h.orig 2013-03-07 09:06:13.000000000 +0000
+++ defines.h
@@ -30,6 +30,15 @@
/* Constants */
+#ifdef HAVE_INTERIX
+/* Interix has a special concept of "administrator". */
+# define ROOTUID 197108
+# define ROOTGID 131616
+#else
+# define ROOTUID 0
+# define ROOTGID 0
+#endif
+
#if defined(HAVE_DECL_SHUT_RD) && HAVE_DECL_SHUT_RD == 0
enum
{
@@ -695,6 +704,24 @@ struct winsize {
# endif
# endif
#endif
+#ifndef UTMPX_FILE
+# ifdef _PATH_UTMPX
+# define UTMPX_FILE _PATH_UTMPX
+# else
+# ifdef CONF_UTMPX_FILE
+# define UTMPX_FILE CONF_UTMPX_FILE
+# endif
+# endif
+#endif
+#ifndef WTMPX_FILE
+# ifdef _PATH_WTMPX
+# define WTMPX_FILE _PATH_WTMPX
+# else
+# ifdef CONF_WTMPX_FILE
+# define WTMPX_FILE CONF_WTMPX_FILE
+# endif
+# endif
+#endif
/* pick up the user's location for lastlog if given */
#ifndef LASTLOG_FILE
# ifdef _PATH_LASTLOG
+17
View File
@@ -0,0 +1,17 @@
$NetBSD: patch-includes.h,v 1.1 2013/05/01 19:58:26 imil Exp $
Interix support
--- includes.h.orig 2013-02-22 22:12:24.000000000 +0000
+++ includes.h
@@ -124,6 +124,10 @@
#ifdef HAVE_READPASSPHRASE_H
# include <readpassphrase.h>
#endif
+#ifdef HAVE_INTERIX
+# include <interix/env.h>
+# include <interix/security.h>
+#endif
#ifdef HAVE_IA_H
# include <ia.h>
+64
View File
@@ -0,0 +1,64 @@
$NetBSD: patch-loginrec.c,v 1.1 2013/05/01 19:58:26 imil Exp $
Interix support and related fixes
--- loginrec.c.orig 2013-02-22 22:12:24.000000000 +0000
+++ loginrec.c
@@ -429,8 +429,8 @@ login_set_addr(struct logininfo *li, con
int
login_write(struct logininfo *li)
{
-#ifndef HAVE_CYGWIN
- if (geteuid() != 0) {
+#if !defined(HAVE_CYGWIN) && !defined(HAVE_INTERIX)
+ if (geteuid() != ROOTUID) {
logit("Attempt to write login records by non-root user (aborting)");
return (1);
}
@@ -438,7 +438,7 @@ login_write(struct logininfo *li)
/* set the timestamp */
login_set_current_time(li);
-#ifdef USE_LOGIN
+#if defined(USE_LOGIN) && (HAVE_UTMP_H)
syslogin_write_entry(li);
#endif
#ifdef USE_LASTLOG
@@ -622,7 +622,7 @@ line_abbrevname(char *dst, const char *s
** into account.
**/
-#if defined(USE_UTMP) || defined (USE_WTMP) || defined (USE_LOGIN)
+#if defined(USE_UTMP) || defined (USE_WTMP) || (defined (USE_LOGIN) && defined (HAVE_UTMP_H))
/* build the utmp structure */
void
@@ -759,10 +759,6 @@ construct_utmpx(struct logininfo *li, st
set_utmpx_time(li, utx);
utx->ut_pid = li->pid;
- /* strncpy(): Don't necessarily want null termination */
- strncpy(utx->ut_user, li->username,
- MIN_SIZEOF(utx->ut_user, li->username));
-
if (li->type == LTYPE_LOGOUT)
return;
@@ -771,6 +767,8 @@ construct_utmpx(struct logininfo *li, st
* for logouts.
*/
+ /* strncpy(): Don't necessarily want null termination */
+ strncpy(utx->ut_name, li->username, MIN_SIZEOF(utx->ut_name, li->username));
# ifdef HAVE_HOST_IN_UTMPX
strncpy(utx->ut_host, li->hostname,
MIN_SIZEOF(utx->ut_host, li->hostname));
@@ -1406,7 +1404,7 @@ wtmpx_get_entry(struct logininfo *li)
** Low-level libutil login() functions
**/
-#ifdef USE_LOGIN
+#if defined(USE_LOGIN) && defined(HAVE_UTMP_H)
static int
syslogin_perform_login(struct logininfo *li)
{
@@ -0,0 +1,26 @@
$NetBSD: patch-openbsd-compat_bsd-openpty.c,v 1.1 2013/05/01 19:58:26 imil Exp $
Interix support
--- openbsd-compat/bsd-openpty.c.orig 2006-08-24 09:52:30.000000000 +0000
+++ openbsd-compat/bsd-openpty.c
@@ -121,15 +121,17 @@ openpty(int *amaster, int *aslave, char
return (-1);
}
+#if !defined(HAVE_INTERIX)
/*
* Try to push the appropriate streams modules, as described
* in Solaris pts(7).
*/
ioctl(*aslave, I_PUSH, "ptem");
ioctl(*aslave, I_PUSH, "ldterm");
-# ifndef __hpux
+ # ifndef __hpux
ioctl(*aslave, I_PUSH, "ttcompat");
-# endif /* __hpux */
+ # endif /* __hpux */
+#endif /* !HAVE_INTERIX */
return (0);
@@ -0,0 +1,17 @@
$NetBSD: patch-openbsd-compat_openbsd-compat.h,v 1.1 2013/05/01 19:58:26 imil Exp $
strtoll() declaration
--- openbsd-compat/openbsd-compat.h.orig 2013-02-15 01:20:42.000000000 +0000
+++ openbsd-compat/openbsd-compat.h
@@ -83,6 +83,10 @@ size_t strlcat(char *dst, const char *sr
int setenv(register const char *name, register const char *value, int rewrite);
#endif
+#ifndef HAVE_STRTOLL
+long long strtoll(const char *, char **, int);
+#endif
+
#ifndef HAVE_STRMODE
void strmode(int mode, char *p);
#endif
@@ -0,0 +1,17 @@
$NetBSD: patch-openbsd-compat_port-tun.c,v 1.1 2013/05/01 19:58:26 imil Exp $
if_tun.h can be found in net/tun
--- openbsd-compat/port-tun.c.orig 2010-08-10 02:47:42.000000000 +0000
+++ openbsd-compat/port-tun.c
@@ -110,6 +110,10 @@ sys_tun_open(int tun, int mode)
#include <sys/socket.h>
#include <net/if.h>
+#ifdef HAVE_NET_TUN_IF_TUN_H
+#include <net/tun/if_tun.h>
+#endif
+
#ifdef HAVE_NET_IF_TUN_H
#include <net/if_tun.h>
#endif
+16
View File
@@ -0,0 +1,16 @@
$NetBSD: patch-platform.c,v 1.2 2013/05/01 19:58:26 imil Exp $
Interix support
--- platform.c.orig 2013-03-12 00:31:05.000000000 +0000
+++ platform.c
@@ -81,7 +81,9 @@ platform_privileged_uidswap(void)
/* uid 0 is not special on Cygwin so always try */
return 1;
#else
+#if !defined(HAVE_INTERIX)
return (getuid() == 0 || geteuid() == 0);
+#endif /* !HAVE_INTERIX */
#endif
}
+39
View File
@@ -0,0 +1,39 @@
$NetBSD: patch-scp.c,v 1.1 2013/05/01 19:58:26 imil Exp $
Interix support
--- scp.c.orig 2013-03-20 01:55:15.000000000 +0000
+++ scp.c
@@ -477,7 +477,11 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;
+#ifdef HAVE_INTERIX
+ if ((pwd = getpwuid_ex(userid = getuid(), PW_FULLNAME)) == NULL)
+#else
if ((pwd = getpwuid(userid = getuid())) == NULL)
+#endif
fatal("unknown user %u", (u_int) userid);
if (!isatty(STDOUT_FILENO))
@@ -881,8 +885,10 @@ rsource(char *name, struct stat *statp)
return;
}
while ((dp = readdir(dirp)) != NULL) {
+#ifndef HAVE_INTERIX
if (dp->d_ino == 0)
continue;
+#endif
if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
continue;
if (strlen(name) + 1 + strlen(dp->d_name) >= sizeof(path) - 1) {
@@ -1279,7 +1285,9 @@ okname(char *cp0)
case '\'':
case '"':
case '`':
+#ifndef HAVE_INTERIX
case ' ':
+#endif
case '#':
goto bad;
default:
+66
View File
@@ -0,0 +1,66 @@
$NetBSD: patch-session.c,v 1.1 2013/05/01 19:58:26 imil Exp $
Interix support
--- session.c.orig 2013-03-15 00:22:37.000000000 +0000
+++ session.c
@@ -1081,7 +1081,7 @@ read_etc_default_login(char ***env, u_in
if (tmpenv == NULL)
return;
- if (uid == 0)
+ if (uid == ROOTUID)
var = child_get_env(tmpenv, "SUPATH");
else
var = child_get_env(tmpenv, "PATH");
@@ -1190,7 +1190,7 @@ do_setup_env(Session *s, const char *she
# endif /* HAVE_ETC_DEFAULT_LOGIN */
if (path == NULL || *path == '\0') {
child_set_env(&env, &envsize, "PATH",
- s->pw->pw_uid == 0 ?
+ s->pw->pw_uid == ROOTUID ?
SUPERUSER_PATH : _PATH_STDPATH);
}
# endif /* HAVE_CYGWIN */
@@ -1304,6 +1304,18 @@ do_setup_env(Session *s, const char *she
strcmp(pw->pw_dir, "/") ? pw->pw_dir : "");
read_environment_file(&env, &envsize, buf);
}
+
+#ifdef HAVE_INTERIX
+ {
+ /* copy standard Windows environment, then apply changes */
+ env_t *winenv = env_login(pw);
+ env_putarray(winenv, env, ENV_OVERRIDE);
+
+ /* swap over to altered environment as a traditional array */
+ env = env_array(winenv);
+ }
+#endif
+
if (debug_flag) {
/* dump the environment */
fprintf(stderr, "Environment:\n");
@@ -1494,11 +1506,13 @@ do_setusercontext(struct passwd *pw)
perror("setgid");
exit(1);
}
+# if !defined(HAVE_INTERIX)
/* Initialize the group list. */
if (initgroups(pw->pw_name, pw->pw_gid) < 0) {
perror("initgroups");
exit(1);
}
+# endif /* !HAVE_INTERIX */
endgrent();
#endif
@@ -2313,7 +2327,7 @@ session_pty_cleanup2(Session *s)
record_logout(s->pid, s->tty, s->pw->pw_name);
/* Release the pseudo-tty. */
- if (getuid() == 0)
+ if (getuid() == ROOTUID)
pty_release(s->tty);
/*
+15
View File
@@ -0,0 +1,15 @@
$NetBSD: patch-ssh.c,v 1.1 2013/05/01 19:58:26 imil Exp $
Interix support
--- ssh.c.orig 2012-07-06 03:45:01.000000000 +0000
+++ ssh.c
@@ -794,7 +794,7 @@ main(int ac, char **av)
if (ssh_connect(host, &hostaddr, options.port,
options.address_family, options.connection_attempts, &timeout_ms,
options.tcp_keep_alive,
-#ifdef HAVE_CYGWIN
+#if defined(HAVE_CYGWIN) || defined(HAVE_INTERIX)
options.use_privileged_port,
#else
original_effective_uid == 0 && options.use_privileged_port,
+84
View File
@@ -0,0 +1,84 @@
$NetBSD: patch-sshd.c,v 1.1 2013/05/01 19:58:27 imil Exp $
Interix support
--- sshd.c.orig 2013-02-12 00:04:48.000000000 +0000
+++ sshd.c
@@ -237,7 +237,11 @@ int *startup_pipes = NULL;
int startup_pipe; /* in child */
/* variables used for privilege separation */
+#ifdef HAVE_INTERIX
int use_privsep = -1;
+#else
+int use_privsep = 0;
+#endif
struct monitor *pmonitor = NULL;
int privsep_is_preauth = 1;
@@ -625,10 +629,15 @@ privsep_preauth_child(void)
/* XXX not ready, too heavy after chroot */
do_setusercontext(privsep_pw);
#else
+#ifdef HAVE_INTERIX
+ if (setuser(privsep_pw->pw_name, NULL, SU_COMPLETE))
+ fatal("setuser: %.100s", strerror(errno));
+#else
gidset[0] = privsep_pw->pw_gid;
if (setgroups(1, gidset) < 0)
fatal("setgroups: %.100s", strerror(errno));
permanently_set_uid(privsep_pw);
+#endif /* HAVE_INTERIX */
#endif
}
@@ -688,7 +697,7 @@ privsep_preauth(Authctxt *authctxt)
set_log_handler(mm_log_handler, pmonitor);
/* Demote the child */
- if (getuid() == 0 || geteuid() == 0)
+ if (getuid() == ROOTUID || geteuid() == ROOTUID)
privsep_preauth_child();
setproctitle("%s", "[net]");
if (box != NULL)
@@ -706,7 +715,7 @@ privsep_postauth(Authctxt *authctxt)
#ifdef DISABLE_FD_PASSING
if (1) {
#else
- if (authctxt->pw->pw_uid == 0 || options.use_login) {
+ if (authctxt->pw->pw_uid == ROOTUID || options.use_login) {
#endif
/* File descriptor passing is broken or root login */
use_privsep = 0;
@@ -1363,8 +1372,10 @@ main(int ac, char **av)
av = saved_argv;
#endif
- if (geteuid() == 0 && setgroups(0, NULL) == -1)
+#ifndef HAVE_INTERIX
+ if (geteuid() == ROOTUID && setgroups(0, NULL) == -1)
debug("setgroups(): %.200s", strerror(errno));
+#endif
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
sanitise_stdfd();
@@ -1732,7 +1743,7 @@ main(int ac, char **av)
(st.st_uid != getuid () ||
(st.st_mode & (S_IWGRP|S_IWOTH)) != 0))
#else
- if (st.st_uid != 0 || (st.st_mode & (S_IWGRP|S_IWOTH)) != 0)
+ if (st.st_uid != ROOTUID || (st.st_mode & (S_IWGRP|S_IWOTH)) != 0)
#endif
fatal("%s must be owned by root and not group or "
"world-writable.", _PATH_PRIVSEP_CHROOT_DIR);
@@ -1755,8 +1766,10 @@ main(int ac, char **av)
* to create a file, and we can't control the code in every
* module which might be used).
*/
+#ifndef HAVE_INTERIX
if (setgroups(0, NULL) < 0)
debug("setgroups() failed: %.200s", strerror(errno));
+#endif
if (rexec_flag) {
rexec_argv = xcalloc(rexec_argc + 2, sizeof(char *));
+24
View File
@@ -0,0 +1,24 @@
$NetBSD: patch-sshpty.c,v 1.1 2013/05/01 19:58:27 imil Exp $
Replace uid 0 with ROOTUID macro
--- sshpty.c.orig 2009-02-12 01:19:21.000000000 +0000
+++ sshpty.c
@@ -86,7 +86,7 @@ void
pty_release(const char *tty)
{
#ifndef __APPLE_PRIVPTY__
- if (chown(tty, (uid_t) 0, (gid_t) 0) < 0)
+ if (chown(tty, (uid_t) ROOTUID, (gid_t) ROOTGID) < 0)
error("chown %.100s 0 0 failed: %.100s", tty, strerror(errno));
if (chmod(tty, (mode_t) 0666) < 0)
error("chmod %.100s 0666 failed: %.100s", tty, strerror(errno));
@@ -233,7 +233,7 @@ pty_setowner(struct passwd *pw, const ch
if (st.st_uid != pw->pw_uid || st.st_gid != gid) {
if (chown(tty, pw->pw_uid, gid) < 0) {
if (errno == EROFS &&
- (st.st_uid == pw->pw_uid || st.st_uid == 0))
+ (st.st_uid == pw->pw_uid || st.st_uid == ROOTUID))
debug("chown(%.100s, %u, %u) failed: %.100s",
tty, (u_int)pw->pw_uid, (u_int)gid,
strerror(errno));
+76
View File
@@ -0,0 +1,76 @@
$NetBSD: patch-uidswap.c,v 1.1 2013/05/01 19:58:27 imil Exp $
Interix support
--- uidswap.c.orig 2012-11-05 06:04:37.000000000 +0000
+++ uidswap.c
@@ -66,13 +66,13 @@ temporarily_use_uid(struct passwd *pw)
(u_int)pw->pw_uid, (u_int)pw->pw_gid,
(u_int)saved_euid, (u_int)saved_egid);
#ifndef HAVE_CYGWIN
- if (saved_euid != 0) {
+ if (saved_euid != ROOTUID) {
privileged = 0;
return;
}
#endif
#else
- if (geteuid() != 0) {
+ if (geteuid() != ROOTUID) {
privileged = 0;
return;
}
@@ -96,9 +96,11 @@ temporarily_use_uid(struct passwd *pw)
/* set and save the user's groups */
if (user_groupslen == -1) {
+#ifndef HAVE_INTERIX
if (initgroups(pw->pw_name, pw->pw_gid) < 0)
fatal("initgroups: %s: %.100s", pw->pw_name,
strerror(errno));
+#endif
user_groupslen = getgroups(0, NULL);
if (user_groupslen < 0)
@@ -113,9 +115,11 @@ temporarily_use_uid(struct passwd *pw)
xfree(user_groups);
}
}
+#ifndef HAVE_INTERIX
/* Set the effective uid to the given (unprivileged) uid. */
if (setgroups(user_groupslen, user_groups) < 0)
fatal("setgroups: %.100s", strerror(errno));
+#endif
#ifndef SAVED_IDS_WORK_WITH_SETEUID
/* Propagate the privileged gid to all of our gids. */
if (setgid(getegid()) < 0)
@@ -186,8 +190,10 @@ restore_uid(void)
setgid(getgid());
#endif /* SAVED_IDS_WORK_WITH_SETEUID */
+#ifndef HAVE_INTERIX
if (setgroups(saved_egroupslen, saved_egroups) < 0)
fatal("setgroups: %.100s", strerror(errno));
+#endif
temporarily_use_uid_effective = 0;
}
@@ -208,6 +214,10 @@ permanently_set_uid(struct passwd *pw)
debug("permanently_set_uid: %u/%u", (u_int)pw->pw_uid,
(u_int)pw->pw_gid);
+#if defined(HAVE_INTERIX)
+ if (setuser(pw->pw_name, NULL, SU_COMPLETE))
+ fatal("setuser %u: %.100s", (u_int)pw->pw_gid, strerror(errno));
+#else
if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) < 0)
fatal("setresgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno));
@@ -244,6 +254,7 @@ permanently_set_uid(struct passwd *pw)
(setuid(old_uid) != -1 || seteuid(old_uid) != -1))
fatal("%s: was able to restore old [e]uid", __func__);
#endif
+#endif /* HAVE_INTERIX */
/* Verify UID drop was successful */
if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid) {