version 1.18, 2004/08/23 14:29:23 |
version 1.18.6.2, 2006/10/06 03:19:33 |
|
|
|
/* $OpenBSD$ */ |
/* |
/* |
* Copyright (c) 2002 Markus Friedl. All rights reserved. |
* Copyright (c) 2002 Markus Friedl. All rights reserved. |
* |
* |
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
*/ |
#include "includes.h" |
|
RCSID("$OpenBSD$"); |
|
|
|
|
#include <sys/types.h> |
|
|
#include <openssl/evp.h> |
#include <openssl/evp.h> |
#include <openssl/rand.h> |
#include <openssl/rand.h> |
#include <openssl/rsa.h> |
#include <openssl/rsa.h> |
|
|
|
#include <fcntl.h> |
|
#include <paths.h> |
|
#include <pwd.h> |
|
#include <stdlib.h> |
|
#include <string.h> |
|
#include <unistd.h> |
|
|
|
#include "xmalloc.h" |
#include "log.h" |
#include "log.h" |
#include "key.h" |
#include "key.h" |
#include "ssh.h" |
#include "ssh.h" |
#include "ssh2.h" |
#include "ssh2.h" |
#include "misc.h" |
#include "misc.h" |
#include "xmalloc.h" |
|
#include "buffer.h" |
#include "buffer.h" |
#include "bufaux.h" |
|
#include "authfile.h" |
#include "authfile.h" |
#include "msg.h" |
#include "msg.h" |
#include "canohost.h" |
#include "canohost.h" |
|
|
buffer_init(&b); |
buffer_init(&b); |
buffer_append(&b, data, datalen); |
buffer_append(&b, data, datalen); |
|
|
/* session id, currently limited to SHA1 (20 bytes) */ |
/* session id, currently limited to SHA1 (20 bytes) or SHA256 (32) */ |
p = buffer_get_string(&b, &len); |
p = buffer_get_string(&b, &len); |
if (len != 20) |
if (len != 20 && len != 32) |
fail++; |
fail++; |
xfree(p); |
xfree(p); |
|
|
|
|
char *host; |
char *host; |
u_int slen, dlen; |
u_int slen, dlen; |
u_int32_t rnd[256]; |
u_int32_t rnd[256]; |
|
|
|
/* Ensure that stdin and stdout are connected */ |
|
if ((fd = open(_PATH_DEVNULL, O_RDWR)) < 2) |
|
exit(1); |
|
/* Leave /dev/null fd iff it is attached to stderr */ |
|
if (fd > 2) |
|
close(fd); |
|
|
key_fd[0] = open(_PATH_HOST_RSA_KEY_FILE, O_RDONLY); |
key_fd[0] = open(_PATH_HOST_RSA_KEY_FILE, O_RDONLY); |
key_fd[1] = open(_PATH_HOST_DSA_KEY_FILE, O_RDONLY); |
key_fd[1] = open(_PATH_HOST_DSA_KEY_FILE, O_RDONLY); |