summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--scard.c4
-rw-r--r--ssh-dss.c14
-rw-r--r--ssh-rsa.c24
-rw-r--r--sshconnect.c5
-rw-r--r--sshconnect2.c13
-rw-r--r--sshd.c6
-rw-r--r--sshlogin.c9
-rw-r--r--sshpty.c6
9 files changed, 42 insertions, 45 deletions
diff --git a/ChangeLog b/ChangeLog
index bf795be27..e39eeba6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,10 @@
6 - deraadt@cvs.openbsd.org 2002/06/23 03:26:19 6 - deraadt@cvs.openbsd.org 2002/06/23 03:26:19
7 [cipher.c key.c] 7 [cipher.c key.c]
8 KNF 8 KNF
9 - deraadt@cvs.openbsd.org 2002/06/23 03:30:58
10 [scard.c ssh-dss.c ssh-rsa.c sshconnect.c sshconnect2.c sshd.c sshlogin.c
11 sshpty.c]
12 various KNF and %d for unsigned
9 13
1020020623 1420020623
11 - (stevesk) [configure.ac] bug #255 LOGIN_NEEDS_UTMPX for AIX. 15 - (stevesk) [configure.ac] bug #255 LOGIN_NEEDS_UTMPX for AIX.
@@ -1050,4 +1054,4 @@
1050 - (stevesk) entropy.c: typo in debug message 1054 - (stevesk) entropy.c: typo in debug message
1051 - (djm) ssh-keygen -i needs seeded RNG; report from markus@ 1055 - (djm) ssh-keygen -i needs seeded RNG; report from markus@
1052 1056
1053$Id: ChangeLog,v 1.2255 2002/06/23 21:21:30 mouring Exp $ 1057$Id: ChangeLog,v 1.2256 2002/06/23 21:23:20 mouring Exp $
diff --git a/scard.c b/scard.c
index db0cc4a80..9791938c0 100644
--- a/scard.c
+++ b/scard.c
@@ -24,7 +24,7 @@
24 24
25#include "includes.h" 25#include "includes.h"
26#if defined(SMARTCARD) && defined(USE_SECTOK) 26#if defined(SMARTCARD) && defined(USE_SECTOK)
27RCSID("$OpenBSD: scard.c,v 1.25 2002/03/26 18:46:59 rees Exp $"); 27RCSID("$OpenBSD: scard.c,v 1.26 2002/06/23 03:30:17 deraadt Exp $");
28 28
29#include <openssl/evp.h> 29#include <openssl/evp.h>
30#include <sectok.h> 30#include <sectok.h>
@@ -191,7 +191,7 @@ sc_read_pubkey(Key * k)
191 191
192 status = 0; 192 status = 0;
193 p = key_fingerprint(k, SSH_FP_MD5, SSH_FP_HEX); 193 p = key_fingerprint(k, SSH_FP_MD5, SSH_FP_HEX);
194 debug("fingerprint %d %s", key_size(k), p); 194 debug("fingerprint %u %s", key_size(k), p);
195 xfree(p); 195 xfree(p);
196 196
197err: 197err:
diff --git a/ssh-dss.c b/ssh-dss.c
index 02403f550..dbf8465ba 100644
--- a/ssh-dss.c
+++ b/ssh-dss.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: ssh-dss.c,v 1.14 2002/02/28 15:46:33 markus Exp $"); 26RCSID("$OpenBSD: ssh-dss.c,v 1.15 2002/06/23 03:30:17 deraadt Exp $");
27 27
28#include <openssl/bn.h> 28#include <openssl/bn.h>
29#include <openssl/evp.h> 29#include <openssl/evp.h>
@@ -40,9 +40,7 @@ RCSID("$OpenBSD: ssh-dss.c,v 1.14 2002/02/28 15:46:33 markus Exp $");
40#define SIGBLOB_LEN (2*INTBLOB_LEN) 40#define SIGBLOB_LEN (2*INTBLOB_LEN)
41 41
42int 42int
43ssh_dss_sign( 43ssh_dss_sign(Key *key, u_char **sigp, u_int *lenp,
44 Key *key,
45 u_char **sigp, u_int *lenp,
46 u_char *data, u_int datalen) 44 u_char *data, u_int datalen)
47{ 45{
48 DSA_SIG *sig; 46 DSA_SIG *sig;
@@ -71,7 +69,7 @@ ssh_dss_sign(
71 rlen = BN_num_bytes(sig->r); 69 rlen = BN_num_bytes(sig->r);
72 slen = BN_num_bytes(sig->s); 70 slen = BN_num_bytes(sig->s);
73 if (rlen > INTBLOB_LEN || slen > INTBLOB_LEN) { 71 if (rlen > INTBLOB_LEN || slen > INTBLOB_LEN) {
74 error("bad sig size %d %d", rlen, slen); 72 error("bad sig size %u %u", rlen, slen);
75 DSA_SIG_free(sig); 73 DSA_SIG_free(sig);
76 return -1; 74 return -1;
77 } 75 }
@@ -104,9 +102,7 @@ ssh_dss_sign(
104 return 0; 102 return 0;
105} 103}
106int 104int
107ssh_dss_verify( 105ssh_dss_verify(Key *key, u_char *signature, u_int signaturelen,
108 Key *key,
109 u_char *signature, u_int signaturelen,
110 u_char *data, u_int datalen) 106 u_char *data, u_int datalen)
111{ 107{
112 DSA_SIG *sig; 108 DSA_SIG *sig;
@@ -151,7 +147,7 @@ ssh_dss_verify(
151 } 147 }
152 148
153 if (len != SIGBLOB_LEN) { 149 if (len != SIGBLOB_LEN) {
154 fatal("bad sigbloblen %d != SIGBLOB_LEN", len); 150 fatal("bad sigbloblen %u != SIGBLOB_LEN", len);
155 } 151 }
156 152
157 /* parse signature */ 153 /* parse signature */
diff --git a/ssh-rsa.c b/ssh-rsa.c
index 3e66294e9..782279bad 100644
--- a/ssh-rsa.c
+++ b/ssh-rsa.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: ssh-rsa.c,v 1.20 2002/06/10 16:53:06 stevesk Exp $"); 26RCSID("$OpenBSD: ssh-rsa.c,v 1.21 2002/06/23 03:30:17 deraadt Exp $");
27 27
28#include <openssl/evp.h> 28#include <openssl/evp.h>
29#include <openssl/err.h> 29#include <openssl/err.h>
@@ -39,9 +39,7 @@ RCSID("$OpenBSD: ssh-rsa.c,v 1.20 2002/06/10 16:53:06 stevesk Exp $");
39 39
40/* RSASSA-PKCS1-v1_5 (PKCS #1 v2.0 signature) with SHA1 */ 40/* RSASSA-PKCS1-v1_5 (PKCS #1 v2.0 signature) with SHA1 */
41int 41int
42ssh_rsa_sign( 42ssh_rsa_sign(Key *key, u_char **sigp, u_int *lenp,
43 Key *key,
44 u_char **sigp, u_int *lenp,
45 u_char *data, u_int datalen) 43 u_char *data, u_int datalen)
46{ 44{
47 const EVP_MD *evp_md; 45 const EVP_MD *evp_md;
@@ -72,17 +70,18 @@ ssh_rsa_sign(
72 70
73 if (ok != 1) { 71 if (ok != 1) {
74 int ecode = ERR_get_error(); 72 int ecode = ERR_get_error();
75 error("ssh_rsa_sign: RSA_sign failed: %s", ERR_error_string(ecode, NULL)); 73 error("ssh_rsa_sign: RSA_sign failed: %s",
74 ERR_error_string(ecode, NULL));
76 xfree(sig); 75 xfree(sig);
77 return -1; 76 return -1;
78 } 77 }
79 if (len < slen) { 78 if (len < slen) {
80 int diff = slen - len; 79 int diff = slen - len;
81 debug("slen %d > len %d", slen, len); 80 debug("slen %u > len %u", slen, len);
82 memmove(sig + diff, sig, len); 81 memmove(sig + diff, sig, len);
83 memset(sig, 0, diff); 82 memset(sig, 0, diff);
84 } else if (len > slen) { 83 } else if (len > slen) {
85 error("ssh_rsa_sign: slen %d slen2 %d", slen, len); 84 error("ssh_rsa_sign: slen %u slen2 %u", slen, len);
86 xfree(sig); 85 xfree(sig);
87 return -1; 86 return -1;
88 } 87 }
@@ -105,9 +104,7 @@ ssh_rsa_sign(
105} 104}
106 105
107int 106int
108ssh_rsa_verify( 107ssh_rsa_verify(Key *key, u_char *signature, u_int signaturelen,
109 Key *key,
110 u_char *signature, u_int signaturelen,
111 u_char *data, u_int datalen) 108 u_char *data, u_int datalen)
112{ 109{
113 Buffer b; 110 Buffer b;
@@ -148,12 +145,12 @@ ssh_rsa_verify(
148 /* RSA_verify expects a signature of RSA_size */ 145 /* RSA_verify expects a signature of RSA_size */
149 modlen = RSA_size(key->rsa); 146 modlen = RSA_size(key->rsa);
150 if (len > modlen) { 147 if (len > modlen) {
151 error("ssh_rsa_verify: len %d > modlen %d", len, modlen); 148 error("ssh_rsa_verify: len %u > modlen %u", len, modlen);
152 xfree(sigblob); 149 xfree(sigblob);
153 return -1; 150 return -1;
154 } else if (len < modlen) { 151 } else if (len < modlen) {
155 int diff = modlen - len; 152 int diff = modlen - len;
156 debug("ssh_rsa_verify: add padding: modlen %d > len %d", 153 debug("ssh_rsa_verify: add padding: modlen %u > len %u",
157 modlen, len); 154 modlen, len);
158 sigblob = xrealloc(sigblob, modlen); 155 sigblob = xrealloc(sigblob, modlen);
159 memmove(sigblob + diff, sigblob, len); 156 memmove(sigblob + diff, sigblob, len);
@@ -176,7 +173,8 @@ ssh_rsa_verify(
176 xfree(sigblob); 173 xfree(sigblob);
177 if (ret == 0) { 174 if (ret == 0) {
178 int ecode = ERR_get_error(); 175 int ecode = ERR_get_error();
179 error("ssh_rsa_verify: RSA_verify failed: %s", ERR_error_string(ecode, NULL)); 176 error("ssh_rsa_verify: RSA_verify failed: %s",
177 ERR_error_string(ecode, NULL));
180 } 178 }
181 debug("ssh_rsa_verify: signature %scorrect", (ret==0) ? "in" : ""); 179 debug("ssh_rsa_verify: signature %scorrect", (ret==0) ? "in" : "");
182 return ret; 180 return ret;
diff --git a/sshconnect.c b/sshconnect.c
index 9b4c38835..b89321fb8 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: sshconnect.c,v 1.125 2002/06/19 00:27:55 deraadt Exp $"); 16RCSID("$OpenBSD: sshconnect.c,v 1.126 2002/06/23 03:30:17 deraadt Exp $");
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19 19
@@ -266,7 +266,7 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr,
266 memset(&hints, 0, sizeof(hints)); 266 memset(&hints, 0, sizeof(hints));
267 hints.ai_family = family; 267 hints.ai_family = family;
268 hints.ai_socktype = SOCK_STREAM; 268 hints.ai_socktype = SOCK_STREAM;
269 snprintf(strport, sizeof strport, "%d", port); 269 snprintf(strport, sizeof strport, "%u", port);
270 if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) 270 if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0)
271 fatal("%s: %.100s: %s", __progname, host, 271 fatal("%s: %.100s: %s", __progname, host,
272 gai_strerror(gaierr)); 272 gai_strerror(gaierr));
@@ -489,7 +489,6 @@ confirm(const char *prompt)
489 * check whether the supplied host key is valid, return -1 if the key 489 * check whether the supplied host key is valid, return -1 if the key
490 * is not valid. the user_hostfile will not be updated if 'readonly' is true. 490 * is not valid. the user_hostfile will not be updated if 'readonly' is true.
491 */ 491 */
492
493static int 492static int
494check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, 493check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key,
495 int readonly, const char *user_hostfile, const char *system_hostfile) 494 int readonly, const char *user_hostfile, const char *system_hostfile)
diff --git a/sshconnect2.c b/sshconnect2.c
index 7f28ab51e..215f76ca2 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: sshconnect2.c,v 1.104 2002/06/19 00:27:55 deraadt Exp $"); 26RCSID("$OpenBSD: sshconnect2.c,v 1.105 2002/06/23 03:30:17 deraadt Exp $");
27 27
28#include "ssh.h" 28#include "ssh.h"
29#include "ssh2.h" 29#include "ssh2.h"
@@ -299,12 +299,14 @@ userauth(Authctxt *authctxt, char *authlist)
299 } 299 }
300 } 300 }
301} 301}
302
302void 303void
303input_userauth_error(int type, u_int32_t seq, void *ctxt) 304input_userauth_error(int type, u_int32_t seq, void *ctxt)
304{ 305{
305 fatal("input_userauth_error: bad message during authentication: " 306 fatal("input_userauth_error: bad message during authentication: "
306 "type %d", type); 307 "type %d", type);
307} 308}
309
308void 310void
309input_userauth_banner(int type, u_int32_t seq, void *ctxt) 311input_userauth_banner(int type, u_int32_t seq, void *ctxt)
310{ 312{
@@ -316,6 +318,7 @@ input_userauth_banner(int type, u_int32_t seq, void *ctxt)
316 xfree(msg); 318 xfree(msg);
317 xfree(lang); 319 xfree(lang);
318} 320}
321
319void 322void
320input_userauth_success(int type, u_int32_t seq, void *ctxt) 323input_userauth_success(int type, u_int32_t seq, void *ctxt)
321{ 324{
@@ -327,6 +330,7 @@ input_userauth_success(int type, u_int32_t seq, void *ctxt)
327 clear_auth_state(authctxt); 330 clear_auth_state(authctxt);
328 authctxt->success = 1; /* break out */ 331 authctxt->success = 1; /* break out */
329} 332}
333
330void 334void
331input_userauth_failure(int type, u_int32_t seq, void *ctxt) 335input_userauth_failure(int type, u_int32_t seq, void *ctxt)
332{ 336{
@@ -375,7 +379,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt)
375 } 379 }
376 packet_check_eom(); 380 packet_check_eom();
377 381
378 debug("input_userauth_pk_ok: pkalg %s blen %d lastkey %p hint %d", 382 debug("input_userauth_pk_ok: pkalg %s blen %u lastkey %p hint %d",
379 pkalg, blen, authctxt->last_key, authctxt->last_key_hint); 383 pkalg, blen, authctxt->last_key, authctxt->last_key_hint);
380 384
381 do { 385 do {
@@ -894,9 +898,7 @@ input_userauth_info_req(int type, u_int32_t seq, void *ctxt)
894} 898}
895 899
896static int 900static int
897ssh_keysign( 901ssh_keysign(Key *key, u_char **sigp, u_int *lenp,
898 Key *key,
899 u_char **sigp, u_int *lenp,
900 u_char *data, u_int datalen) 902 u_char *data, u_int datalen)
901{ 903{
902 Buffer b; 904 Buffer b;
@@ -1098,6 +1100,7 @@ authmethod_lookup(const char *name)
1098static Authmethod *current = NULL; 1100static Authmethod *current = NULL;
1099static char *supported = NULL; 1101static char *supported = NULL;
1100static char *preferred = NULL; 1102static char *preferred = NULL;
1103
1101/* 1104/*
1102 * Given the authentication method list sent by the server, return the 1105 * Given the authentication method list sent by the server, return the
1103 * next method we should try. If the server initially sends a nil list, 1106 * next method we should try. If the server initially sends a nil list,
diff --git a/sshd.c b/sshd.c
index 6b29e7094..473b31670 100644
--- a/sshd.c
+++ b/sshd.c
@@ -42,7 +42,7 @@
42 */ 42 */
43 43
44#include "includes.h" 44#include "includes.h"
45RCSID("$OpenBSD: sshd.c,v 1.248 2002/06/22 20:05:27 stevesk Exp $"); 45RCSID("$OpenBSD: sshd.c,v 1.249 2002/06/23 03:30:17 deraadt Exp $");
46 46
47#include <openssl/dh.h> 47#include <openssl/dh.h>
48#include <openssl/bn.h> 48#include <openssl/bn.h>
@@ -372,7 +372,8 @@ sshd_exchange_identification(int sock_in, int sock_out)
372 372
373 if (client_version_string == NULL) { 373 if (client_version_string == NULL) {
374 /* Send our protocol version identification. */ 374 /* Send our protocol version identification. */
375 if (atomicio(write, sock_out, server_version_string, strlen(server_version_string)) 375 if (atomicio(write, sock_out, server_version_string,
376 strlen(server_version_string))
376 != strlen(server_version_string)) { 377 != strlen(server_version_string)) {
377 log("Could not write ident string to %s", get_remote_ipaddr()); 378 log("Could not write ident string to %s", get_remote_ipaddr());
378 fatal_cleanup(); 379 fatal_cleanup();
@@ -475,7 +476,6 @@ sshd_exchange_identification(int sock_in, int sock_out)
475 } 476 }
476} 477}
477 478
478
479/* Destroy the host and server keys. They will no longer be needed. */ 479/* Destroy the host and server keys. They will no longer be needed. */
480void 480void
481destroy_sensitive_data(void) 481destroy_sensitive_data(void)
diff --git a/sshlogin.c b/sshlogin.c
index 78c51abd6..e76f94534 100644
--- a/sshlogin.c
+++ b/sshlogin.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: sshlogin.c,v 1.3 2001/12/19 07:18:56 deraadt Exp $"); 42RCSID("$OpenBSD: sshlogin.c,v 1.4 2002/06/23 03:30:17 deraadt Exp $");
43 43
44#include "loginrec.h" 44#include "loginrec.h"
45 45
@@ -48,10 +48,9 @@ RCSID("$OpenBSD: sshlogin.c,v 1.3 2001/12/19 07:18:56 deraadt Exp $");
48 * information is not available. This must be called before record_login. 48 * information is not available. This must be called before record_login.
49 * The host the user logged in from will be returned in buf. 49 * The host the user logged in from will be returned in buf.
50 */ 50 */
51
52u_long 51u_long
53get_last_login_time(uid_t uid, const char *logname, 52get_last_login_time(uid_t uid, const char *logname,
54 char *buf, u_int bufsize) 53 char *buf, u_int bufsize)
55{ 54{
56 struct logininfo li; 55 struct logininfo li;
57 56
@@ -64,10 +63,9 @@ get_last_login_time(uid_t uid, const char *logname,
64 * Records that the user has logged in. I these parts of operating systems 63 * Records that the user has logged in. I these parts of operating systems
65 * were more standardized. 64 * were more standardized.
66 */ 65 */
67
68void 66void
69record_login(pid_t pid, const char *ttyname, const char *user, uid_t uid, 67record_login(pid_t pid, const char *ttyname, const char *user, uid_t uid,
70 const char *host, struct sockaddr * addr) 68 const char *host, struct sockaddr * addr)
71{ 69{
72 struct logininfo *li; 70 struct logininfo *li;
73 71
@@ -92,7 +90,6 @@ record_utmp_only(pid_t pid, const char *ttyname, const char *user,
92#endif 90#endif
93 91
94/* Records that the user has logged out. */ 92/* Records that the user has logged out. */
95
96void 93void
97record_logout(pid_t pid, const char *ttyname, const char *user) 94record_logout(pid_t pid, const char *ttyname, const char *user)
98{ 95{
diff --git a/sshpty.c b/sshpty.c
index a7e7e2769..ce64e7a00 100644
--- a/sshpty.c
+++ b/sshpty.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: sshpty.c,v 1.4 2001/12/19 07:18:56 deraadt Exp $"); 15RCSID("$OpenBSD: sshpty.c,v 1.5 2002/06/23 03:30:58 deraadt Exp $");
16 16
17#ifdef HAVE_UTIL_H 17#ifdef HAVE_UTIL_H
18# include <util.h> 18# include <util.h>
@@ -394,11 +394,11 @@ pty_setowner(struct passwd *pw, const char *ttyname)
394 if (chown(ttyname, pw->pw_uid, gid) < 0) { 394 if (chown(ttyname, pw->pw_uid, gid) < 0) {
395 if (errno == EROFS && 395 if (errno == EROFS &&
396 (st.st_uid == pw->pw_uid || st.st_uid == 0)) 396 (st.st_uid == pw->pw_uid || st.st_uid == 0))
397 error("chown(%.100s, %d, %d) failed: %.100s", 397 error("chown(%.100s, %u, %u) failed: %.100s",
398 ttyname, pw->pw_uid, gid, 398 ttyname, pw->pw_uid, gid,
399 strerror(errno)); 399 strerror(errno));
400 else 400 else
401 fatal("chown(%.100s, %d, %d) failed: %.100s", 401 fatal("chown(%.100s, %u, %u) failed: %.100s",
402 ttyname, pw->pw_uid, gid, 402 ttyname, pw->pw_uid, gid,
403 strerror(errno)); 403 strerror(errno));
404 } 404 }