summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-06-23 21:29:23 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-06-23 21:29:23 +0000
commite135363422c0e48901fa0b4927ef3f1c12614287 (patch)
tree5b2b9280aa9694a36cc629e62b58c1b508b592fe
parent58d3b7224fd49bf4d470f9f3ad6bdfc5dbcc1e0a (diff)
- deraadt@cvs.openbsd.org 2002/06/23 09:46:51
[bufaux.c servconf.c] minor KNF. things the fingers do while you read
-rw-r--r--ChangeLog5
-rw-r--r--bufaux.c15
-rw-r--r--servconf.c21
3 files changed, 28 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 44349172e..a6fb2da4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,9 @@
17 - deraadt@cvs.openbsd.org 2002/06/23 09:39:55 17 - deraadt@cvs.openbsd.org 2002/06/23 09:39:55
18 [ssh-keygen.c] 18 [ssh-keygen.c]
19 u_int stuff 19 u_int stuff
20 - deraadt@cvs.openbsd.org 2002/06/23 09:46:51
21 [bufaux.c servconf.c]
22 minor KNF. things the fingers do while you read
20 23
2120020623 2420020623
22 - (stevesk) [configure.ac] bug #255 LOGIN_NEEDS_UTMPX for AIX. 25 - (stevesk) [configure.ac] bug #255 LOGIN_NEEDS_UTMPX for AIX.
@@ -1061,4 +1064,4 @@
1061 - (stevesk) entropy.c: typo in debug message 1064 - (stevesk) entropy.c: typo in debug message
1062 - (djm) ssh-keygen -i needs seeded RNG; report from markus@ 1065 - (djm) ssh-keygen -i needs seeded RNG; report from markus@
1063 1066
1064$Id: ChangeLog,v 1.2258 2002/06/23 21:28:13 mouring Exp $ 1067$Id: ChangeLog,v 1.2259 2002/06/23 21:29:23 mouring Exp $
diff --git a/bufaux.c b/bufaux.c
index 79f8bbd49..80abe890b 100644
--- a/bufaux.c
+++ b/bufaux.c
@@ -37,7 +37,7 @@
37 */ 37 */
38 38
39#include "includes.h" 39#include "includes.h"
40RCSID("$OpenBSD: bufaux.c,v 1.25 2002/04/20 09:14:58 markus Exp $"); 40RCSID("$OpenBSD: bufaux.c,v 1.26 2002/06/23 09:46:51 deraadt Exp $");
41 41
42#include <openssl/bn.h> 42#include <openssl/bn.h>
43#include "bufaux.h" 43#include "bufaux.h"
@@ -105,6 +105,7 @@ buffer_put_bignum2(Buffer *buffer, BIGNUM *value)
105 u_char *buf = xmalloc(bytes); 105 u_char *buf = xmalloc(bytes);
106 int oi; 106 int oi;
107 int hasnohigh = 0; 107 int hasnohigh = 0;
108
108 buf[0] = '\0'; 109 buf[0] = '\0';
109 /* Get the value of in binary */ 110 /* Get the value of in binary */
110 oi = BN_bn2bin(value, buf+1); 111 oi = BN_bn2bin(value, buf+1);
@@ -134,6 +135,7 @@ buffer_get_bignum2(Buffer *buffer, BIGNUM *value)
134 /**XXX should be two's-complement */ 135 /**XXX should be two's-complement */
135 int len; 136 int len;
136 u_char *bin = buffer_get_string(buffer, (u_int *)&len); 137 u_char *bin = buffer_get_string(buffer, (u_int *)&len);
138
137 BN_bin2bn(bin, len, value); 139 BN_bin2bn(bin, len, value);
138 xfree(bin); 140 xfree(bin);
139} 141}
@@ -145,6 +147,7 @@ u_short
145buffer_get_short(Buffer *buffer) 147buffer_get_short(Buffer *buffer)
146{ 148{
147 u_char buf[2]; 149 u_char buf[2];
150
148 buffer_get(buffer, (char *) buf, 2); 151 buffer_get(buffer, (char *) buf, 2);
149 return GET_16BIT(buf); 152 return GET_16BIT(buf);
150} 153}
@@ -153,6 +156,7 @@ u_int
153buffer_get_int(Buffer *buffer) 156buffer_get_int(Buffer *buffer)
154{ 157{
155 u_char buf[4]; 158 u_char buf[4];
159
156 buffer_get(buffer, (char *) buf, 4); 160 buffer_get(buffer, (char *) buf, 4);
157 return GET_32BIT(buf); 161 return GET_32BIT(buf);
158} 162}
@@ -162,6 +166,7 @@ u_int64_t
162buffer_get_int64(Buffer *buffer) 166buffer_get_int64(Buffer *buffer)
163{ 167{
164 u_char buf[8]; 168 u_char buf[8];
169
165 buffer_get(buffer, (char *) buf, 8); 170 buffer_get(buffer, (char *) buf, 8);
166 return GET_64BIT(buf); 171 return GET_64BIT(buf);
167} 172}
@@ -174,6 +179,7 @@ void
174buffer_put_short(Buffer *buffer, u_short value) 179buffer_put_short(Buffer *buffer, u_short value)
175{ 180{
176 char buf[2]; 181 char buf[2];
182
177 PUT_16BIT(buf, value); 183 PUT_16BIT(buf, value);
178 buffer_append(buffer, buf, 2); 184 buffer_append(buffer, buf, 2);
179} 185}
@@ -182,6 +188,7 @@ void
182buffer_put_int(Buffer *buffer, u_int value) 188buffer_put_int(Buffer *buffer, u_int value)
183{ 189{
184 char buf[4]; 190 char buf[4];
191
185 PUT_32BIT(buf, value); 192 PUT_32BIT(buf, value);
186 buffer_append(buffer, buf, 4); 193 buffer_append(buffer, buf, 4);
187} 194}
@@ -191,6 +198,7 @@ void
191buffer_put_int64(Buffer *buffer, u_int64_t value) 198buffer_put_int64(Buffer *buffer, u_int64_t value)
192{ 199{
193 char buf[8]; 200 char buf[8];
201
194 PUT_64BIT(buf, value); 202 PUT_64BIT(buf, value);
195 buffer_append(buffer, buf, 8); 203 buffer_append(buffer, buf, 8);
196} 204}
@@ -207,8 +215,9 @@ buffer_put_int64(Buffer *buffer, u_int64_t value)
207void * 215void *
208buffer_get_string(Buffer *buffer, u_int *length_ptr) 216buffer_get_string(Buffer *buffer, u_int *length_ptr)
209{ 217{
210 u_int len;
211 u_char *value; 218 u_char *value;
219 u_int len;
220
212 /* Get the length. */ 221 /* Get the length. */
213 len = buffer_get_int(buffer); 222 len = buffer_get_int(buffer);
214 if (len > 256 * 1024) 223 if (len > 256 * 1024)
@@ -249,6 +258,7 @@ int
249buffer_get_char(Buffer *buffer) 258buffer_get_char(Buffer *buffer)
250{ 259{
251 char ch; 260 char ch;
261
252 buffer_get(buffer, &ch, 1); 262 buffer_get(buffer, &ch, 1);
253 return (u_char) ch; 263 return (u_char) ch;
254} 264}
@@ -260,5 +270,6 @@ void
260buffer_put_char(Buffer *buffer, int value) 270buffer_put_char(Buffer *buffer, int value)
261{ 271{
262 char ch = value; 272 char ch = value;
273
263 buffer_append(buffer, &ch, 1); 274 buffer_append(buffer, &ch, 1);
264} 275}
diff --git a/servconf.c b/servconf.c
index fb6332c31..0d77c7078 100644
--- a/servconf.c
+++ b/servconf.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include "includes.h" 12#include "includes.h"
13RCSID("$OpenBSD: servconf.c,v 1.111 2002/06/20 23:05:55 markus Exp $"); 13RCSID("$OpenBSD: servconf.c,v 1.112 2002/06/23 09:46:51 deraadt Exp $");
14 14
15#if defined(KRB4) 15#if defined(KRB4)
16#include <krb.h> 16#include <krb.h>
@@ -423,7 +423,7 @@ add_one_listen_addr(ServerOptions *options, char *addr, u_short port)
423 hints.ai_family = IPv4or6; 423 hints.ai_family = IPv4or6;
424 hints.ai_socktype = SOCK_STREAM; 424 hints.ai_socktype = SOCK_STREAM;
425 hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0; 425 hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0;
426 snprintf(strport, sizeof strport, "%d", port); 426 snprintf(strport, sizeof strport, "%u", port);
427 if ((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0) 427 if ((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0)
428 fatal("bad addr or host: %s (%s)", 428 fatal("bad addr or host: %s (%s)",
429 addr ? addr : "<NULL>", 429 addr ? addr : "<NULL>",
@@ -439,9 +439,8 @@ process_server_config_line(ServerOptions *options, char *line,
439 const char *filename, int linenum) 439 const char *filename, int linenum)
440{ 440{
441 char *cp, **charptr, *arg, *p; 441 char *cp, **charptr, *arg, *p;
442 int *intptr, value; 442 int *intptr, value, i, n;
443 ServerOpCodes opcode; 443 ServerOpCodes opcode;
444 int i, n;
445 444
446 cp = line; 445 cp = line;
447 arg = strdelim(&cp); 446 arg = strdelim(&cp);
@@ -765,7 +764,8 @@ parse_flag:
765 if (options->num_allow_users >= MAX_ALLOW_USERS) 764 if (options->num_allow_users >= MAX_ALLOW_USERS)
766 fatal("%s line %d: too many allow users.", 765 fatal("%s line %d: too many allow users.",
767 filename, linenum); 766 filename, linenum);
768 options->allow_users[options->num_allow_users++] = xstrdup(arg); 767 options->allow_users[options->num_allow_users++] =
768 xstrdup(arg);
769 } 769 }
770 break; 770 break;
771 771
@@ -774,7 +774,8 @@ parse_flag:
774 if (options->num_deny_users >= MAX_DENY_USERS) 774 if (options->num_deny_users >= MAX_DENY_USERS)
775 fatal( "%s line %d: too many deny users.", 775 fatal( "%s line %d: too many deny users.",
776 filename, linenum); 776 filename, linenum);
777 options->deny_users[options->num_deny_users++] = xstrdup(arg); 777 options->deny_users[options->num_deny_users++] =
778 xstrdup(arg);
778 } 779 }
779 break; 780 break;
780 781
@@ -783,7 +784,8 @@ parse_flag:
783 if (options->num_allow_groups >= MAX_ALLOW_GROUPS) 784 if (options->num_allow_groups >= MAX_ALLOW_GROUPS)
784 fatal("%s line %d: too many allow groups.", 785 fatal("%s line %d: too many allow groups.",
785 filename, linenum); 786 filename, linenum);
786 options->allow_groups[options->num_allow_groups++] = xstrdup(arg); 787 options->allow_groups[options->num_allow_groups++] =
788 xstrdup(arg);
787 } 789 }
788 break; 790 break;
789 791
@@ -921,10 +923,9 @@ parse_flag:
921void 923void
922read_server_config(ServerOptions *options, const char *filename) 924read_server_config(ServerOptions *options, const char *filename)
923{ 925{
924 FILE *f; 926 int linenum, bad_options = 0;
925 char line[1024]; 927 char line[1024];
926 int linenum; 928 FILE *f;
927 int bad_options = 0;
928 929
929 f = fopen(filename, "r"); 930 f = fopen(filename, "r");
930 if (!f) { 931 if (!f) {