[auth.c key.c misc.c packet.c ssh-add.c]
     in a switch (), break after return or goto is stupid
This commit is contained in:
Damien Miller 2006-03-26 14:02:35 +11:00
parent 429fcc23db
commit 69b7203e6f
6 changed files with 7 additions and 23 deletions

View File

@ -65,6 +65,9 @@
[key.c]
(really) last of the Coverity diffs: avoid possible NULL deref in
key_free. via elad AT netbsd.org; markus@ ok
- deraadt@cvs.openbsd.org 2006/03/20 17:10:19
[auth.c key.c misc.c packet.c ssh-add.c]
in a switch (), break after return or goto is stupid
20060325
- OpenBSD CVS Sync
@ -4322,4 +4325,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.4259 2006/03/26 03:02:16 djm Exp $
$Id: ChangeLog,v 1.4260 2006/03/26 03:02:45 djm Exp $

1
auth.c
View File

@ -314,7 +314,6 @@ auth_root_allowed(char *method)
switch (options.permit_root_login) {
case PERMIT_YES:
return 1;
break;
case PERMIT_NO_PASSWD:
if (strcmp(method, "password") != 0)
return 1;

18
key.c
View File

@ -156,14 +156,12 @@ key_equal(const Key *a, const Key *b)
return a->rsa != NULL && b->rsa != NULL &&
BN_cmp(a->rsa->e, b->rsa->e) == 0 &&
BN_cmp(a->rsa->n, b->rsa->n) == 0;
break;
case KEY_DSA:
return a->dsa != NULL && b->dsa != NULL &&
BN_cmp(a->dsa->p, b->dsa->p) == 0 &&
BN_cmp(a->dsa->q, b->dsa->q) == 0 &&
BN_cmp(a->dsa->g, b->dsa->g) == 0 &&
BN_cmp(a->dsa->pub_key, b->dsa->pub_key) == 0;
break;
default:
fatal("key_equal: bad key type %d", a->type);
break;
@ -210,7 +208,6 @@ key_fingerprint_raw(const Key *k, enum fp_type dgst_type,
break;
case KEY_UNSPEC:
return retval;
break;
default:
fatal("key_fingerprint_raw: bad key type %d", k->type);
break;
@ -531,13 +528,10 @@ key_type(const Key *k)
switch (k->type) {
case KEY_RSA1:
return "RSA1";
break;
case KEY_RSA:
return "RSA";
break;
case KEY_DSA:
return "DSA";
break;
}
return "unknown";
}
@ -548,10 +542,8 @@ key_ssh_name(const Key *k)
switch (k->type) {
case KEY_RSA:
return "ssh-rsa";
break;
case KEY_DSA:
return "ssh-dss";
break;
}
return "ssh-unknown";
}
@ -563,10 +555,8 @@ key_size(const Key *k)
case KEY_RSA1:
case KEY_RSA:
return BN_num_bits(k->rsa->n);
break;
case KEY_DSA:
return BN_num_bits(k->dsa->p);
break;
}
return 0;
}
@ -575,6 +565,7 @@ static RSA *
rsa_generate_private_key(u_int bits)
{
RSA *private;
private = RSA_generate_key(bits, 35, NULL, NULL);
if (private == NULL)
fatal("rsa_generate_private_key: key generation failed.");
@ -585,6 +576,7 @@ static DSA*
dsa_generate_private_key(u_int bits)
{
DSA *private = DSA_generate_parameters(bits, NULL, 0, NULL, NULL, NULL, NULL);
if (private == NULL)
fatal("dsa_generate_private_key: DSA_generate_parameters failed");
if (!DSA_generate_key(private))
@ -794,14 +786,11 @@ key_sign(
switch (key->type) {
case KEY_DSA:
return ssh_dss_sign(key, sigp, lenp, data, datalen);
break;
case KEY_RSA:
return ssh_rsa_sign(key, sigp, lenp, data, datalen);
break;
default:
error("key_sign: invalid key type %d", key->type);
return -1;
break;
}
}
@ -821,14 +810,11 @@ key_verify(
switch (key->type) {
case KEY_DSA:
return ssh_dss_verify(key, signature, signaturelen, data, datalen);
break;
case KEY_RSA:
return ssh_rsa_verify(key, signature, signaturelen, data, datalen);
break;
default:
error("key_verify: invalid key type %d", key->type);
return -1;
break;
}
}

1
misc.c
View File

@ -297,6 +297,7 @@ convtime(const char *s)
switch (*endp++) {
case '\0':
endp--;
break;
case 's':
case 'S':
break;

View File

@ -1188,7 +1188,6 @@ packet_read_poll_seqnr(u_int32_t *seqnr_p)
break;
default:
return type;
break;
}
} else {
type = packet_read_poll1();
@ -1211,7 +1210,6 @@ packet_read_poll_seqnr(u_int32_t *seqnr_p)
if (type)
DBG(debug("received packet type %d", type));
return type;
break;
}
}
}

View File

@ -346,13 +346,11 @@ main(int argc, char **argv)
if (list_identities(ac, ch == 'l' ? 1 : 0) == -1)
ret = 1;
goto done;
break;
case 'x':
case 'X':
if (lock_agent(ac, ch == 'x' ? 1 : 0) == -1)
ret = 1;
goto done;
break;
case 'c':
confirm = 1;
break;
@ -363,7 +361,6 @@ main(int argc, char **argv)
if (delete_all(ac) == -1)
ret = 1;
goto done;
break;
case 's':
sc_reader_id = optarg;
break;