[atomicio.h authfd.h authfile.h auth.h auth-options.h bufaux.h
      buffer.h canohost.h channels.h cipher.h clientloop.h compat.h
      compress.h crc32.h deattack.h dh.h dispatch.h groupaccess.h
      hostfile.h kex.h key.h log.h mac.h match.h misc.h mpaux.h packet.h
      radix.h readconf.h readpass.h rsa.h]
     prototype pedant.  not very creative...
     - () -> (void)
     - no variable names
This commit is contained in:
Ben Lindstrom 2001-07-04 04:02:36 +00:00
parent 90279d80f5
commit 16ae3d0dba
32 changed files with 278 additions and 307 deletions

View File

@ -38,6 +38,15 @@
- markus@cvs.openbsd.org 2001/06/26 05:50:11 - markus@cvs.openbsd.org 2001/06/26 05:50:11
[auth2.c] [auth2.c]
new interface for secure_filename() new interface for secure_filename()
- itojun@cvs.openbsd.org 2001/06/26 06:32:58
[atomicio.h authfd.h authfile.h auth.h auth-options.h bufaux.h
buffer.h canohost.h channels.h cipher.h clientloop.h compat.h
compress.h crc32.h deattack.h dh.h dispatch.h groupaccess.h
hostfile.h kex.h key.h log.h mac.h match.h misc.h mpaux.h packet.h
radix.h readconf.h readpass.h rsa.h]
prototype pedant. not very creative...
- () -> (void)
- no variable names
20010629 20010629
- (bal) Removed net_aton() since we don't use it any more - (bal) Removed net_aton() since we don't use it any more
@ -5865,4 +5874,4 @@
- Wrote replacements for strlcpy and mkdtemp - Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1 - Released 1.0pre1
$Id: ChangeLog,v 1.1355 2001/07/04 03:56:56 mouring Exp $ $Id: ChangeLog,v 1.1356 2001/07/04 04:02:36 mouring Exp $

View File

@ -1,4 +1,4 @@
/* $OpenBSD: atomicio.h,v 1.3 2001/03/02 18:54:30 deraadt Exp $ */ /* $OpenBSD: atomicio.h,v 1.4 2001/06/26 06:32:46 itojun Exp $ */
/* /*
* Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. * Copyright (c) 1995,1999 Theo de Raadt. All rights reserved.
@ -28,4 +28,4 @@
/* /*
* Ensure all of data on socket comes through. f==read || f==write * Ensure all of data on socket comes through. f==read || f==write
*/ */
ssize_t atomicio(ssize_t (*f)(), int fd, void *s, size_t n); ssize_t atomicio(ssize_t (*)(), int, void *, size_t);

View File

@ -11,7 +11,7 @@
* called by a name other than "ssh" or "Secure Shell". * called by a name other than "ssh" or "Secure Shell".
*/ */
/* $OpenBSD: auth-options.h,v 1.8 2001/01/21 19:05:42 markus Exp $ */ /* $OpenBSD: auth-options.h,v 1.9 2001/06/26 06:32:47 itojun Exp $ */
#ifndef AUTH_OPTIONS_H #ifndef AUTH_OPTIONS_H
#define AUTH_OPTIONS_H #define AUTH_OPTIONS_H
@ -35,8 +35,7 @@ extern struct envstring *custom_environment;
* side effect: sets key option flags * side effect: sets key option flags
*/ */
int int
auth_parse_options(struct passwd *pw, char *options, char *file, auth_parse_options(struct passwd *, char *, char *, u_long);
u_long linenum);
/* reset options flags */ /* reset options flags */
void auth_clear_options(void); void auth_clear_options(void);

56
auth.h
View File

@ -21,7 +21,7 @@
* (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.
* *
* $OpenBSD: auth.h,v 1.19 2001/06/25 17:54:49 provos Exp $ * $OpenBSD: auth.h,v 1.20 2001/06/26 06:32:47 itojun Exp $
*/ */
#ifndef AUTH_H #ifndef AUTH_H
#define AUTH_H #define AUTH_H
@ -79,45 +79,44 @@ struct KbdintDevice
* authentication succeeds. If ignore_rhosts is non-zero, this will not * authentication succeeds. If ignore_rhosts is non-zero, this will not
* consider .rhosts and .shosts (/etc/hosts.equiv will still be used). * consider .rhosts and .shosts (/etc/hosts.equiv will still be used).
*/ */
int auth_rhosts(struct passwd * pw, const char *client_user); int auth_rhosts(struct passwd *, const char *);
/* extended interface similar to auth_rhosts() */ /* extended interface similar to auth_rhosts() */
int int
auth_rhosts2(struct passwd *pw, const char *client_user, const char *hostname, auth_rhosts2(struct passwd *, const char *, const char *, const char *);
const char *ipaddr);
/* /*
* Tries to authenticate the user using the .rhosts file and the host using * Tries to authenticate the user using the .rhosts file and the host using
* its host key. Returns true if authentication succeeds. * its host key. Returns true if authentication succeeds.
*/ */
int int
auth_rhosts_rsa(struct passwd * pw, const char *client_user, RSA* client_host_key); auth_rhosts_rsa(struct passwd *, const char *, RSA *);
/* /*
* Tries to authenticate the user using password. Returns true if * Tries to authenticate the user using password. Returns true if
* authentication succeeds. * authentication succeeds.
*/ */
int auth_password(Authctxt *authctxt, const char *password); int auth_password(Authctxt *, const char *);
/* /*
* Performs the RSA authentication dialog with the client. This returns 0 if * Performs the RSA authentication dialog with the client. This returns 0 if
* the client could not be authenticated, and 1 if authentication was * the client could not be authenticated, and 1 if authentication was
* successful. This may exit if there is a serious protocol violation. * successful. This may exit if there is a serious protocol violation.
*/ */
int auth_rsa(struct passwd * pw, BIGNUM * client_n); int auth_rsa(struct passwd *, BIGNUM *);
/* /*
* Parses an RSA key (number of bits, e, n) from a string. Moves the pointer * Parses an RSA key (number of bits, e, n) from a string. Moves the pointer
* over the key. Skips any whitespace at the beginning and at end. * over the key. Skips any whitespace at the beginning and at end.
*/ */
int auth_rsa_read_key(char **cpp, u_int *bitsp, BIGNUM * e, BIGNUM * n); int auth_rsa_read_key(char **, u_int *, BIGNUM *, BIGNUM *);
/* /*
* Performs the RSA authentication challenge-response dialog with the client, * Performs the RSA authentication challenge-response dialog with the client,
* and returns true (non-zero) if the client gave the correct answer to our * and returns true (non-zero) if the client gave the correct answer to our
* challenge; returns zero if the client gives a wrong answer. * challenge; returns zero if the client gives a wrong answer.
*/ */
int auth_rsa_challenge_dialog(RSA *pk); int auth_rsa_challenge_dialog(RSA *);
#ifdef KRB4 #ifdef KRB4
#include <krb.h> #include <krb.h>
@ -126,17 +125,17 @@ int auth_rsa_challenge_dialog(RSA *pk);
* if the client could not be authenticated, and 1 if authentication was * if the client could not be authenticated, and 1 if authentication was
* successful. This may exit if there is a serious protocol violation. * successful. This may exit if there is a serious protocol violation.
*/ */
int auth_krb4(const char *server_user, KTEXT auth, char **client); int auth_krb4(const char *, KTEXT, char **);
int krb4_init(uid_t uid); int krb4_init(uid_t);
void krb4_cleanup_proc(void *ignore); void krb4_cleanup_proc(void *);
int auth_krb4_password(struct passwd * pw, const char *password); int auth_krb4_password(struct passwd *, const char *);
#ifdef AFS #ifdef AFS
#include <kafs.h> #include <kafs.h>
/* Accept passed Kerberos v4 ticket-granting ticket and AFS tokens. */ /* Accept passed Kerberos v4 ticket-granting ticket and AFS tokens. */
int auth_kerberos_tgt(struct passwd * pw, const char *string); int auth_kerberos_tgt(struct passwd *, const char *);
int auth_afs_token(struct passwd * pw, const char *token_string); int auth_afs_token(struct passwd *, const char *);
#endif /* AFS */ #endif /* AFS */
#endif /* KRB4 */ #endif /* KRB4 */
@ -148,33 +147,32 @@ void do_authentication(void);
void do_authentication2(void); void do_authentication2(void);
Authctxt *authctxt_new(void); Authctxt *authctxt_new(void);
void auth_log(Authctxt *authctxt, int authenticated, char *method, char *info); void auth_log(Authctxt *, int, char *, char *);
void userauth_finish(Authctxt *authctxt, int authenticated, char *method); void userauth_finish(Authctxt *, int, char *);
int auth_root_allowed(char *method); int auth_root_allowed(char *);
int auth2_challenge(Authctxt *authctxt, char *devs); int auth2_challenge(Authctxt *, char *);
int allowed_user(struct passwd * pw); int allowed_user(struct passwd *);
char *get_challenge(Authctxt *authctxt); char *get_challenge(Authctxt *);
int verify_response(Authctxt *authctxt, const char *response); int verify_response(Authctxt *, const char *);
struct passwd * auth_get_user(void); struct passwd * auth_get_user(void);
/* expand a filename - return buffer is allocated by xmalloc */ /* expand a filename - return buffer is allocated by xmalloc */
char *expand_filename(const char *template, struct passwd *pw); char *expand_filename(const char *, struct passwd *);
char *authorized_keys_file(struct passwd *pw); char *authorized_keys_file(struct passwd *);
char *authorized_keys_file2(struct passwd *pw); char *authorized_keys_file2(struct passwd *);
/* check a file and the path to it */ /* check a file and the path to it */
int int
secure_filename(FILE *f, const char *file, struct passwd *pw, secure_filename(FILE *, const char *, struct passwd *, char *, size_t);
char *err, size_t errlen);
/* helper for hostbased auth */ /* helper for hostbased auth */
HostStatus HostStatus
check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host, check_key_in_hostfiles(struct passwd *, Key *, const char *,
const char *sysfile, const char *userfile); const char *, const char *);
#define AUTH_FAIL_MAX 6 #define AUTH_FAIL_MAX 6
#define AUTH_FAIL_LOG (AUTH_FAIL_MAX/2) #define AUTH_FAIL_LOG (AUTH_FAIL_MAX/2)

View File

@ -11,7 +11,7 @@
* called by a name other than "ssh" or "Secure Shell". * called by a name other than "ssh" or "Secure Shell".
*/ */
/* RCSID("$OpenBSD: authfd.h,v 1.17 2001/06/26 04:59:59 markus Exp $"); */ /* RCSID("$OpenBSD: authfd.h,v 1.18 2001/06/26 06:32:47 itojun Exp $"); */
#ifndef AUTHFD_H #ifndef AUTHFD_H
#define AUTHFD_H #define AUTHFD_H
@ -62,7 +62,7 @@ int ssh_get_authentication_socket(void);
* ssh_get_authentication_socket(). Depending on the way the descriptor was * ssh_get_authentication_socket(). Depending on the way the descriptor was
* obtained, this may close the descriptor. * obtained, this may close the descriptor.
*/ */
void ssh_close_authentication_socket(int authfd); void ssh_close_authentication_socket(int);
/* /*
* Opens and connects a private socket for communication with the * Opens and connects a private socket for communication with the
@ -76,19 +76,19 @@ AuthenticationConnection *ssh_get_authentication_connection(void);
* Closes the connection to the authentication agent and frees any associated * Closes the connection to the authentication agent and frees any associated
* memory. * memory.
*/ */
void ssh_close_authentication_connection(AuthenticationConnection *auth); void ssh_close_authentication_connection(AuthenticationConnection *);
/* /*
* Returns the number authentication identity held by the agent. * Returns the number authentication identity held by the agent.
*/ */
int ssh_get_num_identities(AuthenticationConnection *auth, int version); int ssh_get_num_identities(AuthenticationConnection *, int);
/* /*
* Returns the first authentication identity held by the agent or NULL if * Returns the first authentication identity held by the agent or NULL if
* no identies are available. Caller must free comment and key. * no identies are available. Caller must free comment and key.
* Note that you cannot mix calls with different versions. * Note that you cannot mix calls with different versions.
*/ */
Key *ssh_get_first_identity(AuthenticationConnection *auth, char **comment, int version); Key *ssh_get_first_identity(AuthenticationConnection *, char **, int);
/* /*
* Returns the next authentication identity for the agent. Other functions * Returns the next authentication identity for the agent. Other functions
@ -96,25 +96,20 @@ Key *ssh_get_first_identity(AuthenticationConnection *auth, char **comment, int
* function. This returns NULL if there are no more identities. The caller * function. This returns NULL if there are no more identities. The caller
* must free key and comment after a successful return. * must free key and comment after a successful return.
*/ */
Key *ssh_get_next_identity(AuthenticationConnection *auth, char **comment, int version); Key *ssh_get_next_identity(AuthenticationConnection *, char **, int);
/* /*
* Requests the agent to decrypt the given challenge. Returns true if the * Requests the agent to decrypt the given challenge. Returns true if the
* agent claims it was able to decrypt it. * agent claims it was able to decrypt it.
*/ */
int int
ssh_decrypt_challenge(AuthenticationConnection *auth, ssh_decrypt_challenge(AuthenticationConnection *, Key *, BIGNUM *, u_char[16],
Key *key, BIGNUM * challenge, u_int, u_char[16]);
u_char session_id[16],
u_int response_type,
u_char response[16]);
/* Requests the agent to sign data using key */ /* Requests the agent to sign data using key */
int int
ssh_agent_sign(AuthenticationConnection *auth, ssh_agent_sign(AuthenticationConnection *, Key *, u_char **, int *,
Key *key, u_char *, int);
u_char **sigp, int *lenp,
u_char *data, int datalen);
/* /*
* Adds an identity to the authentication server. This call is not meant to * Adds an identity to the authentication server. This call is not meant to
@ -122,23 +117,22 @@ ssh_agent_sign(AuthenticationConnection *auth,
* successfully added. * successfully added.
*/ */
int int
ssh_add_identity(AuthenticationConnection *auth, Key *key, ssh_add_identity(AuthenticationConnection *, Key *, const char *);
const char *comment);
/* /*
* Removes the identity from the authentication server. This call is not * Removes the identity from the authentication server. This call is not
* meant to be used by normal applications. This returns true if the * meant to be used by normal applications. This returns true if the
* identity was successfully added. * identity was successfully added.
*/ */
int ssh_remove_identity(AuthenticationConnection *auth, Key *key); int ssh_remove_identity(AuthenticationConnection *, Key *);
/* /*
* Removes all identities from the authentication agent. This call is not * Removes all identities from the authentication agent. This call is not
* meant to be used by normal applications. This returns true if the * meant to be used by normal applications. This returns true if the
* operation was successful. * operation was successful.
*/ */
int ssh_remove_all_identities(AuthenticationConnection *auth, int version); int ssh_remove_all_identities(AuthenticationConnection *, int);
int ssh_update_card(AuthenticationConnection *auth, int add, int reader_id); int ssh_update_card(AuthenticationConnection *, int, int);
#endif /* AUTHFD_H */ #endif /* AUTHFD_H */

View File

@ -10,27 +10,24 @@
* called by a name other than "ssh" or "Secure Shell". * called by a name other than "ssh" or "Secure Shell".
*/ */
/* $OpenBSD: authfile.h,v 1.6 2001/03/26 08:07:08 markus Exp $ */ /* $OpenBSD: authfile.h,v 1.7 2001/06/26 06:32:48 itojun Exp $ */
#ifndef AUTHFILE_H #ifndef AUTHFILE_H
#define AUTHFILE_H #define AUTHFILE_H
int int
key_save_private(Key *key, const char *filename, const char *passphrase, key_save_private(Key *, const char *, const char *, const char *);
const char *comment);
Key * Key *
key_load_public(const char *filename, char **commentp); key_load_public(const char *, char **);
Key * Key *
key_load_public_type(int type, const char *filename, char **commentp); key_load_public_type(int, const char *, char **);
Key * Key *
key_load_private(const char *filename, const char *passphrase, key_load_private(const char *, const char *, char **);
char **commentp);
Key * Key *
key_load_private_type(int type, const char *filename, const char *passphrase, key_load_private_type(int, const char *, const char *, char **);
char **commentp);
#endif #endif

View File

@ -10,7 +10,7 @@
* called by a name other than "ssh" or "Secure Shell". * called by a name other than "ssh" or "Secure Shell".
*/ */
/* RCSID("$OpenBSD: bufaux.h,v 1.11 2001/01/21 19:05:45 markus Exp $"); */ /* RCSID("$OpenBSD: bufaux.h,v 1.12 2001/06/26 06:32:48 itojun Exp $"); */
#ifndef BUFAUX_H #ifndef BUFAUX_H
#define BUFAUX_H #define BUFAUX_H
@ -22,30 +22,30 @@
* Stores an BIGNUM in the buffer with a 2-byte msb first bit count, followed * Stores an BIGNUM in the buffer with a 2-byte msb first bit count, followed
* by (bits+7)/8 bytes of binary data, msb first. * by (bits+7)/8 bytes of binary data, msb first.
*/ */
void buffer_put_bignum(Buffer * buffer, BIGNUM * value); void buffer_put_bignum(Buffer *, BIGNUM *);
void buffer_put_bignum2(Buffer * buffer, BIGNUM * value); void buffer_put_bignum2(Buffer *, BIGNUM *);
/* Retrieves an BIGNUM from the buffer. */ /* Retrieves an BIGNUM from the buffer. */
int buffer_get_bignum(Buffer * buffer, BIGNUM * value); int buffer_get_bignum(Buffer *, BIGNUM *);
int buffer_get_bignum2(Buffer *buffer, BIGNUM * value); int buffer_get_bignum2(Buffer *, BIGNUM *);
/* Returns an integer from the buffer (4 bytes, msb first). */ /* Returns an integer from the buffer (4 bytes, msb first). */
u_int buffer_get_int(Buffer * buffer); u_int buffer_get_int(Buffer *);
#ifdef HAVE_U_INT64_T #ifdef HAVE_U_INT64_T
u_int64_t buffer_get_int64(Buffer *buffer); u_int64_t buffer_get_int64(Buffer *);
#endif #endif
/* Stores an integer in the buffer in 4 bytes, msb first. */ /* Stores an integer in the buffer in 4 bytes, msb first. */
void buffer_put_int(Buffer * buffer, u_int value); void buffer_put_int(Buffer *, u_int);
#ifdef HAVE_U_INT64_T #ifdef HAVE_U_INT64_T
void buffer_put_int64(Buffer *buffer, u_int64_t value); void buffer_put_int64(Buffer *, u_int64_t);
#endif #endif
/* Returns a character from the buffer (0 - 255). */ /* Returns a character from the buffer (0 - 255). */
int buffer_get_char(Buffer * buffer); int buffer_get_char(Buffer *);
/* Stores a character in the buffer. */ /* Stores a character in the buffer. */
void buffer_put_char(Buffer * buffer, int value); void buffer_put_char(Buffer *, int);
/* /*
* Returns an arbitrary binary string from the buffer. The string cannot be * Returns an arbitrary binary string from the buffer. The string cannot be
@ -55,10 +55,10 @@ void buffer_put_char(Buffer * buffer, int value);
* stored there. A null character will be automatically appended to the * stored there. A null character will be automatically appended to the
* returned string, and is not counted in length. * returned string, and is not counted in length.
*/ */
char *buffer_get_string(Buffer * buffer, u_int *length_ptr); char *buffer_get_string(Buffer *, u_int *);
/* Stores and arbitrary binary string in the buffer. */ /* Stores and arbitrary binary string in the buffer. */
void buffer_put_string(Buffer * buffer, const void *buf, u_int len); void buffer_put_string(Buffer *, const void *, u_int);
void buffer_put_cstring(Buffer *buffer, const char *s); void buffer_put_cstring(Buffer *, const char *);
#endif /* BUFAUX_H */ #endif /* BUFAUX_H */

View File

@ -11,7 +11,7 @@
* called by a name other than "ssh" or "Secure Shell". * called by a name other than "ssh" or "Secure Shell".
*/ */
/* RCSID("$OpenBSD: buffer.h,v 1.7 2000/12/19 23:17:55 markus Exp $"); */ /* RCSID("$OpenBSD: buffer.h,v 1.8 2001/06/26 06:32:48 itojun Exp $"); */
#ifndef BUFFER_H #ifndef BUFFER_H
#define BUFFER_H #define BUFFER_H
@ -23,44 +23,44 @@ typedef struct {
u_int end; /* Offset of last byte containing data. */ u_int end; /* Offset of last byte containing data. */
} Buffer; } Buffer;
/* Initializes the buffer structure. */ /* Initializes the buffer structure. */
void buffer_init(Buffer * buffer); void buffer_init(Buffer *);
/* Frees any memory used for the buffer. */ /* Frees any memory used for the buffer. */
void buffer_free(Buffer * buffer); void buffer_free(Buffer *);
/* Clears any data from the buffer, making it empty. This does not actually /* Clears any data from the buffer, making it empty. This does not actually
zero the memory. */ zero the memory. */
void buffer_clear(Buffer * buffer); void buffer_clear(Buffer *);
/* Appends data to the buffer, expanding it if necessary. */ /* Appends data to the buffer, expanding it if necessary. */
void buffer_append(Buffer * buffer, const char *data, u_int len); void buffer_append(Buffer *, const char *, u_int);
/* /*
* Appends space to the buffer, expanding the buffer if necessary. This does * Appends space to the buffer, expanding the buffer if necessary. This does
* not actually copy the data into the buffer, but instead returns a pointer * not actually copy the data into the buffer, but instead returns a pointer
* to the allocated region. * to the allocated region.
*/ */
void buffer_append_space(Buffer * buffer, char **datap, u_int len); void buffer_append_space(Buffer *, char **, u_int);
/* Returns the number of bytes of data in the buffer. */ /* Returns the number of bytes of data in the buffer. */
u_int buffer_len(Buffer * buffer); u_int buffer_len(Buffer *);
/* Gets data from the beginning of the buffer. */ /* Gets data from the beginning of the buffer. */
void buffer_get(Buffer * buffer, char *buf, u_int len); void buffer_get(Buffer *, char *, u_int);
/* Consumes the given number of bytes from the beginning of the buffer. */ /* Consumes the given number of bytes from the beginning of the buffer. */
void buffer_consume(Buffer * buffer, u_int bytes); void buffer_consume(Buffer *, u_int);
/* Consumes the given number of bytes from the end of the buffer. */ /* Consumes the given number of bytes from the end of the buffer. */
void buffer_consume_end(Buffer * buffer, u_int bytes); void buffer_consume_end(Buffer *, u_int);
/* Returns a pointer to the first used byte in the buffer. */ /* Returns a pointer to the first used byte in the buffer. */
char *buffer_ptr(Buffer * buffer); char *buffer_ptr(Buffer *);
/* /*
* Dumps the contents of the buffer to stderr in hex. This intended for * Dumps the contents of the buffer to stderr in hex. This intended for
* debugging purposes only. * debugging purposes only.
*/ */
void buffer_dump(Buffer * buffer); void buffer_dump(Buffer *);
#endif /* BUFFER_H */ #endif /* BUFFER_H */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: canohost.h,v 1.6 2001/04/12 19:15:24 markus Exp $ */ /* $OpenBSD: canohost.h,v 1.7 2001/06/26 06:32:49 itojun Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -17,7 +17,7 @@
* connection (as returned by packet_get_connection). The host name is * connection (as returned by packet_get_connection). The host name is
* cached, so it is efficient to call this several times. * cached, so it is efficient to call this several times.
*/ */
const char *get_canonical_hostname(int reverse_mapping_check); const char *get_canonical_hostname(int);
/* /*
* Returns the IP-address of the remote host as a string. The returned * Returns the IP-address of the remote host as a string. The returned
@ -25,13 +25,13 @@ const char *get_canonical_hostname(int reverse_mapping_check);
*/ */
const char *get_remote_ipaddr(void); const char *get_remote_ipaddr(void);
const char *get_remote_name_or_ip(u_int utmp_len, int reverse_mapping_check); const char *get_remote_name_or_ip(u_int, int);
/* Returns the ipaddr/port number of the peer of the socket. */ /* Returns the ipaddr/port number of the peer of the socket. */
char * get_peer_ipaddr(int socket); char * get_peer_ipaddr(int);
int get_peer_port(int sock); int get_peer_port(int);
char * get_local_ipaddr(int socket); char * get_local_ipaddr(int);
char * get_local_name(int socket); char * get_local_name(int);
/* Returns the port number of the remote/local host. */ /* Returns the port number of the remote/local host. */
int get_remote_port(void); int get_remote_port(void);

View File

@ -32,7 +32,7 @@
* (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.
*/ */
/* RCSID("$OpenBSD: channels.h,v 1.40 2001/06/25 08:25:36 markus Exp $"); */ /* RCSID("$OpenBSD: channels.h,v 1.41 2001/06/26 06:32:49 itojun Exp $"); */
#ifndef CHANNEL_H #ifndef CHANNEL_H
#define CHANNEL_H #define CHANNEL_H
@ -65,8 +65,8 @@
struct Channel; struct Channel;
typedef struct Channel Channel; typedef struct Channel Channel;
typedef void channel_callback_fn(int id, void *arg); typedef void channel_callback_fn(int, void *);
typedef int channel_filter_fn(struct Channel *c, char *buf, int len); typedef int channel_filter_fn(struct Channel *, char *, int);
struct Channel { struct Channel {
int type; /* channel type/state */ int type; /* channel type/state */
@ -142,44 +142,39 @@ struct Channel {
/* channel management */ /* channel management */
Channel *channel_lookup(int id); Channel *channel_lookup(int);
Channel * Channel *channel_new(char *, int, int, int, int, int, int, int, char *, int);
channel_new(char *ctype, int type, int rfd, int wfd, int efd, void channel_set_fds(int, int, int, int, int, int);
int window, int maxpack, int extusage, char *remote_name, int nonblock); void channel_free(Channel *);
void
channel_set_fds(int id, int rfd, int wfd, int efd,
int extusage, int nonblock);
void channel_free(Channel *c);
void channel_free_all(void); void channel_free_all(void);
void channel_send_open(int id); void channel_send_open(int);
void channel_request(int id, char *service, int wantconfirm); void channel_request(int, char *, int);
void channel_request_start(int id, char *service, int wantconfirm); void channel_request_start(int, char *, int);
void channel_register_callback(int id, int mtype, channel_callback_fn *fn, void *arg); void channel_register_callback(int, int mtype, channel_callback_fn *, void *);
void channel_register_cleanup(int id, channel_callback_fn *fn); void channel_register_cleanup(int, channel_callback_fn *);
void channel_register_filter(int id, channel_filter_fn *fn); void channel_register_filter(int, channel_filter_fn *);
void channel_cancel_cleanup(int id); void channel_cancel_cleanup(int);
/* protocol handler */ /* protocol handler */
void channel_input_channel_request(int type, int plen, void *ctxt); void channel_input_channel_request(int, int, void *);
void channel_input_close(int type, int plen, void *ctxt); void channel_input_close(int, int, void *);
void channel_input_close_confirmation(int type, int plen, void *ctxt); void channel_input_close_confirmation(int, int, void *);
void channel_input_data(int type, int plen, void *ctxt); void channel_input_data(int, int, void *);
void channel_input_extended_data(int type, int plen, void *ctxt); void channel_input_extended_data(int, int, void *);
void channel_input_ieof(int type, int plen, void *ctxt); void channel_input_ieof(int, int, void *);
void channel_input_oclose(int type, int plen, void *ctxt); void channel_input_oclose(int, int, void *);
void channel_input_open_confirmation(int type, int plen, void *ctxt); void channel_input_open_confirmation(int, int, void *);
void channel_input_open_failure(int type, int plen, void *ctxt); void channel_input_open_failure(int, int, void *);
void channel_input_port_open(int type, int plen, void *ctxt); void channel_input_port_open(int, int, void *);
void channel_input_window_adjust(int type, int plen, void *ctxt); void channel_input_window_adjust(int, int, void *);
/* file descriptor handling (read/write) */ /* file descriptor handling (read/write) */
void void
channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp, channel_prepare_select(fd_set **, fd_set **, int *, int);
int rekeying); void channel_after_select(fd_set *, fd_set *);
void channel_after_select(fd_set * readset, fd_set * writeset);
void channel_output_poll(void); void channel_output_poll(void);
int channel_not_very_much_buffered_data(void); int channel_not_very_much_buffered_data(void);
@ -191,45 +186,41 @@ int channel_find_open(void);
/* channel_tcpfwd.c */ /* channel_tcpfwd.c */
int int
channel_request_local_forwarding(u_short listen_port, channel_request_local_forwarding(u_short, const char *, u_short, int);
const char *host_to_connect, u_short port_to_connect, int gateway_ports);
int int
channel_request_forwarding(const char *listen_address, u_short listen_port, channel_request_forwarding(const char *, u_short, const char *, u_short, int,
const char *host_to_connect, u_short port_to_connect, int gateway_ports, int);
int remote_fwd);
void void
channel_request_remote_forwarding(u_short port, const char *host, channel_request_remote_forwarding(u_short, const char *, u_short);
u_short remote_port);
void channel_permit_all_opens(void); void channel_permit_all_opens(void);
void channel_add_permitted_opens(char *host, int port); void channel_add_permitted_opens(char *, int);
void channel_clear_permitted_opens(void); void channel_clear_permitted_opens(void);
void channel_input_port_forward_request(int is_root, int gateway_ports); void channel_input_port_forward_request(int, int);
int channel_connect_to(const char *host, u_short host_port); int channel_connect_to(const char *, u_short);
int channel_connect_by_listen_adress(u_short listen_port); int channel_connect_by_listen_adress(u_short);
/* x11 forwarding */ /* x11 forwarding */
int x11_connect_display(void); int x11_connect_display(void);
char *x11_create_display(int screen); char *x11_create_display(int);
char *x11_create_display_inet(int screen, int x11_display_offset); char *x11_create_display_inet(int, int);
void x11_input_open(int type, int plen, void *ctxt); void x11_input_open(int, int, void *);
void x11_request_forwarding(void); void x11_request_forwarding(void);
void void
x11_request_forwarding_with_spoofing(int client_session_id, x11_request_forwarding_with_spoofing(int, const char *, const char *);
const char *proto, const char *data); void deny_input_open(int, int, void *);
void deny_input_open(int type, int plen, void *ctxt);
/* agent forwarding */ /* agent forwarding */
void auth_request_forwarding(void); void auth_request_forwarding(void);
char *auth_get_socket_name(void); char *auth_get_socket_name(void);
void auth_sock_cleanup_proc(void *pw); void auth_sock_cleanup_proc(void *);
int auth_input_request_forwarding(struct passwd * pw); int auth_input_request_forwarding(struct passwd *);
void auth_input_open_request(int type, int plen, void *ctxt); void auth_input_open_request(int, int, void *);
/* channel close */ /* channel close */
typedef void chan_event_fn(Channel * c); typedef void chan_event_fn(Channel *);
/* for the input state */ /* for the input state */
extern chan_event_fn *chan_rcvd_oclose; extern chan_event_fn *chan_rcvd_oclose;
@ -241,9 +232,9 @@ extern chan_event_fn *chan_rcvd_ieof;
extern chan_event_fn *chan_write_failed; extern chan_event_fn *chan_write_failed;
extern chan_event_fn *chan_obuf_empty; extern chan_event_fn *chan_obuf_empty;
int chan_is_dead(Channel * c); int chan_is_dead(Channel *);
void chan_mark_dead(Channel * c); void chan_mark_dead(Channel *);
void chan_init_iostates(Channel * c); void chan_init_iostates(Channel *);
void chan_init(void); void chan_init(void);
#endif #endif

View File

@ -32,7 +32,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
/* RCSID("$OpenBSD: cipher.h,v 1.26 2001/05/28 22:51:11 markus Exp $"); */ /* RCSID("$OpenBSD: cipher.h,v 1.27 2001/06/26 06:32:49 itojun Exp $"); */
#ifndef CIPHER_H #ifndef CIPHER_H
#define CIPHER_H #define CIPHER_H
@ -104,15 +104,16 @@ struct Cipher {
void (*decrypt)(CipherContext *, u_char *, const u_char *, u_int); void (*decrypt)(CipherContext *, u_char *, const u_char *, u_int);
}; };
u_int cipher_mask_ssh1(int client); u_int cipher_mask_ssh1(int);
Cipher *cipher_by_name(const char *name); Cipher *cipher_by_name(const char *);
Cipher *cipher_by_number(int id); Cipher *cipher_by_number(int);
int cipher_number(const char *name); int cipher_number(const char *);
char *cipher_name(int id); char *cipher_name(int);
int ciphers_valid(const char *names); int ciphers_valid(const char *);
void cipher_init(CipherContext *, Cipher *, const u_char *, u_int, const u_char *, u_int); void cipher_init(CipherContext *, Cipher *, const u_char *, u_int,
void cipher_encrypt(CipherContext *context, u_char *dest, const u_char *src, u_int len); const u_char *, u_int);
void cipher_decrypt(CipherContext *context, u_char *dest, const u_char *src, u_int len); void cipher_encrypt(CipherContext *, u_char *, const u_char *, u_int);
void cipher_set_key_string(CipherContext *context, Cipher *cipher, const char *passphrase); void cipher_decrypt(CipherContext *, u_char *, const u_char *, u_int);
void cipher_set_key_string(CipherContext *, Cipher *, const char *);
#endif /* CIPHER_H */ #endif /* CIPHER_H */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: clientloop.h,v 1.4 2001/02/06 22:43:02 markus Exp $ */ /* $OpenBSD: clientloop.h,v 1.5 2001/06/26 06:32:50 itojun Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -36,4 +36,4 @@
*/ */
/* Client side main loop for the interactive session. */ /* Client side main loop for the interactive session. */
int client_loop(int have_pty, int escape_char, int id); int client_loop(int, int, int);

View File

@ -21,7 +21,7 @@
* (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.
*/ */
/* RCSID("$OpenBSD: compat.h,v 1.26 2001/06/25 08:25:37 markus Exp $"); */ /* RCSID("$OpenBSD: compat.h,v 1.27 2001/06/26 06:32:50 itojun Exp $"); */
#ifndef COMPAT_H #ifndef COMPAT_H
#define COMPAT_H #define COMPAT_H
@ -53,9 +53,9 @@
void enable_compat13(void); void enable_compat13(void);
void enable_compat20(void); void enable_compat20(void);
void compat_datafellows(const char *s); void compat_datafellows(const char *);
int proto_spec(const char *spec); int proto_spec(const char *);
char *compat_cipher_proposal(char *cipher_prop); char *compat_cipher_proposal(char *);
extern int compat13; extern int compat13;
extern int compat20; extern int compat20;
extern int datafellows; extern int datafellows;

View File

@ -11,7 +11,7 @@
* called by a name other than "ssh" or "Secure Shell". * called by a name other than "ssh" or "Secure Shell".
*/ */
/* RCSID("$OpenBSD: compress.h,v 1.8 2001/04/05 10:39:02 markus Exp $"); */ /* RCSID("$OpenBSD: compress.h,v 1.9 2001/06/26 06:32:50 itojun Exp $"); */
#ifndef COMPRESS_H #ifndef COMPRESS_H
#define COMPRESS_H #define COMPRESS_H
@ -20,7 +20,7 @@
* Initializes compression; level is compression level from 1 to 9 (as in * Initializes compression; level is compression level from 1 to 9 (as in
* gzip). * gzip).
*/ */
void buffer_compress_init_send(int level); void buffer_compress_init_send(int);
void buffer_compress_init_recv(void); void buffer_compress_init_recv(void);
/* Frees any data structures allocated by buffer_compress_init. */ /* Frees any data structures allocated by buffer_compress_init. */
@ -34,7 +34,7 @@ void buffer_compress_uninit(void);
* order since they together form a single compression stream) by the * order since they together form a single compression stream) by the
* receiver. This appends the compressed data to the output buffer. * receiver. This appends the compressed data to the output buffer.
*/ */
void buffer_compress(Buffer * input_buffer, Buffer * output_buffer); void buffer_compress(Buffer *, Buffer *);
/* /*
* Uncompresses the contents of input_buffer into output_buffer. All packets * Uncompresses the contents of input_buffer into output_buffer. All packets
@ -44,6 +44,6 @@ void buffer_compress(Buffer * input_buffer, Buffer * output_buffer);
* buffer_compress was called, and in the same order that buffers compressed * buffer_compress was called, and in the same order that buffers compressed
* with that. This appends the uncompressed data to the output buffer. * with that. This appends the uncompressed data to the output buffer.
*/ */
void buffer_uncompress(Buffer * input_buffer, Buffer * output_buffer); void buffer_uncompress(Buffer *, Buffer *);
#endif /* COMPRESS_H */ #endif /* COMPRESS_H */

View File

@ -11,7 +11,7 @@
* called by a name other than "ssh" or "Secure Shell". * called by a name other than "ssh" or "Secure Shell".
*/ */
/* RCSID("$OpenBSD: crc32.h,v 1.10 2001/03/02 18:54:31 deraadt Exp $"); */ /* RCSID("$OpenBSD: crc32.h,v 1.11 2001/06/26 06:32:51 itojun Exp $"); */
#ifndef CRC32_H #ifndef CRC32_H
#define CRC32_H #define CRC32_H
@ -20,6 +20,6 @@
* This computes a 32 bit CRC of the data in the buffer, and returns the CRC. * This computes a 32 bit CRC of the data in the buffer, and returns the CRC.
* The polynomial used is 0xedb88320. * The polynomial used is 0xedb88320.
*/ */
u_int ssh_crc32(const u_char *buf, u_int len); u_int ssh_crc32(const u_char *, u_int);
#endif /* CRC32_H */ #endif /* CRC32_H */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: deattack.h,v 1.5 2001/01/29 01:58:15 niklas Exp $ */ /* $OpenBSD: deattack.h,v 1.6 2001/06/26 06:32:51 itojun Exp $ */
/* /*
* Cryptographic attack detector for ssh - Header file * Cryptographic attack detector for ssh - Header file
@ -26,5 +26,5 @@
#define DEATTACK_OK 0 #define DEATTACK_OK 0
#define DEATTACK_DETECTED 1 #define DEATTACK_DETECTED 1
int detect_attack(u_char *buf, u_int32_t len, u_char IV[8]); int detect_attack(u_char *, u_int32_t, u_char[8]);
#endif #endif

8
dh.h
View File

@ -1,4 +1,4 @@
/* $OpenBSD: dh.h,v 1.5 2001/04/03 19:53:29 markus Exp $ */ /* $OpenBSD: dh.h,v 1.6 2001/06/26 06:32:52 itojun Exp $ */
/* /*
* Copyright (c) 2000 Niels Provos. All rights reserved. * Copyright (c) 2000 Niels Provos. All rights reserved.
@ -32,15 +32,15 @@ struct dhgroup {
BIGNUM *p; BIGNUM *p;
}; };
DH *choose_dh(int min, int nbits, int max); DH *choose_dh(int, int, int);
DH *dh_new_group_asc(const char *, const char *); DH *dh_new_group_asc(const char *, const char *);
DH *dh_new_group(BIGNUM *, BIGNUM *); DH *dh_new_group(BIGNUM *, BIGNUM *);
DH *dh_new_group1(void); DH *dh_new_group1(void);
void dh_gen_key(DH *, int); void dh_gen_key(DH *, int);
int dh_pub_is_valid(DH *dh, BIGNUM *dh_pub); int dh_pub_is_valid(DH *, BIGNUM *);
int dh_estimate(int bits); int dh_estimate(int);
#define DH_GRP_MIN 1024 #define DH_GRP_MIN 1024
#define DH_GRP_MAX 8192 #define DH_GRP_MAX 8192

View File

@ -1,4 +1,4 @@
/* $OpenBSD: dispatch.h,v 1.4 2001/01/29 01:58:15 niklas Exp $ */ /* $OpenBSD: dispatch.h,v 1.5 2001/06/26 06:32:52 itojun Exp $ */
/* /*
* Copyright (c) 2000 Markus Friedl. All rights reserved. * Copyright (c) 2000 Markus Friedl. All rights reserved.
@ -28,9 +28,9 @@ enum {
DISPATCH_NONBLOCK DISPATCH_NONBLOCK
}; };
typedef void dispatch_fn(int type, int plen, void *ctxt); typedef void dispatch_fn(int, int, void *);
void dispatch_init(dispatch_fn *dflt); void dispatch_init(dispatch_fn *);
void dispatch_set(int type, dispatch_fn *fn); void dispatch_set(int, dispatch_fn *);
void dispatch_run(int mode, int *done, void *ctxt); void dispatch_run(int, int *, void *);
void dispatch_protocol_error(int type, int plen, void *ctxt); void dispatch_protocol_error(int, int, void *);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: groupaccess.h,v 1.2 2001/01/29 01:58:15 niklas Exp $ */ /* $OpenBSD: groupaccess.h,v 1.3 2001/06/26 06:32:52 itojun Exp $ */
/* /*
* Copyright (c) 2001 Kevin Steves. All rights reserved. * Copyright (c) 2001 Kevin Steves. All rights reserved.
@ -33,13 +33,13 @@
* Initialize group access list for user with primary (base) and * Initialize group access list for user with primary (base) and
* supplementary groups. Return the number of groups in the list. * supplementary groups. Return the number of groups in the list.
*/ */
int ga_init(const char *user, gid_t base); int ga_init(const char *, gid_t);
/* /*
* Return 1 if one of user's groups is contained in groups. * Return 1 if one of user's groups is contained in groups.
* Return 0 otherwise. Use match_pattern() for string comparison. * Return 0 otherwise. Use match_pattern() for string comparison.
*/ */
int ga_match(char * const *groups, int ngroups); int ga_match(char * const *, int);
/* /*
* Free memory allocated for group access list. * Free memory allocated for group access list.

View File

@ -1,4 +1,4 @@
/* $OpenBSD: hostfile.h,v 1.7 2001/02/08 19:30:51 itojun Exp $ */ /* $OpenBSD: hostfile.h,v 1.8 2001/06/26 06:32:53 itojun Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -15,7 +15,7 @@
#define HOSTFILE_H #define HOSTFILE_H
int int
auth_rsa_read_key(char **cpp, u_int *bitsp, BIGNUM * e, BIGNUM * n); auth_rsa_read_key(char **, u_int *, BIGNUM *, BIGNUM *);
/* /*
* Checks whether the given host is already in the list of our known hosts. * Checks whether the given host is already in the list of our known hosts.
@ -28,13 +28,12 @@ typedef enum {
} HostStatus; } HostStatus;
HostStatus HostStatus
check_host_in_hostfile(const char *filename, const char *host, Key *key, check_host_in_hostfile(const char *, const char *, Key *, Key *, int *);
Key *found, int *line);
/* /*
* Appends an entry to the host file. Returns false if the entry could not * Appends an entry to the host file. Returns false if the entry could not
* be appended. * be appended.
*/ */
int add_host_to_hostfile(const char *filename, const char *host, Key *key); int add_host_to_hostfile(const char *, const char *, Key *);
#endif #endif

20
kex.h
View File

@ -1,4 +1,4 @@
/* $OpenBSD: kex.h,v 1.24 2001/06/25 08:25:37 markus Exp $ */ /* $OpenBSD: kex.h,v 1.25 2001/06/26 06:32:53 itojun Exp $ */
/* /*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
@ -107,24 +107,24 @@ struct Kex {
int flags; int flags;
char *client_version_string; char *client_version_string;
char *server_version_string; char *server_version_string;
int (*verify_host_key)(Key *hostkey); int (*verify_host_key)(Key *);
Key *(*load_host_key)(int type); Key *(*load_host_key)(int);
}; };
Kex *kex_setup(char *proposal[PROPOSAL_MAX]); Kex *kex_setup(char *[PROPOSAL_MAX]);
void kex_finish(Kex *kex); void kex_finish(Kex *);
void kex_send_kexinit(Kex *kex); void kex_send_kexinit(Kex *);
void kex_input_kexinit(int type, int plen, void *ctxt); void kex_input_kexinit(int, int, void *);
void kex_derive_keys(Kex *k, u_char *hash, BIGNUM *shared_secret); void kex_derive_keys(Kex *, u_char *, BIGNUM *);
void kexdh(Kex *); void kexdh(Kex *);
void kexgex(Kex *); void kexgex(Kex *);
Newkeys *kex_get_newkeys(int mode); Newkeys *kex_get_newkeys(int);
#if defined(DEBUG_KEX) || defined(DEBUG_KEXDH) #if defined(DEBUG_KEX) || defined(DEBUG_KEXDH)
void dump_digest(char *msg, u_char *digest, int len); void dump_digest(char *, u_char *, int);
#endif #endif
#endif #endif

46
key.h
View File

@ -1,4 +1,4 @@
/* $OpenBSD: key.h,v 1.13 2001/06/25 08:25:38 markus Exp $ */ /* $OpenBSD: key.h,v 1.14 2001/06/26 06:32:54 itojun Exp $ */
/* /*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
@ -50,35 +50,27 @@ struct Key {
DSA *dsa; DSA *dsa;
}; };
Key *key_new(int type); Key *key_new(int);
Key *key_new_private(int type); Key *key_new_private(int);
void key_free(Key *k); void key_free(Key *);
int key_equal(Key *a, Key *b); int key_equal(Key *, Key *);
char *key_fingerprint(Key *k, enum fp_type dgst_type, enum fp_rep dgst_rep); char *key_fingerprint(Key *, enum fp_type, enum fp_rep);
char *key_type(Key *k); char *key_type(Key *);
int key_write(Key *key, FILE *f); int key_write(Key *, FILE *);
int key_read(Key *key, char **cpp); int key_read(Key *, char **);
u_int key_size(Key *k); u_int key_size(Key *);
Key *key_generate(int type, u_int bits); Key *key_generate(int, u_int);
Key *key_from_private(Key *k); Key *key_from_private(Key *);
int key_type_from_name(char *name); int key_type_from_name(char *);
Key *key_from_blob(char *blob, int blen); Key *key_from_blob(char *, int);
int key_to_blob(Key *key, u_char **blobp, u_int *lenp); int key_to_blob(Key *, u_char **, u_int *);
char *key_ssh_name(Key *k); char *key_ssh_name(Key *);
int key_names_valid2(const char *names); int key_names_valid2(const char *);
int int key_sign(Key *, u_char **, int *, u_char *, int);
key_sign(
Key *key,
u_char **sigp, int *lenp,
u_char *data, int datalen);
int int key_verify(Key *, u_char *, int, u_char *, int);
key_verify(
Key *key,
u_char *signature, int signaturelen,
u_char *data, int datalen);
#endif #endif

28
log.h
View File

@ -1,4 +1,4 @@
/* $OpenBSD: log.h,v 1.2 2001/01/29 01:58:16 niklas Exp $ */ /* $OpenBSD: log.h,v 1.3 2001/06/26 06:32:55 itojun Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -46,23 +46,23 @@ typedef enum {
SYSLOG_LEVEL_DEBUG3 SYSLOG_LEVEL_DEBUG3
} LogLevel; } LogLevel;
/* Initializes logging. */ /* Initializes logging. */
void log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr); void log_init(char *, LogLevel, SyslogFacility, int);
/* Logging implementation, depending on server or client */ /* Logging implementation, depending on server or client */
void do_log(LogLevel level, const char *fmt, va_list args); void do_log(LogLevel, const char *, va_list);
/* name to facility/level */ /* name to facility/level */
SyslogFacility log_facility_number(char *name); SyslogFacility log_facility_number(char *);
LogLevel log_level_number(char *name); LogLevel log_level_number(char *);
/* Output a message to syslog or stderr */ /* Output a message to syslog or stderr */
void fatal(const char *fmt,...) __attribute__((format(printf, 1, 2))); void fatal(const char *, ...) __attribute__((format(printf, 1, 2)));
void error(const char *fmt,...) __attribute__((format(printf, 1, 2))); void error(const char *, ...) __attribute__((format(printf, 1, 2)));
void log(const char *fmt,...) __attribute__((format(printf, 1, 2))); void log(const char *, ...) __attribute__((format(printf, 1, 2)));
void verbose(const char *fmt,...) __attribute__((format(printf, 1, 2))); void verbose(const char *, ...) __attribute__((format(printf, 1, 2)));
void debug(const char *fmt,...) __attribute__((format(printf, 1, 2))); void debug(const char *, ...) __attribute__((format(printf, 1, 2)));
void debug2(const char *fmt,...) __attribute__((format(printf, 1, 2))); void debug2(const char *, ...) __attribute__((format(printf, 1, 2)));
void debug3(const char *fmt,...) __attribute__((format(printf, 1, 2))); void debug3(const char *, ...) __attribute__((format(printf, 1, 2)));
/* same as fatal() but w/o logging */ /* same as fatal() but w/o logging */
void fatal_cleanup(void); void fatal_cleanup(void);
@ -72,9 +72,9 @@ void fatal_cleanup(void);
* before exiting. It is permissible to call fatal_remove_cleanup for the * before exiting. It is permissible to call fatal_remove_cleanup for the
* function itself from the function. * function itself from the function.
*/ */
void fatal_add_cleanup(void (*proc) (void *context), void *context); void fatal_add_cleanup(void (*) (void *), void *);
/* Removes a cleanup function to be called at fatal(). */ /* Removes a cleanup function to be called at fatal(). */
void fatal_remove_cleanup(void (*proc) (void *context), void *context); void fatal_remove_cleanup(void (*) (void *), void *);
#endif #endif

8
mac.h
View File

@ -1,4 +1,4 @@
/* $OpenBSD: mac.h,v 1.1 2001/02/11 12:59:24 markus Exp $ */ /* $OpenBSD: mac.h,v 1.2 2001/06/26 06:32:55 itojun Exp $ */
/* /*
* Copyright (c) 2001 Markus Friedl. All rights reserved. * Copyright (c) 2001 Markus Friedl. All rights reserved.
* *
@ -23,6 +23,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
int mac_valid(const char *names); int mac_valid(const char *);
int mac_init(Mac *mac, char *name); int mac_init(Mac *, char *);
u_char *mac_compute(Mac *mac, u_int32_t seqno, u_char *data, int datalen); u_char *mac_compute(Mac *, u_int32_t, u_char *, int);

12
match.h
View File

@ -1,4 +1,4 @@
/* $OpenBSD: match.h,v 1.8 2001/06/24 05:25:10 markus Exp $ */ /* $OpenBSD: match.h,v 1.9 2001/06/26 06:32:56 itojun Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -14,10 +14,10 @@
#ifndef MATCH_H #ifndef MATCH_H
#define MATCH_H #define MATCH_H
int match_pattern(const char *s, const char *pattern); int match_pattern(const char *, const char *);
int match_hostname(const char *host, const char *pattern, u_int len); int match_hostname(const char *, const char *, u_int);
int match_host_and_ip(const char *host, const char *ip, const char *p); int match_host_and_ip(const char *, const char *, const char *);
int match_user(const char *u, const char *h, const char *i, const char *p); int match_user(const char *, const char *, const char *, const char *);
char *match_list(const char *client, const char *server, u_int *next); char *match_list(const char *, const char *, u_int *);
#endif #endif

22
misc.h
View File

@ -1,4 +1,4 @@
/* $OpenBSD: misc.h,v 1.8 2001/05/19 19:43:57 stevesk Exp $ */ /* $OpenBSD: misc.h,v 1.9 2001/06/26 06:32:56 itojun Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -12,27 +12,27 @@
* called by a name other than "ssh" or "Secure Shell". * called by a name other than "ssh" or "Secure Shell".
*/ */
/* remove newline at end of string */ /* remove newline at end of string */
char *chop(char *s); char *chop(char *);
/* return next token in configuration line */ /* return next token in configuration line */
char *strdelim(char **s); char *strdelim(char **);
/* set/unset filedescriptor to non-blocking */ /* set/unset filedescriptor to non-blocking */
void set_nonblock(int fd); void set_nonblock(int);
void unset_nonblock(int fd); void unset_nonblock(int);
struct passwd * pwcopy(struct passwd *pw); struct passwd * pwcopy(struct passwd *);
/* /*
* Convert ASCII string to TCP/IP port number. * Convert ASCII string to TCP/IP port number.
* Port must be >0 and <=65535. * Port must be >0 and <=65535.
* Return 0 if invalid. * Return 0 if invalid.
*/ */
int a2port(const char *s); int a2port(const char *);
/* code from scp.c/rcp.c */ /* code from scp.c/rcp.c */
char *cleanhostname(char *host); char *cleanhostname(char *);
char *colon(char *cp); char *colon(char *);
/* /*
* Convert a time string into seconds; format is * Convert a time string into seconds; format is
@ -56,7 +56,7 @@ char *colon(char *cp);
* Return -1 if time string is invalid. * Return -1 if time string is invalid.
*/ */
long convtime(const char *s); long convtime(const char *);
/* function to assist building execv() arguments */ /* function to assist building execv() arguments */
typedef struct arglist arglist; typedef struct arglist arglist;
@ -66,7 +66,7 @@ struct arglist {
int nalloc; int nalloc;
}; };
void addargs(arglist *args, char *fmt, ...) __attribute__((format(printf, 2, 3))); void addargs(arglist *, char *, ...) __attribute__((format(printf, 2, 3)));
/* wrapper for signal interface */ /* wrapper for signal interface */
typedef void (*mysig_t)(int); typedef void (*mysig_t)(int);

View File

@ -12,7 +12,7 @@
* called by a name other than "ssh" or "Secure Shell". * called by a name other than "ssh" or "Secure Shell".
*/ */
/* RCSID("$OpenBSD: mpaux.h,v 1.9 2000/12/19 23:17:57 markus Exp $"); */ /* RCSID("$OpenBSD: mpaux.h,v 1.10 2001/06/26 06:32:57 itojun Exp $"); */
#ifndef MPAUX_H #ifndef MPAUX_H
#define MPAUX_H #define MPAUX_H
@ -23,9 +23,6 @@
* representations of host_key_n, session_key_n, and the cookie. * representations of host_key_n, session_key_n, and the cookie.
*/ */
void void
compute_session_id(u_char session_id[16], compute_session_id(u_char[16], u_char[8], BIGNUM *, BIGNUM *);
u_char cookie[8],
BIGNUM * host_key_n,
BIGNUM * session_key_n);
#endif /* MPAUX_H */ #endif /* MPAUX_H */

View File

@ -11,7 +11,7 @@
* called by a name other than "ssh" or "Secure Shell". * called by a name other than "ssh" or "Secure Shell".
*/ */
/* RCSID("$OpenBSD: packet.h,v 1.23 2001/05/28 23:58:35 markus Exp $"); */ /* RCSID("$OpenBSD: packet.h,v 1.24 2001/06/26 06:32:57 itojun Exp $"); */
#ifndef PACKET_H #ifndef PACKET_H
#define PACKET_H #define PACKET_H
@ -23,7 +23,7 @@
* packet_set_encryption_key is called. It is permissible that fd_in and * packet_set_encryption_key is called. It is permissible that fd_in and
* fd_out are the same descriptor; in that case it is assumed to be a socket. * fd_out are the same descriptor; in that case it is assumed to be a socket.
*/ */
void packet_set_connection(int fd_in, int fd_out); void packet_set_connection(int, int);
/* Puts the connection file descriptors into non-blocking mode. */ /* Puts the connection file descriptors into non-blocking mode. */
void packet_set_nonblocking(void); void packet_set_nonblocking(void);
@ -46,32 +46,31 @@ void packet_close(void);
* encrypted independently of each other. Cipher types are defined in ssh.h. * encrypted independently of each other. Cipher types are defined in ssh.h.
*/ */
void void
packet_set_encryption_key(const u_char *key, u_int keylen, packet_set_encryption_key(const u_char *, u_int, int);
int cipher_type);
/* /*
* Sets remote side protocol flags for the current connection. This can be * Sets remote side protocol flags for the current connection. This can be
* called at any time. * called at any time.
*/ */
void packet_set_protocol_flags(u_int flags); void packet_set_protocol_flags(u_int);
/* Returns the remote protocol flags set earlier by the above function. */ /* Returns the remote protocol flags set earlier by the above function. */
u_int packet_get_protocol_flags(void); u_int packet_get_protocol_flags(void);
/* Enables compression in both directions starting from the next packet. */ /* Enables compression in both directions starting from the next packet. */
void packet_start_compression(int level); void packet_start_compression(int);
/* /*
* Informs that the current session is interactive. Sets IP flags for * Informs that the current session is interactive. Sets IP flags for
* optimal performance in interactive use. * optimal performance in interactive use.
*/ */
void packet_set_interactive(int interactive); void packet_set_interactive(int);
/* Returns true if the current connection is interactive. */ /* Returns true if the current connection is interactive. */
int packet_is_interactive(void); int packet_is_interactive(void);
/* Starts constructing a packet to send. */ /* Starts constructing a packet to send. */
void packet_start(u_char type); void packet_start(u_char);
/* Appends a character to the packet data. */ /* Appends a character to the packet data. */
void packet_put_char(int ch); void packet_put_char(int ch);
@ -175,14 +174,14 @@ int packet_not_very_much_data_to_write(void);
/* maximum packet size, requested by client with SSH_CMSG_MAX_PACKET_SIZE */ /* maximum packet size, requested by client with SSH_CMSG_MAX_PACKET_SIZE */
extern int max_packet_size; extern int max_packet_size;
int packet_set_maxsize(int s); int packet_set_maxsize(int);
#define packet_get_maxsize() max_packet_size #define packet_get_maxsize() max_packet_size
/* Stores tty modes from the fd or tiop into current packet. */ /* Stores tty modes from the fd or tiop into current packet. */
void tty_make_modes(int fd, struct termios *tiop); void tty_make_modes(int, struct termios *);
/* Parses tty modes for the fd from the current packet. */ /* Parses tty modes for the fd from the current packet. */
void tty_parse_modes(int fd, int *n_bytes_ptr); void tty_parse_modes(int, int *);
#define packet_integrity_check(payload_len, expected_len, type) \ #define packet_integrity_check(payload_len, expected_len, type) \
do { \ do { \
@ -212,9 +211,9 @@ int packet_connection_is_ipv4(void);
int packet_remaining(void); int packet_remaining(void);
/* append an ignore message */ /* append an ignore message */
void packet_send_ignore(int nbytes); void packet_send_ignore(int);
/* add an ignore message and make sure size (current+ignore) = n*sumlen */ /* add an ignore message and make sure size (current+ignore) = n*sumlen */
void packet_inject_ignore(int sumlen); void packet_inject_ignore(int);
#endif /* PACKET_H */ #endif /* PACKET_H */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: radix.h,v 1.2 2001/01/29 01:58:17 niklas Exp $ */ /* $OpenBSD: radix.h,v 1.3 2001/06/26 06:32:57 itojun Exp $ */
/* /*
* Copyright (c) 1999 Dug Song. All rights reserved. * Copyright (c) 1999 Dug Song. All rights reserved.
@ -24,5 +24,5 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
int creds_to_radix(CREDENTIALS * creds, u_char *buf, size_t buflen); int creds_to_radix(CREDENTIALS *, u_char *, size_t);
int radix_to_creds(const char *buf, CREDENTIALS * creds); int radix_to_creds(const char *, CREDENTIALS *);

View File

@ -11,7 +11,7 @@
* called by a name other than "ssh" or "Secure Shell". * called by a name other than "ssh" or "Secure Shell".
*/ */
/* RCSID("$OpenBSD: readconf.h,v 1.32 2001/05/18 14:13:29 markus Exp $"); */ /* RCSID("$OpenBSD: readconf.h,v 1.33 2001/06/26 06:32:58 itojun Exp $"); */
#ifndef READCONF_H #ifndef READCONF_H
#define READCONF_H #define READCONF_H
@ -107,13 +107,13 @@ typedef struct {
* are processed in the following order: command line, user config file, * are processed in the following order: command line, user config file,
* system config file. Last, fill_default_options is called. * system config file. Last, fill_default_options is called.
*/ */
void initialize_options(Options * options); void initialize_options(Options *);
/* /*
* Called after processing other sources of option data, this fills those * Called after processing other sources of option data, this fills those
* options for which no value has been specified with their default values. * options for which no value has been specified with their default values.
*/ */
void fill_default_options(Options * options); void fill_default_options(Options *);
/* /*
* Processes a single option line as used in the configuration files. This * Processes a single option line as used in the configuration files. This
@ -121,9 +121,7 @@ void fill_default_options(Options * options);
* options * options
*/ */
int int
process_config_line(Options * options, const char *host, process_config_line(Options *, const char *, char *, const char *, int, int *);
char *line, const char *filename, int linenum,
int *activep);
/* /*
* Reads the config file and modifies the options accordingly. Options * Reads the config file and modifies the options accordingly. Options
@ -131,23 +129,20 @@ process_config_line(Options * options, const char *host,
* there is an error. If the file does not exist, this returns immediately. * there is an error. If the file does not exist, this returns immediately.
*/ */
void void
read_config_file(const char *filename, const char *host, read_config_file(const char *, const char *, Options *);
Options * options);
/* /*
* Adds a local TCP/IP port forward to options. Never returns if there is an * Adds a local TCP/IP port forward to options. Never returns if there is an
* error. * error.
*/ */
void void
add_local_forward(Options * options, u_short port, const char *host, add_local_forward(Options *, u_short, const char *, u_short);
u_short host_port);
/* /*
* Adds a remote TCP/IP port forward to options. Never returns if there is * Adds a remote TCP/IP port forward to options. Never returns if there is
* an error. * an error.
*/ */
void void
add_remote_forward(Options * options, u_short port, const char *host, add_remote_forward(Options *, u_short, const char *, u_short);
u_short host_port);
#endif /* READCONF_H */ #endif /* READCONF_H */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: readpass.h,v 1.4 2001/06/24 05:35:33 markus Exp $ */ /* $OpenBSD: readpass.h,v 1.5 2001/06/26 06:32:58 itojun Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -14,4 +14,4 @@
#define RP_ECHO 0x0001 #define RP_ECHO 0x0001
#define RP_ALLOW_STDIN 0x0002 #define RP_ALLOW_STDIN 0x0002
char *read_passphrase(const char *prompt, int flags); char *read_passphrase(const char *, int);

8
rsa.h
View File

@ -11,7 +11,7 @@
* called by a name other than "ssh" or "Secure Shell". * called by a name other than "ssh" or "Secure Shell".
*/ */
/* RCSID("$OpenBSD: rsa.h,v 1.11 2001/03/26 23:23:24 markus Exp $"); */ /* RCSID("$OpenBSD: rsa.h,v 1.12 2001/06/26 06:32:58 itojun Exp $"); */
#ifndef RSA_H #ifndef RSA_H
#define RSA_H #define RSA_H
@ -19,9 +19,9 @@
#include <openssl/bn.h> #include <openssl/bn.h>
#include <openssl/rsa.h> #include <openssl/rsa.h>
void rsa_public_encrypt __P((BIGNUM * out, BIGNUM * in, RSA * prv)); void rsa_public_encrypt __P((BIGNUM *, BIGNUM *, RSA *));
int rsa_private_decrypt __P((BIGNUM * out, BIGNUM * in, RSA * prv)); int rsa_private_decrypt __P((BIGNUM *, BIGNUM *, RSA *));
void generate_additional_parameters __P((RSA *rsa)); void generate_additional_parameters __P((RSA *));
#endif /* RSA_H */ #endif /* RSA_H */