[bufaux.c servconf.c]
     minor KNF.  things the fingers do while you read
This commit is contained in:
Ben Lindstrom 2002-06-23 21:29:23 +00:00
parent 58d3b7224f
commit e135363422
3 changed files with 28 additions and 13 deletions

View File

@ -17,6 +17,9 @@
- deraadt@cvs.openbsd.org 2002/06/23 09:39:55 - deraadt@cvs.openbsd.org 2002/06/23 09:39:55
[ssh-keygen.c] [ssh-keygen.c]
u_int stuff u_int stuff
- deraadt@cvs.openbsd.org 2002/06/23 09:46:51
[bufaux.c servconf.c]
minor KNF. things the fingers do while you read
20020623 20020623
- (stevesk) [configure.ac] bug #255 LOGIN_NEEDS_UTMPX for AIX. - (stevesk) [configure.ac] bug #255 LOGIN_NEEDS_UTMPX for AIX.
@ -1061,4 +1064,4 @@
- (stevesk) entropy.c: typo in debug message - (stevesk) entropy.c: typo in debug message
- (djm) ssh-keygen -i needs seeded RNG; report from markus@ - (djm) ssh-keygen -i needs seeded RNG; report from markus@
$Id: ChangeLog,v 1.2258 2002/06/23 21:28:13 mouring Exp $ $Id: ChangeLog,v 1.2259 2002/06/23 21:29:23 mouring Exp $

View File

@ -37,7 +37,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: bufaux.c,v 1.25 2002/04/20 09:14:58 markus Exp $"); RCSID("$OpenBSD: bufaux.c,v 1.26 2002/06/23 09:46:51 deraadt Exp $");
#include <openssl/bn.h> #include <openssl/bn.h>
#include "bufaux.h" #include "bufaux.h"
@ -105,6 +105,7 @@ buffer_put_bignum2(Buffer *buffer, BIGNUM *value)
u_char *buf = xmalloc(bytes); u_char *buf = xmalloc(bytes);
int oi; int oi;
int hasnohigh = 0; int hasnohigh = 0;
buf[0] = '\0'; buf[0] = '\0';
/* Get the value of in binary */ /* Get the value of in binary */
oi = BN_bn2bin(value, buf+1); oi = BN_bn2bin(value, buf+1);
@ -134,6 +135,7 @@ buffer_get_bignum2(Buffer *buffer, BIGNUM *value)
/**XXX should be two's-complement */ /**XXX should be two's-complement */
int len; int len;
u_char *bin = buffer_get_string(buffer, (u_int *)&len); u_char *bin = buffer_get_string(buffer, (u_int *)&len);
BN_bin2bn(bin, len, value); BN_bin2bn(bin, len, value);
xfree(bin); xfree(bin);
} }
@ -145,6 +147,7 @@ u_short
buffer_get_short(Buffer *buffer) buffer_get_short(Buffer *buffer)
{ {
u_char buf[2]; u_char buf[2];
buffer_get(buffer, (char *) buf, 2); buffer_get(buffer, (char *) buf, 2);
return GET_16BIT(buf); return GET_16BIT(buf);
} }
@ -153,6 +156,7 @@ u_int
buffer_get_int(Buffer *buffer) buffer_get_int(Buffer *buffer)
{ {
u_char buf[4]; u_char buf[4];
buffer_get(buffer, (char *) buf, 4); buffer_get(buffer, (char *) buf, 4);
return GET_32BIT(buf); return GET_32BIT(buf);
} }
@ -162,6 +166,7 @@ u_int64_t
buffer_get_int64(Buffer *buffer) buffer_get_int64(Buffer *buffer)
{ {
u_char buf[8]; u_char buf[8];
buffer_get(buffer, (char *) buf, 8); buffer_get(buffer, (char *) buf, 8);
return GET_64BIT(buf); return GET_64BIT(buf);
} }
@ -174,6 +179,7 @@ void
buffer_put_short(Buffer *buffer, u_short value) buffer_put_short(Buffer *buffer, u_short value)
{ {
char buf[2]; char buf[2];
PUT_16BIT(buf, value); PUT_16BIT(buf, value);
buffer_append(buffer, buf, 2); buffer_append(buffer, buf, 2);
} }
@ -182,6 +188,7 @@ void
buffer_put_int(Buffer *buffer, u_int value) buffer_put_int(Buffer *buffer, u_int value)
{ {
char buf[4]; char buf[4];
PUT_32BIT(buf, value); PUT_32BIT(buf, value);
buffer_append(buffer, buf, 4); buffer_append(buffer, buf, 4);
} }
@ -191,6 +198,7 @@ void
buffer_put_int64(Buffer *buffer, u_int64_t value) buffer_put_int64(Buffer *buffer, u_int64_t value)
{ {
char buf[8]; char buf[8];
PUT_64BIT(buf, value); PUT_64BIT(buf, value);
buffer_append(buffer, buf, 8); buffer_append(buffer, buf, 8);
} }
@ -207,8 +215,9 @@ buffer_put_int64(Buffer *buffer, u_int64_t value)
void * void *
buffer_get_string(Buffer *buffer, u_int *length_ptr) buffer_get_string(Buffer *buffer, u_int *length_ptr)
{ {
u_int len;
u_char *value; u_char *value;
u_int len;
/* Get the length. */ /* Get the length. */
len = buffer_get_int(buffer); len = buffer_get_int(buffer);
if (len > 256 * 1024) if (len > 256 * 1024)
@ -249,6 +258,7 @@ int
buffer_get_char(Buffer *buffer) buffer_get_char(Buffer *buffer)
{ {
char ch; char ch;
buffer_get(buffer, &ch, 1); buffer_get(buffer, &ch, 1);
return (u_char) ch; return (u_char) ch;
} }
@ -260,5 +270,6 @@ void
buffer_put_char(Buffer *buffer, int value) buffer_put_char(Buffer *buffer, int value)
{ {
char ch = value; char ch = value;
buffer_append(buffer, &ch, 1); buffer_append(buffer, &ch, 1);
} }

View File

@ -10,7 +10,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: servconf.c,v 1.111 2002/06/20 23:05:55 markus Exp $"); RCSID("$OpenBSD: servconf.c,v 1.112 2002/06/23 09:46:51 deraadt Exp $");
#if defined(KRB4) #if defined(KRB4)
#include <krb.h> #include <krb.h>
@ -423,7 +423,7 @@ add_one_listen_addr(ServerOptions *options, char *addr, u_short port)
hints.ai_family = IPv4or6; hints.ai_family = IPv4or6;
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0; hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0;
snprintf(strport, sizeof strport, "%d", port); snprintf(strport, sizeof strport, "%u", port);
if ((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0) if ((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0)
fatal("bad addr or host: %s (%s)", fatal("bad addr or host: %s (%s)",
addr ? addr : "<NULL>", addr ? addr : "<NULL>",
@ -439,9 +439,8 @@ process_server_config_line(ServerOptions *options, char *line,
const char *filename, int linenum) const char *filename, int linenum)
{ {
char *cp, **charptr, *arg, *p; char *cp, **charptr, *arg, *p;
int *intptr, value; int *intptr, value, i, n;
ServerOpCodes opcode; ServerOpCodes opcode;
int i, n;
cp = line; cp = line;
arg = strdelim(&cp); arg = strdelim(&cp);
@ -765,7 +764,8 @@ parse_flag:
if (options->num_allow_users >= MAX_ALLOW_USERS) if (options->num_allow_users >= MAX_ALLOW_USERS)
fatal("%s line %d: too many allow users.", fatal("%s line %d: too many allow users.",
filename, linenum); filename, linenum);
options->allow_users[options->num_allow_users++] = xstrdup(arg); options->allow_users[options->num_allow_users++] =
xstrdup(arg);
} }
break; break;
@ -774,7 +774,8 @@ parse_flag:
if (options->num_deny_users >= MAX_DENY_USERS) if (options->num_deny_users >= MAX_DENY_USERS)
fatal( "%s line %d: too many deny users.", fatal( "%s line %d: too many deny users.",
filename, linenum); filename, linenum);
options->deny_users[options->num_deny_users++] = xstrdup(arg); options->deny_users[options->num_deny_users++] =
xstrdup(arg);
} }
break; break;
@ -783,7 +784,8 @@ parse_flag:
if (options->num_allow_groups >= MAX_ALLOW_GROUPS) if (options->num_allow_groups >= MAX_ALLOW_GROUPS)
fatal("%s line %d: too many allow groups.", fatal("%s line %d: too many allow groups.",
filename, linenum); filename, linenum);
options->allow_groups[options->num_allow_groups++] = xstrdup(arg); options->allow_groups[options->num_allow_groups++] =
xstrdup(arg);
} }
break; break;
@ -921,10 +923,9 @@ parse_flag:
void void
read_server_config(ServerOptions *options, const char *filename) read_server_config(ServerOptions *options, const char *filename)
{ {
FILE *f; int linenum, bad_options = 0;
char line[1024]; char line[1024];
int linenum; FILE *f;
int bad_options = 0;
f = fopen(filename, "r"); f = fopen(filename, "r");
if (!f) { if (!f) {