sshd.c (162984) | sshd.c (164149) |
---|---|
1/* $OpenBSD: sshd.c,v 1.347 2006/08/18 09:15:20 markus Exp $ */ | 1/* $OpenBSD: sshd.c,v 1.348 2006/11/06 21:25:28 markus Exp $ */ |
2/* 3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 5 * All rights reserved 6 * This program is the ssh daemon. It listens for connections from clients, 7 * and performs authentication, executes use commands or shell, and forwards 8 * information to/from the application to the user client over an encrypted 9 * connection. This can also handle forwarding of X11, TCP/IP, and --- 28 unchanged lines hidden (view full) --- 38 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 39 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 40 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 41 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 42 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 */ 44 45#include "includes.h" | 2/* 3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 5 * All rights reserved 6 * This program is the ssh daemon. It listens for connections from clients, 7 * and performs authentication, executes use commands or shell, and forwards 8 * information to/from the application to the user client over an encrypted 9 * connection. This can also handle forwarding of X11, TCP/IP, and --- 28 unchanged lines hidden (view full) --- 38 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 39 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 40 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 41 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 42 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 */ 44 45#include "includes.h" |
46__RCSID("$FreeBSD: head/crypto/openssh/sshd.c 162984 2006-10-03 11:33:25Z des $"); | 46__RCSID("$FreeBSD: head/crypto/openssh/sshd.c 164149 2006-11-10 16:52:41Z des $"); |
47 48#include <sys/types.h> 49#include <sys/ioctl.h> 50#include <sys/socket.h> 51#ifdef HAVE_SYS_STAT_H 52# include <sys/stat.h> 53#endif 54#ifdef HAVE_SYS_TIME_H --- 1381 unchanged lines hidden (view full) --- 1436 /* Check that there are no remaining arguments. */ 1437 if (optind < ac) { 1438 fprintf(stderr, "Extra argument %s.\n", av[optind]); 1439 exit(1); 1440 } 1441 1442 debug("sshd version %.100s", SSH_RELEASE); 1443 | 47 48#include <sys/types.h> 49#include <sys/ioctl.h> 50#include <sys/socket.h> 51#ifdef HAVE_SYS_STAT_H 52# include <sys/stat.h> 53#endif 54#ifdef HAVE_SYS_TIME_H --- 1381 unchanged lines hidden (view full) --- 1436 /* Check that there are no remaining arguments. */ 1437 if (optind < ac) { 1438 fprintf(stderr, "Extra argument %s.\n", av[optind]); 1439 exit(1); 1440 } 1441 1442 debug("sshd version %.100s", SSH_RELEASE); 1443 |
1444 /* Store privilege separation user for later use */ 1445 if ((privsep_pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) 1446 fatal("Privilege separation user %s does not exist", 1447 SSH_PRIVSEP_USER); 1448 memset(privsep_pw->pw_passwd, 0, strlen(privsep_pw->pw_passwd)); 1449 privsep_pw->pw_passwd = "*"; 1450 privsep_pw = pwcopy(privsep_pw); | 1444 /* Store privilege separation user for later use if required. */ 1445 if ((privsep_pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) { 1446 if (use_privsep || options.kerberos_authentication) 1447 fatal("Privilege separation user %s does not exist", 1448 SSH_PRIVSEP_USER); 1449 } else { 1450 memset(privsep_pw->pw_passwd, 0, strlen(privsep_pw->pw_passwd)); 1451 privsep_pw = pwcopy(privsep_pw); 1452 xfree(privsep_pw->pw_passwd); 1453 privsep_pw->pw_passwd = xstrdup("*"); 1454 } |
1451 endpwent(); 1452 1453 /* load private host keys */ 1454 sensitive_data.host_keys = xcalloc(options.num_host_key_files, 1455 sizeof(Key *)); 1456 for (i = 0; i < options.num_host_key_files; i++) 1457 sensitive_data.host_keys[i] = NULL; 1458 --- 578 unchanged lines hidden (view full) --- 2037 rsafail = PRIVSEP(ssh1_session_key(session_key_int)); 2038 2039 /* 2040 * Extract session key from the decrypted integer. The key is in the 2041 * least significant 256 bits of the integer; the first byte of the 2042 * key is in the highest bits. 2043 */ 2044 if (!rsafail) { | 1455 endpwent(); 1456 1457 /* load private host keys */ 1458 sensitive_data.host_keys = xcalloc(options.num_host_key_files, 1459 sizeof(Key *)); 1460 for (i = 0; i < options.num_host_key_files; i++) 1461 sensitive_data.host_keys[i] = NULL; 1462 --- 578 unchanged lines hidden (view full) --- 2041 rsafail = PRIVSEP(ssh1_session_key(session_key_int)); 2042 2043 /* 2044 * Extract session key from the decrypted integer. The key is in the 2045 * least significant 256 bits of the integer; the first byte of the 2046 * key is in the highest bits. 2047 */ 2048 if (!rsafail) { |
2045 BN_mask_bits(session_key_int, sizeof(session_key) * 8); | 2049 (void) BN_mask_bits(session_key_int, sizeof(session_key) * 8); |
2046 len = BN_num_bytes(session_key_int); 2047 if (len < 0 || (u_int)len > sizeof(session_key)) { | 2050 len = BN_num_bytes(session_key_int); 2051 if (len < 0 || (u_int)len > sizeof(session_key)) { |
2048 error("do_connection: bad session key len from %s: " | 2052 error("do_ssh1_kex: bad session key len from %s: " |
2049 "session_key_int %d > sizeof(session_key) %lu", 2050 get_remote_ipaddr(), len, (u_long)sizeof(session_key)); 2051 rsafail++; 2052 } else { 2053 memset(session_key, 0, sizeof(session_key)); 2054 BN_bn2bin(session_key_int, 2055 session_key + sizeof(session_key) - len); 2056 --- 129 unchanged lines hidden --- | 2053 "session_key_int %d > sizeof(session_key) %lu", 2054 get_remote_ipaddr(), len, (u_long)sizeof(session_key)); 2055 rsafail++; 2056 } else { 2057 memset(session_key, 0, sizeof(session_key)); 2058 BN_bn2bin(session_key_int, 2059 session_key + sizeof(session_key) - len); 2060 --- 129 unchanged lines hidden --- |