version 1.38, 1999/11/23 22:25:55 |
version 1.39, 1999/11/24 00:26:03 |
|
|
/* |
/* |
|
* Author: Tatu Ylonen <ylo@cs.hut.fi> |
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
|
* All rights reserved |
|
* Created: Sat Mar 18 22:15:47 1995 ylo |
|
* Code to connect to a remote host, and to perform the client side of the |
|
* login (authentication) dialog. |
|
*/ |
|
|
sshconnect.c |
|
|
|
Author: Tatu Ylonen <ylo@cs.hut.fi> |
|
|
|
Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
|
All rights reserved |
|
|
|
Created: Sat Mar 18 22:15:47 1995 ylo |
|
|
|
Code to connect to a remote host, and to perform the client side of the |
|
login (authentication) dialog. |
|
|
|
*/ |
|
|
|
#include "includes.h" |
#include "includes.h" |
RCSID("$Id$"); |
RCSID("$Id$"); |
|
|
|
|
/* Session id for the current session. */ |
/* Session id for the current session. */ |
unsigned char session_id[16]; |
unsigned char session_id[16]; |
|
|
/* Connect to the given ssh server using a proxy command. */ |
/* |
|
* Connect to the given ssh server using a proxy command. |
|
*/ |
int |
int |
ssh_proxy_connect(const char *host, int port, uid_t original_real_uid, |
ssh_proxy_connect(const char *host, int port, uid_t original_real_uid, |
const char *proxy_command) |
const char *proxy_command) |
|
|
return 1; |
return 1; |
} |
} |
|
|
/* Creates a (possibly privileged) socket for use as the ssh connection. */ |
/* |
|
* Creates a (possibly privileged) socket for use as the ssh connection. |
|
*/ |
int |
int |
ssh_create_socket(uid_t original_real_uid, int privileged) |
ssh_create_socket(uid_t original_real_uid, int privileged) |
{ |
{ |
|
|
return sock; |
return sock; |
} |
} |
|
|
/* Opens a TCP/IP connection to the remote server on the given host. If |
/* |
port is 0, the default port will be used. If anonymous is zero, |
* Opens a TCP/IP connection to the remote server on the given host. If |
a privileged port will be allocated to make the connection. |
* port is 0, the default port will be used. If anonymous is zero, |
This requires super-user privileges if anonymous is false. |
* a privileged port will be allocated to make the connection. |
Connection_attempts specifies the maximum number of tries (one per |
* This requires super-user privileges if anonymous is false. |
second). If proxy_command is non-NULL, it specifies the command (with %h |
* Connection_attempts specifies the maximum number of tries (one per |
and %p substituted for host and port, respectively) to use to contact |
* second). If proxy_command is non-NULL, it specifies the command (with %h |
the daemon. */ |
* and %p substituted for host and port, respectively) to use to contact |
|
* the daemon. |
|
*/ |
int |
int |
ssh_connect(const char *host, struct sockaddr_in * hostaddr, |
ssh_connect(const char *host, struct sockaddr_in * hostaddr, |
int port, int connection_attempts, |
int port, int connection_attempts, |
|
|
return 1; |
return 1; |
} |
} |
|
|
/* Checks if the user has an authentication agent, and if so, tries to |
/* |
authenticate using the agent. */ |
* Checks if the user has an authentication agent, and if so, tries to |
|
* authenticate using the agent. |
|
*/ |
int |
int |
try_agent_authentication() |
try_agent_authentication() |
{ |
{ |
|
|
return 0; |
return 0; |
} |
} |
|
|
/* Computes the proper response to a RSA challenge, and sends the response to |
/* |
the server. */ |
* Computes the proper response to a RSA challenge, and sends the response to |
|
* the server. |
|
*/ |
void |
void |
respond_to_rsa_challenge(BIGNUM * challenge, RSA * prv) |
respond_to_rsa_challenge(BIGNUM * challenge, RSA * prv) |
{ |
{ |
|
|
memset(&md, 0, sizeof(md)); |
memset(&md, 0, sizeof(md)); |
} |
} |
|
|
/* Checks if the user has authentication file, and if so, tries to authenticate |
/* |
the user using it. */ |
* Checks if the user has authentication file, and if so, tries to authenticate |
|
* the user using it. |
|
*/ |
int |
int |
try_rsa_authentication(struct passwd * pw, const char *authfile) |
try_rsa_authentication(struct passwd * pw, const char *authfile) |
{ |
{ |
|
|
return 0; |
return 0; |
} |
} |
|
|
/* Tries to authenticate the user using combined rhosts or /etc/hosts.equiv |
/* |
authentication and RSA host authentication. */ |
* Tries to authenticate the user using combined rhosts or /etc/hosts.equiv |
|
* authentication and RSA host authentication. |
|
*/ |
int |
int |
try_rhosts_rsa_authentication(const char *local_user, RSA * host_key) |
try_rhosts_rsa_authentication(const char *local_user, RSA * host_key) |
{ |
{ |
|
|
|
|
#endif /* AFS */ |
#endif /* AFS */ |
|
|
/* Waits for the server identification string, and sends our own |
/* |
identification string. */ |
* Waits for the server identification string, and sends our own |
|
* identification string. |
|
*/ |
void |
void |
ssh_exchange_identification() |
ssh_exchange_identification() |
{ |
{ |
|
|
} |
} |
} |
} |
|
|
/* Starts a dialog with the server, and authenticates the current user on the |
/* |
server. This does not need any extra privileges. The basic connection |
* Starts a dialog with the server, and authenticates the current user on the |
to the server must already have been established before this is called. |
* server. This does not need any extra privileges. The basic connection |
User is the remote user; if it is NULL, the current local user name will |
* to the server must already have been established before this is called. |
be used. Anonymous indicates that no rhosts authentication will be used. |
* User is the remote user; if it is NULL, the current local user name will |
If login fails, this function prints an error and never returns. |
* be used. Anonymous indicates that no rhosts authentication will be used. |
This function does not require super-user privileges. */ |
* If login fails, this function prints an error and never returns. |
|
* This function does not require super-user privileges. |
|
*/ |
void |
void |
ssh_login(int host_key_valid, |
ssh_login(int host_key_valid, |
RSA *own_host_key, |
RSA *own_host_key, |