1/*
2 * Author: Tatu Ylonen <ylo@cs.hut.fi>
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 * All rights reserved
5 * Created: Sat Mar 18 22:15:47 1995 ylo
6 * Code to connect to a remote host, and to perform the client side of the
7 * login (authentication) dialog.
8 *
9 * $FreeBSD: head/crypto/openssh/sshconnect.c 60576 2000-05-15 05:24:25Z kris $
10 */
11
12#include "includes.h"
13RCSID("$OpenBSD: sshconnect.c,v 1.72 2000/05/04 09:50:22 markus Exp $");
14
15#include <openssl/bn.h>
16#include <openssl/dsa.h>
17#include <openssl/rsa.h>
18
19#include "xmalloc.h"
20#include "rsa.h"
21#include "ssh.h"
--- 226 unchanged lines hidden (view full) ---
248
249 /* Connect to the host. We use the user's uid in the
250 * hope that it will help with tcp_wrappers showing
251 * the remote uid as root.
252 */
253 temporarily_use_uid(original_real_uid);
254 if (connect(sock, ai->ai_addr, ai->ai_addrlen) >= 0) {
255 /* Successful connection. */
256 memcpy(hostaddr, ai->ai_addr, sizeof(*hostaddr));
257 restore_uid();
258 break;
259 } else {
260 debug("connect: %.100s", strerror(errno));
261 restore_uid();
262 /*
263 * Close the failed socket; there appear to
264 * be some problems when reusing a socket for
--- 29 unchanged lines hidden (view full) ---
294 setsockopt(sock, SOL_SOCKET, SO_LINGER, (void *) &linger, sizeof(linger));
295
296 /* Set the connection. */
297 packet_set_connection(sock, sock);
298
299 return 1;
300}
301
302char *
303chop(char *s)
304{
305 char *t = s;
306 while (*t) {
307 if(*t == '\n' || *t == '\r') {
308 *t = '\0';
309 return s;
310 }
311 t++;
312 }
313 return s;
314
315}
316
317/*
318 * Waits for the server identification string, and sends our own
319 * identification string.
320 */
321void
322ssh_exchange_identification()
323{
324 char buf[256], remote_version[256]; /* must be same size! */
--- 618 unchanged lines hidden ---
2 * Author: Tatu Ylonen <ylo@cs.hut.fi>
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 * All rights reserved
5 * Created: Sat Mar 18 22:15:47 1995 ylo
6 * Code to connect to a remote host, and to perform the client side of the
7 * login (authentication) dialog.
8 *
9 * $FreeBSD: head/crypto/openssh/sshconnect.c 60576 2000-05-15 05:24:25Z kris $
10 */
11
12#include "includes.h"
13RCSID("$OpenBSD: sshconnect.c,v 1.72 2000/05/04 09:50:22 markus Exp $");
14
15#include <openssl/bn.h>
16#include <openssl/dsa.h>
17#include <openssl/rsa.h>
18
19#include "xmalloc.h"
20#include "rsa.h"
21#include "ssh.h"
--- 226 unchanged lines hidden (view full) ---
248
249 /* Connect to the host. We use the user's uid in the
250 * hope that it will help with tcp_wrappers showing
251 * the remote uid as root.
252 */
253 temporarily_use_uid(original_real_uid);
254 if (connect(sock, ai->ai_addr, ai->ai_addrlen) >= 0) {
255 /* Successful connection. */
256 memcpy(hostaddr, ai->ai_addr, sizeof(*hostaddr));
257 restore_uid();
258 break;
259 } else {
260 debug("connect: %.100s", strerror(errno));
261 restore_uid();
262 /*
263 * Close the failed socket; there appear to
264 * be some problems when reusing a socket for
--- 29 unchanged lines hidden (view full) ---
294 setsockopt(sock, SOL_SOCKET, SO_LINGER, (void *) &linger, sizeof(linger));
295
296 /* Set the connection. */
297 packet_set_connection(sock, sock);
298
299 return 1;
300}
301
302char *
303chop(char *s)
304{
305 char *t = s;
306 while (*t) {
307 if(*t == '\n' || *t == '\r') {
308 *t = '\0';
309 return s;
310 }
311 t++;
312 }
313 return s;
314
315}
316
317/*
318 * Waits for the server identification string, and sends our own
319 * identification string.
320 */
321void
322ssh_exchange_identification()
323{
324 char buf[256], remote_version[256]; /* must be same size! */
--- 618 unchanged lines hidden ---