summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-08-13 21:18:00 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-08-13 21:18:00 +1000
commitc7a6fc41bfdcd73469b153437a8e75e0b1057894 (patch)
tree4ad8c688ec8a08573b3c2efa38af1dcc5df24222
parent03669a363eb8c76f460a75adc11d0eb933e4af49 (diff)
- avsm@cvs.openbsd.org 2004/08/11 21:43:05
[channels.c channels.h clientloop.c misc.c misc.h serverloop.c ssh-agent.c] some signed/unsigned int comparison cleanups; markus@ ok
-rw-r--r--ChangeLog6
-rw-r--r--channels.c47
-rw-r--r--channels.h4
-rw-r--r--clientloop.c7
-rw-r--r--misc.c4
-rw-r--r--misc.h6
-rw-r--r--serverloop.c7
-rw-r--r--ssh-agent.c7
8 files changed, 48 insertions, 40 deletions
diff --git a/ChangeLog b/ChangeLog
index fe0ff0099..6c5722e4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
120040813 120040813
2 - (dtucker) [openbsd-compat/bsd-misc.c] Typo in #ifdef; from vinschen at 2 - (dtucker) [openbsd-compat/bsd-misc.c] Typo in #ifdef; from vinschen at
3 redhat.com 3 redhat.com
4- (dtucker) OpenBSD CVS Sync
5 - avsm@cvs.openbsd.org 2004/08/11 21:43:05
6 [channels.c channels.h clientloop.c misc.c misc.h serverloop.c ssh-agent.c]
7 some signed/unsigned int comparison cleanups; markus@ ok
4 8
520040812 920040812
6 - (dtucker) [sshd.c] Remove duplicate variable imported during sync. 10 - (dtucker) [sshd.c] Remove duplicate variable imported during sync.
@@ -1598,4 +1602,4 @@
1598 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 1602 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
1599 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 1603 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
1600 1604
1601$Id: ChangeLog,v 1.3498 2004/08/13 08:37:21 dtucker Exp $ 1605$Id: ChangeLog,v 1.3499 2004/08/13 11:18:00 dtucker Exp $
diff --git a/channels.c b/channels.c
index cf46ce09f..1f6984aa7 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: channels.c,v 1.208 2004/07/11 17:48:47 deraadt Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.209 2004/08/11 21:43:04 avsm Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -68,7 +68,7 @@ static Channel **channels = NULL;
68 * Size of the channel array. All slots of the array must always be 68 * Size of the channel array. All slots of the array must always be
69 * initialized (at least the type field); unused slots set to NULL 69 * initialized (at least the type field); unused slots set to NULL
70 */ 70 */
71static int channels_alloc = 0; 71static u_int channels_alloc = 0;
72 72
73/* 73/*
74 * Maximum file descriptor value used in any of the channels. This is 74 * Maximum file descriptor value used in any of the channels. This is
@@ -141,7 +141,7 @@ channel_lookup(int id)
141{ 141{
142 Channel *c; 142 Channel *c;
143 143
144 if (id < 0 || id >= channels_alloc) { 144 if (id < 0 || (u_int)id >= channels_alloc) {
145 logit("channel_lookup: %d: bad id", id); 145 logit("channel_lookup: %d: bad id", id);
146 return NULL; 146 return NULL;
147 } 147 }
@@ -209,7 +209,8 @@ Channel *
209channel_new(char *ctype, int type, int rfd, int wfd, int efd, 209channel_new(char *ctype, int type, int rfd, int wfd, int efd,
210 u_int window, u_int maxpack, int extusage, char *remote_name, int nonblock) 210 u_int window, u_int maxpack, int extusage, char *remote_name, int nonblock)
211{ 211{
212 int i, found; 212 int found;
213 u_int i;
213 Channel *c; 214 Channel *c;
214 215
215 /* Do initial allocation if this is the first call. */ 216 /* Do initial allocation if this is the first call. */
@@ -223,10 +224,10 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
223 for (found = -1, i = 0; i < channels_alloc; i++) 224 for (found = -1, i = 0; i < channels_alloc; i++)
224 if (channels[i] == NULL) { 225 if (channels[i] == NULL) {
225 /* Found a free slot. */ 226 /* Found a free slot. */
226 found = i; 227 found = (int)i;
227 break; 228 break;
228 } 229 }
229 if (found == -1) { 230 if (found < 0) {
230 /* There are no free slots. Take last+1 slot and expand the array. */ 231 /* There are no free slots. Take last+1 slot and expand the array. */
231 found = channels_alloc; 232 found = channels_alloc;
232 if (channels_alloc > 10000) 233 if (channels_alloc > 10000)
@@ -273,7 +274,8 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
273static int 274static int
274channel_find_maxfd(void) 275channel_find_maxfd(void)
275{ 276{
276 int i, max = 0; 277 u_int i;
278 int max = 0;
277 Channel *c; 279 Channel *c;
278 280
279 for (i = 0; i < channels_alloc; i++) { 281 for (i = 0; i < channels_alloc; i++) {
@@ -322,12 +324,12 @@ void
322channel_free(Channel *c) 324channel_free(Channel *c)
323{ 325{
324 char *s; 326 char *s;
325 int i, n; 327 u_int i, n;
326 328
327 for (n = 0, i = 0; i < channels_alloc; i++) 329 for (n = 0, i = 0; i < channels_alloc; i++)
328 if (channels[i]) 330 if (channels[i])
329 n++; 331 n++;
330 debug("channel %d: free: %s, nchannels %d", c->self, 332 debug("channel %d: free: %s, nchannels %u", c->self,
331 c->remote_name ? c->remote_name : "???", n); 333 c->remote_name ? c->remote_name : "???", n);
332 334
333 s = channel_open_message(); 335 s = channel_open_message();
@@ -353,7 +355,7 @@ channel_free(Channel *c)
353void 355void
354channel_free_all(void) 356channel_free_all(void)
355{ 357{
356 int i; 358 u_int i;
357 359
358 for (i = 0; i < channels_alloc; i++) 360 for (i = 0; i < channels_alloc; i++)
359 if (channels[i] != NULL) 361 if (channels[i] != NULL)
@@ -368,7 +370,7 @@ channel_free_all(void)
368void 370void
369channel_close_all(void) 371channel_close_all(void)
370{ 372{
371 int i; 373 u_int i;
372 374
373 for (i = 0; i < channels_alloc; i++) 375 for (i = 0; i < channels_alloc; i++)
374 if (channels[i] != NULL) 376 if (channels[i] != NULL)
@@ -382,7 +384,7 @@ channel_close_all(void)
382void 384void
383channel_stop_listening(void) 385channel_stop_listening(void)
384{ 386{
385 int i; 387 u_int i;
386 Channel *c; 388 Channel *c;
387 389
388 for (i = 0; i < channels_alloc; i++) { 390 for (i = 0; i < channels_alloc; i++) {
@@ -439,7 +441,7 @@ channel_not_very_much_buffered_data(void)
439int 441int
440channel_still_open(void) 442channel_still_open(void)
441{ 443{
442 int i; 444 u_int i;
443 Channel *c; 445 Channel *c;
444 446
445 for (i = 0; i < channels_alloc; i++) { 447 for (i = 0; i < channels_alloc; i++) {
@@ -482,7 +484,7 @@ channel_still_open(void)
482int 484int
483channel_find_open(void) 485channel_find_open(void)
484{ 486{
485 int i; 487 u_int i;
486 Channel *c; 488 Channel *c;
487 489
488 for (i = 0; i < channels_alloc; i++) { 490 for (i = 0; i < channels_alloc; i++) {
@@ -530,7 +532,7 @@ channel_open_message(void)
530 Buffer buffer; 532 Buffer buffer;
531 Channel *c; 533 Channel *c;
532 char buf[1024], *cp; 534 char buf[1024], *cp;
533 int i; 535 u_int i;
534 536
535 buffer_init(&buffer); 537 buffer_init(&buffer);
536 snprintf(buf, sizeof buf, "The following connections are open:\r\n"); 538 snprintf(buf, sizeof buf, "The following connections are open:\r\n");
@@ -1674,7 +1676,7 @@ static void
1674channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset) 1676channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset)
1675{ 1677{
1676 static int did_init = 0; 1678 static int did_init = 0;
1677 int i; 1679 u_int i;
1678 Channel *c; 1680 Channel *c;
1679 1681
1680 if (!did_init) { 1682 if (!did_init) {
@@ -1697,10 +1699,9 @@ channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset)
1697 */ 1699 */
1698void 1700void
1699channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp, 1701channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
1700 int *nallocp, int rekeying) 1702 u_int *nallocp, int rekeying)
1701{ 1703{
1702 int n; 1704 u_int n, sz;
1703 u_int sz;
1704 1705
1705 n = MAX(*maxfdp, channel_max_fd); 1706 n = MAX(*maxfdp, channel_max_fd);
1706 1707
@@ -1736,8 +1737,7 @@ void
1736channel_output_poll(void) 1737channel_output_poll(void)
1737{ 1738{
1738 Channel *c; 1739 Channel *c;
1739 int i; 1740 u_int i, len;
1740 u_int len;
1741 1741
1742 for (i = 0; i < channels_alloc; i++) { 1742 for (i = 0; i < channels_alloc; i++) {
1743 c = channels[i]; 1743 c = channels[i];
@@ -2270,7 +2270,8 @@ channel_setup_fwd_listener(int type, const char *listen_addr, u_short listen_por
2270int 2270int
2271channel_cancel_rport_listener(const char *host, u_short port) 2271channel_cancel_rport_listener(const char *host, u_short port)
2272{ 2272{
2273 int i, found = 0; 2273 u_int i;
2274 int found = 0;
2274 2275
2275 for(i = 0; i < channels_alloc; i++) { 2276 for(i = 0; i < channels_alloc; i++) {
2276 Channel *c = channels[i]; 2277 Channel *c = channels[i];
@@ -2572,7 +2573,7 @@ channel_connect_to(const char *host, u_short port)
2572void 2573void
2573channel_send_window_changes(void) 2574channel_send_window_changes(void)
2574{ 2575{
2575 int i; 2576 u_int i;
2576 struct winsize ws; 2577 struct winsize ws;
2577 2578
2578 for (i = 0; i < channels_alloc; i++) { 2579 for (i = 0; i < channels_alloc; i++) {
diff --git a/channels.h b/channels.h
index 41f3cedd3..f8dc8249c 100644
--- a/channels.h
+++ b/channels.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.h,v 1.73 2004/06/13 15:03:02 djm Exp $ */ 1/* $OpenBSD: channels.h,v 1.74 2004/08/11 21:43:04 avsm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -184,7 +184,7 @@ void channel_input_window_adjust(int, u_int32_t, void *);
184 184
185/* file descriptor handling (read/write) */ 185/* file descriptor handling (read/write) */
186 186
187void channel_prepare_select(fd_set **, fd_set **, int *, int*, int); 187void channel_prepare_select(fd_set **, fd_set **, int *, u_int*, int);
188void channel_after_select(fd_set *, fd_set *); 188void channel_after_select(fd_set *, fd_set *);
189void channel_output_poll(void); 189void channel_output_poll(void);
190 190
diff --git a/clientloop.c b/clientloop.c
index def4d8a7b..0b9a0fb29 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -59,7 +59,7 @@
59 */ 59 */
60 60
61#include "includes.h" 61#include "includes.h"
62RCSID("$OpenBSD: clientloop.c,v 1.129 2004/07/11 17:48:47 deraadt Exp $"); 62RCSID("$OpenBSD: clientloop.c,v 1.130 2004/08/11 21:43:04 avsm Exp $");
63 63
64#include "ssh.h" 64#include "ssh.h"
65#include "ssh1.h" 65#include "ssh1.h"
@@ -348,7 +348,7 @@ server_alive_check(void)
348 */ 348 */
349static void 349static void
350client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, 350client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp,
351 int *maxfdp, int *nallocp, int rekeying) 351 int *maxfdp, u_int *nallocp, int rekeying)
352{ 352{
353 struct timeval tv, *tvp; 353 struct timeval tv, *tvp;
354 int ret; 354 int ret;
@@ -1147,7 +1147,8 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1147{ 1147{
1148 fd_set *readset = NULL, *writeset = NULL; 1148 fd_set *readset = NULL, *writeset = NULL;
1149 double start_time, total_time; 1149 double start_time, total_time;
1150 int max_fd = 0, max_fd2 = 0, len, rekeying = 0, nalloc = 0; 1150 int max_fd = 0, max_fd2 = 0, len, rekeying = 0;
1151 u_int nalloc = 0;
1151 char buf[100]; 1152 char buf[100];
1152 1153
1153 debug("Entering interactive session."); 1154 debug("Entering interactive session.");
diff --git a/misc.c b/misc.c
index 1c43bc007..8cb411ccc 100644
--- a/misc.c
+++ b/misc.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: misc.c,v 1.24 2004/06/14 01:44:39 djm Exp $"); 26RCSID("$OpenBSD: misc.c,v 1.25 2004/08/11 21:43:05 avsm Exp $");
27 27
28#include "misc.h" 28#include "misc.h"
29#include "log.h" 29#include "log.h"
@@ -314,7 +314,7 @@ addargs(arglist *args, char *fmt, ...)
314{ 314{
315 va_list ap; 315 va_list ap;
316 char buf[1024]; 316 char buf[1024];
317 int nalloc; 317 u_int nalloc;
318 318
319 va_start(ap, fmt); 319 va_start(ap, fmt);
320 vsnprintf(buf, sizeof(buf), fmt, ap); 320 vsnprintf(buf, sizeof(buf), fmt, ap);
diff --git a/misc.h b/misc.h
index ffa8d8f27..ec47a611d 100644
--- a/misc.h
+++ b/misc.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: misc.h,v 1.16 2004/06/17 15:10:14 djm Exp $ */ 1/* $OpenBSD: misc.h,v 1.17 2004/08/11 21:43:05 avsm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -29,8 +29,8 @@ struct passwd *pwcopy(struct passwd *);
29typedef struct arglist arglist; 29typedef struct arglist arglist;
30struct arglist { 30struct arglist {
31 char **list; 31 char **list;
32 int num; 32 u_int num;
33 int nalloc; 33 u_int nalloc;
34}; 34};
35void addargs(arglist *, char *, ...) __attribute__((format(printf, 2, 3))); 35void addargs(arglist *, char *, ...) __attribute__((format(printf, 2, 3)));
36 36
diff --git a/serverloop.c b/serverloop.c
index 8d2642d5b..eee1e7959 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: serverloop.c,v 1.116 2004/05/21 11:33:11 djm Exp $"); 38RCSID("$OpenBSD: serverloop.c,v 1.117 2004/08/11 21:43:05 avsm Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "packet.h" 41#include "packet.h"
@@ -240,7 +240,7 @@ client_alive_check(void)
240 */ 240 */
241static void 241static void
242wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp, 242wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
243 int *nallocp, u_int max_time_milliseconds) 243 u_int *nallocp, u_int max_time_milliseconds)
244{ 244{
245 struct timeval tv, *tvp; 245 struct timeval tv, *tvp;
246 int ret; 246 int ret;
@@ -486,7 +486,8 @@ void
486server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg) 486server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
487{ 487{
488 fd_set *readset = NULL, *writeset = NULL; 488 fd_set *readset = NULL, *writeset = NULL;
489 int max_fd = 0, nalloc = 0; 489 int max_fd = 0;
490 u_int nalloc = 0;
490 int wait_status; /* Status returned by wait(). */ 491 int wait_status; /* Status returned by wait(). */
491 pid_t wait_pid; /* pid returned by wait(). */ 492 pid_t wait_pid; /* pid returned by wait(). */
492 int waiting_termination = 0; /* Have displayed waiting close message. */ 493 int waiting_termination = 0; /* Have displayed waiting close message. */
diff --git a/ssh-agent.c b/ssh-agent.c
index 54ab4d7a2..bc4d8d33a 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -35,7 +35,7 @@
35 35
36#include "includes.h" 36#include "includes.h"
37#include "openbsd-compat/sys-queue.h" 37#include "openbsd-compat/sys-queue.h"
38RCSID("$OpenBSD: ssh-agent.c,v 1.119 2004/06/14 01:44:39 djm Exp $"); 38RCSID("$OpenBSD: ssh-agent.c,v 1.120 2004/08/11 21:43:05 avsm Exp $");
39 39
40#include <openssl/evp.h> 40#include <openssl/evp.h>
41#include <openssl/md5.h> 41#include <openssl/md5.h>
@@ -816,7 +816,7 @@ new_socket(sock_type type, int fd)
816} 816}
817 817
818static int 818static int
819prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl, int *nallocp) 819prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl, u_int *nallocp)
820{ 820{
821 u_int i, sz; 821 u_int i, sz;
822 int n = 0; 822 int n = 0;
@@ -1002,7 +1002,8 @@ int
1002main(int ac, char **av) 1002main(int ac, char **av)
1003{ 1003{
1004 int c_flag = 0, d_flag = 0, k_flag = 0, s_flag = 0; 1004 int c_flag = 0, d_flag = 0, k_flag = 0, s_flag = 0;
1005 int sock, fd, ch, nalloc; 1005 int sock, fd, ch;
1006 u_int nalloc;
1006 char *shell, *format, *pidstr, *agentsocket = NULL; 1007 char *shell, *format, *pidstr, *agentsocket = NULL;
1007 fd_set *readsetp = NULL, *writesetp = NULL; 1008 fd_set *readsetp = NULL, *writesetp = NULL;
1008 struct sockaddr_un sunaddr; 1009 struct sockaddr_un sunaddr;