diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-06-23 03:30:59 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-06-23 03:30:59 +0000 |
commit | 848cff039827b93f79dd8b6611cc087984bd262b (patch) | |
tree | 36dcaa539f90cba9623ca29d613bead1bb9964c7 /usr.bin | |
parent | 6be7a49258cd787f12d2d4415ea670aaf474da37 (diff) |
various KNF and %d for unsigned
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/scard.c | 4 | ||||
-rw-r--r-- | usr.bin/ssh/ssh-dss.c | 14 | ||||
-rw-r--r-- | usr.bin/ssh/ssh-rsa.c | 24 | ||||
-rw-r--r-- | usr.bin/ssh/sshconnect.c | 5 | ||||
-rw-r--r-- | usr.bin/ssh/sshconnect2.c | 13 | ||||
-rw-r--r-- | usr.bin/ssh/sshd.c | 6 | ||||
-rw-r--r-- | usr.bin/ssh/sshlogin.c | 9 | ||||
-rw-r--r-- | usr.bin/ssh/sshpty.c | 6 |
8 files changed, 37 insertions, 44 deletions
diff --git a/usr.bin/ssh/scard.c b/usr.bin/ssh/scard.c index e71815e7d4b..ce548a75ff6 100644 --- a/usr.bin/ssh/scard.c +++ b/usr.bin/ssh/scard.c @@ -24,7 +24,7 @@ #ifdef SMARTCARD #include "includes.h" -RCSID("$OpenBSD: scard.c,v 1.25 2002/03/26 18:46:59 rees Exp $"); +RCSID("$OpenBSD: scard.c,v 1.26 2002/06/23 03:30:17 deraadt Exp $"); #include <openssl/evp.h> #include <sectok.h> @@ -191,7 +191,7 @@ sc_read_pubkey(Key * k) status = 0; p = key_fingerprint(k, SSH_FP_MD5, SSH_FP_HEX); - debug("fingerprint %d %s", key_size(k), p); + debug("fingerprint %u %s", key_size(k), p); xfree(p); err: diff --git a/usr.bin/ssh/ssh-dss.c b/usr.bin/ssh/ssh-dss.c index 02403f550af..dbf8465bae5 100644 --- a/usr.bin/ssh/ssh-dss.c +++ b/usr.bin/ssh/ssh-dss.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh-dss.c,v 1.14 2002/02/28 15:46:33 markus Exp $"); +RCSID("$OpenBSD: ssh-dss.c,v 1.15 2002/06/23 03:30:17 deraadt Exp $"); #include <openssl/bn.h> #include <openssl/evp.h> @@ -40,9 +40,7 @@ RCSID("$OpenBSD: ssh-dss.c,v 1.14 2002/02/28 15:46:33 markus Exp $"); #define SIGBLOB_LEN (2*INTBLOB_LEN) int -ssh_dss_sign( - Key *key, - u_char **sigp, u_int *lenp, +ssh_dss_sign(Key *key, u_char **sigp, u_int *lenp, u_char *data, u_int datalen) { DSA_SIG *sig; @@ -71,7 +69,7 @@ ssh_dss_sign( rlen = BN_num_bytes(sig->r); slen = BN_num_bytes(sig->s); if (rlen > INTBLOB_LEN || slen > INTBLOB_LEN) { - error("bad sig size %d %d", rlen, slen); + error("bad sig size %u %u", rlen, slen); DSA_SIG_free(sig); return -1; } @@ -104,9 +102,7 @@ ssh_dss_sign( return 0; } int -ssh_dss_verify( - Key *key, - u_char *signature, u_int signaturelen, +ssh_dss_verify(Key *key, u_char *signature, u_int signaturelen, u_char *data, u_int datalen) { DSA_SIG *sig; @@ -151,7 +147,7 @@ ssh_dss_verify( } if (len != SIGBLOB_LEN) { - fatal("bad sigbloblen %d != SIGBLOB_LEN", len); + fatal("bad sigbloblen %u != SIGBLOB_LEN", len); } /* parse signature */ diff --git a/usr.bin/ssh/ssh-rsa.c b/usr.bin/ssh/ssh-rsa.c index 3e66294e9f8..782279bad23 100644 --- a/usr.bin/ssh/ssh-rsa.c +++ b/usr.bin/ssh/ssh-rsa.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh-rsa.c,v 1.20 2002/06/10 16:53:06 stevesk Exp $"); +RCSID("$OpenBSD: ssh-rsa.c,v 1.21 2002/06/23 03:30:17 deraadt Exp $"); #include <openssl/evp.h> #include <openssl/err.h> @@ -39,9 +39,7 @@ RCSID("$OpenBSD: ssh-rsa.c,v 1.20 2002/06/10 16:53:06 stevesk Exp $"); /* RSASSA-PKCS1-v1_5 (PKCS #1 v2.0 signature) with SHA1 */ int -ssh_rsa_sign( - Key *key, - u_char **sigp, u_int *lenp, +ssh_rsa_sign(Key *key, u_char **sigp, u_int *lenp, u_char *data, u_int datalen) { const EVP_MD *evp_md; @@ -72,17 +70,18 @@ ssh_rsa_sign( if (ok != 1) { int ecode = ERR_get_error(); - error("ssh_rsa_sign: RSA_sign failed: %s", ERR_error_string(ecode, NULL)); + error("ssh_rsa_sign: RSA_sign failed: %s", + ERR_error_string(ecode, NULL)); xfree(sig); return -1; } if (len < slen) { int diff = slen - len; - debug("slen %d > len %d", slen, len); + debug("slen %u > len %u", slen, len); memmove(sig + diff, sig, len); memset(sig, 0, diff); } else if (len > slen) { - error("ssh_rsa_sign: slen %d slen2 %d", slen, len); + error("ssh_rsa_sign: slen %u slen2 %u", slen, len); xfree(sig); return -1; } @@ -105,9 +104,7 @@ ssh_rsa_sign( } int -ssh_rsa_verify( - Key *key, - u_char *signature, u_int signaturelen, +ssh_rsa_verify(Key *key, u_char *signature, u_int signaturelen, u_char *data, u_int datalen) { Buffer b; @@ -148,12 +145,12 @@ ssh_rsa_verify( /* RSA_verify expects a signature of RSA_size */ modlen = RSA_size(key->rsa); if (len > modlen) { - error("ssh_rsa_verify: len %d > modlen %d", len, modlen); + error("ssh_rsa_verify: len %u > modlen %u", len, modlen); xfree(sigblob); return -1; } else if (len < modlen) { int diff = modlen - len; - debug("ssh_rsa_verify: add padding: modlen %d > len %d", + debug("ssh_rsa_verify: add padding: modlen %u > len %u", modlen, len); sigblob = xrealloc(sigblob, modlen); memmove(sigblob + diff, sigblob, len); @@ -176,7 +173,8 @@ ssh_rsa_verify( xfree(sigblob); if (ret == 0) { int ecode = ERR_get_error(); - error("ssh_rsa_verify: RSA_verify failed: %s", ERR_error_string(ecode, NULL)); + error("ssh_rsa_verify: RSA_verify failed: %s", + ERR_error_string(ecode, NULL)); } debug("ssh_rsa_verify: signature %scorrect", (ret==0) ? "in" : ""); return ret; diff --git a/usr.bin/ssh/sshconnect.c b/usr.bin/ssh/sshconnect.c index 52ccf8901cb..335431fb98b 100644 --- a/usr.bin/ssh/sshconnect.c +++ b/usr.bin/ssh/sshconnect.c @@ -13,7 +13,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshconnect.c,v 1.125 2002/06/19 00:27:55 deraadt Exp $"); +RCSID("$OpenBSD: sshconnect.c,v 1.126 2002/06/23 03:30:17 deraadt Exp $"); #include <openssl/bn.h> @@ -262,7 +262,7 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr, memset(&hints, 0, sizeof(hints)); hints.ai_family = family; hints.ai_socktype = SOCK_STREAM; - snprintf(strport, sizeof strport, "%d", port); + snprintf(strport, sizeof strport, "%u", port); if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) fatal("%s: %.100s: %s", __progname, host, gai_strerror(gaierr)); @@ -485,7 +485,6 @@ confirm(const char *prompt) * check whether the supplied host key is valid, return -1 if the key * is not valid. the user_hostfile will not be updated if 'readonly' is true. */ - static int check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, int readonly, const char *user_hostfile, const char *system_hostfile) diff --git a/usr.bin/ssh/sshconnect2.c b/usr.bin/ssh/sshconnect2.c index c16a3184bcc..dce933b390c 100644 --- a/usr.bin/ssh/sshconnect2.c +++ b/usr.bin/ssh/sshconnect2.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshconnect2.c,v 1.104 2002/06/19 00:27:55 deraadt Exp $"); +RCSID("$OpenBSD: sshconnect2.c,v 1.105 2002/06/23 03:30:17 deraadt Exp $"); #include "ssh.h" #include "ssh2.h" @@ -299,12 +299,14 @@ userauth(Authctxt *authctxt, char *authlist) } } } + void input_userauth_error(int type, u_int32_t seq, void *ctxt) { fatal("input_userauth_error: bad message during authentication: " "type %d", type); } + void input_userauth_banner(int type, u_int32_t seq, void *ctxt) { @@ -316,6 +318,7 @@ input_userauth_banner(int type, u_int32_t seq, void *ctxt) xfree(msg); xfree(lang); } + void input_userauth_success(int type, u_int32_t seq, void *ctxt) { @@ -327,6 +330,7 @@ input_userauth_success(int type, u_int32_t seq, void *ctxt) clear_auth_state(authctxt); authctxt->success = 1; /* break out */ } + void input_userauth_failure(int type, u_int32_t seq, void *ctxt) { @@ -375,7 +379,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt) } packet_check_eom(); - debug("input_userauth_pk_ok: pkalg %s blen %d lastkey %p hint %d", + debug("input_userauth_pk_ok: pkalg %s blen %u lastkey %p hint %d", pkalg, blen, authctxt->last_key, authctxt->last_key_hint); do { @@ -894,9 +898,7 @@ input_userauth_info_req(int type, u_int32_t seq, void *ctxt) } static int -ssh_keysign( - Key *key, - u_char **sigp, u_int *lenp, +ssh_keysign(Key *key, u_char **sigp, u_int *lenp, u_char *data, u_int datalen) { Buffer b; @@ -1098,6 +1100,7 @@ authmethod_lookup(const char *name) static Authmethod *current = NULL; static char *supported = NULL; static char *preferred = NULL; + /* * Given the authentication method list sent by the server, return the * next method we should try. If the server initially sends a nil list, diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c index df28a63d58e..505d834cd8e 100644 --- a/usr.bin/ssh/sshd.c +++ b/usr.bin/ssh/sshd.c @@ -42,7 +42,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshd.c,v 1.248 2002/06/22 20:05:27 stevesk Exp $"); +RCSID("$OpenBSD: sshd.c,v 1.249 2002/06/23 03:30:17 deraadt Exp $"); #include <openssl/dh.h> #include <openssl/bn.h> @@ -359,7 +359,8 @@ sshd_exchange_identification(int sock_in, int sock_out) if (client_version_string == NULL) { /* Send our protocol version identification. */ - if (atomicio(write, sock_out, server_version_string, strlen(server_version_string)) + if (atomicio(write, sock_out, server_version_string, + strlen(server_version_string)) != strlen(server_version_string)) { log("Could not write ident string to %s", get_remote_ipaddr()); fatal_cleanup(); @@ -462,7 +463,6 @@ sshd_exchange_identification(int sock_in, int sock_out) } } - /* Destroy the host and server keys. They will no longer be needed. */ void destroy_sensitive_data(void) diff --git a/usr.bin/ssh/sshlogin.c b/usr.bin/ssh/sshlogin.c index c6e2ad4fe27..9e9841cec9a 100644 --- a/usr.bin/ssh/sshlogin.c +++ b/usr.bin/ssh/sshlogin.c @@ -39,7 +39,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshlogin.c,v 1.3 2001/12/19 07:18:56 deraadt Exp $"); +RCSID("$OpenBSD: sshlogin.c,v 1.4 2002/06/23 03:30:17 deraadt Exp $"); #include <util.h> #include <utmp.h> @@ -51,10 +51,9 @@ RCSID("$OpenBSD: sshlogin.c,v 1.3 2001/12/19 07:18:56 deraadt Exp $"); * information is not available. This must be called before record_login. * The host the user logged in from will be returned in buf. */ - u_long get_last_login_time(uid_t uid, const char *logname, - char *buf, u_int bufsize) + char *buf, u_int bufsize) { struct lastlog ll; char *lastlog; @@ -83,10 +82,9 @@ get_last_login_time(uid_t uid, const char *logname, * Records that the user has logged in. I these parts of operating systems * were more standardized. */ - void record_login(pid_t pid, const char *ttyname, const char *user, uid_t uid, - const char *host, struct sockaddr * addr) + const char *host, struct sockaddr * addr) { int fd; struct lastlog ll; @@ -126,7 +124,6 @@ record_login(pid_t pid, const char *ttyname, const char *user, uid_t uid, } /* Records that the user has logged out. */ - void record_logout(pid_t pid, const char *ttyname) { diff --git a/usr.bin/ssh/sshpty.c b/usr.bin/ssh/sshpty.c index b21d3cc1769..433511aec77 100644 --- a/usr.bin/ssh/sshpty.c +++ b/usr.bin/ssh/sshpty.c @@ -12,7 +12,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshpty.c,v 1.4 2001/12/19 07:18:56 deraadt Exp $"); +RCSID("$OpenBSD: sshpty.c,v 1.5 2002/06/23 03:30:58 deraadt Exp $"); #include <util.h> #include "sshpty.h" @@ -275,11 +275,11 @@ pty_setowner(struct passwd *pw, const char *ttyname) if (chown(ttyname, pw->pw_uid, gid) < 0) { if (errno == EROFS && (st.st_uid == pw->pw_uid || st.st_uid == 0)) - error("chown(%.100s, %d, %d) failed: %.100s", + error("chown(%.100s, %u, %u) failed: %.100s", ttyname, pw->pw_uid, gid, strerror(errno)); else - fatal("chown(%.100s, %d, %d) failed: %.100s", + fatal("chown(%.100s, %u, %u) failed: %.100s", ttyname, pw->pw_uid, gid, strerror(errno)); } |