diff options
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | auth-options.h | 11 | ||||
-rw-r--r-- | auth.h | 60 | ||||
-rw-r--r-- | authfd.h | 85 | ||||
-rw-r--r-- | authfile.h | 21 | ||||
-rw-r--r-- | bufaux.h | 26 | ||||
-rw-r--r-- | buffer.h | 55 | ||||
-rw-r--r-- | canohost.h | 33 | ||||
-rw-r--r-- | channels.h | 123 | ||||
-rw-r--r-- | cipher.h | 22 | ||||
-rw-r--r-- | clientloop.h | 4 | ||||
-rw-r--r-- | compat.h | 11 | ||||
-rw-r--r-- | compress.h | 36 | ||||
-rw-r--r-- | crc32.h | 8 | ||||
-rw-r--r-- | deattack.h | 4 | ||||
-rw-r--r-- | dh.h | 8 | ||||
-rw-r--r-- | dispatch.h | 10 | ||||
-rw-r--r-- | groupaccess.c | 13 | ||||
-rw-r--r-- | groupaccess.h | 21 | ||||
-rw-r--r-- | hostfile.h | 19 | ||||
-rw-r--r-- | kex.h | 14 | ||||
-rw-r--r-- | key.h | 23 | ||||
-rw-r--r-- | log.c | 6 | ||||
-rw-r--r-- | log.h | 40 | ||||
-rw-r--r-- | mac.h | 6 | ||||
-rw-r--r-- | misc.c | 40 | ||||
-rw-r--r-- | misc.h | 58 | ||||
-rw-r--r-- | mpaux.h | 10 | ||||
-rw-r--r-- | packet.h | 232 | ||||
-rw-r--r-- | radix.h | 6 | ||||
-rw-r--r-- | readconf.h | 46 | ||||
-rw-r--r-- | readpass.h | 3 | ||||
-rw-r--r-- | rsa.h | 9 | ||||
-rw-r--r-- | servconf.h | 18 | ||||
-rw-r--r-- | serverloop.h | 7 | ||||
-rw-r--r-- | session.h | 12 | ||||
-rw-r--r-- | sftp-common.c | 8 | ||||
-rw-r--r-- | sftp-common.h | 19 | ||||
-rw-r--r-- | sftp-glob.h | 3 | ||||
-rw-r--r-- | sftp-int.h | 4 | ||||
-rw-r--r-- | ssh-dss.h | 7 | ||||
-rw-r--r-- | ssh-rsa.h | 7 | ||||
-rw-r--r-- | sshconnect.h | 14 | ||||
-rw-r--r-- | sshlogin.h | 35 | ||||
-rw-r--r-- | sshpty.h | 31 | ||||
-rw-r--r-- | sshtty.h | 25 | ||||
-rw-r--r-- | tildexpand.h | 8 | ||||
-rw-r--r-- | uidswap.h | 22 | ||||
-rw-r--r-- | uuencode.h | 8 | ||||
-rw-r--r-- | xmalloc.h | 17 |
50 files changed, 412 insertions, 911 deletions
@@ -62,7 +62,18 @@ | |||
62 | - markus@cvs.openbsd.org 2001/06/26 17:25:34 | 62 | - markus@cvs.openbsd.org 2001/06/26 17:25:34 |
63 | [ssh.1] | 63 | [ssh.1] |
64 | document SSH_ASKPASS; fubob@MIT.EDU | 64 | document SSH_ASKPASS; fubob@MIT.EDU |
65 | 65 | - markus@cvs.openbsd.org 2001/06/26 17:27:25 | |
66 | [authfd.h authfile.h auth.h auth-options.h bufaux.h buffer.h | ||
67 | canohost.h channels.h cipher.h clientloop.h compat.h compress.h | ||
68 | crc32.h deattack.h dh.h dispatch.h groupaccess.c groupaccess.h | ||
69 | hostfile.h kex.h key.h log.c log.h mac.h misc.c misc.h mpaux.h | ||
70 | packet.h radix.h readconf.h readpass.h rsa.h servconf.h serverloop.h | ||
71 | session.h sftp-common.c sftp-common.h sftp-glob.h sftp-int.h | ||
72 | sshconnect.h ssh-dss.h sshlogin.h sshpty.h ssh-rsa.h sshtty.h | ||
73 | tildexpand.h uidswap.h uuencode.h xmalloc.h] | ||
74 | remove comments from .h, since they are cut&paste from the .c files | ||
75 | and out of sync | ||
76 | |||
66 | 20010629 | 77 | 20010629 |
67 | - (bal) Removed net_aton() since we don't use it any more | 78 | - (bal) Removed net_aton() since we don't use it any more |
68 | - (bal) Fixed _DISABLE_VPOSIX in readpassphrase.c. | 79 | - (bal) Fixed _DISABLE_VPOSIX in readpassphrase.c. |
@@ -5889,4 +5900,4 @@ | |||
5889 | - Wrote replacements for strlcpy and mkdtemp | 5900 | - Wrote replacements for strlcpy and mkdtemp |
5890 | - Released 1.0pre1 | 5901 | - Released 1.0pre1 |
5891 | 5902 | ||
5892 | $Id: ChangeLog,v 1.1359 2001/07/04 04:31:38 mouring Exp $ | 5903 | $Id: ChangeLog,v 1.1360 2001/07/04 04:46:56 mouring Exp $ |
diff --git a/auth-options.h b/auth-options.h index db0e6e8fb..3b2ce344b 100644 --- a/auth-options.h +++ b/auth-options.h | |||
@@ -11,7 +11,7 @@ | |||
11 | * called by a name other than "ssh" or "Secure Shell". | 11 | * called by a name other than "ssh" or "Secure Shell". |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* $OpenBSD: auth-options.h,v 1.9 2001/06/26 06:32:47 itojun Exp $ */ | 14 | /* $OpenBSD: auth-options.h,v 1.10 2001/06/26 17:27:22 markus Exp $ */ |
15 | 15 | ||
16 | #ifndef AUTH_OPTIONS_H | 16 | #ifndef AUTH_OPTIONS_H |
17 | #define AUTH_OPTIONS_H | 17 | #define AUTH_OPTIONS_H |
@@ -30,14 +30,7 @@ extern int no_pty_flag; | |||
30 | extern char *forced_command; | 30 | extern char *forced_command; |
31 | extern struct envstring *custom_environment; | 31 | extern struct envstring *custom_environment; |
32 | 32 | ||
33 | /* | 33 | int auth_parse_options(struct passwd *, char *, char *, u_long); |
34 | * return 1 if access is granted, 0 if not. | ||
35 | * side effect: sets key option flags | ||
36 | */ | ||
37 | int | ||
38 | auth_parse_options(struct passwd *, char *, char *, u_long); | ||
39 | |||
40 | /* reset options flags */ | ||
41 | void auth_clear_options(void); | 34 | void auth_clear_options(void); |
42 | 35 | ||
43 | #endif | 36 | #endif |
@@ -21,7 +21,7 @@ | |||
21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | * | 23 | * |
24 | * $OpenBSD: auth.h,v 1.21 2001/06/26 16:15:23 dugsong Exp $ | 24 | * $OpenBSD: auth.h,v 1.22 2001/06/26 17:27:22 markus Exp $ |
25 | */ | 25 | */ |
26 | #ifndef AUTH_H | 26 | #ifndef AUTH_H |
27 | #define AUTH_H | 27 | #define AUTH_H |
@@ -87,70 +87,29 @@ struct KbdintDevice | |||
87 | void (*free_ctx) __P((void *ctx)); | 87 | void (*free_ctx) __P((void *ctx)); |
88 | }; | 88 | }; |
89 | 89 | ||
90 | /* | ||
91 | * Tries to authenticate the user using the .rhosts file. Returns true if | ||
92 | * authentication succeeds. If ignore_rhosts is non-zero, this will not | ||
93 | * consider .rhosts and .shosts (/etc/hosts.equiv will still be used). | ||
94 | */ | ||
95 | int auth_rhosts(struct passwd *, const char *); | 90 | int auth_rhosts(struct passwd *, const char *); |
96 | |||
97 | /* extended interface similar to auth_rhosts() */ | ||
98 | int | 91 | int |
99 | auth_rhosts2(struct passwd *, const char *, const char *, const char *); | 92 | auth_rhosts2(struct passwd *, const char *, const char *, const char *); |
100 | 93 | ||
101 | /* | 94 | int auth_rhosts_rsa(struct passwd *, const char *, RSA *); |
102 | * Tries to authenticate the user using the .rhosts file and the host using | 95 | int auth_password(Authctxt *, const char *); |
103 | * its host key. Returns true if authentication succeeds. | 96 | int auth_rsa(struct passwd *, BIGNUM *); |
104 | */ | 97 | int auth_rsa_read_key(char **, u_int *, BIGNUM *, BIGNUM *); |
105 | int | 98 | int auth_rsa_challenge_dialog(RSA *); |
106 | auth_rhosts_rsa(struct passwd *, const char *, RSA *); | ||
107 | |||
108 | /* | ||
109 | * Tries to authenticate the user using password. Returns true if | ||
110 | * authentication succeeds. | ||
111 | */ | ||
112 | int auth_password(Authctxt *, const char *); | ||
113 | |||
114 | /* | ||
115 | * Performs the RSA authentication dialog with the client. This returns 0 if | ||
116 | * the client could not be authenticated, and 1 if authentication was | ||
117 | * successful. This may exit if there is a serious protocol violation. | ||
118 | */ | ||
119 | int auth_rsa(struct passwd *, BIGNUM *); | ||
120 | |||
121 | /* | ||
122 | * Parses an RSA key (number of bits, e, n) from a string. Moves the pointer | ||
123 | * over the key. Skips any whitespace at the beginning and at end. | ||
124 | */ | ||
125 | int auth_rsa_read_key(char **, u_int *, BIGNUM *, BIGNUM *); | ||
126 | |||
127 | /* | ||
128 | * Performs the RSA authentication challenge-response dialog with the client, | ||
129 | * and returns true (non-zero) if the client gave the correct answer to our | ||
130 | * challenge; returns zero if the client gives a wrong answer. | ||
131 | */ | ||
132 | int auth_rsa_challenge_dialog(RSA *); | ||
133 | 99 | ||
134 | #ifdef KRB4 | 100 | #ifdef KRB4 |
135 | #include <krb.h> | 101 | #include <krb.h> |
136 | /* | ||
137 | * Performs Kerberos v4 mutual authentication with the client. This returns 0 | ||
138 | * if the client could not be authenticated, and 1 if authentication was | ||
139 | * successful. This may exit if there is a serious protocol violation. | ||
140 | */ | ||
141 | int auth_krb4(Authctxt *, KTEXT, char **); | 102 | int auth_krb4(Authctxt *, KTEXT, char **); |
142 | int auth_krb4_password(Authctxt *, const char *); | 103 | int auth_krb4_password(Authctxt *, const char *); |
143 | void krb4_cleanup_proc(void *); | 104 | void krb4_cleanup_proc(void *); |
144 | 105 | ||
145 | #ifdef AFS | 106 | #ifdef AFS |
146 | #include <kafs.h> | 107 | #include <kafs.h> |
147 | |||
148 | /* Accept passed Kerberos v4 ticket-granting ticket and AFS tokens. */ | ||
149 | int auth_krb4_tgt(Authctxt *, const char *); | 108 | int auth_krb4_tgt(Authctxt *, const char *); |
150 | int auth_afs_token(Authctxt *, const char *); | 109 | int auth_afs_token(Authctxt *, const char *); |
151 | #endif /* AFS */ | 110 | #endif /* AFS */ |
152 | 111 | ||
153 | #endif /* KRB4 */ | 112 | #endif /* KRB4 */ |
154 | 113 | ||
155 | #ifdef KRB5 | 114 | #ifdef KRB5 |
156 | int auth_krb5(Authctxt *authctxt, krb5_data *auth, char **client); | 115 | int auth_krb5(Authctxt *authctxt, krb5_data *auth, char **client); |
@@ -179,16 +138,13 @@ int verify_response(Authctxt *, const char *); | |||
179 | 138 | ||
180 | struct passwd * auth_get_user(void); | 139 | struct passwd * auth_get_user(void); |
181 | 140 | ||
182 | /* expand a filename - return buffer is allocated by xmalloc */ | ||
183 | char *expand_filename(const char *, struct passwd *); | 141 | char *expand_filename(const char *, struct passwd *); |
184 | char *authorized_keys_file(struct passwd *); | 142 | char *authorized_keys_file(struct passwd *); |
185 | char *authorized_keys_file2(struct passwd *); | 143 | char *authorized_keys_file2(struct passwd *); |
186 | 144 | ||
187 | /* check a file and the path to it */ | ||
188 | int | 145 | int |
189 | secure_filename(FILE *, const char *, struct passwd *, char *, size_t); | 146 | secure_filename(FILE *, const char *, struct passwd *, char *, size_t); |
190 | 147 | ||
191 | /* helper for hostbased auth */ | ||
192 | HostStatus | 148 | HostStatus |
193 | check_key_in_hostfiles(struct passwd *, Key *, const char *, | 149 | check_key_in_hostfiles(struct passwd *, Key *, const char *, |
194 | const char *, const char *); | 150 | const char *, const char *); |
@@ -11,7 +11,7 @@ | |||
11 | * called by a name other than "ssh" or "Secure Shell". | 11 | * called by a name other than "ssh" or "Secure Shell". |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* RCSID("$OpenBSD: authfd.h,v 1.18 2001/06/26 06:32:47 itojun Exp $"); */ | 14 | /* RCSID("$OpenBSD: authfd.h,v 1.19 2001/06/26 17:27:22 markus Exp $"); */ |
15 | 15 | ||
16 | #ifndef AUTHFD_H | 16 | #ifndef AUTHFD_H |
17 | #define AUTHFD_H | 17 | #define AUTHFD_H |
@@ -43,96 +43,35 @@ | |||
43 | #define SSH_AGENTC_REMOVE_SMARTCARD_KEY 21 | 43 | #define SSH_AGENTC_REMOVE_SMARTCARD_KEY 21 |
44 | 44 | ||
45 | /* additional error code for ssh.com's ssh-agent2 */ | 45 | /* additional error code for ssh.com's ssh-agent2 */ |
46 | #define SSH_COM_AGENT2_FAILURE 102 | 46 | #define SSH_COM_AGENT2_FAILURE 102 |
47 | 47 | ||
48 | #define SSH_AGENT_OLD_SIGNATURE 0x01 | 48 | #define SSH_AGENT_OLD_SIGNATURE 0x01 |
49 | 49 | ||
50 | |||
51 | typedef struct { | 50 | typedef struct { |
52 | int fd; | 51 | int fd; |
53 | Buffer identities; | 52 | Buffer identities; |
54 | int howmany; | 53 | int howmany; |
55 | } AuthenticationConnection; | 54 | } AuthenticationConnection; |
56 | 55 | ||
57 | /* Returns the number of the authentication fd, or -1 if there is none. */ | 56 | int ssh_get_authentication_socket(void); |
58 | int ssh_get_authentication_socket(void); | 57 | void ssh_close_authentication_socket(int); |
59 | |||
60 | /* | ||
61 | * This should be called for any descriptor returned by | ||
62 | * ssh_get_authentication_socket(). Depending on the way the descriptor was | ||
63 | * obtained, this may close the descriptor. | ||
64 | */ | ||
65 | void ssh_close_authentication_socket(int); | ||
66 | 58 | ||
67 | /* | ||
68 | * Opens and connects a private socket for communication with the | ||
69 | * authentication agent. Returns NULL if an error occurred and the | ||
70 | * connection could not be opened. The connection should be closed by the | ||
71 | * caller by calling ssh_close_authentication_connection(). | ||
72 | */ | ||
73 | AuthenticationConnection *ssh_get_authentication_connection(void); | 59 | AuthenticationConnection *ssh_get_authentication_connection(void); |
74 | 60 | void ssh_close_authentication_connection(AuthenticationConnection *); | |
75 | /* | 61 | int ssh_get_num_identities(AuthenticationConnection *, int); |
76 | * Closes the connection to the authentication agent and frees any associated | ||
77 | * memory. | ||
78 | */ | ||
79 | void ssh_close_authentication_connection(AuthenticationConnection *); | ||
80 | |||
81 | /* | ||
82 | * Returns the number authentication identity held by the agent. | ||
83 | */ | ||
84 | int ssh_get_num_identities(AuthenticationConnection *, int); | ||
85 | |||
86 | /* | ||
87 | * Returns the first authentication identity held by the agent or NULL if | ||
88 | * no identies are available. Caller must free comment and key. | ||
89 | * Note that you cannot mix calls with different versions. | ||
90 | */ | ||
91 | Key *ssh_get_first_identity(AuthenticationConnection *, char **, int); | 62 | Key *ssh_get_first_identity(AuthenticationConnection *, char **, int); |
92 | |||
93 | /* | ||
94 | * Returns the next authentication identity for the agent. Other functions | ||
95 | * can be called between this and ssh_get_first_identity or two calls of this | ||
96 | * function. This returns NULL if there are no more identities. The caller | ||
97 | * must free key and comment after a successful return. | ||
98 | */ | ||
99 | Key *ssh_get_next_identity(AuthenticationConnection *, char **, int); | 63 | Key *ssh_get_next_identity(AuthenticationConnection *, char **, int); |
64 | int ssh_add_identity(AuthenticationConnection *, Key *, const char *); | ||
65 | int ssh_remove_identity(AuthenticationConnection *, Key *); | ||
66 | int ssh_remove_all_identities(AuthenticationConnection *, int); | ||
67 | int ssh_update_card(AuthenticationConnection *, int, int); | ||
100 | 68 | ||
101 | /* | ||
102 | * Requests the agent to decrypt the given challenge. Returns true if the | ||
103 | * agent claims it was able to decrypt it. | ||
104 | */ | ||
105 | int | 69 | int |
106 | ssh_decrypt_challenge(AuthenticationConnection *, Key *, BIGNUM *, u_char[16], | 70 | ssh_decrypt_challenge(AuthenticationConnection *, Key *, BIGNUM *, u_char[16], |
107 | u_int, u_char[16]); | 71 | u_int, u_char[16]); |
108 | 72 | ||
109 | /* Requests the agent to sign data using key */ | ||
110 | int | ||
111 | ssh_agent_sign(AuthenticationConnection *, Key *, u_char **, int *, | ||
112 | u_char *, int); | ||
113 | |||
114 | /* | ||
115 | * Adds an identity to the authentication server. This call is not meant to | ||
116 | * be used by normal applications. This returns true if the identity was | ||
117 | * successfully added. | ||
118 | */ | ||
119 | int | 73 | int |
120 | ssh_add_identity(AuthenticationConnection *, Key *, const char *); | 74 | ssh_agent_sign(AuthenticationConnection *, Key *, u_char **, int *, u_char *, |
121 | 75 | int); | |
122 | /* | ||
123 | * Removes the identity from the authentication server. This call is not | ||
124 | * meant to be used by normal applications. This returns true if the | ||
125 | * identity was successfully added. | ||
126 | */ | ||
127 | int ssh_remove_identity(AuthenticationConnection *, Key *); | ||
128 | |||
129 | /* | ||
130 | * Removes all identities from the authentication agent. This call is not | ||
131 | * meant to be used by normal applications. This returns true if the | ||
132 | * operation was successful. | ||
133 | */ | ||
134 | int ssh_remove_all_identities(AuthenticationConnection *, int); | ||
135 | |||
136 | int ssh_update_card(AuthenticationConnection *, int, int); | ||
137 | 76 | ||
138 | #endif /* AUTHFD_H */ | 77 | #endif /* AUTHFD_H */ |
diff --git a/authfile.h b/authfile.h index 982645d50..c8b31fbe6 100644 --- a/authfile.h +++ b/authfile.h | |||
@@ -10,24 +10,15 @@ | |||
10 | * called by a name other than "ssh" or "Secure Shell". | 10 | * called by a name other than "ssh" or "Secure Shell". |
11 | */ | 11 | */ |
12 | 12 | ||
13 | /* $OpenBSD: authfile.h,v 1.7 2001/06/26 06:32:48 itojun Exp $ */ | 13 | /* $OpenBSD: authfile.h,v 1.8 2001/06/26 17:27:22 markus Exp $ */ |
14 | 14 | ||
15 | #ifndef AUTHFILE_H | 15 | #ifndef AUTHFILE_H |
16 | #define AUTHFILE_H | 16 | #define AUTHFILE_H |
17 | 17 | ||
18 | int | 18 | int key_save_private(Key *, const char *, const char *, const char *); |
19 | key_save_private(Key *, const char *, const char *, const char *); | 19 | Key *key_load_public(const char *, char **); |
20 | 20 | Key *key_load_public_type(int, const char *, char **); | |
21 | Key * | 21 | Key *key_load_private(const char *, const char *, char **); |
22 | key_load_public(const char *, char **); | 22 | Key *key_load_private_type(int, const char *, const char *, char **); |
23 | |||
24 | Key * | ||
25 | key_load_public_type(int, const char *, char **); | ||
26 | |||
27 | Key * | ||
28 | key_load_private(const char *, const char *, char **); | ||
29 | |||
30 | Key * | ||
31 | key_load_private_type(int, const char *, const char *, char **); | ||
32 | 23 | ||
33 | #endif | 24 | #endif |
@@ -10,7 +10,7 @@ | |||
10 | * called by a name other than "ssh" or "Secure Shell". | 10 | * called by a name other than "ssh" or "Secure Shell". |
11 | */ | 11 | */ |
12 | 12 | ||
13 | /* RCSID("$OpenBSD: bufaux.h,v 1.12 2001/06/26 06:32:48 itojun Exp $"); */ | 13 | /* RCSID("$OpenBSD: bufaux.h,v 1.13 2001/06/26 17:27:22 markus Exp $"); */ |
14 | 14 | ||
15 | #ifndef BUFAUX_H | 15 | #ifndef BUFAUX_H |
16 | #define BUFAUX_H | 16 | #define BUFAUX_H |
@@ -18,46 +18,26 @@ | |||
18 | #include "buffer.h" | 18 | #include "buffer.h" |
19 | #include <openssl/bn.h> | 19 | #include <openssl/bn.h> |
20 | 20 | ||
21 | /* | ||
22 | * Stores an BIGNUM in the buffer with a 2-byte msb first bit count, followed | ||
23 | * by (bits+7)/8 bytes of binary data, msb first. | ||
24 | */ | ||
25 | void buffer_put_bignum(Buffer *, BIGNUM *); | 21 | void buffer_put_bignum(Buffer *, BIGNUM *); |
26 | void buffer_put_bignum2(Buffer *, BIGNUM *); | 22 | void buffer_put_bignum2(Buffer *, BIGNUM *); |
27 | 23 | ||
28 | /* Retrieves an BIGNUM from the buffer. */ | ||
29 | int buffer_get_bignum(Buffer *, BIGNUM *); | 24 | int buffer_get_bignum(Buffer *, BIGNUM *); |
30 | int buffer_get_bignum2(Buffer *, BIGNUM *); | 25 | int buffer_get_bignum2(Buffer *, BIGNUM *); |
31 | 26 | ||
32 | /* Returns an integer from the buffer (4 bytes, msb first). */ | ||
33 | u_int buffer_get_int(Buffer *); | 27 | u_int buffer_get_int(Buffer *); |
34 | #ifdef HAVE_U_INT64_T | ||
35 | u_int64_t buffer_get_int64(Buffer *); | ||
36 | #endif | ||
37 | |||
38 | /* Stores an integer in the buffer in 4 bytes, msb first. */ | ||
39 | void buffer_put_int(Buffer *, u_int); | 28 | void buffer_put_int(Buffer *, u_int); |
29 | |||
40 | #ifdef HAVE_U_INT64_T | 30 | #ifdef HAVE_U_INT64_T |
31 | u_int64_t buffer_get_int64(Buffer *); | ||
41 | void buffer_put_int64(Buffer *, u_int64_t); | 32 | void buffer_put_int64(Buffer *, u_int64_t); |
42 | #endif | 33 | #endif |
43 | 34 | ||
44 | /* Returns a character from the buffer (0 - 255). */ | ||
45 | int buffer_get_char(Buffer *); | 35 | int buffer_get_char(Buffer *); |
46 | 36 | ||
47 | /* Stores a character in the buffer. */ | ||
48 | void buffer_put_char(Buffer *, int); | 37 | void buffer_put_char(Buffer *, int); |
49 | 38 | ||
50 | /* | ||
51 | * Returns an arbitrary binary string from the buffer. The string cannot be | ||
52 | * longer than 256k. The returned value points to memory allocated with | ||
53 | * xmalloc; it is the responsibility of the calling function to free the | ||
54 | * data. If length_ptr is non-NULL, the length of the returned data will be | ||
55 | * stored there. A null character will be automatically appended to the | ||
56 | * returned string, and is not counted in length. | ||
57 | */ | ||
58 | char *buffer_get_string(Buffer *, u_int *); | 39 | char *buffer_get_string(Buffer *, u_int *); |
59 | 40 | ||
60 | /* Stores and arbitrary binary string in the buffer. */ | ||
61 | void buffer_put_string(Buffer *, const void *, u_int); | 41 | void buffer_put_string(Buffer *, const void *, u_int); |
62 | void buffer_put_cstring(Buffer *, const char *); | 42 | void buffer_put_cstring(Buffer *, const char *); |
63 | 43 | ||
@@ -11,56 +11,33 @@ | |||
11 | * called by a name other than "ssh" or "Secure Shell". | 11 | * called by a name other than "ssh" or "Secure Shell". |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* RCSID("$OpenBSD: buffer.h,v 1.8 2001/06/26 06:32:48 itojun Exp $"); */ | 14 | /* RCSID("$OpenBSD: buffer.h,v 1.9 2001/06/26 17:27:23 markus Exp $"); */ |
15 | 15 | ||
16 | #ifndef BUFFER_H | 16 | #ifndef BUFFER_H |
17 | #define BUFFER_H | 17 | #define BUFFER_H |
18 | 18 | ||
19 | typedef struct { | 19 | typedef struct { |
20 | char *buf; /* Buffer for data. */ | 20 | char *buf; /* Buffer for data. */ |
21 | u_int alloc; /* Number of bytes allocated for data. */ | 21 | u_int alloc; /* Number of bytes allocated for data. */ |
22 | u_int offset; /* Offset of first byte containing data. */ | 22 | u_int offset; /* Offset of first byte containing data. */ |
23 | u_int end; /* Offset of last byte containing data. */ | 23 | u_int end; /* Offset of last byte containing data. */ |
24 | } Buffer; | 24 | } Buffer; |
25 | /* Initializes the buffer structure. */ | ||
26 | void buffer_init(Buffer *); | ||
27 | 25 | ||
28 | /* Frees any memory used for the buffer. */ | 26 | void buffer_init(Buffer *); |
29 | void buffer_free(Buffer *); | 27 | void buffer_clear(Buffer *); |
28 | void buffer_free(Buffer *); | ||
30 | 29 | ||
31 | /* Clears any data from the buffer, making it empty. This does not actually | 30 | u_int buffer_len(Buffer *); |
32 | zero the memory. */ | 31 | char *buffer_ptr(Buffer *); |
33 | void buffer_clear(Buffer *); | ||
34 | 32 | ||
35 | /* Appends data to the buffer, expanding it if necessary. */ | 33 | void buffer_append(Buffer *, const char *, u_int); |
36 | void buffer_append(Buffer *, const char *, u_int); | 34 | void buffer_append_space(Buffer *, char **, u_int); |
37 | 35 | ||
38 | /* | 36 | void buffer_get(Buffer *, char *, u_int); |
39 | * Appends space to the buffer, expanding the buffer if necessary. This does | ||
40 | * not actually copy the data into the buffer, but instead returns a pointer | ||
41 | * to the allocated region. | ||
42 | */ | ||
43 | void buffer_append_space(Buffer *, char **, u_int); | ||
44 | |||
45 | /* Returns the number of bytes of data in the buffer. */ | ||
46 | u_int buffer_len(Buffer *); | ||
47 | |||
48 | /* Gets data from the beginning of the buffer. */ | ||
49 | void buffer_get(Buffer *, char *, u_int); | ||
50 | 37 | ||
51 | /* Consumes the given number of bytes from the beginning of the buffer. */ | 38 | void buffer_consume(Buffer *, u_int); |
52 | void buffer_consume(Buffer *, u_int); | 39 | void buffer_consume_end(Buffer *, u_int); |
53 | 40 | ||
54 | /* Consumes the given number of bytes from the end of the buffer. */ | 41 | void buffer_dump(Buffer *); |
55 | void buffer_consume_end(Buffer *, u_int); | ||
56 | |||
57 | /* Returns a pointer to the first used byte in the buffer. */ | ||
58 | char *buffer_ptr(Buffer *); | ||
59 | |||
60 | /* | ||
61 | * Dumps the contents of the buffer to stderr in hex. This intended for | ||
62 | * debugging purposes only. | ||
63 | */ | ||
64 | void buffer_dump(Buffer *); | ||
65 | 42 | ||
66 | #endif /* BUFFER_H */ | 43 | #endif /* BUFFER_H */ |
diff --git a/canohost.h b/canohost.h index 66e64d506..4347b488a 100644 --- a/canohost.h +++ b/canohost.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: canohost.h,v 1.7 2001/06/26 06:32:49 itojun Exp $ */ | 1 | /* $OpenBSD: canohost.h,v 1.8 2001/06/26 17:27:23 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -12,27 +12,14 @@ | |||
12 | * called by a name other than "ssh" or "Secure Shell". | 12 | * called by a name other than "ssh" or "Secure Shell". |
13 | */ | 13 | */ |
14 | 14 | ||
15 | /* | 15 | const char *get_canonical_hostname(int); |
16 | * Return the canonical name of the host in the other side of the current | 16 | const char *get_remote_ipaddr(void); |
17 | * connection (as returned by packet_get_connection). The host name is | 17 | const char *get_remote_name_or_ip(u_int, int); |
18 | * cached, so it is efficient to call this several times. | ||
19 | */ | ||
20 | const char *get_canonical_hostname(int); | ||
21 | |||
22 | /* | ||
23 | * Returns the IP-address of the remote host as a string. The returned | ||
24 | * string is cached and must not be freed. | ||
25 | */ | ||
26 | const char *get_remote_ipaddr(void); | ||
27 | |||
28 | const char *get_remote_name_or_ip(u_int, int); | ||
29 | 18 | ||
30 | /* Returns the ipaddr/port number of the peer of the socket. */ | 19 | char *get_peer_ipaddr(int); |
31 | char * get_peer_ipaddr(int); | 20 | int get_peer_port(int); |
32 | int get_peer_port(int); | 21 | char *get_local_ipaddr(int); |
33 | char * get_local_ipaddr(int); | 22 | char *get_local_name(int); |
34 | char * get_local_name(int); | ||
35 | 23 | ||
36 | /* Returns the port number of the remote/local host. */ | 24 | int get_remote_port(void); |
37 | int get_remote_port(void); | 25 | int get_local_port(void); |
38 | int get_local_port(void); | ||
diff --git a/channels.h b/channels.h index 3a114e070..98bba1aed 100644 --- a/channels.h +++ b/channels.h | |||
@@ -32,7 +32,7 @@ | |||
32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
33 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 33 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
34 | */ | 34 | */ |
35 | /* RCSID("$OpenBSD: channels.h,v 1.41 2001/06/26 06:32:49 itojun Exp $"); */ | 35 | /* RCSID("$OpenBSD: channels.h,v 1.42 2001/06/26 17:27:23 markus Exp $"); */ |
36 | 36 | ||
37 | #ifndef CHANNEL_H | 37 | #ifndef CHANNEL_H |
38 | #define CHANNEL_H | 38 | #define CHANNEL_H |
@@ -58,10 +58,6 @@ | |||
58 | 58 | ||
59 | #define SSH_CHANNEL_PATH_LEN 30 | 59 | #define SSH_CHANNEL_PATH_LEN 30 |
60 | 60 | ||
61 | /* | ||
62 | * Data structure for channel data. This is initialized in channel_new | ||
63 | * and cleared in channel_free. | ||
64 | */ | ||
65 | struct Channel; | 61 | struct Channel; |
66 | typedef struct Channel Channel; | 62 | typedef struct Channel Channel; |
67 | 63 | ||
@@ -139,87 +135,87 @@ struct Channel { | |||
139 | #define CHAN_CLOSE_SENT 0x01 | 135 | #define CHAN_CLOSE_SENT 0x01 |
140 | #define CHAN_CLOSE_RCVD 0x02 | 136 | #define CHAN_CLOSE_RCVD 0x02 |
141 | 137 | ||
142 | |||
143 | /* channel management */ | 138 | /* channel management */ |
144 | 139 | ||
145 | Channel *channel_lookup(int); | 140 | Channel *channel_lookup(int); |
146 | Channel *channel_new(char *, int, int, int, int, int, int, int, char *, int); | 141 | Channel *channel_new(char *, int, int, int, int, int, int, int, char *, int); |
147 | void channel_set_fds(int, int, int, int, int, int); | 142 | void channel_set_fds(int, int, int, int, int, int); |
148 | void channel_free(Channel *); | 143 | void channel_free(Channel *); |
149 | void channel_free_all(void); | 144 | void channel_free_all(void); |
150 | 145 | ||
151 | void channel_send_open(int); | 146 | void channel_send_open(int); |
152 | void channel_request(int, char *, int); | 147 | void channel_request(int, char *, int); |
153 | void channel_request_start(int, char *, int); | 148 | void channel_request_start(int, char *, int); |
154 | void channel_register_callback(int, int mtype, channel_callback_fn *, void *); | 149 | void channel_register_callback(int, int mtype, channel_callback_fn *, void *); |
155 | void channel_register_cleanup(int, channel_callback_fn *); | 150 | void channel_register_cleanup(int, channel_callback_fn *); |
156 | void channel_register_filter(int, channel_filter_fn *); | 151 | void channel_register_filter(int, channel_filter_fn *); |
157 | void channel_cancel_cleanup(int); | 152 | void channel_cancel_cleanup(int); |
158 | 153 | ||
159 | /* protocol handler */ | 154 | /* protocol handler */ |
160 | 155 | ||
161 | void channel_input_channel_request(int, int, void *); | 156 | void channel_input_channel_request(int, int, void *); |
162 | void channel_input_close(int, int, void *); | 157 | void channel_input_close(int, int, void *); |
163 | void channel_input_close_confirmation(int, int, void *); | 158 | void channel_input_close_confirmation(int, int, void *); |
164 | void channel_input_data(int, int, void *); | 159 | void channel_input_data(int, int, void *); |
165 | void channel_input_extended_data(int, int, void *); | 160 | void channel_input_extended_data(int, int, void *); |
166 | void channel_input_ieof(int, int, void *); | 161 | void channel_input_ieof(int, int, void *); |
167 | void channel_input_oclose(int, int, void *); | 162 | void channel_input_oclose(int, int, void *); |
168 | void channel_input_open_confirmation(int, int, void *); | 163 | void channel_input_open_confirmation(int, int, void *); |
169 | void channel_input_open_failure(int, int, void *); | 164 | void channel_input_open_failure(int, int, void *); |
170 | void channel_input_port_open(int, int, void *); | 165 | void channel_input_port_open(int, int, void *); |
171 | void channel_input_window_adjust(int, int, void *); | 166 | void channel_input_window_adjust(int, int, void *); |
172 | 167 | ||
173 | /* file descriptor handling (read/write) */ | 168 | /* file descriptor handling (read/write) */ |
174 | 169 | ||
175 | void | 170 | void channel_prepare_select(fd_set **, fd_set **, int *, int); |
176 | channel_prepare_select(fd_set **, fd_set **, int *, int); | 171 | void channel_after_select(fd_set *, fd_set *); |
177 | void channel_after_select(fd_set *, fd_set *); | 172 | void channel_output_poll(void); |
178 | void channel_output_poll(void); | ||
179 | 173 | ||
180 | int channel_not_very_much_buffered_data(void); | 174 | int channel_not_very_much_buffered_data(void); |
181 | void channel_close_all(void); | 175 | void channel_close_all(void); |
182 | void channel_free_all(void); | 176 | void channel_free_all(void); |
183 | int channel_still_open(void); | 177 | int channel_still_open(void); |
184 | char *channel_open_message(void); | 178 | char *channel_open_message(void); |
185 | int channel_find_open(void); | 179 | int channel_find_open(void); |
186 | 180 | ||
187 | /* channel_tcpfwd.c */ | 181 | /* channel_tcpfwd.c */ |
188 | int | 182 | void channel_permit_all_opens(void); |
189 | channel_request_local_forwarding(u_short, const char *, u_short, int); | 183 | void channel_add_permitted_opens(char *, int); |
184 | void channel_clear_permitted_opens(void); | ||
185 | void channel_input_port_forward_request(int, int); | ||
186 | int channel_connect_to(const char *, u_short); | ||
187 | int channel_connect_by_listen_adress(u_short); | ||
188 | void channel_request_remote_forwarding(u_short, const char *, u_short); | ||
189 | int channel_request_local_forwarding(u_short, const char *, u_short, int); | ||
190 | int | 190 | int |
191 | channel_request_forwarding(const char *, u_short, const char *, u_short, int, | 191 | channel_request_forwarding(const char *, u_short, const char *, u_short, int, |
192 | int); | 192 | int); |
193 | void | ||
194 | channel_request_remote_forwarding(u_short, const char *, u_short); | ||
195 | void channel_permit_all_opens(void); | ||
196 | void channel_add_permitted_opens(char *, int); | ||
197 | void channel_clear_permitted_opens(void); | ||
198 | void channel_input_port_forward_request(int, int); | ||
199 | int channel_connect_to(const char *, u_short); | ||
200 | int channel_connect_by_listen_adress(u_short); | ||
201 | 193 | ||
202 | /* x11 forwarding */ | 194 | /* x11 forwarding */ |
203 | 195 | ||
204 | int x11_connect_display(void); | 196 | int x11_connect_display(void); |
205 | char *x11_create_display(int); | 197 | char *x11_create_display(int); |
206 | char *x11_create_display_inet(int, int); | 198 | char *x11_create_display_inet(int, int); |
207 | void x11_input_open(int, int, void *); | 199 | void x11_input_open(int, int, void *); |
208 | void x11_request_forwarding(void); | 200 | void x11_request_forwarding(void); |
209 | void | 201 | void x11_request_forwarding_with_spoofing(int, const char *, const char *); |
210 | x11_request_forwarding_with_spoofing(int, const char *, const char *); | 202 | void deny_input_open(int, int, void *); |
211 | void deny_input_open(int, int, void *); | ||
212 | 203 | ||
213 | /* agent forwarding */ | 204 | /* agent forwarding */ |
214 | 205 | ||
215 | void auth_request_forwarding(void); | 206 | void auth_request_forwarding(void); |
216 | char *auth_get_socket_name(void); | 207 | char *auth_get_socket_name(void); |
217 | void auth_sock_cleanup_proc(void *); | 208 | void auth_sock_cleanup_proc(void *); |
218 | int auth_input_request_forwarding(struct passwd *); | 209 | int auth_input_request_forwarding(struct passwd *); |
219 | void auth_input_open_request(int, int, void *); | 210 | void auth_input_open_request(int, int, void *); |
220 | 211 | ||
221 | /* channel close */ | 212 | /* channel close */ |
222 | 213 | ||
214 | int chan_is_dead(Channel *); | ||
215 | void chan_mark_dead(Channel *); | ||
216 | void chan_init_iostates(Channel *); | ||
217 | void chan_init(void); | ||
218 | |||
223 | typedef void chan_event_fn(Channel *); | 219 | typedef void chan_event_fn(Channel *); |
224 | 220 | ||
225 | /* for the input state */ | 221 | /* for the input state */ |
@@ -232,9 +228,4 @@ extern chan_event_fn *chan_rcvd_ieof; | |||
232 | extern chan_event_fn *chan_write_failed; | 228 | extern chan_event_fn *chan_write_failed; |
233 | extern chan_event_fn *chan_obuf_empty; | 229 | extern chan_event_fn *chan_obuf_empty; |
234 | 230 | ||
235 | int chan_is_dead(Channel *); | ||
236 | void chan_mark_dead(Channel *); | ||
237 | void chan_init_iostates(Channel *); | ||
238 | void chan_init(void); | ||
239 | |||
240 | #endif | 231 | #endif |
@@ -32,7 +32,7 @@ | |||
32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | /* RCSID("$OpenBSD: cipher.h,v 1.27 2001/06/26 06:32:49 itojun Exp $"); */ | 35 | /* RCSID("$OpenBSD: cipher.h,v 1.28 2001/06/26 17:27:23 markus Exp $"); */ |
36 | 36 | ||
37 | #ifndef CIPHER_H | 37 | #ifndef CIPHER_H |
38 | #define CIPHER_H | 38 | #define CIPHER_H |
@@ -104,16 +104,16 @@ struct Cipher { | |||
104 | void (*decrypt)(CipherContext *, u_char *, const u_char *, u_int); | 104 | void (*decrypt)(CipherContext *, u_char *, const u_char *, u_int); |
105 | }; | 105 | }; |
106 | 106 | ||
107 | u_int cipher_mask_ssh1(int); | 107 | u_int cipher_mask_ssh1(int); |
108 | Cipher *cipher_by_name(const char *); | 108 | Cipher *cipher_by_name(const char *); |
109 | Cipher *cipher_by_number(int); | 109 | Cipher *cipher_by_number(int); |
110 | int cipher_number(const char *); | 110 | int cipher_number(const char *); |
111 | char *cipher_name(int); | 111 | char *cipher_name(int); |
112 | int ciphers_valid(const char *); | 112 | int ciphers_valid(const char *); |
113 | void cipher_init(CipherContext *, Cipher *, const u_char *, u_int, | 113 | void cipher_init(CipherContext *, Cipher *, const u_char *, u_int, |
114 | const u_char *, u_int); | 114 | const u_char *, u_int); |
115 | void cipher_encrypt(CipherContext *, u_char *, const u_char *, u_int); | 115 | void cipher_encrypt(CipherContext *, u_char *, const u_char *, u_int); |
116 | void cipher_decrypt(CipherContext *, u_char *, const u_char *, u_int); | 116 | void cipher_decrypt(CipherContext *, u_char *, const u_char *, u_int); |
117 | void cipher_set_key_string(CipherContext *, Cipher *, const char *); | 117 | void cipher_set_key_string(CipherContext *, Cipher *, const char *); |
118 | 118 | ||
119 | #endif /* CIPHER_H */ | 119 | #endif /* CIPHER_H */ |
diff --git a/clientloop.h b/clientloop.h index b7f48aa86..1bc9a9523 100644 --- a/clientloop.h +++ b/clientloop.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: clientloop.h,v 1.5 2001/06/26 06:32:50 itojun Exp $ */ | 1 | /* $OpenBSD: clientloop.h,v 1.6 2001/06/26 17:27:23 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -36,4 +36,4 @@ | |||
36 | */ | 36 | */ |
37 | 37 | ||
38 | /* Client side main loop for the interactive session. */ | 38 | /* Client side main loop for the interactive session. */ |
39 | int client_loop(int, int, int); | 39 | int client_loop(int, int, int); |
@@ -21,7 +21,7 @@ | |||
21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | /* RCSID("$OpenBSD: compat.h,v 1.27 2001/06/26 06:32:50 itojun Exp $"); */ | 24 | /* RCSID("$OpenBSD: compat.h,v 1.28 2001/06/26 17:27:23 markus Exp $"); */ |
25 | 25 | ||
26 | #ifndef COMPAT_H | 26 | #ifndef COMPAT_H |
27 | #define COMPAT_H | 27 | #define COMPAT_H |
@@ -51,11 +51,12 @@ | |||
51 | #define SSH_BUG_OPENFAILURE 0x00020000 | 51 | #define SSH_BUG_OPENFAILURE 0x00020000 |
52 | #define SSH_BUG_DERIVEKEY 0x00040000 | 52 | #define SSH_BUG_DERIVEKEY 0x00040000 |
53 | 53 | ||
54 | void enable_compat13(void); | 54 | void enable_compat13(void); |
55 | void enable_compat20(void); | 55 | void enable_compat20(void); |
56 | void compat_datafellows(const char *); | 56 | void compat_datafellows(const char *); |
57 | int proto_spec(const char *); | 57 | int proto_spec(const char *); |
58 | char *compat_cipher_proposal(char *); | 58 | char *compat_cipher_proposal(char *); |
59 | |||
59 | extern int compat13; | 60 | extern int compat13; |
60 | extern int compat20; | 61 | extern int compat20; |
61 | extern int datafellows; | 62 | extern int datafellows; |
diff --git a/compress.h b/compress.h index a9d06fc05..2721d450c 100644 --- a/compress.h +++ b/compress.h | |||
@@ -11,39 +11,15 @@ | |||
11 | * called by a name other than "ssh" or "Secure Shell". | 11 | * called by a name other than "ssh" or "Secure Shell". |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* RCSID("$OpenBSD: compress.h,v 1.9 2001/06/26 06:32:50 itojun Exp $"); */ | 14 | /* RCSID("$OpenBSD: compress.h,v 1.10 2001/06/26 17:27:23 markus Exp $"); */ |
15 | 15 | ||
16 | #ifndef COMPRESS_H | 16 | #ifndef COMPRESS_H |
17 | #define COMPRESS_H | 17 | #define COMPRESS_H |
18 | 18 | ||
19 | /* | 19 | void buffer_compress_init_send(int); |
20 | * Initializes compression; level is compression level from 1 to 9 (as in | 20 | void buffer_compress_init_recv(void); |
21 | * gzip). | 21 | void buffer_compress_uninit(void); |
22 | */ | 22 | void buffer_compress(Buffer *, Buffer *); |
23 | void buffer_compress_init_send(int); | 23 | void buffer_uncompress(Buffer *, Buffer *); |
24 | void buffer_compress_init_recv(void); | ||
25 | |||
26 | /* Frees any data structures allocated by buffer_compress_init. */ | ||
27 | void buffer_compress_uninit(void); | ||
28 | |||
29 | /* | ||
30 | * Compresses the contents of input_buffer into output_buffer. All packets | ||
31 | * compressed using this function will form a single compressed data stream; | ||
32 | * however, data will be flushed at the end of every call so that each | ||
33 | * output_buffer can be decompressed independently (but in the appropriate | ||
34 | * order since they together form a single compression stream) by the | ||
35 | * receiver. This appends the compressed data to the output buffer. | ||
36 | */ | ||
37 | void buffer_compress(Buffer *, Buffer *); | ||
38 | |||
39 | /* | ||
40 | * Uncompresses the contents of input_buffer into output_buffer. All packets | ||
41 | * uncompressed using this function will form a single compressed data | ||
42 | * stream; however, data will be flushed at the end of every call so that | ||
43 | * each output_buffer. This must be called for the same size units that the | ||
44 | * buffer_compress was called, and in the same order that buffers compressed | ||
45 | * with that. This appends the uncompressed data to the output buffer. | ||
46 | */ | ||
47 | void buffer_uncompress(Buffer *, Buffer *); | ||
48 | 24 | ||
49 | #endif /* COMPRESS_H */ | 25 | #endif /* COMPRESS_H */ |
@@ -11,15 +11,11 @@ | |||
11 | * called by a name other than "ssh" or "Secure Shell". | 11 | * called by a name other than "ssh" or "Secure Shell". |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* RCSID("$OpenBSD: crc32.h,v 1.11 2001/06/26 06:32:51 itojun Exp $"); */ | 14 | /* RCSID("$OpenBSD: crc32.h,v 1.12 2001/06/26 17:27:23 markus Exp $"); */ |
15 | 15 | ||
16 | #ifndef CRC32_H | 16 | #ifndef CRC32_H |
17 | #define CRC32_H | 17 | #define CRC32_H |
18 | 18 | ||
19 | /* | 19 | u_int ssh_crc32(const u_char *, u_int); |
20 | * This computes a 32 bit CRC of the data in the buffer, and returns the CRC. | ||
21 | * The polynomial used is 0xedb88320. | ||
22 | */ | ||
23 | u_int ssh_crc32(const u_char *, u_int); | ||
24 | 20 | ||
25 | #endif /* CRC32_H */ | 21 | #endif /* CRC32_H */ |
diff --git a/deattack.h b/deattack.h index 24d3957a6..ddccdea50 100644 --- a/deattack.h +++ b/deattack.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: deattack.h,v 1.6 2001/06/26 06:32:51 itojun Exp $ */ | 1 | /* $OpenBSD: deattack.h,v 1.7 2001/06/26 17:27:23 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Cryptographic attack detector for ssh - Header file | 4 | * Cryptographic attack detector for ssh - Header file |
@@ -26,5 +26,5 @@ | |||
26 | #define DEATTACK_OK 0 | 26 | #define DEATTACK_OK 0 |
27 | #define DEATTACK_DETECTED 1 | 27 | #define DEATTACK_DETECTED 1 |
28 | 28 | ||
29 | int detect_attack(u_char *, u_int32_t, u_char[8]); | 29 | int detect_attack(u_char *, u_int32_t, u_char[8]); |
30 | #endif | 30 | #endif |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dh.h,v 1.6 2001/06/26 06:32:52 itojun Exp $ */ | 1 | /* $OpenBSD: dh.h,v 1.7 2001/06/26 17:27:23 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Niels Provos. All rights reserved. | 4 | * Copyright (c) 2000 Niels Provos. All rights reserved. |
@@ -37,10 +37,10 @@ DH *dh_new_group_asc(const char *, const char *); | |||
37 | DH *dh_new_group(BIGNUM *, BIGNUM *); | 37 | DH *dh_new_group(BIGNUM *, BIGNUM *); |
38 | DH *dh_new_group1(void); | 38 | DH *dh_new_group1(void); |
39 | 39 | ||
40 | void dh_gen_key(DH *, int); | 40 | void dh_gen_key(DH *, int); |
41 | int dh_pub_is_valid(DH *, BIGNUM *); | 41 | int dh_pub_is_valid(DH *, BIGNUM *); |
42 | 42 | ||
43 | int dh_estimate(int); | 43 | int dh_estimate(int); |
44 | 44 | ||
45 | #define DH_GRP_MIN 1024 | 45 | #define DH_GRP_MIN 1024 |
46 | #define DH_GRP_MAX 8192 | 46 | #define DH_GRP_MAX 8192 |
diff --git a/dispatch.h b/dispatch.h index f796705a2..7b94032af 100644 --- a/dispatch.h +++ b/dispatch.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dispatch.h,v 1.5 2001/06/26 06:32:52 itojun Exp $ */ | 1 | /* $OpenBSD: dispatch.h,v 1.6 2001/06/26 17:27:23 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
@@ -30,7 +30,7 @@ enum { | |||
30 | 30 | ||
31 | typedef void dispatch_fn(int, int, void *); | 31 | typedef void dispatch_fn(int, int, void *); |
32 | 32 | ||
33 | void dispatch_init(dispatch_fn *); | 33 | void dispatch_init(dispatch_fn *); |
34 | void dispatch_set(int, dispatch_fn *); | 34 | void dispatch_set(int, dispatch_fn *); |
35 | void dispatch_run(int, int *, void *); | 35 | void dispatch_run(int, int *, void *); |
36 | void dispatch_protocol_error(int, int, void *); | 36 | void dispatch_protocol_error(int, int, void *); |
diff --git a/groupaccess.c b/groupaccess.c index ac9e00aca..cbfe72035 100644 --- a/groupaccess.c +++ b/groupaccess.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: groupaccess.c,v 1.3 2001/01/29 01:58:15 niklas Exp $ */ | 1 | /* $OpenBSD: groupaccess.c,v 1.4 2001/06/26 17:27:23 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001 Kevin Steves. All rights reserved. | 4 | * Copyright (c) 2001 Kevin Steves. All rights reserved. |
@@ -34,6 +34,10 @@ | |||
34 | static int ngroups; | 34 | static int ngroups; |
35 | static char *groups_byname[NGROUPS_MAX + 1]; /* +1 for base/primary group */ | 35 | static char *groups_byname[NGROUPS_MAX + 1]; /* +1 for base/primary group */ |
36 | 36 | ||
37 | /* | ||
38 | * Initialize group access list for user with primary (base) and | ||
39 | * supplementary groups. Return the number of groups in the list. | ||
40 | */ | ||
37 | int | 41 | int |
38 | ga_init(const char *user, gid_t base) | 42 | ga_init(const char *user, gid_t base) |
39 | { | 43 | { |
@@ -53,6 +57,10 @@ ga_init(const char *user, gid_t base) | |||
53 | return (ngroups = j); | 57 | return (ngroups = j); |
54 | } | 58 | } |
55 | 59 | ||
60 | /* | ||
61 | * Return 1 if one of user's groups is contained in groups. | ||
62 | * Return 0 otherwise. Use match_pattern() for string comparison. | ||
63 | */ | ||
56 | int | 64 | int |
57 | ga_match(char * const *groups, int n) | 65 | ga_match(char * const *groups, int n) |
58 | { | 66 | { |
@@ -65,6 +73,9 @@ ga_match(char * const *groups, int n) | |||
65 | return 0; | 73 | return 0; |
66 | } | 74 | } |
67 | 75 | ||
76 | /* | ||
77 | * Free memory allocated for group access list. | ||
78 | */ | ||
68 | void | 79 | void |
69 | ga_free(void) | 80 | ga_free(void) |
70 | { | 81 | { |
diff --git a/groupaccess.h b/groupaccess.h index 01e394f69..ede4805c2 100644 --- a/groupaccess.h +++ b/groupaccess.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: groupaccess.h,v 1.3 2001/06/26 06:32:52 itojun Exp $ */ | 1 | /* $OpenBSD: groupaccess.h,v 1.4 2001/06/26 17:27:23 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001 Kevin Steves. All rights reserved. | 4 | * Copyright (c) 2001 Kevin Steves. All rights reserved. |
@@ -29,21 +29,8 @@ | |||
29 | 29 | ||
30 | #include <grp.h> | 30 | #include <grp.h> |
31 | 31 | ||
32 | /* | 32 | int ga_init(const char *, gid_t); |
33 | * Initialize group access list for user with primary (base) and | 33 | int ga_match(char * const *, int); |
34 | * supplementary groups. Return the number of groups in the list. | 34 | void ga_free(void); |
35 | */ | ||
36 | int ga_init(const char *, gid_t); | ||
37 | |||
38 | /* | ||
39 | * Return 1 if one of user's groups is contained in groups. | ||
40 | * Return 0 otherwise. Use match_pattern() for string comparison. | ||
41 | */ | ||
42 | int ga_match(char * const *, int); | ||
43 | |||
44 | /* | ||
45 | * Free memory allocated for group access list. | ||
46 | */ | ||
47 | void ga_free(void); | ||
48 | 35 | ||
49 | #endif | 36 | #endif |
diff --git a/hostfile.h b/hostfile.h index b83b77008..05ef69174 100644 --- a/hostfile.h +++ b/hostfile.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: hostfile.h,v 1.8 2001/06/26 06:32:53 itojun Exp $ */ | 1 | /* $OpenBSD: hostfile.h,v 1.9 2001/06/26 17:27:23 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -14,26 +14,13 @@ | |||
14 | #ifndef HOSTFILE_H | 14 | #ifndef HOSTFILE_H |
15 | #define HOSTFILE_H | 15 | #define HOSTFILE_H |
16 | 16 | ||
17 | int | ||
18 | auth_rsa_read_key(char **, u_int *, BIGNUM *, BIGNUM *); | ||
19 | |||
20 | /* | ||
21 | * Checks whether the given host is already in the list of our known hosts. | ||
22 | * Returns HOST_OK if the host is known and has the specified key, HOST_NEW | ||
23 | * if the host is not known, and HOST_CHANGED if the host is known but used | ||
24 | * to have a different host key. The host must be in all lowercase. | ||
25 | */ | ||
26 | typedef enum { | 17 | typedef enum { |
27 | HOST_OK, HOST_NEW, HOST_CHANGED | 18 | HOST_OK, HOST_NEW, HOST_CHANGED |
28 | } HostStatus; | 19 | } HostStatus; |
29 | 20 | ||
30 | HostStatus | 21 | HostStatus |
31 | check_host_in_hostfile(const char *, const char *, Key *, Key *, int *); | 22 | check_host_in_hostfile(const char *, const char *, Key *, Key *, int *); |
32 | 23 | int add_host_to_hostfile(const char *, const char *, Key *); | |
33 | /* | 24 | int auth_rsa_read_key(char **, u_int *, BIGNUM *, BIGNUM *); |
34 | * Appends an entry to the host file. Returns false if the entry could not | ||
35 | * be appended. | ||
36 | */ | ||
37 | int add_host_to_hostfile(const char *, const char *, Key *); | ||
38 | 25 | ||
39 | #endif | 26 | #endif |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kex.h,v 1.25 2001/06/26 06:32:53 itojun Exp $ */ | 1 | /* $OpenBSD: kex.h,v 1.26 2001/06/26 17:27:23 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. |
@@ -112,14 +112,14 @@ struct Kex { | |||
112 | }; | 112 | }; |
113 | 113 | ||
114 | Kex *kex_setup(char *[PROPOSAL_MAX]); | 114 | Kex *kex_setup(char *[PROPOSAL_MAX]); |
115 | void kex_finish(Kex *); | 115 | void kex_finish(Kex *); |
116 | 116 | ||
117 | void kex_send_kexinit(Kex *); | 117 | void kex_send_kexinit(Kex *); |
118 | void kex_input_kexinit(int, int, void *); | 118 | void kex_input_kexinit(int, int, void *); |
119 | void kex_derive_keys(Kex *, u_char *, BIGNUM *); | 119 | void kex_derive_keys(Kex *, u_char *, BIGNUM *); |
120 | 120 | ||
121 | void kexdh(Kex *); | 121 | void kexdh(Kex *); |
122 | void kexgex(Kex *); | 122 | void kexgex(Kex *); |
123 | 123 | ||
124 | Newkeys *kex_get_newkeys(int); | 124 | Newkeys *kex_get_newkeys(int); |
125 | 125 | ||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: key.h,v 1.14 2001/06/26 06:32:54 itojun Exp $ */ | 1 | /* $OpenBSD: key.h,v 1.15 2001/06/26 17:27:23 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. |
@@ -52,25 +52,24 @@ struct Key { | |||
52 | 52 | ||
53 | Key *key_new(int); | 53 | Key *key_new(int); |
54 | Key *key_new_private(int); | 54 | Key *key_new_private(int); |
55 | void key_free(Key *); | 55 | void key_free(Key *); |
56 | int key_equal(Key *, Key *); | 56 | int key_equal(Key *, Key *); |
57 | char *key_fingerprint(Key *, enum fp_type, enum fp_rep); | 57 | char *key_fingerprint(Key *, enum fp_type, enum fp_rep); |
58 | char *key_type(Key *); | 58 | char *key_type(Key *); |
59 | int key_write(Key *, FILE *); | 59 | int key_write(Key *, FILE *); |
60 | int key_read(Key *, char **); | 60 | int key_read(Key *, char **); |
61 | u_int key_size(Key *); | 61 | u_int key_size(Key *); |
62 | 62 | ||
63 | Key *key_generate(int, u_int); | 63 | Key *key_generate(int, u_int); |
64 | Key *key_from_private(Key *); | 64 | Key *key_from_private(Key *); |
65 | int key_type_from_name(char *); | 65 | int key_type_from_name(char *); |
66 | 66 | ||
67 | Key *key_from_blob(char *, int); | 67 | Key *key_from_blob(char *, int); |
68 | int key_to_blob(Key *, u_char **, u_int *); | 68 | int key_to_blob(Key *, u_char **, u_int *); |
69 | char *key_ssh_name(Key *); | 69 | char *key_ssh_name(Key *); |
70 | int key_names_valid2(const char *); | 70 | int key_names_valid2(const char *); |
71 | 71 | ||
72 | int key_sign(Key *, u_char **, int *, u_char *, int); | 72 | int key_sign(Key *, u_char **, int *, u_char *, int); |
73 | 73 | int key_verify(Key *, u_char *, int, u_char *, int); | |
74 | int key_verify(Key *, u_char *, int, u_char *, int); | ||
75 | 74 | ||
76 | #endif | 75 | #endif |
@@ -34,7 +34,7 @@ | |||
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include "includes.h" | 36 | #include "includes.h" |
37 | RCSID("$OpenBSD: log.c,v 1.17 2001/03/04 17:42:28 millert Exp $"); | 37 | RCSID("$OpenBSD: log.c,v 1.18 2001/06/26 17:27:23 markus Exp $"); |
38 | 38 | ||
39 | #include "log.h" | 39 | #include "log.h" |
40 | #include "xmalloc.h" | 40 | #include "xmalloc.h" |
@@ -88,6 +88,8 @@ static struct { | |||
88 | { NULL, 0 } | 88 | { NULL, 0 } |
89 | }; | 89 | }; |
90 | 90 | ||
91 | static void do_log(LogLevel level, const char *fmt, va_list args); | ||
92 | |||
91 | SyslogFacility | 93 | SyslogFacility |
92 | log_facility_number(char *name) | 94 | log_facility_number(char *name) |
93 | { | 95 | { |
@@ -326,7 +328,7 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) | |||
326 | 328 | ||
327 | #define MSGBUFSIZ 1024 | 329 | #define MSGBUFSIZ 1024 |
328 | 330 | ||
329 | void | 331 | static void |
330 | do_log(LogLevel level, const char *fmt, va_list args) | 332 | do_log(LogLevel level, const char *fmt, va_list args) |
331 | { | 333 | { |
332 | char msgbuf[MSGBUFSIZ]; | 334 | char msgbuf[MSGBUFSIZ]; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: log.h,v 1.3 2001/06/26 06:32:55 itojun Exp $ */ | 1 | /* $OpenBSD: log.h,v 1.4 2001/06/26 17:27:24 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -45,36 +45,22 @@ typedef enum { | |||
45 | SYSLOG_LEVEL_DEBUG2, | 45 | SYSLOG_LEVEL_DEBUG2, |
46 | SYSLOG_LEVEL_DEBUG3 | 46 | SYSLOG_LEVEL_DEBUG3 |
47 | } LogLevel; | 47 | } LogLevel; |
48 | /* Initializes logging. */ | ||
49 | void log_init(char *, LogLevel, SyslogFacility, int); | ||
50 | 48 | ||
51 | /* Logging implementation, depending on server or client */ | 49 | void log_init(char *, LogLevel, SyslogFacility, int); |
52 | void do_log(LogLevel, const char *, va_list); | ||
53 | 50 | ||
54 | /* name to facility/level */ | 51 | SyslogFacility log_facility_number(char *); |
55 | SyslogFacility log_facility_number(char *); | ||
56 | LogLevel log_level_number(char *); | 52 | LogLevel log_level_number(char *); |
57 | 53 | ||
58 | /* Output a message to syslog or stderr */ | 54 | void fatal(const char *, ...) __attribute__((format(printf, 1, 2))); |
59 | void fatal(const char *, ...) __attribute__((format(printf, 1, 2))); | 55 | void error(const char *, ...) __attribute__((format(printf, 1, 2))); |
60 | void error(const char *, ...) __attribute__((format(printf, 1, 2))); | 56 | void log(const char *, ...) __attribute__((format(printf, 1, 2))); |
61 | void log(const char *, ...) __attribute__((format(printf, 1, 2))); | 57 | void verbose(const char *, ...) __attribute__((format(printf, 1, 2))); |
62 | void verbose(const char *, ...) __attribute__((format(printf, 1, 2))); | 58 | void debug(const char *, ...) __attribute__((format(printf, 1, 2))); |
63 | void debug(const char *, ...) __attribute__((format(printf, 1, 2))); | 59 | void debug2(const char *, ...) __attribute__((format(printf, 1, 2))); |
64 | void debug2(const char *, ...) __attribute__((format(printf, 1, 2))); | 60 | void debug3(const char *, ...) __attribute__((format(printf, 1, 2))); |
65 | void debug3(const char *, ...) __attribute__((format(printf, 1, 2))); | ||
66 | 61 | ||
67 | /* same as fatal() but w/o logging */ | 62 | void fatal_cleanup(void); |
68 | void fatal_cleanup(void); | 63 | void fatal_add_cleanup(void (*) (void *), void *); |
69 | 64 | void fatal_remove_cleanup(void (*) (void *), void *); | |
70 | /* | ||
71 | * Registers a cleanup function to be called by fatal()/fatal_cleanup() | ||
72 | * before exiting. It is permissible to call fatal_remove_cleanup for the | ||
73 | * function itself from the function. | ||
74 | */ | ||
75 | void fatal_add_cleanup(void (*) (void *), void *); | ||
76 | |||
77 | /* Removes a cleanup function to be called at fatal(). */ | ||
78 | void fatal_remove_cleanup(void (*) (void *), void *); | ||
79 | 65 | ||
80 | #endif | 66 | #endif |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: mac.h,v 1.2 2001/06/26 06:32:55 itojun Exp $ */ | 1 | /* $OpenBSD: mac.h,v 1.3 2001/06/26 17:27:24 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -23,6 +23,6 @@ | |||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | int mac_valid(const char *); | 26 | int mac_valid(const char *); |
27 | int mac_init(Mac *, char *); | 27 | int mac_init(Mac *, char *); |
28 | u_char *mac_compute(Mac *, u_int32_t, u_char *, int); | 28 | u_char *mac_compute(Mac *, u_int32_t, u_char *, int); |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: misc.c,v 1.11 2001/06/16 08:58:34 markus Exp $ */ | 1 | /* $OpenBSD: misc.c,v 1.12 2001/06/26 17:27:24 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
@@ -25,12 +25,13 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "includes.h" | 27 | #include "includes.h" |
28 | RCSID("$OpenBSD: misc.c,v 1.11 2001/06/16 08:58:34 markus Exp $"); | 28 | RCSID("$OpenBSD: misc.c,v 1.12 2001/06/26 17:27:24 markus Exp $"); |
29 | 29 | ||
30 | #include "misc.h" | 30 | #include "misc.h" |
31 | #include "log.h" | 31 | #include "log.h" |
32 | #include "xmalloc.h" | 32 | #include "xmalloc.h" |
33 | 33 | ||
34 | /* remove newline at end of string */ | ||
34 | char * | 35 | char * |
35 | chop(char *s) | 36 | chop(char *s) |
36 | { | 37 | { |
@@ -46,6 +47,7 @@ chop(char *s) | |||
46 | 47 | ||
47 | } | 48 | } |
48 | 49 | ||
50 | /* set/unset filedescriptor to non-blocking */ | ||
49 | void | 51 | void |
50 | set_nonblock(int fd) | 52 | set_nonblock(int fd) |
51 | { | 53 | { |
@@ -93,6 +95,7 @@ unset_nonblock(int fd) | |||
93 | /* Characters considered whitespace in strsep calls. */ | 95 | /* Characters considered whitespace in strsep calls. */ |
94 | #define WHITESPACE " \t\r\n" | 96 | #define WHITESPACE " \t\r\n" |
95 | 97 | ||
98 | /* return next token in configuration line */ | ||
96 | char * | 99 | char * |
97 | strdelim(char **s) | 100 | strdelim(char **s) |
98 | { | 101 | { |
@@ -145,7 +148,13 @@ pwcopy(struct passwd *pw) | |||
145 | return copy; | 148 | return copy; |
146 | } | 149 | } |
147 | 150 | ||
148 | int a2port(const char *s) | 151 | /* |
152 | * Convert ASCII string to TCP/IP port number. | ||
153 | * Port must be >0 and <=65535. | ||
154 | * Return 0 if invalid. | ||
155 | */ | ||
156 | int | ||
157 | a2port(const char *s) | ||
149 | { | 158 | { |
150 | long port; | 159 | long port; |
151 | char *endp; | 160 | char *endp; |
@@ -166,7 +175,29 @@ int a2port(const char *s) | |||
166 | #define DAYS (HOURS * 24) | 175 | #define DAYS (HOURS * 24) |
167 | #define WEEKS (DAYS * 7) | 176 | #define WEEKS (DAYS * 7) |
168 | 177 | ||
169 | long convtime(const char *s) | 178 | /* |
179 | * Convert a time string into seconds; format is | ||
180 | * a sequence of: | ||
181 | * time[qualifier] | ||
182 | * | ||
183 | * Valid time qualifiers are: | ||
184 | * <none> seconds | ||
185 | * s|S seconds | ||
186 | * m|M minutes | ||
187 | * h|H hours | ||
188 | * d|D days | ||
189 | * w|W weeks | ||
190 | * | ||
191 | * Examples: | ||
192 | * 90m 90 minutes | ||
193 | * 1h30m 90 minutes | ||
194 | * 2d 2 days | ||
195 | * 1w 1 week | ||
196 | * | ||
197 | * Return -1 if time string is invalid. | ||
198 | */ | ||
199 | long | ||
200 | convtime(const char *s) | ||
170 | { | 201 | { |
171 | long total, secs; | 202 | long total, secs; |
172 | const char *p; | 203 | const char *p; |
@@ -253,6 +284,7 @@ colon(char *cp) | |||
253 | return (0); | 284 | return (0); |
254 | } | 285 | } |
255 | 286 | ||
287 | /* function to assist building execv() arguments */ | ||
256 | void | 288 | void |
257 | addargs(arglist *args, char *fmt, ...) | 289 | addargs(arglist *args, char *fmt, ...) |
258 | { | 290 | { |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: misc.h,v 1.9 2001/06/26 06:32:56 itojun Exp $ */ | 1 | /* $OpenBSD: misc.h,v 1.10 2001/06/26 17:27:24 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -11,54 +11,16 @@ | |||
11 | * incompatible with the protocol description in the RFC file, it must be | 11 | * incompatible with the protocol description in the RFC file, it must be |
12 | * called by a name other than "ssh" or "Secure Shell". | 12 | * called by a name other than "ssh" or "Secure Shell". |
13 | */ | 13 | */ |
14 | /* remove newline at end of string */ | ||
15 | char *chop(char *); | ||
16 | 14 | ||
17 | /* return next token in configuration line */ | 15 | char *chop(char *); |
18 | char *strdelim(char **); | 16 | char *strdelim(char **); |
17 | void set_nonblock(int); | ||
18 | void unset_nonblock(int); | ||
19 | int a2port(const char *); | ||
20 | char *cleanhostname(char *); | ||
21 | char *colon(char *); | ||
22 | long convtime(const char *); | ||
19 | 23 | ||
20 | /* set/unset filedescriptor to non-blocking */ | ||
21 | void set_nonblock(int); | ||
22 | void unset_nonblock(int); | ||
23 | |||
24 | struct passwd * pwcopy(struct passwd *); | ||
25 | |||
26 | /* | ||
27 | * Convert ASCII string to TCP/IP port number. | ||
28 | * Port must be >0 and <=65535. | ||
29 | * Return 0 if invalid. | ||
30 | */ | ||
31 | int a2port(const char *); | ||
32 | |||
33 | /* code from scp.c/rcp.c */ | ||
34 | char *cleanhostname(char *); | ||
35 | char *colon(char *); | ||
36 | |||
37 | /* | ||
38 | * Convert a time string into seconds; format is | ||
39 | * a sequence of: | ||
40 | * time[qualifier] | ||
41 | * | ||
42 | * Valid time qualifiers are: | ||
43 | * <none> seconds | ||
44 | * s|S seconds | ||
45 | * m|M minutes | ||
46 | * h|H hours | ||
47 | * d|D days | ||
48 | * w|W weeks | ||
49 | * | ||
50 | * Examples: | ||
51 | * 90m 90 minutes | ||
52 | * 1h30m 90 minutes | ||
53 | * 2d 2 days | ||
54 | * 1w 1 week | ||
55 | * | ||
56 | * Return -1 if time string is invalid. | ||
57 | */ | ||
58 | |||
59 | long convtime(const char *); | ||
60 | |||
61 | /* function to assist building execv() arguments */ | ||
62 | typedef struct arglist arglist; | 24 | typedef struct arglist arglist; |
63 | struct arglist { | 25 | struct arglist { |
64 | char **list; | 26 | char **list; |
@@ -66,7 +28,7 @@ struct arglist { | |||
66 | int nalloc; | 28 | int nalloc; |
67 | }; | 29 | }; |
68 | 30 | ||
69 | void addargs(arglist *, char *, ...) __attribute__((format(printf, 2, 3))); | 31 | void addargs(arglist *, char *, ...) __attribute__((format(printf, 2, 3))); |
70 | 32 | ||
71 | /* wrapper for signal interface */ | 33 | /* wrapper for signal interface */ |
72 | typedef void (*mysig_t)(int); | 34 | typedef void (*mysig_t)(int); |
@@ -12,17 +12,11 @@ | |||
12 | * called by a name other than "ssh" or "Secure Shell". | 12 | * called by a name other than "ssh" or "Secure Shell". |
13 | */ | 13 | */ |
14 | 14 | ||
15 | /* RCSID("$OpenBSD: mpaux.h,v 1.10 2001/06/26 06:32:57 itojun Exp $"); */ | 15 | /* RCSID("$OpenBSD: mpaux.h,v 1.11 2001/06/26 17:27:24 markus Exp $"); */ |
16 | 16 | ||
17 | #ifndef MPAUX_H | 17 | #ifndef MPAUX_H |
18 | #define MPAUX_H | 18 | #define MPAUX_H |
19 | 19 | ||
20 | /* | 20 | void compute_session_id(u_char[16], u_char[8], BIGNUM *, BIGNUM *); |
21 | * Computes a 16-byte session id in the global variable session_id. The | ||
22 | * session id is computed by concatenating the linearized, msb first | ||
23 | * representations of host_key_n, session_key_n, and the cookie. | ||
24 | */ | ||
25 | void | ||
26 | compute_session_id(u_char[16], u_char[8], BIGNUM *, BIGNUM *); | ||
27 | 21 | ||
28 | #endif /* MPAUX_H */ | 22 | #endif /* MPAUX_H */ |
@@ -11,186 +11,75 @@ | |||
11 | * called by a name other than "ssh" or "Secure Shell". | 11 | * called by a name other than "ssh" or "Secure Shell". |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* RCSID("$OpenBSD: packet.h,v 1.24 2001/06/26 06:32:57 itojun Exp $"); */ | 14 | /* RCSID("$OpenBSD: packet.h,v 1.25 2001/06/26 17:27:24 markus Exp $"); */ |
15 | 15 | ||
16 | #ifndef PACKET_H | 16 | #ifndef PACKET_H |
17 | #define PACKET_H | 17 | #define PACKET_H |
18 | 18 | ||
19 | #include <openssl/bn.h> | 19 | #include <openssl/bn.h> |
20 | 20 | ||
21 | /* | 21 | void packet_set_connection(int, int); |
22 | * Sets the socket used for communication. Disables encryption until | 22 | void packet_set_nonblocking(void); |
23 | * packet_set_encryption_key is called. It is permissible that fd_in and | 23 | int packet_get_connection_in(void); |
24 | * fd_out are the same descriptor; in that case it is assumed to be a socket. | 24 | int packet_get_connection_out(void); |
25 | */ | 25 | void packet_close(void); |
26 | void packet_set_connection(int, int); | 26 | void packet_set_encryption_key(const u_char *, u_int, int); |
27 | 27 | void packet_set_protocol_flags(u_int); | |
28 | /* Puts the connection file descriptors into non-blocking mode. */ | 28 | u_int packet_get_protocol_flags(void); |
29 | void packet_set_nonblocking(void); | 29 | void packet_start_compression(int); |
30 | 30 | void packet_set_interactive(int); | |
31 | /* Returns the file descriptor used for input. */ | 31 | int packet_is_interactive(void); |
32 | int packet_get_connection_in(void); | 32 | |
33 | 33 | void packet_start(u_char); | |
34 | /* Returns the file descriptor used for output. */ | 34 | void packet_put_char(int ch); |
35 | int packet_get_connection_out(void); | 35 | void packet_put_int(u_int value); |
36 | 36 | void packet_put_bignum(BIGNUM * value); | |
37 | /* | 37 | void packet_put_bignum2(BIGNUM * value); |
38 | * Closes the connection (both descriptors) and clears and frees internal | 38 | void packet_put_string(const char *buf, u_int len); |
39 | * data structures. | 39 | void packet_put_cstring(const char *str); |
40 | */ | 40 | void packet_put_raw(const char *buf, u_int len); |
41 | void packet_close(void); | 41 | void packet_send(void); |
42 | 42 | ||
43 | /* | 43 | int packet_read(int *payload_len_ptr); |
44 | * Causes any further packets to be encrypted using the given key. The same | 44 | void packet_read_expect(int *payload_len_ptr, int type); |
45 | * key is used for both sending and reception. However, both directions are | 45 | int packet_read_poll(int *packet_len_ptr); |
46 | * encrypted independently of each other. Cipher types are defined in ssh.h. | 46 | void packet_process_incoming(const char *buf, u_int len); |
47 | */ | 47 | |
48 | void | 48 | u_int packet_get_char(void); |
49 | packet_set_encryption_key(const u_char *, u_int, int); | 49 | u_int packet_get_int(void); |
50 | 50 | void packet_get_bignum(BIGNUM * value, int *length_ptr); | |
51 | /* | 51 | void packet_get_bignum2(BIGNUM * value, int *length_ptr); |
52 | * Sets remote side protocol flags for the current connection. This can be | ||
53 | * called at any time. | ||
54 | */ | ||
55 | void packet_set_protocol_flags(u_int); | ||
56 | |||
57 | /* Returns the remote protocol flags set earlier by the above function. */ | ||
58 | u_int packet_get_protocol_flags(void); | ||
59 | |||
60 | /* Enables compression in both directions starting from the next packet. */ | ||
61 | void packet_start_compression(int); | ||
62 | |||
63 | /* | ||
64 | * Informs that the current session is interactive. Sets IP flags for | ||
65 | * optimal performance in interactive use. | ||
66 | */ | ||
67 | void packet_set_interactive(int); | ||
68 | |||
69 | /* Returns true if the current connection is interactive. */ | ||
70 | int packet_is_interactive(void); | ||
71 | |||
72 | /* Starts constructing a packet to send. */ | ||
73 | void packet_start(u_char); | ||
74 | |||
75 | /* Appends a character to the packet data. */ | ||
76 | void packet_put_char(int ch); | ||
77 | |||
78 | /* Appends an integer to the packet data. */ | ||
79 | void packet_put_int(u_int value); | ||
80 | |||
81 | /* Appends an arbitrary precision integer to packet data. */ | ||
82 | void packet_put_bignum(BIGNUM * value); | ||
83 | void packet_put_bignum2(BIGNUM * value); | ||
84 | |||
85 | /* Appends a string to packet data. */ | ||
86 | void packet_put_string(const char *buf, u_int len); | ||
87 | void packet_put_cstring(const char *str); | ||
88 | void packet_put_raw(const char *buf, u_int len); | ||
89 | |||
90 | /* | ||
91 | * Finalizes and sends the packet. If the encryption key has been set, | ||
92 | * encrypts the packet before sending. | ||
93 | */ | ||
94 | void packet_send(void); | ||
95 | |||
96 | /* Waits until a packet has been received, and returns its type. */ | ||
97 | int packet_read(int *payload_len_ptr); | ||
98 | |||
99 | /* | ||
100 | * Waits until a packet has been received, verifies that its type matches | ||
101 | * that given, and gives a fatal error and exits if there is a mismatch. | ||
102 | */ | ||
103 | void packet_read_expect(int *payload_len_ptr, int type); | ||
104 | |||
105 | /* | ||
106 | * Checks if a full packet is available in the data received so far via | ||
107 | * packet_process_incoming. If so, reads the packet; otherwise returns | ||
108 | * SSH_MSG_NONE. This does not wait for data from the connection. | ||
109 | * SSH_MSG_DISCONNECT is handled specially here. Also, SSH_MSG_IGNORE | ||
110 | * messages are skipped by this function and are never returned to higher | ||
111 | * levels. | ||
112 | */ | ||
113 | int packet_read_poll(int *packet_len_ptr); | ||
114 | |||
115 | /* | ||
116 | * Buffers the given amount of input characters. This is intended to be used | ||
117 | * together with packet_read_poll. | ||
118 | */ | ||
119 | void packet_process_incoming(const char *buf, u_int len); | ||
120 | |||
121 | /* Returns a character (0-255) from the packet data. */ | ||
122 | u_int packet_get_char(void); | ||
123 | |||
124 | /* Returns an integer from the packet data. */ | ||
125 | u_int packet_get_int(void); | ||
126 | |||
127 | /* | ||
128 | * Returns an arbitrary precision integer from the packet data. The integer | ||
129 | * must have been initialized before this call. | ||
130 | */ | ||
131 | void packet_get_bignum(BIGNUM * value, int *length_ptr); | ||
132 | void packet_get_bignum2(BIGNUM * value, int *length_ptr); | ||
133 | char *packet_get_raw(int *length_ptr); | 52 | char *packet_get_raw(int *length_ptr); |
53 | char *packet_get_string(u_int *length_ptr); | ||
54 | void packet_disconnect(const char *fmt,...) __attribute__((format(printf, 1, 2))); | ||
55 | void packet_send_debug(const char *fmt,...) __attribute__((format(printf, 1, 2))); | ||
134 | 56 | ||
135 | /* | 57 | void packet_write_poll(void); |
136 | * Returns a string from the packet data. The string is allocated using | 58 | void packet_write_wait(void); |
137 | * xmalloc; it is the responsibility of the calling program to free it when | 59 | int packet_have_data_to_write(void); |
138 | * no longer needed. The length_ptr argument may be NULL, or point to an | 60 | int packet_not_very_much_data_to_write(void); |
139 | * integer into which the length of the string is stored. | ||
140 | */ | ||
141 | char *packet_get_string(u_int *length_ptr); | ||
142 | |||
143 | /* | ||
144 | * Logs the error in syslog using LOG_INFO, constructs and sends a disconnect | ||
145 | * packet, closes the connection, and exits. This function never returns. | ||
146 | * The error message should not contain a newline. The total length of the | ||
147 | * message must not exceed 1024 bytes. | ||
148 | */ | ||
149 | void packet_disconnect(const char *fmt,...) __attribute__((format(printf, 1, 2))); | ||
150 | |||
151 | /* | ||
152 | * Sends a diagnostic message to the other side. This message can be sent at | ||
153 | * any time (but not while constructing another message). The message is | ||
154 | * printed immediately, but only if the client is being executed in verbose | ||
155 | * mode. These messages are primarily intended to ease debugging | ||
156 | * authentication problems. The total length of the message must not exceed | ||
157 | * 1024 bytes. This will automatically call packet_write_wait. If the | ||
158 | * remote side protocol flags do not indicate that it supports SSH_MSG_DEBUG, | ||
159 | * this will do nothing. | ||
160 | */ | ||
161 | void packet_send_debug(const char *fmt,...) __attribute__((format(printf, 1, 2))); | ||
162 | |||
163 | /* Checks if there is any buffered output, and tries to write some of the output. */ | ||
164 | void packet_write_poll(void); | ||
165 | |||
166 | /* Waits until all pending output data has been written. */ | ||
167 | void packet_write_wait(void); | ||
168 | 61 | ||
169 | /* Returns true if there is buffered data to write to the connection. */ | 62 | int packet_connection_is_on_socket(void); |
170 | int packet_have_data_to_write(void); | 63 | int packet_connection_is_ipv4(void); |
64 | int packet_remaining(void); | ||
65 | void packet_send_ignore(int); | ||
66 | void packet_inject_ignore(int); | ||
171 | 67 | ||
172 | /* Returns true if there is not too much data to write to the connection. */ | 68 | void tty_make_modes(int, struct termios *); |
173 | int packet_not_very_much_data_to_write(void); | 69 | void tty_parse_modes(int, int *); |
174 | 70 | ||
175 | /* maximum packet size, requested by client with SSH_CMSG_MAX_PACKET_SIZE */ | ||
176 | extern int max_packet_size; | 71 | extern int max_packet_size; |
177 | int packet_set_maxsize(int); | 72 | int packet_set_maxsize(int); |
178 | #define packet_get_maxsize() max_packet_size | 73 | #define packet_get_maxsize() max_packet_size |
179 | |||
180 | /* Stores tty modes from the fd or tiop into current packet. */ | ||
181 | void tty_make_modes(int, struct termios *); | ||
182 | |||
183 | /* Parses tty modes for the fd from the current packet. */ | ||
184 | void tty_parse_modes(int, int *); | ||
185 | 74 | ||
186 | #define packet_integrity_check(payload_len, expected_len, type) \ | 75 | #define packet_integrity_check(payload_len, expected_len, type) \ |
187 | do { \ | 76 | do { \ |
188 | int _p = (payload_len), _e = (expected_len); \ | 77 | int _p = (payload_len), _e = (expected_len); \ |
189 | if (_p != _e) { \ | 78 | if (_p != _e) { \ |
190 | log("Packet integrity error (%d != %d) at %s:%d", \ | 79 | log("Packet integrity error (%d != %d) at %s:%d", \ |
191 | _p, _e, __FILE__, __LINE__); \ | 80 | _p, _e, __FILE__, __LINE__); \ |
192 | packet_disconnect("Packet integrity error. (%d)", (type)); \ | 81 | packet_disconnect("Packet integrity error. (%d)", (type)); \ |
193 | } \ | 82 | } \ |
194 | } while (0) | 83 | } while (0) |
195 | 84 | ||
196 | #define packet_done() \ | 85 | #define packet_done() \ |
@@ -203,17 +92,4 @@ do { \ | |||
203 | } \ | 92 | } \ |
204 | } while (0) | 93 | } while (0) |
205 | 94 | ||
206 | /* remote host is connected via a socket/ipv4 */ | ||
207 | int packet_connection_is_on_socket(void); | ||
208 | int packet_connection_is_ipv4(void); | ||
209 | |||
210 | /* returns remaining payload bytes */ | ||
211 | int packet_remaining(void); | ||
212 | |||
213 | /* append an ignore message */ | ||
214 | void packet_send_ignore(int); | ||
215 | |||
216 | /* add an ignore message and make sure size (current+ignore) = n*sumlen */ | ||
217 | void packet_inject_ignore(int); | ||
218 | |||
219 | #endif /* PACKET_H */ | 95 | #endif /* PACKET_H */ |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: radix.h,v 1.3 2001/06/26 06:32:57 itojun Exp $ */ | 1 | /* $OpenBSD: radix.h,v 1.4 2001/06/26 17:27:24 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1999 Dug Song. All rights reserved. | 4 | * Copyright (c) 1999 Dug Song. All rights reserved. |
@@ -24,5 +24,5 @@ | |||
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | int creds_to_radix(CREDENTIALS *, u_char *, size_t); | 27 | int creds_to_radix(CREDENTIALS *, u_char *, size_t); |
28 | int radix_to_creds(const char *, CREDENTIALS *); | 28 | int radix_to_creds(const char *, CREDENTIALS *); |
diff --git a/readconf.h b/readconf.h index 2f784e6e2..f91dc3899 100644 --- a/readconf.h +++ b/readconf.h | |||
@@ -11,7 +11,7 @@ | |||
11 | * called by a name other than "ssh" or "Secure Shell". | 11 | * called by a name other than "ssh" or "Secure Shell". |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* RCSID("$OpenBSD: readconf.h,v 1.34 2001/06/26 16:15:24 dugsong Exp $"); */ | 14 | /* RCSID("$OpenBSD: readconf.h,v 1.35 2001/06/26 17:27:24 markus Exp $"); */ |
15 | 15 | ||
16 | #ifndef READCONF_H | 16 | #ifndef READCONF_H |
17 | #define READCONF_H | 17 | #define READCONF_H |
@@ -102,48 +102,14 @@ typedef struct { | |||
102 | } Options; | 102 | } Options; |
103 | 103 | ||
104 | 104 | ||
105 | /* | 105 | void initialize_options(Options *); |
106 | * Initializes options to special values that indicate that they have not yet | 106 | void fill_default_options(Options *); |
107 | * been set. Read_config_file will only set options with this value. Options | 107 | void read_config_file(const char *, const char *, Options *); |
108 | * are processed in the following order: command line, user config file, | ||
109 | * system config file. Last, fill_default_options is called. | ||
110 | */ | ||
111 | void initialize_options(Options *); | ||
112 | |||
113 | /* | ||
114 | * Called after processing other sources of option data, this fills those | ||
115 | * options for which no value has been specified with their default values. | ||
116 | */ | ||
117 | void fill_default_options(Options *); | ||
118 | 108 | ||
119 | /* | ||
120 | * Processes a single option line as used in the configuration files. This | ||
121 | * only sets those values that have not already been set. Returns 0 for legal | ||
122 | * options | ||
123 | */ | ||
124 | int | 109 | int |
125 | process_config_line(Options *, const char *, char *, const char *, int, int *); | 110 | process_config_line(Options *, const char *, char *, const char *, int, int *); |
126 | 111 | ||
127 | /* | 112 | void add_local_forward(Options *, u_short, const char *, u_short); |
128 | * Reads the config file and modifies the options accordingly. Options | 113 | void add_remote_forward(Options *, u_short, const char *, u_short); |
129 | * should already be initialized before this call. This never returns if | ||
130 | * there is an error. If the file does not exist, this returns immediately. | ||
131 | */ | ||
132 | void | ||
133 | read_config_file(const char *, const char *, Options *); | ||
134 | |||
135 | /* | ||
136 | * Adds a local TCP/IP port forward to options. Never returns if there is an | ||
137 | * error. | ||
138 | */ | ||
139 | void | ||
140 | add_local_forward(Options *, u_short, const char *, u_short); | ||
141 | |||
142 | /* | ||
143 | * Adds a remote TCP/IP port forward to options. Never returns if there is | ||
144 | * an error. | ||
145 | */ | ||
146 | void | ||
147 | add_remote_forward(Options *, u_short, const char *, u_short); | ||
148 | 114 | ||
149 | #endif /* READCONF_H */ | 115 | #endif /* READCONF_H */ |
diff --git a/readpass.h b/readpass.h index da362ab41..229973c68 100644 --- a/readpass.h +++ b/readpass.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: readpass.h,v 1.5 2001/06/26 06:32:58 itojun Exp $ */ | 1 | /* $OpenBSD: readpass.h,v 1.6 2001/06/26 17:27:24 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -14,4 +14,5 @@ | |||
14 | 14 | ||
15 | #define RP_ECHO 0x0001 | 15 | #define RP_ECHO 0x0001 |
16 | #define RP_ALLOW_STDIN 0x0002 | 16 | #define RP_ALLOW_STDIN 0x0002 |
17 | |||
17 | char *read_passphrase(const char *, int); | 18 | char *read_passphrase(const char *, int); |
@@ -11,7 +11,7 @@ | |||
11 | * called by a name other than "ssh" or "Secure Shell". | 11 | * called by a name other than "ssh" or "Secure Shell". |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* RCSID("$OpenBSD: rsa.h,v 1.12 2001/06/26 06:32:58 itojun Exp $"); */ | 14 | /* RCSID("$OpenBSD: rsa.h,v 1.13 2001/06/26 17:27:24 markus Exp $"); */ |
15 | 15 | ||
16 | #ifndef RSA_H | 16 | #ifndef RSA_H |
17 | #define RSA_H | 17 | #define RSA_H |
@@ -19,9 +19,8 @@ | |||
19 | #include <openssl/bn.h> | 19 | #include <openssl/bn.h> |
20 | #include <openssl/rsa.h> | 20 | #include <openssl/rsa.h> |
21 | 21 | ||
22 | void rsa_public_encrypt __P((BIGNUM *, BIGNUM *, RSA *)); | 22 | void rsa_public_encrypt(BIGNUM *, BIGNUM *, RSA *); |
23 | int rsa_private_decrypt __P((BIGNUM *, BIGNUM *, RSA *)); | 23 | int rsa_private_decrypt(BIGNUM *, BIGNUM *, RSA *); |
24 | 24 | void generate_additional_parameters(RSA *); | |
25 | void generate_additional_parameters __P((RSA *)); | ||
26 | 25 | ||
27 | #endif /* RSA_H */ | 26 | #endif /* RSA_H */ |
diff --git a/servconf.h b/servconf.h index 1b0220283..3552bb11a 100644 --- a/servconf.h +++ b/servconf.h | |||
@@ -11,7 +11,7 @@ | |||
11 | * called by a name other than "ssh" or "Secure Shell". | 11 | * called by a name other than "ssh" or "Secure Shell". |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* RCSID("$OpenBSD: servconf.h,v 1.46 2001/06/26 16:15:24 dugsong Exp $"); */ | 14 | /* RCSID("$OpenBSD: servconf.h,v 1.47 2001/06/26 17:27:24 markus Exp $"); */ |
15 | 15 | ||
16 | #ifndef SERVCONF_H | 16 | #ifndef SERVCONF_H |
17 | #define SERVCONF_H | 17 | #define SERVCONF_H |
@@ -130,19 +130,9 @@ typedef struct { | |||
130 | char *authorized_keys_file2; /* File containing public SSH2 keys */ | 130 | char *authorized_keys_file2; /* File containing public SSH2 keys */ |
131 | int pam_authentication_via_kbd_int; | 131 | int pam_authentication_via_kbd_int; |
132 | } ServerOptions; | 132 | } ServerOptions; |
133 | /* | ||
134 | * Initializes the server options to special values that indicate that they | ||
135 | * have not yet been set. | ||
136 | */ | ||
137 | void initialize_server_options(ServerOptions *); | ||
138 | |||
139 | /* | ||
140 | * Reads the server configuration file. This only sets the values for those | ||
141 | * options that have the special value indicating they have not been set. | ||
142 | */ | ||
143 | void read_server_config(ServerOptions *, const char *); | ||
144 | 133 | ||
145 | /* Sets values for those values that have not yet been set. */ | 134 | void initialize_server_options(ServerOptions *); |
146 | void fill_default_server_options(ServerOptions *); | 135 | void read_server_config(ServerOptions *, const char *); |
136 | void fill_default_server_options(ServerOptions *); | ||
147 | 137 | ||
148 | #endif /* SERVCONF_H */ | 138 | #endif /* SERVCONF_H */ |
diff --git a/serverloop.h b/serverloop.h index 9c2c2ccb9..9ea2b38d4 100644 --- a/serverloop.h +++ b/serverloop.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: serverloop.h,v 1.3 2001/06/26 06:33:00 itojun Exp $ */ | 1 | /* $OpenBSD: serverloop.h,v 1.4 2001/06/26 17:27:24 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -18,5 +18,10 @@ | |||
18 | * (of the child program), and reads from stdout and stderr (of the child | 18 | * (of the child program), and reads from stdout and stderr (of the child |
19 | * program). | 19 | * program). |
20 | */ | 20 | */ |
21 | #ifndef SERVERLOOP_H | ||
22 | #define SERVERLOOP_H | ||
23 | |||
21 | void server_loop(pid_t, int, int, int); | 24 | void server_loop(pid_t, int, int, int); |
22 | void server_loop2(void); | 25 | void server_loop2(void); |
26 | |||
27 | #endif | ||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: session.h,v 1.8 2001/06/26 06:33:01 itojun Exp $ */ | 1 | /* $OpenBSD: session.h,v 1.9 2001/06/26 17:27:24 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. |
@@ -26,11 +26,11 @@ | |||
26 | #ifndef SESSION_H | 26 | #ifndef SESSION_H |
27 | #define SESSION_H | 27 | #define SESSION_H |
28 | 28 | ||
29 | void do_authenticated(Authctxt *); | 29 | void do_authenticated(Authctxt *); |
30 | 30 | ||
31 | int session_open(int); | 31 | int session_open(int); |
32 | void session_input_channel_req(int, void *); | 32 | void session_input_channel_req(int, void *); |
33 | void session_close_by_pid(pid_t, int); | 33 | void session_close_by_pid(pid_t, int); |
34 | void session_close_by_channel(int, void *); | 34 | void session_close_by_channel(int, void *); |
35 | 35 | ||
36 | #endif | 36 | #endif |
diff --git a/sftp-common.c b/sftp-common.c index 3310eabab..aed95f2f0 100644 --- a/sftp-common.c +++ b/sftp-common.c | |||
@@ -24,7 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "includes.h" | 26 | #include "includes.h" |
27 | RCSID("$OpenBSD: sftp-common.c,v 1.2 2001/02/06 23:50:10 markus Exp $"); | 27 | RCSID("$OpenBSD: sftp-common.c,v 1.3 2001/06/26 17:27:24 markus Exp $"); |
28 | 28 | ||
29 | #include "buffer.h" | 29 | #include "buffer.h" |
30 | #include "bufaux.h" | 30 | #include "bufaux.h" |
@@ -35,6 +35,7 @@ RCSID("$OpenBSD: sftp-common.c,v 1.2 2001/02/06 23:50:10 markus Exp $"); | |||
35 | #include "sftp.h" | 35 | #include "sftp.h" |
36 | #include "sftp-common.h" | 36 | #include "sftp-common.h" |
37 | 37 | ||
38 | /* Clear contents of attributes structure */ | ||
38 | void | 39 | void |
39 | attrib_clear(Attrib *a) | 40 | attrib_clear(Attrib *a) |
40 | { | 41 | { |
@@ -47,6 +48,7 @@ attrib_clear(Attrib *a) | |||
47 | a->mtime = 0; | 48 | a->mtime = 0; |
48 | } | 49 | } |
49 | 50 | ||
51 | /* Convert from struct stat to filexfer attribs */ | ||
50 | void | 52 | void |
51 | stat_to_attrib(struct stat *st, Attrib *a) | 53 | stat_to_attrib(struct stat *st, Attrib *a) |
52 | { | 54 | { |
@@ -64,6 +66,7 @@ stat_to_attrib(struct stat *st, Attrib *a) | |||
64 | a->mtime = st->st_mtime; | 66 | a->mtime = st->st_mtime; |
65 | } | 67 | } |
66 | 68 | ||
69 | /* Decode attributes in buffer */ | ||
67 | Attrib * | 70 | Attrib * |
68 | decode_attrib(Buffer *b) | 71 | decode_attrib(Buffer *b) |
69 | { | 72 | { |
@@ -98,6 +101,7 @@ decode_attrib(Buffer *b) | |||
98 | return &a; | 101 | return &a; |
99 | } | 102 | } |
100 | 103 | ||
104 | /* Encode attributes to buffer */ | ||
101 | void | 105 | void |
102 | encode_attrib(Buffer *b, Attrib *a) | 106 | encode_attrib(Buffer *b, Attrib *a) |
103 | { | 107 | { |
@@ -116,6 +120,7 @@ encode_attrib(Buffer *b, Attrib *a) | |||
116 | } | 120 | } |
117 | } | 121 | } |
118 | 122 | ||
123 | /* Convert from SSH2_FX_ status to text error message */ | ||
119 | const char * | 124 | const char * |
120 | fx2txt(int status) | 125 | fx2txt(int status) |
121 | { | 126 | { |
@@ -143,4 +148,3 @@ fx2txt(int status) | |||
143 | }; | 148 | }; |
144 | /* NOTREACHED */ | 149 | /* NOTREACHED */ |
145 | } | 150 | } |
146 | |||
diff --git a/sftp-common.h b/sftp-common.h index 3e4f502b0..4c126bf10 100644 --- a/sftp-common.h +++ b/sftp-common.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp-common.h,v 1.2 2001/06/26 06:33:01 itojun Exp $ */ | 1 | /* $OpenBSD: sftp-common.h,v 1.3 2001/06/26 17:27:24 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
@@ -38,18 +38,9 @@ struct Attrib { | |||
38 | u_int32_t mtime; | 38 | u_int32_t mtime; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | /* Clear contents of attributes structure */ | 41 | void attrib_clear(Attrib *); |
42 | void attrib_clear(Attrib *); | 42 | void stat_to_attrib(struct stat *, Attrib *); |
43 | Attrib *decode_attrib(Buffer *); | ||
44 | void encode_attrib(Buffer *, Attrib *); | ||
43 | 45 | ||
44 | /* Convert from struct stat to filexfer attribs */ | ||
45 | void stat_to_attrib(struct stat *, Attrib *); | ||
46 | |||
47 | /* Decode attributes in buffer */ | ||
48 | Attrib *decode_attrib(Buffer *); | ||
49 | |||
50 | /* Encode attributes to buffer */ | ||
51 | void encode_attrib(Buffer *, Attrib *); | ||
52 | |||
53 | /* Convert from SSH2_FX_ status to text error message */ | ||
54 | const char *fx2txt(int); | 46 | const char *fx2txt(int); |
55 | |||
diff --git a/sftp-glob.h b/sftp-glob.h index 37bd5d2da..2885044ae 100644 --- a/sftp-glob.h +++ b/sftp-glob.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp-glob.h,v 1.4 2001/06/26 06:33:01 itojun Exp $ */ | 1 | /* $OpenBSD: sftp-glob.h,v 1.5 2001/06/26 17:27:24 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2001 Damien Miller. All rights reserved. |
@@ -28,4 +28,3 @@ | |||
28 | 28 | ||
29 | int | 29 | int |
30 | remote_glob(int, int, const char *, int, int (*)(const char *, int), glob_t *); | 30 | remote_glob(int, int, const char *, int, int (*)(const char *, int), glob_t *); |
31 | |||
diff --git a/sftp-int.h b/sftp-int.h index bbb138a6b..699e758b1 100644 --- a/sftp-int.h +++ b/sftp-int.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp-int.h,v 1.3 2001/06/26 06:33:02 itojun Exp $ */ | 1 | /* $OpenBSD: sftp-int.h,v 1.4 2001/06/26 17:27:25 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2001 Damien Miller. All rights reserved. |
@@ -24,4 +24,4 @@ | |||
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | void interactive_loop(int, int, char *, char *); | 27 | void interactive_loop(int, int, char *, char *); |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-dss.h,v 1.4 2001/06/26 06:33:02 itojun Exp $ */ | 1 | /* $OpenBSD: ssh-dss.h,v 1.5 2001/06/26 17:27:25 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
@@ -26,8 +26,7 @@ | |||
26 | #ifndef DSA_H | 26 | #ifndef DSA_H |
27 | #define DSA_H | 27 | #define DSA_H |
28 | 28 | ||
29 | int ssh_dss_sign(Key *, u_char **, int *, u_char *, int); | 29 | int ssh_dss_sign(Key *, u_char **, int *, u_char *, int); |
30 | 30 | int ssh_dss_verify(Key *, u_char *, int, u_char *, int); | |
31 | int ssh_dss_verify(Key *, u_char *, int, u_char *, int); | ||
32 | 31 | ||
33 | #endif | 32 | #endif |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-rsa.h,v 1.4 2001/06/26 06:33:03 itojun Exp $ */ | 1 | /* $OpenBSD: ssh-rsa.h,v 1.5 2001/06/26 17:27:25 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
@@ -26,8 +26,7 @@ | |||
26 | #ifndef SSH_RSA_H | 26 | #ifndef SSH_RSA_H |
27 | #define SSH_RSA_H | 27 | #define SSH_RSA_H |
28 | 28 | ||
29 | int ssh_rsa_sign(Key *, u_char **, int *, u_char *, int); | 29 | int ssh_rsa_sign(Key *, u_char **, int *, u_char *, int); |
30 | 30 | int ssh_rsa_verify(Key *, u_char *, int, u_char *, int); | |
31 | int ssh_rsa_verify(Key *, u_char *, int, u_char *, int); | ||
32 | 31 | ||
33 | #endif | 32 | #endif |
diff --git a/sshconnect.h b/sshconnect.h index c15ed4bc4..27ed2b745 100644 --- a/sshconnect.h +++ b/sshconnect.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect.h,v 1.11 2001/06/26 06:33:03 itojun Exp $ */ | 1 | /* $OpenBSD: sshconnect.h,v 1.12 2001/06/26 17:27:25 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
@@ -33,14 +33,14 @@ ssh_connect(const char *, struct sockaddr_storage *, u_short, int, | |||
33 | void | 33 | void |
34 | ssh_login(Key **, int, const char *, struct sockaddr *, struct passwd *); | 34 | ssh_login(Key **, int, const char *, struct sockaddr *, struct passwd *); |
35 | 35 | ||
36 | int verify_host_key(char *, struct sockaddr *, Key *); | 36 | int verify_host_key(char *, struct sockaddr *, Key *); |
37 | 37 | ||
38 | void ssh_kex(char *, struct sockaddr *); | 38 | void ssh_kex(char *, struct sockaddr *); |
39 | void ssh_kex2(char *, struct sockaddr *); | 39 | void ssh_kex2(char *, struct sockaddr *); |
40 | 40 | ||
41 | void ssh_userauth1(const char *, const char *, char *, Key **, int); | 41 | void ssh_userauth1(const char *, const char *, char *, Key **, int); |
42 | void ssh_userauth2(const char *, const char *, char *, Key **, int); | 42 | void ssh_userauth2(const char *, const char *, char *, Key **, int); |
43 | 43 | ||
44 | void ssh_put_password(char *); | 44 | void ssh_put_password(char *); |
45 | 45 | ||
46 | #endif | 46 | #endif |
diff --git a/sshlogin.h b/sshlogin.h index 05840c291..79d42a982 100644 --- a/sshlogin.h +++ b/sshlogin.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshlogin.h,v 1.2 2001/06/26 06:33:04 itojun Exp $ */ | 1 | /* $OpenBSD: sshlogin.h,v 1.3 2001/06/26 17:27:25 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -14,35 +14,10 @@ | |||
14 | #ifndef SSHLOGIN_H | 14 | #ifndef SSHLOGIN_H |
15 | #define SSHLOGIN_H | 15 | #define SSHLOGIN_H |
16 | 16 | ||
17 | /* | ||
18 | * Returns the time when the user last logged in. Returns 0 if the | ||
19 | * information is not available. This must be called before record_login. | ||
20 | * The host from which the user logged in is stored in buf. | ||
21 | */ | ||
22 | u_long | ||
23 | get_last_login_time(uid_t, const char *, char *, u_int); | ||
24 | |||
25 | /* | ||
26 | * Records that the user has logged in. This does many things normally done | ||
27 | * by login(1). | ||
28 | */ | ||
29 | void | 17 | void |
30 | record_login(pid_t, const char *, const char *, uid_t, const char *, | 18 | record_login(pid_t, const char *, const char *, uid_t, |
31 | struct sockaddr *); | 19 | const char *, struct sockaddr *); |
32 | 20 | void record_logout(pid_t, const char *); | |
33 | #ifdef LOGIN_NEEDS_UTMPX | 21 | u_long get_last_login_time(uid_t, const char *, char *, u_int); |
34 | /* | ||
35 | * Record just the utmp info for /bin/login. | ||
36 | */ | ||
37 | void | ||
38 | record_utmp_only(pid_t, const char *, const char *, const char *, | ||
39 | struct sockaddr *); | ||
40 | #endif | ||
41 | |||
42 | /* | ||
43 | * Records that the user has logged out. This does many thigs normally done | ||
44 | * by login(1) or init. | ||
45 | */ | ||
46 | void record_logout(pid_t, const char *); | ||
47 | 22 | ||
48 | #endif | 23 | #endif |
@@ -12,34 +12,15 @@ | |||
12 | * called by a name other than "ssh" or "Secure Shell". | 12 | * called by a name other than "ssh" or "Secure Shell". |
13 | */ | 13 | */ |
14 | 14 | ||
15 | /* RCSID("$OpenBSD: sshpty.h,v 1.2 2001/06/26 06:33:04 itojun Exp $"); */ | 15 | /* RCSID("$OpenBSD: sshpty.h,v 1.3 2001/06/26 17:27:25 markus Exp $"); */ |
16 | 16 | ||
17 | #ifndef SSHPTY_H | 17 | #ifndef SSHPTY_H |
18 | #define SSHPTY_H | 18 | #define SSHPTY_H |
19 | 19 | ||
20 | /* | 20 | int pty_allocate(int *, int *, char *, int); |
21 | * Allocates and opens a pty. Returns 0 if no pty could be allocated, or | 21 | void pty_release(const char *); |
22 | * nonzero if a pty was successfully allocated. On success, open file | 22 | void pty_make_controlling_tty(int *, const char *); |
23 | * descriptors for the pty and tty sides and the name of the tty side are | 23 | void pty_change_window_size(int, int, int, int, int); |
24 | * returned (the buffer must be able to hold at least 64 characters). | 24 | void pty_setowner(struct passwd *, const char *); |
25 | */ | ||
26 | int pty_allocate(int *, int *, char *, int); | ||
27 | |||
28 | /* | ||
29 | * Releases the tty. Its ownership is returned to root, and permissions to | ||
30 | * 0666. | ||
31 | */ | ||
32 | void pty_release(const char *); | ||
33 | |||
34 | /* | ||
35 | * Makes the tty the processes controlling tty and sets it to sane modes. | ||
36 | * This may need to reopen the tty to get rid of possible eavesdroppers. | ||
37 | */ | ||
38 | void pty_make_controlling_tty(int *, const char *); | ||
39 | |||
40 | /* Changes the window size associated with the pty. */ | ||
41 | void pty_change_window_size(int, int, int, int, int); | ||
42 | |||
43 | void pty_setowner(struct passwd *, const char *); | ||
44 | 25 | ||
45 | #endif /* SSHPTY_H */ | 26 | #endif /* SSHPTY_H */ |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshtty.h,v 1.1 2001/04/14 16:33:20 stevesk Exp $ */ | 1 | /* $OpenBSD: sshtty.h,v 1.2 2001/06/26 17:27:25 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -40,26 +40,9 @@ | |||
40 | 40 | ||
41 | #include <termios.h> | 41 | #include <termios.h> |
42 | 42 | ||
43 | /* | 43 | int in_raw_mode(void); |
44 | * Accessor function indicating whether we are in raw mode. Set by | ||
45 | * enter_raw_mode() and leave_raw_mode(). | ||
46 | */ | ||
47 | int in_raw_mode(void); | ||
48 | |||
49 | /* | ||
50 | * Return terminal modes, as saved by enter_raw_mode(). | ||
51 | */ | ||
52 | struct termios get_saved_tio(void); | 44 | struct termios get_saved_tio(void); |
53 | 45 | void leave_raw_mode(void); | |
54 | /* | 46 | void enter_raw_mode(void); |
55 | * Returns the user's terminal to normal mode if it had been | ||
56 | * put in raw mode. | ||
57 | */ | ||
58 | void leave_raw_mode(void); | ||
59 | |||
60 | /* | ||
61 | * Puts the user's terminal in raw mode. | ||
62 | */ | ||
63 | void enter_raw_mode(void); | ||
64 | 47 | ||
65 | #endif | 48 | #endif |
diff --git a/tildexpand.h b/tildexpand.h index a30f0db30..f5e7e40bc 100644 --- a/tildexpand.h +++ b/tildexpand.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tildexpand.h,v 1.3 2001/06/26 06:33:06 itojun Exp $ */ | 1 | /* $OpenBSD: tildexpand.h,v 1.4 2001/06/26 17:27:25 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -12,8 +12,4 @@ | |||
12 | * called by a name other than "ssh" or "Secure Shell". | 12 | * called by a name other than "ssh" or "Secure Shell". |
13 | */ | 13 | */ |
14 | 14 | ||
15 | /* | 15 | char *tilde_expand_filename(const char *, uid_t); |
16 | * Expands tildes in the file name. Returns data allocated by xmalloc. | ||
17 | * Warning: this calls getpw*. | ||
18 | */ | ||
19 | char *tilde_expand_filename(const char *, uid_t); | ||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: uidswap.h,v 1.8 2001/06/26 06:33:06 itojun Exp $ */ | 1 | /* $OpenBSD: uidswap.h,v 1.9 2001/06/26 17:27:25 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -15,22 +15,8 @@ | |||
15 | #ifndef UIDSWAP_H | 15 | #ifndef UIDSWAP_H |
16 | #define UIDSWAP_H | 16 | #define UIDSWAP_H |
17 | 17 | ||
18 | /* | 18 | void temporarily_use_uid(struct passwd *); |
19 | * Temporarily changes to the given uid. If the effective user id is not | 19 | void restore_uid(void); |
20 | * root, this does nothing. This call cannot be nested. | 20 | void permanently_set_uid(struct passwd *); |
21 | */ | ||
22 | void temporarily_use_uid(struct passwd *); | ||
23 | |||
24 | /* | ||
25 | * Restores the original effective user id after temporarily_use_uid(). | ||
26 | * This should only be called while temporarily_use_uid is effective. | ||
27 | */ | ||
28 | void restore_uid(void); | ||
29 | |||
30 | /* | ||
31 | * Permanently sets all uids to the given uid. This cannot be called while | ||
32 | * temporarily_use_uid is effective. This must also clear any saved uids. | ||
33 | */ | ||
34 | void permanently_set_uid(struct passwd *); | ||
35 | 21 | ||
36 | #endif /* UIDSWAP_H */ | 22 | #endif /* UIDSWAP_H */ |
diff --git a/uuencode.h b/uuencode.h index fd8f3dbda..0067635b6 100644 --- a/uuencode.h +++ b/uuencode.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: uuencode.h,v 1.7 2001/06/26 06:33:06 itojun Exp $ */ | 1 | /* $OpenBSD: uuencode.h,v 1.8 2001/06/26 17:27:25 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | #ifndef UUENCODE_H | 27 | #ifndef UUENCODE_H |
28 | #define UUENCODE_H | 28 | #define UUENCODE_H |
29 | int uuencode(u_char *, u_int, char *, size_t); | 29 | int uuencode(u_char *, u_int, char *, size_t); |
30 | int uudecode(const char *, u_char *, size_t); | 30 | int uudecode(const char *, u_char *, size_t); |
31 | void dump_base64(FILE *, u_char *, int); | 31 | void dump_base64(FILE *, u_char *, int); |
32 | #endif | 32 | #endif |
@@ -14,21 +14,14 @@ | |||
14 | * called by a name other than "ssh" or "Secure Shell". | 14 | * called by a name other than "ssh" or "Secure Shell". |
15 | */ | 15 | */ |
16 | 16 | ||
17 | /* RCSID("$OpenBSD: xmalloc.h,v 1.6 2001/06/26 06:33:07 itojun Exp $"); */ | 17 | /* RCSID("$OpenBSD: xmalloc.h,v 1.7 2001/06/26 17:27:25 markus Exp $"); */ |
18 | 18 | ||
19 | #ifndef XMALLOC_H | 19 | #ifndef XMALLOC_H |
20 | #define XMALLOC_H | 20 | #define XMALLOC_H |
21 | 21 | ||
22 | /* Like malloc, but calls fatal() if out of memory. */ | 22 | void *xmalloc(size_t); |
23 | void *xmalloc(size_t); | 23 | void *xrealloc(void *, size_t); |
24 | 24 | void xfree(void *); | |
25 | /* Like realloc, but calls fatal() if out of memory. */ | 25 | char *xstrdup(const char *); |
26 | void *xrealloc(void *, size_t); | ||
27 | |||
28 | /* Frees memory allocated using xmalloc or xrealloc. */ | ||
29 | void xfree(void *); | ||
30 | |||
31 | /* Allocates memory using xmalloc, and copies the string into that memory. */ | ||
32 | char *xstrdup(const char *); | ||
33 | 26 | ||
34 | #endif /* XMALLOC_H */ | 27 | #endif /* XMALLOC_H */ |