Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae225aa559 | ||
|
|
c0d2468298 | ||
|
|
63e2615c13 | ||
|
|
a62e554c24 | ||
|
|
934a3a2983 | ||
|
|
1f1ac904ad | ||
|
|
f38ba20df5 | ||
|
|
f56198fb86 | ||
|
|
1182f654ee | ||
|
|
94de3b20db | ||
|
|
eca464db1e |
@@ -1,3 +1,21 @@
|
||||
20030326
|
||||
- (djm) OpenBSD CVS Sync
|
||||
- [email protected] 2003/03/26 04:02:51
|
||||
[sftp-server.c]
|
||||
one last fix to the tree: race fix broke stuff; pr 3169;
|
||||
[email protected], help from djm
|
||||
- (djm) Fix getpeerid support for 64 bit BE systems. From
|
||||
Arnd Bergmann <[email protected]>
|
||||
- Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
|
||||
Report from [email protected], diagnosis from [email protected]
|
||||
- Release 3.6p1
|
||||
|
||||
20030324
|
||||
- (djm) OpenBSD CVS Sync
|
||||
- [email protected] 2003/03/23 19:02:00
|
||||
[monitor.c]
|
||||
unbreak rekeying for privsep; ok millert@
|
||||
|
||||
20030320
|
||||
- (djm) OpenBSD CVS Sync
|
||||
- [email protected] 2003/03/17 10:38:38
|
||||
@@ -6,6 +24,15 @@
|
||||
- [email protected] 2003/03/17 11:43:47
|
||||
[version.h]
|
||||
enter 3.6
|
||||
- (bal) The days of lack of int64_t support are over. Sorry kids.
|
||||
- (bal) scp.c 'limit' conflicts with Cray. Rename to 'limitbw'
|
||||
- (bal) Collection of Cray patches (bsd-cray.h fix for CRAYT3E and improved
|
||||
guessing rules)
|
||||
- (bal) Disable Privsep for Tru64 after pre-authentication due to issues
|
||||
with SIA. Also, clean up of tru64 support patch by Chris Adams
|
||||
<[email protected]>
|
||||
- (tim) [contrib/caldera/openssh.spec] workaround RPM quirk. Fix %files
|
||||
section.
|
||||
|
||||
20030318
|
||||
- (tim) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h]
|
||||
@@ -1231,4 +1258,4 @@
|
||||
save auth method before monitor_reset_key_state(); bugzilla bug #284;
|
||||
ok provos@
|
||||
|
||||
$Id: ChangeLog,v 1.2633 2003/03/19 23:11:34 djm Exp $
|
||||
$Id: ChangeLog,v 1.2633.2.9 2003/03/26 05:03:05 djm Exp $
|
||||
|
||||
+6
-8
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.in,v 1.227 2003/02/24 23:22:36 djm Exp $
|
||||
# $Id: Makefile.in,v 1.227.2.1 2003/03/21 00:51:35 mouring Exp $
|
||||
|
||||
# uncomment if you run a non bourne compatable shell. Ie. csh
|
||||
#SHELL = @SH@
|
||||
@@ -58,9 +58,7 @@ EXEEXT=@EXEEXT@
|
||||
INSTALL_SSH_PRNG_CMDS=@INSTALL_SSH_PRNG_CMDS@
|
||||
INSTALL_SSH_RAND_HELPER=@INSTALL_SSH_RAND_HELPER@
|
||||
|
||||
@NO_SFTP@SFTP_PROGS=sftp-server$(EXEEXT) sftp$(EXEEXT)
|
||||
|
||||
TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-agent$(EXEEXT) scp$(EXEEXT) ssh-rand-helper${EXEEXT} $(SFTP_PROGS)
|
||||
TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-agent$(EXEEXT) scp$(EXEEXT) ssh-rand-helper${EXEEXT} sftp-server$(EXEEXT) sftp$(EXEEXT)
|
||||
|
||||
LIBSSH_OBJS=authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o \
|
||||
cipher.o compat.o compress.o crc32.o deattack.o fatal.o \
|
||||
@@ -247,8 +245,8 @@ install-files: scard-install
|
||||
$(INSTALL) -m 0755 $(STRIP_OPT) ssh-rand-helper $(DESTDIR)$(libexecdir)/ssh-rand-helper ; \
|
||||
fi
|
||||
$(INSTALL) -m 4711 $(STRIP_OPT) ssh-keysign $(DESTDIR)$(SSH_KEYSIGN)
|
||||
@NO_SFTP@$(INSTALL) -m 0755 $(STRIP_OPT) sftp $(DESTDIR)$(bindir)/sftp
|
||||
@NO_SFTP@$(INSTALL) -m 0755 $(STRIP_OPT) sftp-server $(DESTDIR)$(SFTP_SERVER)
|
||||
$(INSTALL) -m 0755 $(STRIP_OPT) sftp $(DESTDIR)$(bindir)/sftp
|
||||
$(INSTALL) -m 0755 $(STRIP_OPT) sftp-server $(DESTDIR)$(SFTP_SERVER)
|
||||
$(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
|
||||
$(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
|
||||
$(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
|
||||
@@ -261,8 +259,8 @@ install-files: scard-install
|
||||
if [ ! -z "$(INSTALL_SSH_RAND_HELPER)" ]; then \
|
||||
$(INSTALL) -m 644 ssh-rand-helper.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-rand-helper.8 ; \
|
||||
fi
|
||||
@NO_SFTP@$(INSTALL) -m 644 sftp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
|
||||
@NO_SFTP@$(INSTALL) -m 644 sftp-server.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
|
||||
$(INSTALL) -m 644 sftp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
|
||||
$(INSTALL) -m 644 sftp-server.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
|
||||
$(INSTALL) -m 644 ssh-keysign.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8
|
||||
-rm -f $(DESTDIR)$(bindir)/slogin
|
||||
ln -s ./ssh$(EXEEXT) $(DESTDIR)$(bindir)/slogin
|
||||
|
||||
+5
-1
@@ -43,6 +43,10 @@ It does not function on HP-UX with a trusted system
|
||||
configuration. PAMAuthenticationViaKbdInt does not function with
|
||||
privsep.
|
||||
|
||||
On Compaq Tru64 Unix, only the pre-authentication part of privsep is
|
||||
supported. Post-authentication privsep is disabled automatically (so
|
||||
you won't see the additional process mentioned below).
|
||||
|
||||
Note that for a normal interactive login with a shell, enabling privsep
|
||||
will require 1 additional process per login session.
|
||||
|
||||
@@ -58,4 +62,4 @@ process 1005 is the sshd process listening for new connections.
|
||||
process 6917 is the privileged monitor process, 6919 is the user owned
|
||||
sshd process and 6921 is the shell process.
|
||||
|
||||
$Id: README.privsep,v 1.10 2002/06/26 00:43:57 stevesk Exp $
|
||||
$Id: README.privsep,v 1.10.6.1 2003/03/21 01:15:18 mouring Exp $
|
||||
|
||||
+16
-31
@@ -45,27 +45,25 @@ extern ServerOptions options;
|
||||
extern int saved_argc;
|
||||
extern char **saved_argv;
|
||||
|
||||
extern int errno;
|
||||
|
||||
int
|
||||
auth_sia_password(Authctxt *authctxt, char *pass)
|
||||
{
|
||||
int ret;
|
||||
SIAENTITY *ent = NULL;
|
||||
const char *host;
|
||||
char *user = authctxt->user;
|
||||
|
||||
host = get_canonical_hostname(options.verify_reverse_mapping);
|
||||
|
||||
if (pass[0] == '\0')
|
||||
if (!authctxt->user || !pass || pass[0] == '\0')
|
||||
return(0);
|
||||
|
||||
if (sia_ses_init(&ent, saved_argc, saved_argv, host, user, NULL, 0,
|
||||
NULL) != SIASUCCESS)
|
||||
if (sia_ses_init(&ent, saved_argc, saved_argv, host, authctxt->user,
|
||||
NULL, 0, NULL) != SIASUCCESS)
|
||||
return(0);
|
||||
|
||||
if ((ret = sia_ses_authent(NULL, pass, ent)) != SIASUCCESS) {
|
||||
error("Couldn't authenticate %s from %s", user, host);
|
||||
error("Couldn't authenticate %s from %s", authctxt->user,
|
||||
host);
|
||||
if (ret & SIASTOP)
|
||||
sia_ses_release(&ent);
|
||||
return(0);
|
||||
@@ -77,48 +75,35 @@ auth_sia_password(Authctxt *authctxt, char *pass)
|
||||
}
|
||||
|
||||
void
|
||||
session_setup_sia(char *user, char *tty)
|
||||
session_setup_sia(struct passwd *pw, char *tty)
|
||||
{
|
||||
struct passwd *pw;
|
||||
SIAENTITY *ent = NULL;
|
||||
const char *host;
|
||||
|
||||
host = get_canonical_hostname (options.verify_reverse_mapping);
|
||||
host = get_canonical_hostname(options.verify_reverse_mapping);
|
||||
|
||||
if (sia_ses_init(&ent, saved_argc, saved_argv, host, user, tty, 0,
|
||||
NULL) != SIASUCCESS) {
|
||||
if (sia_ses_init(&ent, saved_argc, saved_argv, host, pw->pw_name, tty,
|
||||
0, NULL) != SIASUCCESS)
|
||||
fatal("sia_ses_init failed");
|
||||
}
|
||||
|
||||
if ((pw = getpwnam(user)) == NULL) {
|
||||
sia_ses_release(&ent);
|
||||
fatal("getpwnam: no user: %s", user);
|
||||
}
|
||||
if (sia_make_entity_pwd(pw, ent) != SIASUCCESS) {
|
||||
sia_ses_release(&ent);
|
||||
fatal("sia_make_entity_pwd failed");
|
||||
}
|
||||
|
||||
ent->authtype = SIA_A_NONE;
|
||||
if (sia_ses_estab(sia_collect_trm, ent) != SIASUCCESS) {
|
||||
fatal("Couldn't establish session for %s from %s", user,
|
||||
if (sia_ses_estab(sia_collect_trm, ent) != SIASUCCESS)
|
||||
fatal("Couldn't establish session for %s from %s",
|
||||
pw->pw_name, host);
|
||||
|
||||
if (sia_ses_launch(sia_collect_trm, ent) != SIASUCCESS)
|
||||
fatal("Couldn't launch session for %s from %s", pw->pw_name,
|
||||
host);
|
||||
}
|
||||
|
||||
if (setpriority(PRIO_PROCESS, 0, 0) == -1) {
|
||||
sia_ses_release(&ent);
|
||||
fatal("setpriority: %s", strerror (errno));
|
||||
}
|
||||
|
||||
if (sia_ses_launch(sia_collect_trm, ent) != SIASUCCESS) {
|
||||
fatal("Couldn't launch session for %s from %s", user, host);
|
||||
}
|
||||
|
||||
sia_ses_release(&ent);
|
||||
|
||||
if (setreuid(geteuid(), geteuid()) < 0) {
|
||||
if (setreuid(geteuid(), geteuid()) < 0)
|
||||
fatal("setreuid: %s", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_OSF_SIA */
|
||||
|
||||
+1
-1
@@ -27,6 +27,6 @@
|
||||
#ifdef HAVE_OSF_SIA
|
||||
|
||||
int auth_sia_password(Authctxt *authctxt, char *pass);
|
||||
void session_setup_sia(char *user, char *tty);
|
||||
void session_setup_sia(struct passwd *pw, char *tty);
|
||||
|
||||
#endif /* HAVE_OSF_SIA */
|
||||
|
||||
Vendored
+3
@@ -726,6 +726,9 @@ EOF
|
||||
CRAY*SV1:*:*:*)
|
||||
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit 0 ;;
|
||||
*:UNICOS/mp:*:*)
|
||||
echo nv1-cray-unicosmp | sed -e 's/\.[^.]*$/.X/'
|
||||
exit 0 ;;
|
||||
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
||||
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
|
||||
Vendored
+4
-1
@@ -315,7 +315,7 @@ case $basic_machine in
|
||||
| mipsisa64-* | mipsisa64el-* \
|
||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipstx39 | mipstx39el \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* | nv1-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
@@ -715,6 +715,9 @@ case $basic_machine in
|
||||
nsr-tandem)
|
||||
basic_machine=nsr-tandem
|
||||
;;
|
||||
nv1)
|
||||
basic_machine=nv1-cray
|
||||
;;
|
||||
op50n-* | op60c-*)
|
||||
basic_machine=hppa1.1-oki
|
||||
os=-proelf
|
||||
|
||||
+7
-11
@@ -1,4 +1,4 @@
|
||||
# $Id: configure.ac,v 1.111 2003/03/18 18:21:41 tim Exp $
|
||||
# $Id: configure.ac,v 1.111.2.2 2003/03/21 01:15:18 mouring Exp $
|
||||
|
||||
AC_INIT
|
||||
AC_CONFIG_SRCDIR([ssh.c])
|
||||
@@ -331,6 +331,7 @@ mips-sony-bsd|mips-sony-newsos4)
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_OSF_SIA)
|
||||
AC_DEFINE(DISABLE_LOGIN)
|
||||
AC_DEFINE(DISABLE_FD_PASSING)
|
||||
LIBS="$LIBS -lsecurity -ldb -lm -laud"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
@@ -1485,12 +1486,14 @@ fi
|
||||
|
||||
AC_CHECK_TYPES(struct timespec)
|
||||
|
||||
# If we don't have int64_t then we can't compile sftp-server. So don't
|
||||
# even attempt to do it.
|
||||
# We need int64_t or else certian parts of the compile will fail.
|
||||
if test "x$ac_cv_have_int64_t" = "xno" -a \
|
||||
"x$ac_cv_sizeof_long_int" != "x8" -a \
|
||||
"x$ac_cv_sizeof_long_long_int" = "x0" ; then
|
||||
NO_SFTP='#'
|
||||
echo "OpenSSH requires int64_t support. Contact your vendor or install"
|
||||
echo "an alternative compiler (I.E., GCC) before continuing."
|
||||
echo ""
|
||||
exit 1;
|
||||
else
|
||||
dnl test snprintf (broken on SCO w/gcc)
|
||||
AC_TRY_RUN(
|
||||
@@ -1520,7 +1523,6 @@ main() { exit(0); }
|
||||
], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
|
||||
)
|
||||
fi
|
||||
AC_SUBST(NO_SFTP)
|
||||
|
||||
dnl Checks for structure members
|
||||
OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
|
||||
@@ -2555,12 +2557,6 @@ if test "x$PAM_MSG" = "xyes" ; then
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if test ! -z "$NO_SFTP"; then
|
||||
echo "sftp-server will be disabled. Your compiler does not "
|
||||
echo "support 64bit integers."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if test ! -z "$RAND_HELPER_CMDHASH" ; then
|
||||
echo "WARNING: you are using the builtin random number collection "
|
||||
echo "service. Please read WARNING.RNG and request that your OS "
|
||||
|
||||
@@ -198,7 +198,7 @@ xmkmf
|
||||
%Install
|
||||
[ %{buildroot} != "/" ] && rm -rf %{buildroot}
|
||||
|
||||
%makeinstall
|
||||
make install DESTDIR=%{buildroot}
|
||||
%makeinstall -C %{askpass} \
|
||||
BINDIR=%{_libexecdir} \
|
||||
MANPATH=%{_mandir} \
|
||||
@@ -325,6 +325,7 @@ fi
|
||||
%{_bindir}/ssh-keygen
|
||||
%{_bindir}/ssh-keyscan
|
||||
%dir %{_libexecdir}
|
||||
%attr(4711,root,root) %{_libexecdir}/ssh-keysign
|
||||
%{_sbindir}/ssh-host-keygen
|
||||
%dir %{_defaultdocdir}/%{name}-%{version}
|
||||
%{_defaultdocdir}/%{name}-%{version}/CREDITS
|
||||
@@ -335,6 +336,8 @@ fi
|
||||
%{_defaultdocdir}/%{name}-%{version}/TODO
|
||||
%{_defaultdocdir}/%{name}-%{version}/faq.html
|
||||
%{_mandir}/man1/*
|
||||
%{_mandir}/man8/ssh-keysign.8.gz
|
||||
%{_mandir}/man5/ssh_config.5.gz
|
||||
|
||||
%Files server
|
||||
%defattr(-,root,root)
|
||||
@@ -346,6 +349,7 @@ fi
|
||||
%config %{SVIcdir}/sshd
|
||||
%{_libexecdir}/sftp-server
|
||||
%{_sbindir}/sshd
|
||||
%{_mandir}/man5/sshd_config.5.gz
|
||||
%{_mandir}/man8/sftp-server.8.gz
|
||||
%{_mandir}/man8/sshd.8.gz
|
||||
|
||||
@@ -360,4 +364,4 @@ fi
|
||||
* Mon Jan 01 1998 ...
|
||||
Template Version: 1.31
|
||||
|
||||
$Id: openssh.spec,v 1.40 2003/03/19 23:52:14 djm Exp $
|
||||
$Id: openssh.spec,v 1.39.2.2 2003/03/21 04:52:56 tim Exp $
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
%define scard 0
|
||||
|
||||
# Use GTK2 instead of GNOME in gnome-ssh-askpass
|
||||
%define gtk2 0
|
||||
%define gtk2 1
|
||||
|
||||
# Is this build for RHL 6.x?
|
||||
%define build6x 0
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: monitor.c,v 1.33 2003/03/05 22:33:43 markus Exp $");
|
||||
RCSID("$OpenBSD: monitor.c,v 1.34 2003/03/23 19:02:00 markus Exp $");
|
||||
|
||||
#include <openssl/dh.h>
|
||||
|
||||
@@ -1466,6 +1466,8 @@ mm_get_kex(Buffer *m)
|
||||
(memcmp(kex->session_id, session_id2, session_id2_len) != 0))
|
||||
fatal("mm_get_get: internal error: bad session id");
|
||||
kex->we_need = buffer_get_int(m);
|
||||
kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server;
|
||||
kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
|
||||
kex->server = 1;
|
||||
kex->hostkey_type = buffer_get_int(m);
|
||||
kex->kex_type = buffer_get_int(m);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: bsd-cray.h,v 1.6 2003/01/27 21:15:11 mouring Exp $
|
||||
* $Id: bsd-cray.h,v 1.6.2.1 2003/03/21 01:07:45 mouring Exp $
|
||||
*
|
||||
* bsd-cray.h
|
||||
*
|
||||
@@ -49,8 +49,10 @@ extern char cray_tmpdir[]; /* cray tmpdir */
|
||||
#ifndef MAXHOSTNAMELEN
|
||||
#define MAXHOSTNAMELEN 64
|
||||
#endif
|
||||
#ifndef _CRAYT3E
|
||||
#include <sys/ttold.h>
|
||||
#define TIOCGPGRP (tIOC|20)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* _BSD_CRAY_H */
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
RCSID("$Id: bsd-getpeereid.c,v 1.1 2002/09/12 00:33:02 djm Exp $");
|
||||
RCSID("$Id: bsd-getpeereid.c,v 1.1.4.1 2003/03/26 05:02:47 djm Exp $");
|
||||
|
||||
#if !defined(HAVE_GETPEEREID)
|
||||
|
||||
@@ -33,7 +33,7 @@ int
|
||||
getpeereid(int s, uid_t *euid, gid_t *gid)
|
||||
{
|
||||
struct ucred cred;
|
||||
size_t len = sizeof(cred);
|
||||
socklen_t len = sizeof(cred);
|
||||
|
||||
if (getsockopt(s, SOL_SOCKET, SO_PEERCRED, &cred, &len) < 0)
|
||||
return (-1);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "includes.h"
|
||||
#include "ssh.h"
|
||||
|
||||
RCSID("$Id: fake-getaddrinfo.c,v 1.4 2003/02/24 01:35:09 djm Exp $");
|
||||
RCSID("$Id: fake-getaddrinfo.c,v 1.4.2.1 2003/03/26 05:03:06 djm Exp $");
|
||||
|
||||
#ifndef HAVE_GAI_STRERROR
|
||||
char *gai_strerror(int ecode)
|
||||
@@ -71,6 +71,7 @@ int getaddrinfo(const char *hostname, const char *servname,
|
||||
struct in_addr in;
|
||||
int i;
|
||||
long int port;
|
||||
u_long addr;
|
||||
|
||||
port = 0;
|
||||
if (servname != NULL) {
|
||||
@@ -86,7 +87,10 @@ int getaddrinfo(const char *hostname, const char *servname,
|
||||
}
|
||||
|
||||
if (hints && hints->ai_flags & AI_PASSIVE) {
|
||||
if (NULL != (*res = malloc_ai(port, htonl(0x00000000))))
|
||||
addr = htonl(0x00000000);
|
||||
if (hostname && inet_aton(hostname, &in) != 0)
|
||||
addr = in.s_addr;
|
||||
if (NULL != (*res = malloc_ai(port, addr)))
|
||||
return 0;
|
||||
else
|
||||
return EAI_MEMORY;
|
||||
|
||||
@@ -96,7 +96,7 @@ void bwlimit(int);
|
||||
arglist args;
|
||||
|
||||
/* Bandwidth limit */
|
||||
off_t limit = 0;
|
||||
off_t limitbw = 0;
|
||||
|
||||
/* Name of current file being transferred. */
|
||||
char *curfile;
|
||||
@@ -251,7 +251,7 @@ main(argc, argv)
|
||||
speed = strtod(optarg, &endp);
|
||||
if (speed <= 0 || *endp != '\0')
|
||||
usage();
|
||||
limit = speed * 1024;
|
||||
limitbw = speed * 1024;
|
||||
break;
|
||||
case 'p':
|
||||
pflag = 1;
|
||||
@@ -594,7 +594,7 @@ next: (void) close(fd);
|
||||
haderr = result >= 0 ? EIO : errno;
|
||||
statbytes += result;
|
||||
}
|
||||
if (limit)
|
||||
if (limitbw)
|
||||
bwlimit(amt);
|
||||
}
|
||||
if (showprogress)
|
||||
@@ -688,7 +688,7 @@ bwlimit(int amount)
|
||||
return;
|
||||
|
||||
lamt *= 8;
|
||||
wait = (double)1000000L * lamt / limit;
|
||||
wait = (double)1000000L * lamt / limitbw;
|
||||
|
||||
bwstart.tv_sec = wait / 1000000L;
|
||||
bwstart.tv_usec = wait % 1000000L;
|
||||
@@ -917,7 +917,7 @@ bad: run_err("%s: %s", np, strerror(errno));
|
||||
statbytes += j;
|
||||
} while (amt > 0);
|
||||
|
||||
if (limit)
|
||||
if (limitbw)
|
||||
bwlimit(4096);
|
||||
|
||||
if (count == bp->cnt) {
|
||||
|
||||
@@ -1321,7 +1321,7 @@ do_child(Session *s, const char *command)
|
||||
*/
|
||||
if (!options.use_login) {
|
||||
#ifdef HAVE_OSF_SIA
|
||||
session_setup_sia(pw->pw_name, s->ttyfd == -1 ? NULL : s->tty);
|
||||
session_setup_sia(pw, s->ttyfd == -1 ? NULL : s->tty);
|
||||
if (!check_quietlogin(s, command))
|
||||
do_motd();
|
||||
#else /* HAVE_OSF_SIA */
|
||||
|
||||
+20
-9
@@ -22,7 +22,7 @@
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: sftp-server.c,v 1.40 2003/03/05 22:33:43 markus Exp $");
|
||||
RCSID("$OpenBSD: sftp-server.c,v 1.41 2003/03/26 04:02:51 deraadt Exp $");
|
||||
|
||||
#include "buffer.h"
|
||||
#include "bufaux.h"
|
||||
@@ -836,20 +836,31 @@ process_rename(void)
|
||||
u_int32_t id;
|
||||
char *oldpath, *newpath;
|
||||
int status;
|
||||
struct stat sb;
|
||||
|
||||
id = get_int();
|
||||
oldpath = get_string(NULL);
|
||||
newpath = get_string(NULL);
|
||||
TRACE("rename id %u old %s new %s", id, oldpath, newpath);
|
||||
/* fail if 'newpath' exists */
|
||||
if (link(oldpath, newpath) == -1)
|
||||
status = SSH2_FX_FAILURE;
|
||||
if (lstat(oldpath, &sb) == -1)
|
||||
status = errno_to_portable(errno);
|
||||
else if (unlink(oldpath) == -1) {
|
||||
status = errno_to_portable(errno);
|
||||
/* clean spare link */
|
||||
unlink(newpath);
|
||||
} else
|
||||
status = SSH2_FX_OK;
|
||||
else if (S_ISREG(sb.st_mode)) {
|
||||
/* Race-free rename of regular files */
|
||||
if (link(oldpath, newpath) == -1)
|
||||
status = errno_to_portable(errno);
|
||||
else if (unlink(oldpath) == -1) {
|
||||
status = errno_to_portable(errno);
|
||||
/* clean spare link */
|
||||
unlink(newpath);
|
||||
} else
|
||||
status = SSH2_FX_OK;
|
||||
} else if (stat(newpath, &sb) == -1) {
|
||||
if (rename(oldpath, newpath) == -1)
|
||||
status = errno_to_portable(errno);
|
||||
else
|
||||
status = SSH2_FX_OK;
|
||||
}
|
||||
send_status(id, status);
|
||||
xfree(oldpath);
|
||||
xfree(newpath);
|
||||
|
||||
Reference in New Issue
Block a user