[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
Родитель 58d3b7224f
Коммит e135363422
3 изменённых файлов: 28 добавлений и 13 удалений

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

@ -17,6 +17,9 @@
- deraadt@cvs.openbsd.org 2002/06/23 09:39:55
[ssh-keygen.c]
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
- (stevesk) [configure.ac] bug #255 LOGIN_NEEDS_UTMPX for AIX.
@ -1061,4 +1064,4 @@
- (stevesk) entropy.c: typo in debug message
- (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 $

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

@ -37,7 +37,7 @@
*/
#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 "bufaux.h"
@ -105,6 +105,7 @@ buffer_put_bignum2(Buffer *buffer, BIGNUM *value)
u_char *buf = xmalloc(bytes);
int oi;
int hasnohigh = 0;
buf[0] = '\0';
/* Get the value of in binary */
oi = BN_bn2bin(value, buf+1);
@ -134,6 +135,7 @@ buffer_get_bignum2(Buffer *buffer, BIGNUM *value)
/**XXX should be two's-complement */
int len;
u_char *bin = buffer_get_string(buffer, (u_int *)&len);
BN_bin2bn(bin, len, value);
xfree(bin);
}
@ -145,6 +147,7 @@ u_short
buffer_get_short(Buffer *buffer)
{
u_char buf[2];
buffer_get(buffer, (char *) buf, 2);
return GET_16BIT(buf);
}
@ -153,6 +156,7 @@ u_int
buffer_get_int(Buffer *buffer)
{
u_char buf[4];
buffer_get(buffer, (char *) buf, 4);
return GET_32BIT(buf);
}
@ -162,6 +166,7 @@ u_int64_t
buffer_get_int64(Buffer *buffer)
{
u_char buf[8];
buffer_get(buffer, (char *) buf, 8);
return GET_64BIT(buf);
}
@ -174,6 +179,7 @@ void
buffer_put_short(Buffer *buffer, u_short value)
{
char buf[2];
PUT_16BIT(buf, value);
buffer_append(buffer, buf, 2);
}
@ -182,6 +188,7 @@ void
buffer_put_int(Buffer *buffer, u_int value)
{
char buf[4];
PUT_32BIT(buf, value);
buffer_append(buffer, buf, 4);
}
@ -191,6 +198,7 @@ void
buffer_put_int64(Buffer *buffer, u_int64_t value)
{
char buf[8];
PUT_64BIT(buf, value);
buffer_append(buffer, buf, 8);
}
@ -207,8 +215,9 @@ buffer_put_int64(Buffer *buffer, u_int64_t value)
void *
buffer_get_string(Buffer *buffer, u_int *length_ptr)
{
u_int len;
u_char *value;
u_int len;
/* Get the length. */
len = buffer_get_int(buffer);
if (len > 256 * 1024)
@ -249,6 +258,7 @@ int
buffer_get_char(Buffer *buffer)
{
char ch;
buffer_get(buffer, &ch, 1);
return (u_char) ch;
}
@ -260,5 +270,6 @@ void
buffer_put_char(Buffer *buffer, int value)
{
char ch = value;
buffer_append(buffer, &ch, 1);
}

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

@ -10,7 +10,7 @@
*/
#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)
#include <krb.h>
@ -423,7 +423,7 @@ add_one_listen_addr(ServerOptions *options, char *addr, u_short port)
hints.ai_family = IPv4or6;
hints.ai_socktype = SOCK_STREAM;
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)
fatal("bad addr or host: %s (%s)",
addr ? addr : "<NULL>",
@ -439,9 +439,8 @@ process_server_config_line(ServerOptions *options, char *line,
const char *filename, int linenum)
{
char *cp, **charptr, *arg, *p;
int *intptr, value;
int *intptr, value, i, n;
ServerOpCodes opcode;
int i, n;
cp = line;
arg = strdelim(&cp);
@ -765,7 +764,8 @@ parse_flag:
if (options->num_allow_users >= MAX_ALLOW_USERS)
fatal("%s line %d: too many allow users.",
filename, linenum);
options->allow_users[options->num_allow_users++] = xstrdup(arg);
options->allow_users[options->num_allow_users++] =
xstrdup(arg);
}
break;
@ -774,7 +774,8 @@ parse_flag:
if (options->num_deny_users >= MAX_DENY_USERS)
fatal( "%s line %d: too many deny users.",
filename, linenum);
options->deny_users[options->num_deny_users++] = xstrdup(arg);
options->deny_users[options->num_deny_users++] =
xstrdup(arg);
}
break;
@ -783,7 +784,8 @@ parse_flag:
if (options->num_allow_groups >= MAX_ALLOW_GROUPS)
fatal("%s line %d: too many allow groups.",
filename, linenum);
options->allow_groups[options->num_allow_groups++] = xstrdup(arg);
options->allow_groups[options->num_allow_groups++] =
xstrdup(arg);
}
break;
@ -921,10 +923,9 @@ parse_flag:
void
read_server_config(ServerOptions *options, const char *filename)
{
FILE *f;
int linenum, bad_options = 0;
char line[1024];
int linenum;
int bad_options = 0;
FILE *f;
f = fopen(filename, "r");
if (!f) {