Compare commits

...
17 Commits
Author SHA1 Message Date
Darren Tucker 4f606dd5c3 - (djm) bz#1325: Fix SELinux in permissive mode where it would
incorrectly fatal() on errors. patch from cjwatson AT debian.org;
   ok dtucker
   (backport from current)
2007-06-28 10:07:43 +10:00
Darren Tucker 202c17be30 - [email protected] 2007/06/14 22:48:05
[ssh.c]
     when waiting for the multiplex exit status, read until the master end
     writes an entire int of data *and* closes the client_fd; fixes mux
     regression spotted by dtucker, ok dtucker@
2007-06-25 18:59:31 +10:00
Darren Tucker 20c4012e60 - [email protected] 2007/06/14 21:43:25
[ssh.c]
     handle EINTR when waiting for mux exit status properly
2007-06-25 18:43:03 +10:00
Darren Tucker a422cfcd46 - [email protected] 2007/06/14 21:43:25
[ssh.c]
     handle EINTR when waiting for mux exit status properly
2007-06-25 18:35:49 +10:00
Darren Tucker e64ad08d0c - [email protected] 2007/06/13 00:21:27
[scp.c]
     don't ftruncate() non-regular files; bz#1236 reported by wood AT
     xmission.com; ok dtucker@
2007-06-25 18:33:56 +10:00
Darren Tucker 1ed2740f13 - [email protected] 2007/06/12 11:11:08
[ssh.c]
     fix slave exit value when a control master goes away without passing the
     full exit status by ensuring that the slave reads a full int. bz#1261
     reported by frekko AT gmail.com; ok markus@ dtucker@
2007-06-12 23:49:11 +10:00
Darren Tucker c3244a98df - [email protected] 2007/06/12 11:56:15
[gss-genr.c]
     Pass GSS OID to gss_display_status to provide better information in
     error messages.  Patch from Simon Wilkinson via bz 1220.  ok djm@
2007-06-12 23:47:25 +10:00
Darren Tucker 2b359f9541 - (dtucker) [includes.h] Bug #1243: HAVE_PATHS -> HAVE_PATHS_H. Should
prevent warnings about redefinitions of various things in paths.h.
   Spotted by cartmanltd at hotmail.com.
2007-06-11 14:44:17 +10:00
Darren Tucker 98015ba05e - (djm) Bugzilla #1306: silence spurious error messages from hang-on-exit
fix; tested by dtucker@ and jochen.kirn AT gmail.com (backport from HEAD)
2007-06-11 14:32:30 +10:00
Darren Tucker a50bfccd46 - (dtucker) [mdoc2man.awk] Sync with rev 1.8, mainly for %R reference
support used for RFCs.
2007-06-05 20:05:37 +10:00
Darren Tucker cd58e4d4da - [email protected] 2007/04/23 10:15:39
[servconf.c]
     Remove debug() left over from development.  ok deraadt@
     (This fixes a null pointer deref on startup with Match+debug on some
     platforms).
2007-05-20 15:06:11 +10:00
Darren Tucker b7bbc8b9bd - (dtucker) [configure.ac openbsd-compat/getrrsetbyname.c] Bug #1299: Use the
platform's _res if it has one.  Should fix problem of DNSSEC record lookups
   on NetBSD as reported by Curt Sampson.
2007-04-29 13:58:47 +10:00
Darren Tucker 02cd252e4a - (tim) [auth.c configure.ac defines.h session.c openbsd-compat/port-uw.c
openbsd-compat/port-uw.h openbsd-compat/xcrypt.c] Rework libiaf test/defines
   to account for IRIX having libiaf but not set_id(). Patch with & ok dtucker@

  (backport from -HEAD)
2007-03-27 19:07:48 +10:00
Darren Tucker 05f577f5a6 - [email protected] 2007/03/09 05:20:06
[servconf.c sshd.c]
     Move C/R -> kbdint special case to after the defaults have been
     loaded, which makes ChallengeResponse default to yes again.  This
     was broken by the Match changes and not fixed properly subsequently.
     Found by okan at demirmen.com, ok djm@ "please do it" deraadt@
2007-03-21 20:40:10 +11:00
Darren Tucker 05974bf67c - (dtucker) [cipher-3des1.c cipher-bf1.c] The OpenSSL 0.9.8e problem in
bug #1291 also affects Protocol 1 3des.  While at it, use compat-openssl.h
   in cipher-bf1.c.  Patch from Juan Gallego.
2007-03-13 18:49:31 +11:00
Darren Tucker d19f416144 - (dtucker) [entropy.c scard-opensc.c ssh-rand-helper.c] Bug #1294: include
string.h to prevent warnings, from vapier at gentoo.org.
2007-03-13 07:33:34 +11:00
Damien Miller 4ee72c71e3 - (djm) [README] correct link to release notes 2007-03-06 21:27:55 +11:00
24 changed files with 196 additions and 66 deletions
+79 -1
View File
@@ -1,3 +1,80 @@
20070628
- (djm) bz#1325: Fix SELinux in permissive mode where it would
incorrectly fatal() on errors. patch from cjwatson AT debian.org;
ok dtucker
20070625
- (dtucker) OpenBSD CVS Sync
- [email protected] 2007/06/13 00:21:27
[scp.c]
don't ftruncate() non-regular files; bz#1236 reported by wood AT
xmission.com; ok dtucker@
- [email protected] 2007/06/14 21:43:25
[ssh.c]
handle EINTR when waiting for mux exit status properly
- [email protected] 2007/06/14 22:48:05
[ssh.c]
when waiting for the multiplex exit status, read until the master end
writes an entire int of data *and* closes the client_fd; fixes mux
regression spotted by dtucker, ok dtucker@
20070612
- (dtucker) OpenBSD CVS Sync
- [email protected] 2007/06/12 11:11:08
[ssh.c]
fix slave exit value when a control master goes away without passing the
full exit status by ensuring that the slave reads a full int. bz#1261
reported by frekko AT gmail.com; ok markus@ dtucker@
- [email protected] 2007/06/12 11:56:15
[gss-genr.c]
Pass GSS OID to gss_display_status to provide better information in
error messages. Patch from Simon Wilkinson via bz 1220. ok djm@
20070611
- (djm) Bugzilla #1306: silence spurious error messages from hang-on-exit
fix; tested by dtucker@ and jochen.kirn AT gmail.com (backport from HEAD)
- (dtucker) [includes.h] Bug #1243: HAVE_PATHS -> HAVE_PATHS_H. Should
prevent warnings about redefinitions of various things in paths.h.
Spotted by cartmanltd at hotmail.com.
20070605
- (dtucker) [mdoc2man.awk] Sync with rev 1.8, mainly for %R reference
support used for RFCs.
20070520
- (dtucker) OpenBSD CVS Sync
- [email protected] 2007/04/23 10:15:39
[servconf.c]
Remove debug() left over from development. ok deraadt@
(This fixes a null pointer deref on startup with Match+debug on some
platforms).
20070429
- (dtucker) [configure.ac openbsd-compat/getrrsetbyname.c] Bug #1299: Use the
platform's _res if it has one. Should fix problem of DNSSEC record lookups
on NetBSD as reported by Curt Sampson.
20070326
- (tim) [auth.c configure.ac defines.h session.c openbsd-compat/port-uw.c
openbsd-compat/port-uw.h openbsd-compat/xcrypt.c] Rework libiaf test/defines
to account for IRIX having libiaf but not set_id(). Patch with & ok dtucker@
20070321
- (dtucker) OpenBSD CVS Sync
- [email protected] 2007/03/09 05:20:06
[servconf.c sshd.c]
Move C/R -> kbdint special case to after the defaults have been
loaded, which makes ChallengeResponse default to yes again. This
was broken by the Match changes and not fixed properly subsequently.
Found by okan at demirmen.com, ok djm@ "please do it" deraadt@
20070313
- (dtucker) [entropy.c scard-opensc.c ssh-rand-helper.c] Bug #1294: include
string.h to prevent warnings, from vapier at gentoo.org.
- (dtucker) [cipher-3des1.c cipher-bf1.c] The OpenSSL 0.9.8e problem in
bug #1291 also affects Protocol 1 3des. While at it, use compat-openssl.h
in cipher-bf1.c. Patch from Juan Gallego.
20070306
- (djm) OpenBSD CVS Sync
- [email protected] 2007/03/01 16:19:33
@@ -8,6 +85,7 @@
openssh-4.6; "please" deraadt@
- (djm) [contrib/caldera/openssh.spec contrib/redhat/openssh.spec]
[contrib/suse/openssh.spec] crank spec files for release
- (djm) [README] correct link to release notes
- (djm) Release 4.6p1
20070304
@@ -2815,4 +2893,4 @@
OpenServer 6 and add osr5bigcrypt support so when someone migrates
passwords between UnixWare and OpenServer they will still work. OK dtucker@
$Id: ChangeLog,v 1.4635 2007/03/06 10:24:00 djm Exp $
$Id: ChangeLog,v 1.4635.2.16 2007/06/28 00:07:43 dtucker Exp $
+2 -2
View File
@@ -1,4 +1,4 @@
See http://www.openssh.com/txt/release-4.5 for the release notes.
See http://www.openssh.com/txt/release-4.6 for the release notes.
- A Japanese translation of this document and of the OpenSSH FAQ is
- available at http://www.unixuser.org/~haruyama/security/openssh/index.html
@@ -62,4 +62,4 @@ References -
[6] http://www.openbsd.org/cgi-bin/man.cgi?query=style&sektion=9
[7] http://www.openssh.com/faq.html
$Id: README,v 1.64 2006/11/07 12:25:45 dtucker Exp $
$Id: README,v 1.64.4.1 2007/03/06 10:27:56 djm Exp $
+4 -4
View File
@@ -115,11 +115,11 @@ allowed_user(struct passwd * pw)
/* grab passwd field for locked account check */
#ifdef USE_SHADOW
if (spw != NULL)
#if defined(HAVE_LIBIAF) && !defined(BROKEN_LIBIAF)
#ifdef USE_LIBIAF
passwd = get_iaf_password(pw);
#else
passwd = spw->sp_pwdp;
#endif /* HAVE_LIBIAF && !BROKEN_LIBIAF */
#endif /* USE_LIBIAF */
#else
passwd = pw->pw_passwd;
#endif
@@ -141,9 +141,9 @@ allowed_user(struct passwd * pw)
if (strstr(passwd, LOCKED_PASSWD_SUBSTR))
locked = 1;
#endif
#if defined(HAVE_LIBIAF) && !defined(BROKEN_LIBIAF)
#ifdef USE_LIBIAF
free(passwd);
#endif /* HAVE_LIBIAF && !BROKEN_LIBIAF */
#endif /* USE_LIBIAF */
if (locked) {
logit("User %.100s not allowed because account is locked",
pw->pw_name);
+4 -5
View File
@@ -1446,14 +1446,13 @@ static int
channel_handle_rfd(Channel *c, fd_set *readset, fd_set *writeset)
{
char buf[CHAN_RBUF];
int len;
int len, force;
if (c->rfd != -1 &&
(c->detach_close || FD_ISSET(c->rfd, readset))) {
force = c->isatty && c->detach_close && c->istate != CHAN_INPUT_CLOSED;
if (c->rfd != -1 && (force || FD_ISSET(c->rfd, readset))) {
errno = 0;
len = read(c->rfd, buf, sizeof(buf));
if (len < 0 && (errno == EINTR ||
(errno == EAGAIN && !(c->isatty && c->detach_close))))
if (len < 0 && (errno == EINTR || (errno == EAGAIN && !force)))
return 1;
#ifndef PTY_ZEROREAD
if (len <= 0) {
+1 -3
View File
@@ -35,9 +35,7 @@
#include "xmalloc.h"
#include "log.h"
#if OPENSSL_VERSION_NUMBER < 0x00906000L
#define SSH_OLD_EVP
#endif
#include "openbsd-compat/openssl-compat.h"
/*
* This is used by SSH1:
+1 -3
View File
@@ -35,9 +35,7 @@
#include "xmalloc.h"
#include "log.h"
#if OPENSSL_VERSION_NUMBER < 0x00906000L
#define SSH_OLD_EVP
#endif
#include "openbsd-compat/openssl-compat.h"
/*
* SSH1 uses a variation on Blowfish, all bytes must be swapped before
+27 -3
View File
@@ -1,4 +1,4 @@
# $Id: configure.ac,v 1.372 2007/03/05 00:51:27 djm Exp $
# $Id: configure.ac,v 1.372.2.2 2007/04/29 03:58:47 dtucker Exp $
#
# Copyright (c) 1999-2004 Damien Miller
#
@@ -15,7 +15,7 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
AC_INIT(OpenSSH, Portable, [email protected])
AC_REVISION($Revision: 1.372 $)
AC_REVISION($Revision: 1.372.2.2 $)
AC_CONFIG_SRCDIR([ssh.c])
AC_CONFIG_HEADER(config.h)
@@ -1977,7 +1977,12 @@ fi
# Search for SHA256 support in libc and/or OpenSSL
AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
AC_CHECK_LIB(iaf, ia_openinfo)
saved_LIBS="$LIBS"
AC_CHECK_LIB(iaf, ia_openinfo, [
LIBS="$LIBS -liaf"
AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"])
])
LIBS="$saved_LIBS"
### Configure cryptographic random number support
@@ -3150,6 +3155,25 @@ int main()
[#include <arpa/nameser.h>])
])
AC_MSG_CHECKING(if struct __res_state _res is an extern)
AC_LINK_IFELSE([
#include <stdio.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
extern struct __res_state _res;
int main() { return 0; }
],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE__RES_EXTERN, 1,
[Define if you have struct __res_state _res as an extern])
],
[ AC_MSG_RESULT(no) ]
)
# Check whether user wants SELinux support
SELINUX_MSG="no"
LIBSELINUX=""
+3 -2
View File
@@ -25,7 +25,7 @@
#ifndef _DEFINES_H
#define _DEFINES_H
/* $Id: defines.h,v 1.138 2006/09/21 13:13:30 dtucker Exp $ */
/* $Id: defines.h,v 1.138.6.1 2007/03/27 09:07:48 dtucker Exp $ */
/* Constants */
@@ -696,7 +696,8 @@ struct winsize {
# define CUSTOM_SYS_AUTH_PASSWD 1
#endif
#ifdef HAVE_LIBIAF
#if defined(HAVE_LIBIAF) && defined(HAVE_SET_ID) && !defined(BROKEN_LIBIAF)
# define USE_LIBIAF
# define CUSTOM_SYS_AUTH_PASSWD 1
#endif
+2 -1
View File
@@ -35,8 +35,9 @@
# include <fcntl.h>
#endif
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>
#include <openssl/rand.h>
#include <openssl/crypto.h>
+3 -3
View File
@@ -1,7 +1,7 @@
/* $OpenBSD: gss-genr.c,v 1.17 2006/08/29 12:02:30 dtucker Exp $ */
/*
* Copyright (c) 2001-2006 Simon Wilkinson. All rights reserved.
* Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -107,7 +107,7 @@ ssh_gssapi_last_error(Gssctxt *ctxt, OM_uint32 *major_status,
/* The GSSAPI error */
do {
gss_display_status(&lmin, ctxt->major,
GSS_C_GSS_CODE, GSS_C_NULL_OID, &ctx, &msg);
GSS_C_GSS_CODE, ctxt->oid, &ctx, &msg);
buffer_append(&b, msg.value, msg.length);
buffer_put_char(&b, '\n');
@@ -118,7 +118,7 @@ ssh_gssapi_last_error(Gssctxt *ctxt, OM_uint32 *major_status,
/* The mechanism specific error */
do {
gss_display_status(&lmin, ctxt->minor,
GSS_C_MECH_CODE, GSS_C_NULL_OID, &ctx, &msg);
GSS_C_MECH_CODE, ctxt->oid, &ctx, &msg);
buffer_append(&b, msg.value, msg.length);
buffer_put_char(&b, '\n');
+1 -1
View File
@@ -49,7 +49,7 @@
#ifdef HAVE_NEXT
# include <libc.h>
#endif
#ifdef HAVE_PATHS
#ifdef HAVE_PATHS_H
# include <paths.h>
#endif
+17 -1
View File
@@ -1,6 +1,9 @@
#!/usr/bin/awk
#
# $Id: mdoc2man.awk,v 1.5.10.1 2007/06/05 10:05:38 dtucker Exp $
#
# Version history:
# v4+ Adapted for OpenSSH Portable (see cvs Id and history)
# v3, I put the program under a proper license
# Dan Nelson <[email protected]> added .An, .Aq and fixed a typo
# v2, fixed to work on GNU awk --posix and MacOS X
@@ -135,6 +138,12 @@ function add(str) {
nospace=0
}
if(match(words[w],"^Dd$")) {
if(match(words[w+1],"^\\$Mdocdate:")) {
w++;
if(match(words[w+4],"^\\$$")) {
words[w+4] = ""
}
}
date=wtail()
next
} else if(match(words[w],"^Dt$")) {
@@ -157,6 +166,7 @@ function add(str) {
refissue=""
refdate=""
refopt=""
refreport=""
reference=1
next
} else if(match(words[w],"^Re$")) {
@@ -168,9 +178,14 @@ function add(str) {
}
if(nrefauthors>1)
add(" and ")
add(refauthors[0] ", \\fI" reftitle "\\fP")
if(nrefauthors>0)
add(refauthors[0] ", ")
add("\\fI" reftitle "\\fP")
if(length(refissue))
add(", " refissue)
if(length(refreport)) {
add(", " refreport)
}
if(length(refdate))
add(", " refdate)
if(length(refopt))
@@ -187,6 +202,7 @@ function add(str) {
if(match(words[w],"^%N$")) { refissue=wtail() }
if(match(words[w],"^%D$")) { refdate=wtail() }
if(match(words[w],"^%O$")) { refopt=wtail() }
if(match(words[w],"^%R$")) { refreport=wtail() }
} else if(match(words[w],"^Nm$")) {
if(synopsis) {
add(".br")
+2 -6
View File
@@ -67,13 +67,9 @@ extern int h_errno;
#endif
#define _THREAD_PRIVATE(a,b,c) (c)
/* to avoid conflicts where a platform already has _res */
#ifdef _res
# undef _res
#endif
#define _res _compat_res
#ifndef HAVE__RES_EXTERN
struct __res_state _res;
#endif
/* Necessary functions and macros */
+3 -1
View File
@@ -1,4 +1,4 @@
/* $Id: port-linux.c,v 1.3 2006/09/01 05:38:41 djm Exp $ */
/* $Id: port-linux.c,v 1.3.6.1 2007/06/28 00:07:44 dtucker Exp $ */
/*
* Copyright (c) 2005 Daniel Walsh <dwalsh@redhat.com>
@@ -79,6 +79,7 @@ ssh_selinux_getctxbyname(char *pwname)
case 0:
error("%s: Failed to get default SELinux security "
"context for %s", __func__, pwname);
break;
default:
fatal("%s: Failed to get default SELinux security "
"context for %s (in enforcing mode)",
@@ -115,6 +116,7 @@ ssh_selinux_setup_exec_context(char *pwname)
case 0:
error("%s: Failed to set SELinux execution "
"context for %s", __func__, pwname);
break;
default:
fatal("%s: Failed to set SELinux execution context "
"for %s (in enforcing mode)", __func__, pwname);
+3 -3
View File
@@ -79,7 +79,7 @@ sys_auth_passwd(Authctxt *authctxt, const char *password)
#endif /* UNIXWARE_LONG_PASSWORDS */
result = (strcmp(xcrypt(password, salt), pw_password) == 0);
#if !defined(BROKEN_LIBIAF)
#ifdef USE_LIBIAF
if (authctxt->valid)
free(pw_password);
#endif
@@ -127,7 +127,7 @@ nischeck(char *namep)
functions that call shadow_pw() will need to free
*/
#if !defined(BROKEN_LIBIAF)
#ifdef USE_LIBIAF
char *
get_iaf_password(struct passwd *pw)
{
@@ -144,6 +144,6 @@ get_iaf_password(struct passwd *pw)
else
fatal("ia_openinfo: Unable to open the shadow passwd file");
}
#endif /* !BROKEN_LIBIAF */
#endif /* USE_LIBIAF */
#endif /* HAVE_LIBIAF */
+1 -1
View File
@@ -24,7 +24,7 @@
#include "includes.h"
#if defined(HAVE_LIBIAF) && !defined(BROKEN_LIBIAF)
#ifdef USE_LIBIAF
char * get_iaf_password(struct passwd *pw);
#endif
+1 -1
View File
@@ -98,7 +98,7 @@ shadow_pw(struct passwd *pw)
pw_password = spw->sp_pwdp;
# endif
#if defined(HAVE_LIBIAF) && !defined(BROKEN_LIBIAF)
#ifdef USE_LIBIAF
return(get_iaf_password(pw));
#endif
+1
View File
@@ -32,6 +32,7 @@
#include <openssl/x509.h>
#include <stdarg.h>
#include <string.h>
#include <opensc/opensc.h>
#include <opensc/pkcs15.h>
+2 -1
View File
@@ -1021,7 +1021,8 @@ bad: run_err("%s: %s", np, strerror(errno));
wrerr = YES;
wrerrno = errno;
}
if (wrerr == NO && ftruncate(ofd, size) != 0) {
if (wrerr == NO && (!exists || S_ISREG(stb.st_mode)) &&
ftruncate(ofd, size) != 0) {
run_err("%s: truncate: %s", np, strerror(errno));
wrerr = DISPLAYED;
}
+1 -6
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: servconf.c,v 1.170 2007/03/01 10:28:02 dtucker Exp $ */
/* $OpenBSD: servconf.c,v 1.172 2007/04/23 10:15:39 dtucker Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -592,7 +592,6 @@ match_cfg_line(char **condition, int line, const char *user, const char *host,
debug("connection from %.100s matched 'Host "
"%.100s' at line %d", host, arg, line);
} else if (strcasecmp(attrib, "address") == 0) {
debug("address '%s' arg '%s'", address, arg);
if (!address) {
result = 0;
continue;
@@ -1387,8 +1386,4 @@ parse_server_config(ServerOptions *options, const char *filename, Buffer *conf,
if (bad_options > 0)
fatal("%s: terminating, %d bad configuration options",
filename, bad_options);
/* challenge-response is implemented via keyboard interactive */
if (options->challenge_response_authentication == 1)
options->kbd_interactive_authentication = 1;
}
+2 -2
View File
@@ -1361,11 +1361,11 @@ do_setusercontext(struct passwd *pw)
# ifdef _AIX
aix_usrinfo(pw);
# endif /* _AIX */
#if defined(HAVE_LIBIAF) && !defined(BROKEN_LIBIAF)
#ifdef USE_LIBIAF
if (set_id(pw->pw_name) != 0) {
exit(1);
}
#endif /* HAVE_LIBIAF && !BROKEN_LIBIAF */
#endif /* USE_LIBIAF */
/* Permanently switch to the desired uid. */
permanently_set_uid(pw);
#endif
+1
View File
@@ -32,6 +32,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+30 -15
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: ssh.c,v 1.295 2007/01/03 03:01:40 stevesk Exp $ */
/* $OpenBSD: ssh.c,v 1.296 2007/06/12 11:11:08 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1307,7 +1307,7 @@ static void
control_client(const char *path)
{
struct sockaddr_un addr;
int i, r, fd, sock, exitval, num_env, addr_len;
int i, r, fd, sock, exitval[2], num_env, addr_len;
Buffer m;
char *term;
extern char **environ;
@@ -1456,29 +1456,44 @@ control_client(const char *path)
if (tty_flag)
enter_raw_mode();
/* Stick around until the controlee closes the client_fd */
exitval = 0;
for (;!control_client_terminate;) {
r = read(sock, &exitval, sizeof(exitval));
/*
* Stick around until the controlee closes the client_fd.
* Before it does, it is expected to write this process' exit
* value (one int). This process must read the value and wait for
* the closure of the client_fd; if this one closes early, the
* multiplex master will terminate early too (possibly losing data).
*/
exitval[0] = 0;
for (i = 0; !control_client_terminate && i < (int)sizeof(exitval);) {
r = read(sock, (char *)exitval + i, sizeof(exitval) - i);
if (r == 0) {
debug2("Received EOF from master");
break;
}
if (r > 0)
debug2("Received exit status from master %d", exitval);
if (r == -1 && errno != EINTR)
if (r == -1) {
if (errno == EINTR)
continue;
fatal("%s: read %s", __func__, strerror(errno));
}
i += r;
}
if (control_client_terminate)
debug2("Exiting on signal %d", control_client_terminate);
close(sock);
leave_raw_mode();
if (i > (int)sizeof(int))
fatal("%s: master returned too much data (%d > %lu)",
__func__, i, sizeof(int));
if (control_client_terminate) {
debug2("Exiting on signal %d", control_client_terminate);
exitval[0] = 255;
} else if (i < (int)sizeof(int)) {
debug2("Control master terminated unexpectedly");
exitval[0] = 255;
} else
debug2("Received exit status from master %d", exitval[0]);
if (tty_flag && options.log_level != SYSLOG_LEVEL_QUIET)
fprintf(stderr, "Connection to master closed.\r\n");
fprintf(stderr, "Shared connection to %s closed.\r\n", host);
exit(exitval);
exit(exitval[0]);
}
+5 -1
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: sshd.c,v 1.349 2007/02/21 11:00:05 dtucker Exp $ */
/* $OpenBSD: sshd.c,v 1.350 2007/03/09 05:20:06 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1421,6 +1421,10 @@ main(int ac, char **av)
/* Fill in default values for those options not explicitly set. */
fill_default_server_options(&options);
/* challenge-response is implemented via keyboard interactive */
if (options.challenge_response_authentication)
options.kbd_interactive_authentication = 1;
/* set default channel AF */
channel_set_af(options.address_family);