summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorAnil Madhavapeddy <avsm@cvs.openbsd.org>2004-08-11 21:43:06 +0000
committerAnil Madhavapeddy <avsm@cvs.openbsd.org>2004-08-11 21:43:06 +0000
commit1e8f8d3cdc3218b79cb25e1b4f8c10ef9145ee74 (patch)
tree0947aaa23f45c0d8f44507be1df3352fc4b695eb /usr.bin/ssh
parented15899e24d3418651bb041d592cb84bf2207c36 (diff)
some signed/unsigned int comparison cleanups; markus@ ok
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/channels.c47
-rw-r--r--usr.bin/ssh/channels.h4
-rw-r--r--usr.bin/ssh/clientloop.c7
-rw-r--r--usr.bin/ssh/misc.c4
-rw-r--r--usr.bin/ssh/misc.h6
-rw-r--r--usr.bin/ssh/serverloop.c7
-rw-r--r--usr.bin/ssh/ssh-agent.c7
7 files changed, 43 insertions, 39 deletions
diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c
index 3e7e398f901..24357a7a283 100644
--- a/usr.bin/ssh/channels.c
+++ b/usr.bin/ssh/channels.c
@@ -39,7 +39,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: channels.c,v 1.208 2004/07/11 17:48:47 deraadt Exp $");
+RCSID("$OpenBSD: channels.c,v 1.209 2004/08/11 21:43:04 avsm Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -68,7 +68,7 @@ static Channel **channels = NULL;
* Size of the channel array. All slots of the array must always be
* initialized (at least the type field); unused slots set to NULL
*/
-static int channels_alloc = 0;
+static u_int channels_alloc = 0;
/*
* Maximum file descriptor value used in any of the channels. This is
@@ -141,7 +141,7 @@ channel_lookup(int id)
{
Channel *c;
- if (id < 0 || id >= channels_alloc) {
+ if (id < 0 || (u_int)id >= channels_alloc) {
logit("channel_lookup: %d: bad id", id);
return NULL;
}
@@ -208,7 +208,8 @@ Channel *
channel_new(char *ctype, int type, int rfd, int wfd, int efd,
u_int window, u_int maxpack, int extusage, char *remote_name, int nonblock)
{
- int i, found;
+ int found;
+ u_int i;
Channel *c;
/* Do initial allocation if this is the first call. */
@@ -222,10 +223,10 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
for (found = -1, i = 0; i < channels_alloc; i++)
if (channels[i] == NULL) {
/* Found a free slot. */
- found = i;
+ found = (int)i;
break;
}
- if (found == -1) {
+ if (found < 0) {
/* There are no free slots. Take last+1 slot and expand the array. */
found = channels_alloc;
if (channels_alloc > 10000)
@@ -272,7 +273,8 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
static int
channel_find_maxfd(void)
{
- int i, max = 0;
+ u_int i;
+ int max = 0;
Channel *c;
for (i = 0; i < channels_alloc; i++) {
@@ -321,12 +323,12 @@ void
channel_free(Channel *c)
{
char *s;
- int i, n;
+ u_int i, n;
for (n = 0, i = 0; i < channels_alloc; i++)
if (channels[i])
n++;
- debug("channel %d: free: %s, nchannels %d", c->self,
+ debug("channel %d: free: %s, nchannels %u", c->self,
c->remote_name ? c->remote_name : "???", n);
s = channel_open_message();
@@ -352,7 +354,7 @@ channel_free(Channel *c)
void
channel_free_all(void)
{
- int i;
+ u_int i;
for (i = 0; i < channels_alloc; i++)
if (channels[i] != NULL)
@@ -367,7 +369,7 @@ channel_free_all(void)
void
channel_close_all(void)
{
- int i;
+ u_int i;
for (i = 0; i < channels_alloc; i++)
if (channels[i] != NULL)
@@ -381,7 +383,7 @@ channel_close_all(void)
void
channel_stop_listening(void)
{
- int i;
+ u_int i;
Channel *c;
for (i = 0; i < channels_alloc; i++) {
@@ -438,7 +440,7 @@ channel_not_very_much_buffered_data(void)
int
channel_still_open(void)
{
- int i;
+ u_int i;
Channel *c;
for (i = 0; i < channels_alloc; i++) {
@@ -481,7 +483,7 @@ channel_still_open(void)
int
channel_find_open(void)
{
- int i;
+ u_int i;
Channel *c;
for (i = 0; i < channels_alloc; i++) {
@@ -529,7 +531,7 @@ channel_open_message(void)
Buffer buffer;
Channel *c;
char buf[1024], *cp;
- int i;
+ u_int i;
buffer_init(&buffer);
snprintf(buf, sizeof buf, "The following connections are open:\r\n");
@@ -1668,7 +1670,7 @@ static void
channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset)
{
static int did_init = 0;
- int i;
+ u_int i;
Channel *c;
if (!did_init) {
@@ -1691,10 +1693,9 @@ channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset)
*/
void
channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
- int *nallocp, int rekeying)
+ u_int *nallocp, int rekeying)
{
- int n;
- u_int sz;
+ u_int n, sz;
n = MAX(*maxfdp, channel_max_fd);
@@ -1730,8 +1731,7 @@ void
channel_output_poll(void)
{
Channel *c;
- int i;
- u_int len;
+ u_int i, len;
for (i = 0; i < channels_alloc; i++) {
c = channels[i];
@@ -2260,7 +2260,8 @@ channel_setup_fwd_listener(int type, const char *listen_addr, u_short listen_por
int
channel_cancel_rport_listener(const char *host, u_short port)
{
- int i, found = 0;
+ u_int i;
+ int found = 0;
for(i = 0; i < channels_alloc; i++) {
Channel *c = channels[i];
@@ -2560,7 +2561,7 @@ channel_connect_to(const char *host, u_short port)
void
channel_send_window_changes(void)
{
- int i;
+ u_int i;
struct winsize ws;
for (i = 0; i < channels_alloc; i++) {
diff --git a/usr.bin/ssh/channels.h b/usr.bin/ssh/channels.h
index eef72c2e1b8..3aad0c1f181 100644
--- a/usr.bin/ssh/channels.h
+++ b/usr.bin/ssh/channels.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.h,v 1.73 2004/06/13 15:03:02 djm Exp $ */
+/* $OpenBSD: channels.h,v 1.74 2004/08/11 21:43:04 avsm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -183,7 +183,7 @@ void channel_input_window_adjust(int, u_int32_t, void *);
/* file descriptor handling (read/write) */
-void channel_prepare_select(fd_set **, fd_set **, int *, int*, int);
+void channel_prepare_select(fd_set **, fd_set **, int *, u_int*, int);
void channel_after_select(fd_set *, fd_set *);
void channel_output_poll(void);
diff --git a/usr.bin/ssh/clientloop.c b/usr.bin/ssh/clientloop.c
index def4d8a7baa..0b9a0fb29c8 100644
--- a/usr.bin/ssh/clientloop.c
+++ b/usr.bin/ssh/clientloop.c
@@ -59,7 +59,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: clientloop.c,v 1.129 2004/07/11 17:48:47 deraadt Exp $");
+RCSID("$OpenBSD: clientloop.c,v 1.130 2004/08/11 21:43:04 avsm Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -348,7 +348,7 @@ server_alive_check(void)
*/
static void
client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp,
- int *maxfdp, int *nallocp, int rekeying)
+ int *maxfdp, u_int *nallocp, int rekeying)
{
struct timeval tv, *tvp;
int ret;
@@ -1147,7 +1147,8 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
{
fd_set *readset = NULL, *writeset = NULL;
double start_time, total_time;
- int max_fd = 0, max_fd2 = 0, len, rekeying = 0, nalloc = 0;
+ int max_fd = 0, max_fd2 = 0, len, rekeying = 0;
+ u_int nalloc = 0;
char buf[100];
debug("Entering interactive session.");
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c
index 31c559d713a..26f62b6c16c 100644
--- a/usr.bin/ssh/misc.c
+++ b/usr.bin/ssh/misc.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: misc.c,v 1.24 2004/06/14 01:44:39 djm Exp $");
+RCSID("$OpenBSD: misc.c,v 1.25 2004/08/11 21:43:05 avsm Exp $");
#include "misc.h"
#include "log.h"
@@ -308,7 +308,7 @@ addargs(arglist *args, char *fmt, ...)
{
va_list ap;
char buf[1024];
- int nalloc;
+ u_int nalloc;
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
diff --git a/usr.bin/ssh/misc.h b/usr.bin/ssh/misc.h
index ffa8d8f27bd..ec47a611d48 100644
--- a/usr.bin/ssh/misc.h
+++ b/usr.bin/ssh/misc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.h,v 1.16 2004/06/17 15:10:14 djm Exp $ */
+/* $OpenBSD: misc.h,v 1.17 2004/08/11 21:43:05 avsm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -29,8 +29,8 @@ struct passwd *pwcopy(struct passwd *);
typedef struct arglist arglist;
struct arglist {
char **list;
- int num;
- int nalloc;
+ u_int num;
+ u_int nalloc;
};
void addargs(arglist *, char *, ...) __attribute__((format(printf, 2, 3)));
diff --git a/usr.bin/ssh/serverloop.c b/usr.bin/ssh/serverloop.c
index a9c8dcbf456..2f66aec692a 100644
--- a/usr.bin/ssh/serverloop.c
+++ b/usr.bin/ssh/serverloop.c
@@ -35,7 +35,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: serverloop.c,v 1.116 2004/05/21 11:33:11 djm Exp $");
+RCSID("$OpenBSD: serverloop.c,v 1.117 2004/08/11 21:43:05 avsm Exp $");
#include "xmalloc.h"
#include "packet.h"
@@ -238,7 +238,7 @@ client_alive_check(void)
*/
static void
wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
- int *nallocp, u_int max_time_milliseconds)
+ u_int *nallocp, u_int max_time_milliseconds)
{
struct timeval tv, *tvp;
int ret;
@@ -484,7 +484,8 @@ void
server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
{
fd_set *readset = NULL, *writeset = NULL;
- int max_fd = 0, nalloc = 0;
+ int max_fd = 0;
+ u_int nalloc = 0;
int wait_status; /* Status returned by wait(). */
pid_t wait_pid; /* pid returned by wait(). */
int waiting_termination = 0; /* Have displayed waiting close message. */
diff --git a/usr.bin/ssh/ssh-agent.c b/usr.bin/ssh/ssh-agent.c
index bca392f84e8..515dcc972ec 100644
--- a/usr.bin/ssh/ssh-agent.c
+++ b/usr.bin/ssh/ssh-agent.c
@@ -35,7 +35,7 @@
#include "includes.h"
#include <sys/queue.h>
-RCSID("$OpenBSD: ssh-agent.c,v 1.119 2004/06/14 01:44:39 djm Exp $");
+RCSID("$OpenBSD: ssh-agent.c,v 1.120 2004/08/11 21:43:05 avsm Exp $");
#include <openssl/evp.h>
#include <openssl/md5.h>
@@ -812,7 +812,7 @@ new_socket(sock_type type, int fd)
}
static int
-prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl, int *nallocp)
+prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl, u_int *nallocp)
{
u_int i, sz;
int n = 0;
@@ -998,7 +998,8 @@ int
main(int ac, char **av)
{
int c_flag = 0, d_flag = 0, k_flag = 0, s_flag = 0;
- int sock, fd, ch, nalloc;
+ int sock, fd, ch;
+ u_int nalloc;
char *shell, *format, *pidstr, *agentsocket = NULL;
fd_set *readsetp = NULL, *writesetp = NULL;
struct sockaddr_un sunaddr;