[authfd.c authfile.c bufaux.c channels.c compat.c kex.c kexgex.c
      key.c misc.c packet.c servconf.c ssh-agent.c sshconnect2.c
      sshconnect.c sshd.c ssh-dss.c ssh-keygen.c ssh-rsa.c]
     minor KNF
This commit is contained in:
Ben Lindstrom 2001-12-06 18:00:18 +00:00
Родитель 3c36bb29ca
Коммит 1c37c6a518
19 изменённых файлов: 82 добавлений и 76 удалений

Просмотреть файл

@ -57,6 +57,11 @@
[auth1.c auth2.c canohost.c channels.c deattack.c packet.c scp.c
sshconnect2.c]
make it compile with more strict prototype checking
- deraadt@cvs.openbsd.org 2001/12/05 10:06:12
[authfd.c authfile.c bufaux.c channels.c compat.c kex.c kexgex.c
key.c misc.c packet.c servconf.c ssh-agent.c sshconnect2.c
sshconnect.c sshd.c ssh-dss.c ssh-keygen.c ssh-rsa.c]
minor KNF
20011126
- (tim) [contrib/cygwin/README, openbsd-compat/bsd-cygwin_util.c,
@ -6979,4 +6984,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
$Id: ChangeLog,v 1.1683 2001/12/06 17:55:26 mouring Exp $
$Id: ChangeLog,v 1.1684 2001/12/06 18:00:18 mouring Exp $

Просмотреть файл

@ -35,7 +35,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: authfd.c,v 1.45 2001/09/19 19:35:30 stevesk Exp $");
RCSID("$OpenBSD: authfd.c,v 1.46 2001/12/05 10:06:12 deraadt Exp $");
#include <openssl/evp.h>
@ -217,7 +217,7 @@ ssh_get_num_identities(AuthenticationConnection *auth, int version)
int type, code1 = 0, code2 = 0;
Buffer request;
switch(version){
switch (version) {
case 1:
code1 = SSH_AGENTC_REQUEST_RSA_IDENTITIES;
code2 = SSH_AGENT_RSA_IDENTITIES_ANSWER;
@ -286,7 +286,7 @@ ssh_get_next_identity(AuthenticationConnection *auth, char **comment, int versio
* Get the next entry from the packet. These will abort with a fatal
* error if the packet is too short or contains corrupt data.
*/
switch(version){
switch (version) {
case 1:
key = key_new(KEY_RSA1);
bits = buffer_get_int(&auth->identities);
@ -438,7 +438,7 @@ ssh_encode_identity_ssh2(Buffer *b, Key *key, const char *comment)
buffer_clear(b);
buffer_put_char(b, SSH2_AGENTC_ADD_IDENTITY);
buffer_put_cstring(b, key_ssh_name(key));
switch(key->type){
switch (key->type) {
case KEY_RSA:
buffer_put_bignum2(b, key->rsa->n);
buffer_put_bignum2(b, key->rsa->e);

Просмотреть файл

@ -36,7 +36,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: authfile.c,v 1.39 2001/10/07 10:29:52 markus Exp $");
RCSID("$OpenBSD: authfile.c,v 1.40 2001/12/05 10:06:12 deraadt Exp $");
#include <openssl/err.h>
#include <openssl/evp.h>
@ -586,7 +586,7 @@ key_try_load_public(Key *k, const char *filename, char **commentp)
while (fgets(line, sizeof(line), f)) {
line[sizeof(line)-1] = '\0';
cp = line;
switch(*cp){
switch (*cp) {
case '#':
case '\n':
case '\0':

Просмотреть файл

@ -37,7 +37,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: bufaux.c,v 1.17 2001/01/21 19:05:45 markus Exp $");
RCSID("$OpenBSD: bufaux.c,v 1.18 2001/12/05 10:06:12 deraadt Exp $");
#include <openssl/bn.h>
#include "bufaux.h"
@ -121,7 +121,7 @@ buffer_put_bignum2(Buffer *buffer, BIGNUM *value)
log("negativ!");
for(i = bytes-1, carry = 1; i>=0; i--) {
uc[i] ^= 0xff;
if(carry)
if (carry)
carry = !++uc[i];
}
}

Просмотреть файл

@ -39,7 +39,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: channels.c,v 1.142 2001/12/05 03:56:39 itojun Exp $");
RCSID("$OpenBSD: channels.c,v 1.143 2001/12/05 10:06:12 deraadt Exp $");
#include "ssh.h"
#include "ssh1.h"
@ -1277,7 +1277,7 @@ channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset)
}
return -1;
}
if(c->input_filter != NULL) {
if (c->input_filter != NULL) {
if (c->input_filter(c, buf, len) == -1) {
debug("channel %d: filter stops", c->self);
chan_read_failed(c);
@ -1725,7 +1725,7 @@ channel_input_data(int type, int plen, void *ctxt)
data = packet_get_string(&data_len);
packet_done();
if (compat20){
if (compat20) {
if (data_len > c->local_maxpacket) {
log("channel %d: rcvd big packet %d, maxpack %d",
c->self, data_len, c->local_maxpacket);
@ -1909,7 +1909,7 @@ channel_input_open_confirmation(int type, int plen, void *ctxt)
static char *
reason2txt(int reason)
{
switch(reason) {
switch (reason) {
case SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED:
return "administratively prohibited";
case SSH2_OPEN_CONNECT_FAILED:
@ -2719,7 +2719,7 @@ void
deny_input_open(int type, int plen, void *ctxt)
{
int rchan = packet_get_int();
switch(type){
switch (type) {
case SSH_SMSG_AGENT_OPEN:
error("Warning: ssh server tried agent forwarding.");
break;

Просмотреть файл

@ -23,7 +23,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: compat.c,v 1.53 2001/09/20 13:50:40 markus Exp $");
RCSID("$OpenBSD: compat.c,v 1.54 2001/12/05 10:06:12 deraadt Exp $");
#ifdef HAVE_LIBPCRE
# include <pcreposix.h>
@ -159,7 +159,7 @@ proto_spec(const char *spec)
return ret;
q = s = xstrdup(spec);
for ((p = strsep(&q, SEP)); p && *p != '\0'; (p = strsep(&q, SEP))) {
switch(atoi(p)) {
switch (atoi(p)) {
case 1:
if (ret == SSH_PROTO_UNKNOWN)
ret |= SSH_PROTO_1_PREFERRED;
@ -191,7 +191,7 @@ compat_cipher_proposal(char *cipher_prop)
fix_ciphers = xmalloc(len);
*fix_ciphers = '\0';
tmp = orig_prop = xstrdup(cipher_prop);
while((cp = strsep(&tmp, ",")) != NULL) {
while ((cp = strsep(&tmp, ",")) != NULL) {
if (strncmp(cp, "aes", 3) && strncmp(cp, "rijndael", 8)) {
if (*fix_ciphers)
strlcat(fix_ciphers, ",", len);

6
kex.c
Просмотреть файл

@ -23,7 +23,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: kex.c,v 1.36 2001/06/25 08:25:37 markus Exp $");
RCSID("$OpenBSD: kex.c,v 1.37 2001/12/05 10:06:12 deraadt Exp $");
#include <openssl/crypto.h>
@ -219,7 +219,7 @@ kex_kexinit_finish(Kex *kex)
kex_choose_conf(kex);
switch(kex->kex_type) {
switch (kex->kex_type) {
case DH_GRP1_SHA1:
kexdh(kex);
break;
@ -444,7 +444,7 @@ dump_digest(char *msg, u_char *digest, int len)
int i;
fprintf(stderr, "%s\n", msg);
for (i = 0; i< len; i++){
for (i = 0; i< len; i++) {
fprintf(stderr, "%02x", digest[i]);
if (i%32 == 31)
fprintf(stderr, "\n");

Просмотреть файл

@ -24,7 +24,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: kexgex.c,v 1.9 2001/09/17 19:27:15 stevesk Exp $");
RCSID("$OpenBSD: kexgex.c,v 1.10 2001/12/05 10:06:12 deraadt Exp $");
#include <openssl/bn.h>
@ -270,7 +270,7 @@ kexgex_server(Kex *kex)
fatal("Unsupported hostkey type %d", kex->hostkey_type);
type = packet_read(&plen);
switch(type){
switch (type) {
case SSH2_MSG_KEX_DH_GEX_REQUEST:
debug("SSH2_MSG_KEX_DH_GEX_REQUEST received");
min = packet_get_int();

27
key.c
Просмотреть файл

@ -32,7 +32,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
RCSID("$OpenBSD: key.c,v 1.34 2001/11/21 15:51:24 markus Exp $");
RCSID("$OpenBSD: key.c,v 1.35 2001/12/05 10:06:12 deraadt Exp $");
#include <openssl/evp.h>
@ -285,7 +285,7 @@ key_fingerprint(Key *k, enum fp_type dgst_type, enum fp_rep dgst_rep)
dgst_raw = key_fingerprint_raw(k, dgst_type, &dgst_raw_len);
if (!dgst_raw)
fatal("key_fingerprint: null from key_fingerprint_raw()");
switch(dgst_rep) {
switch (dgst_rep) {
case SSH_FP_HEX:
retval = key_fingerprint_hex(dgst_raw, dgst_raw_len);
break;
@ -371,7 +371,7 @@ key_read(Key *ret, char **cpp)
cp = *cpp;
switch(ret->type) {
switch (ret->type) {
case KEY_RSA1:
/* Get number of bits. */
if (*cp < '0' || *cp > '9')
@ -533,7 +533,8 @@ key_ssh_name(Key *k)
return "ssh-unknown";
}
u_int
key_size(Key *k){
key_size(Key *k)
{
switch (k->type) {
case KEY_RSA1:
case KEY_RSA:
@ -616,15 +617,15 @@ key_from_private(Key *k)
int
key_type_from_name(char *name)
{
if (strcmp(name, "rsa1") == 0){
if (strcmp(name, "rsa1") == 0) {
return KEY_RSA1;
} else if (strcmp(name, "rsa") == 0){
} else if (strcmp(name, "rsa") == 0) {
return KEY_RSA;
} else if (strcmp(name, "dsa") == 0){
} else if (strcmp(name, "dsa") == 0) {
return KEY_DSA;
} else if (strcmp(name, "ssh-rsa") == 0){
} else if (strcmp(name, "ssh-rsa") == 0) {
return KEY_RSA;
} else if (strcmp(name, "ssh-dss") == 0){
} else if (strcmp(name, "ssh-dss") == 0) {
return KEY_DSA;
}
debug2("key_type_from_name: unknown key type '%s'", name);
@ -669,7 +670,7 @@ key_from_blob(u_char *blob, int blen)
ktype = buffer_get_string(&b, NULL);
type = key_type_from_name(ktype);
switch(type){
switch (type) {
case KEY_RSA:
key = key_new(type);
buffer_get_bignum2(&b, key->rsa->e);
@ -715,7 +716,7 @@ key_to_blob(Key *key, u_char **blobp, u_int *lenp)
return 0;
}
buffer_init(&b);
switch(key->type){
switch (key->type) {
case KEY_DSA:
buffer_put_cstring(&b, key_ssh_name(key));
buffer_put_bignum2(&b, key->dsa->p);
@ -751,7 +752,7 @@ key_sign(
u_char **sigp, int *lenp,
u_char *data, int datalen)
{
switch(key->type){
switch (key->type) {
case KEY_DSA:
return ssh_dss_sign(key, sigp, lenp, data, datalen);
break;
@ -774,7 +775,7 @@ key_verify(
if (signaturelen == 0)
return -1;
switch(key->type){
switch (key->type) {
case KEY_DSA:
return ssh_dss_verify(key, signature, signaturelen, data, datalen);
break;

6
misc.c
Просмотреть файл

@ -1,4 +1,4 @@
/* $OpenBSD: misc.c,v 1.12 2001/06/26 17:27:24 markus Exp $ */
/* $OpenBSD: misc.c,v 1.13 2001/12/05 10:06:12 deraadt Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
@ -25,7 +25,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: misc.c,v 1.12 2001/06/26 17:27:24 markus Exp $");
RCSID("$OpenBSD: misc.c,v 1.13 2001/12/05 10:06:12 deraadt Exp $");
#include "misc.h"
#include "log.h"
@ -37,7 +37,7 @@ chop(char *s)
{
char *t = s;
while (*t) {
if(*t == '\n' || *t == '\r') {
if (*t == '\n' || *t == '\r') {
*t = '\0';
return s;
}

Просмотреть файл

@ -37,7 +37,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: packet.c,v 1.73 2001/12/05 03:56:39 itojun Exp $");
RCSID("$OpenBSD: packet.c,v 1.74 2001/12/05 10:06:12 deraadt Exp $");
#include "xmalloc.h"
#include "buffer.h"
@ -900,7 +900,7 @@ packet_read_poll(int *payload_len_ptr)
type = packet_read_poll2(payload_len_ptr);
if (type)
DBG(debug("received packet type %d", type));
switch(type) {
switch (type) {
case SSH2_MSG_IGNORE:
break;
case SSH2_MSG_DEBUG:
@ -925,7 +925,7 @@ packet_read_poll(int *payload_len_ptr)
}
} else {
type = packet_read_poll1(payload_len_ptr);
switch(type) {
switch (type) {
case SSH_MSG_IGNORE:
break;
case SSH_MSG_DEBUG:

Просмотреть файл

@ -10,7 +10,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: servconf.c,v 1.92 2001/11/17 19:14:34 stevesk Exp $");
RCSID("$OpenBSD: servconf.c,v 1.93 2001/12/05 10:06:12 deraadt Exp $");
#if defined(KRB4) || defined(KRB5)
#include <krb.h>
@ -792,7 +792,7 @@ parse_flag:
break;
case sSubsystem:
if(options->num_subsystems >= MAX_SUBSYSTEMS) {
if (options->num_subsystems >= MAX_SUBSYSTEMS) {
fatal("%s line %d: too many subsystems defined.",
filename, linenum);
}
@ -801,7 +801,7 @@ parse_flag:
fatal("%s line %d: Missing subsystem name.",
filename, linenum);
for (i = 0; i < options->num_subsystems; i++)
if(strcmp(arg, options->subsystem_name[i]) == 0)
if (strcmp(arg, options->subsystem_name[i]) == 0)
fatal("%s line %d: Subsystem '%s' already defined.",
filename, linenum, arg);
options->subsystem_name[options->num_subsystems] = xstrdup(arg);
@ -862,7 +862,7 @@ parse_flag:
case sDeprecated:
log("%s line %d: Deprecated option %s",
filename, linenum, arg);
while(arg)
while (arg)
arg = strdelim(&cp);
break;

Просмотреть файл

@ -1,4 +1,4 @@
/* $OpenBSD: ssh-agent.c,v 1.73 2001/11/17 19:14:34 stevesk Exp $ */
/* $OpenBSD: ssh-agent.c,v 1.74 2001/12/05 10:06:12 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -36,7 +36,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: ssh-agent.c,v 1.73 2001/11/17 19:14:34 stevesk Exp $");
RCSID("$OpenBSD: ssh-agent.c,v 1.74 2001/12/05 10:06:12 deraadt Exp $");
#include <openssl/evp.h>
#include <openssl/md5.h>
@ -109,7 +109,7 @@ static void
idtab_init(void)
{
int i;
for (i = 0; i <=2; i++){
for (i = 0; i <=2; i++) {
idtable[i].identities = NULL;
idtable[i].nentries = 0;
}
@ -293,7 +293,7 @@ process_remove_identity(SocketEntry *e, int version)
u_int bits;
int success = 0;
switch(version){
switch (version) {
case 1:
key = key_new(KEY_RSA1);
bits = buffer_get_int(&e->input);
@ -395,7 +395,7 @@ process_add_identity(SocketEntry *e, int version)
type_name = buffer_get_string(&e->input, NULL);
type = key_type_from_name(type_name);
xfree(type_name);
switch(type) {
switch (type) {
case KEY_DSA:
k = key_new_private(type);
buffer_get_bignum2(&e->input, k->dsa->p);

Просмотреть файл

@ -23,7 +23,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: ssh-dss.c,v 1.9 2001/11/07 22:10:28 markus Exp $");
RCSID("$OpenBSD: ssh-dss.c,v 1.10 2001/12/05 10:06:12 deraadt Exp $");
#include <openssl/bn.h>
#include <openssl/evp.h>
@ -145,7 +145,7 @@ ssh_dss_verify(
sigblob = buffer_get_string(&b, &len);
rlen = buffer_len(&b);
buffer_free(&b);
if(rlen != 0) {
if (rlen != 0) {
error("ssh_dss_verify: "
"remaining bytes in signature %d", rlen);
xfree(sigblob);

Просмотреть файл

@ -12,7 +12,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: ssh-keygen.c,v 1.84 2001/11/17 19:14:34 stevesk Exp $");
RCSID("$OpenBSD: ssh-keygen.c,v 1.85 2001/12/05 10:06:12 deraadt Exp $");
#include <openssl/evp.h>
#include <openssl/pem.h>
@ -272,7 +272,7 @@ do_convert_private_ssh2_from_blob(u_char *blob, int blen)
break;
}
rlen = buffer_len(&b);
if(rlen != 0)
if (rlen != 0)
error("do_convert_private_ssh2_from_blob: "
"remaining bytes in key blob %d", rlen);
buffer_free(&b);
@ -393,7 +393,7 @@ do_print_public(struct passwd *pw)
debug("#bytes %d", len); \
if (BN_bn2bin(prv->rsa->x, elements[i]) < 0) \
goto done; \
} while(0)
} while (0)
static int
get_AUT0(char *aut0)

Просмотреть файл

@ -23,7 +23,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: ssh-rsa.c,v 1.13 2001/11/10 13:22:42 markus Exp $");
RCSID("$OpenBSD: ssh-rsa.c,v 1.14 2001/12/05 10:06:12 deraadt Exp $");
#include <openssl/evp.h>
#include <openssl/err.h>
@ -150,7 +150,7 @@ ssh_rsa_verify(
sigblob = buffer_get_string(&b, &len);
rlen = buffer_len(&b);
buffer_free(&b);
if(rlen != 0) {
if (rlen != 0) {
error("ssh_rsa_verify: remaining bytes in signature %d", rlen);
xfree(sigblob);
return -1;

Просмотреть файл

@ -13,7 +13,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: sshconnect.c,v 1.115 2001/10/08 19:05:05 markus Exp $");
RCSID("$OpenBSD: sshconnect.c,v 1.116 2001/12/05 10:06:13 deraadt Exp $");
#include <openssl/bn.h>
@ -49,15 +49,15 @@ sockaddr_ntop(struct sockaddr *sa)
static char addrbuf[INET6_ADDRSTRLEN];
switch (sa->sa_family) {
case AF_INET:
addr = &((struct sockaddr_in *)sa)->sin_addr;
break;
case AF_INET6:
addr = &((struct sockaddr_in6 *)sa)->sin6_addr;
break;
default:
/* This case should be protected against elsewhere */
abort();
case AF_INET:
addr = &((struct sockaddr_in *)sa)->sin_addr;
break;
case AF_INET6:
addr = &((struct sockaddr_in6 *)sa)->sin6_addr;
break;
default:
/* This case should be protected against elsewhere */
abort(); /* XXX abort is bad -- do something else */
}
inet_ntop(sa->sa_family, addr, addrbuf, sizeof(addrbuf));
return addrbuf;
@ -434,7 +434,7 @@ ssh_exchange_identification(void)
compat_datafellows(remote_version);
mismatch = 0;
switch(remote_major) {
switch (remote_major) {
case 1:
if (remote_minor == 99 &&
(options.protocol & SSH_PROTO_2) &&

Просмотреть файл

@ -23,7 +23,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: sshconnect2.c,v 1.86 2001/12/05 03:56:39 itojun Exp $");
RCSID("$OpenBSD: sshconnect2.c,v 1.87 2001/12/05 10:06:13 deraadt Exp $");
#include <openssl/bn.h>
#include <openssl/md5.h>
@ -407,7 +407,7 @@ input_userauth_pk_ok(int type, int plen, void *ctxt)
}
sent = sign_and_send_pubkey(authctxt, key,
authctxt->last_key_sign);
} while(0);
} while (0);
if (key != NULL)
key_free(key);
@ -446,7 +446,7 @@ userauth_passwd(Authctxt *authctxt)
if (attempt++ >= options.number_of_password_prompts)
return 0;
if(attempt != 1)
if (attempt != 1)
error("Permission denied, please try again.");
snprintf(prompt, sizeof(prompt), "%.30s@%.128s's password: ",
@ -710,7 +710,7 @@ userauth_pubkey(Authctxt *authctxt)
if (authctxt->agent != NULL) {
do {
sent = userauth_pubkey_agent(authctxt);
} while(!sent && authctxt->agent->howmany > 0);
} while (!sent && authctxt->agent->howmany > 0);
}
while (!sent && idx < options.num_identity_files) {
key = options.identity_keys[idx];

8
sshd.c
Просмотреть файл

@ -40,7 +40,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: sshd.c,v 1.213 2001/12/05 03:50:01 itojun Exp $");
RCSID("$OpenBSD: sshd.c,v 1.214 2001/12/05 10:06:13 deraadt Exp $");
#include <openssl/dh.h>
#include <openssl/bn.h>
@ -410,7 +410,7 @@ sshd_exchange_identification(int sock_in, int sock_out)
}
mismatch = 0;
switch(remote_major) {
switch (remote_major) {
case 1:
if (remote_minor == 99) {
if (options.protocol & SSH_PROTO_2)
@ -487,7 +487,7 @@ list_hostkey_types(void)
Key *key = sensitive_data.host_keys[i];
if (key == NULL)
continue;
switch(key->type) {
switch (key->type) {
case KEY_RSA:
case KEY_DSA:
strlcat(buf, key_ssh_name(key), sizeof buf);
@ -737,7 +737,7 @@ main(int ac, char **av)
sensitive_data.host_keys[i] = NULL;
continue;
}
switch(key->type){
switch (key->type) {
case KEY_RSA1:
sensitive_data.ssh1_host_key = key;
sensitive_data.have_ssh1_key = 1;