mirror of
git://anongit.mindrot.org/openssh.git
synced 2025-01-03 00:02:05 +00:00
- 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
This commit is contained in:
parent
03669a363e
commit
c7a6fc41bf
@ -1,6 +1,10 @@
|
|||||||
20040813
|
20040813
|
||||||
- (dtucker) [openbsd-compat/bsd-misc.c] Typo in #ifdef; from vinschen at
|
- (dtucker) [openbsd-compat/bsd-misc.c] Typo in #ifdef; from vinschen at
|
||||||
redhat.com
|
redhat.com
|
||||||
|
- (dtucker) OpenBSD CVS Sync
|
||||||
|
- 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
|
||||||
|
|
||||||
20040812
|
20040812
|
||||||
- (dtucker) [sshd.c] Remove duplicate variable imported during sync.
|
- (dtucker) [sshd.c] Remove duplicate variable imported during sync.
|
||||||
@ -1598,4 +1602,4 @@
|
|||||||
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
||||||
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.3498 2004/08/13 08:37:21 dtucker Exp $
|
$Id: ChangeLog,v 1.3499 2004/08/13 11:18:00 dtucker Exp $
|
||||||
|
47
channels.c
47
channels.c
@ -39,7 +39,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#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 "ssh.h"
|
||||||
#include "ssh1.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
|
* Size of the channel array. All slots of the array must always be
|
||||||
* initialized (at least the type field); unused slots set to NULL
|
* 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
|
* Maximum file descriptor value used in any of the channels. This is
|
||||||
@ -141,7 +141,7 @@ channel_lookup(int id)
|
|||||||
{
|
{
|
||||||
Channel *c;
|
Channel *c;
|
||||||
|
|
||||||
if (id < 0 || id >= channels_alloc) {
|
if (id < 0 || (u_int)id >= channels_alloc) {
|
||||||
logit("channel_lookup: %d: bad id", id);
|
logit("channel_lookup: %d: bad id", id);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -209,7 +209,8 @@ Channel *
|
|||||||
channel_new(char *ctype, int type, int rfd, int wfd, int efd,
|
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)
|
u_int window, u_int maxpack, int extusage, char *remote_name, int nonblock)
|
||||||
{
|
{
|
||||||
int i, found;
|
int found;
|
||||||
|
u_int i;
|
||||||
Channel *c;
|
Channel *c;
|
||||||
|
|
||||||
/* Do initial allocation if this is the first call. */
|
/* 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,
|
|||||||
for (found = -1, i = 0; i < channels_alloc; i++)
|
for (found = -1, i = 0; i < channels_alloc; i++)
|
||||||
if (channels[i] == NULL) {
|
if (channels[i] == NULL) {
|
||||||
/* Found a free slot. */
|
/* Found a free slot. */
|
||||||
found = i;
|
found = (int)i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (found == -1) {
|
if (found < 0) {
|
||||||
/* There are no free slots. Take last+1 slot and expand the array. */
|
/* There are no free slots. Take last+1 slot and expand the array. */
|
||||||
found = channels_alloc;
|
found = channels_alloc;
|
||||||
if (channels_alloc > 10000)
|
if (channels_alloc > 10000)
|
||||||
@ -273,7 +274,8 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
|
|||||||
static int
|
static int
|
||||||
channel_find_maxfd(void)
|
channel_find_maxfd(void)
|
||||||
{
|
{
|
||||||
int i, max = 0;
|
u_int i;
|
||||||
|
int max = 0;
|
||||||
Channel *c;
|
Channel *c;
|
||||||
|
|
||||||
for (i = 0; i < channels_alloc; i++) {
|
for (i = 0; i < channels_alloc; i++) {
|
||||||
@ -322,12 +324,12 @@ void
|
|||||||
channel_free(Channel *c)
|
channel_free(Channel *c)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
int i, n;
|
u_int i, n;
|
||||||
|
|
||||||
for (n = 0, i = 0; i < channels_alloc; i++)
|
for (n = 0, i = 0; i < channels_alloc; i++)
|
||||||
if (channels[i])
|
if (channels[i])
|
||||||
n++;
|
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);
|
c->remote_name ? c->remote_name : "???", n);
|
||||||
|
|
||||||
s = channel_open_message();
|
s = channel_open_message();
|
||||||
@ -353,7 +355,7 @@ channel_free(Channel *c)
|
|||||||
void
|
void
|
||||||
channel_free_all(void)
|
channel_free_all(void)
|
||||||
{
|
{
|
||||||
int i;
|
u_int i;
|
||||||
|
|
||||||
for (i = 0; i < channels_alloc; i++)
|
for (i = 0; i < channels_alloc; i++)
|
||||||
if (channels[i] != NULL)
|
if (channels[i] != NULL)
|
||||||
@ -368,7 +370,7 @@ channel_free_all(void)
|
|||||||
void
|
void
|
||||||
channel_close_all(void)
|
channel_close_all(void)
|
||||||
{
|
{
|
||||||
int i;
|
u_int i;
|
||||||
|
|
||||||
for (i = 0; i < channels_alloc; i++)
|
for (i = 0; i < channels_alloc; i++)
|
||||||
if (channels[i] != NULL)
|
if (channels[i] != NULL)
|
||||||
@ -382,7 +384,7 @@ channel_close_all(void)
|
|||||||
void
|
void
|
||||||
channel_stop_listening(void)
|
channel_stop_listening(void)
|
||||||
{
|
{
|
||||||
int i;
|
u_int i;
|
||||||
Channel *c;
|
Channel *c;
|
||||||
|
|
||||||
for (i = 0; i < channels_alloc; i++) {
|
for (i = 0; i < channels_alloc; i++) {
|
||||||
@ -439,7 +441,7 @@ channel_not_very_much_buffered_data(void)
|
|||||||
int
|
int
|
||||||
channel_still_open(void)
|
channel_still_open(void)
|
||||||
{
|
{
|
||||||
int i;
|
u_int i;
|
||||||
Channel *c;
|
Channel *c;
|
||||||
|
|
||||||
for (i = 0; i < channels_alloc; i++) {
|
for (i = 0; i < channels_alloc; i++) {
|
||||||
@ -482,7 +484,7 @@ channel_still_open(void)
|
|||||||
int
|
int
|
||||||
channel_find_open(void)
|
channel_find_open(void)
|
||||||
{
|
{
|
||||||
int i;
|
u_int i;
|
||||||
Channel *c;
|
Channel *c;
|
||||||
|
|
||||||
for (i = 0; i < channels_alloc; i++) {
|
for (i = 0; i < channels_alloc; i++) {
|
||||||
@ -530,7 +532,7 @@ channel_open_message(void)
|
|||||||
Buffer buffer;
|
Buffer buffer;
|
||||||
Channel *c;
|
Channel *c;
|
||||||
char buf[1024], *cp;
|
char buf[1024], *cp;
|
||||||
int i;
|
u_int i;
|
||||||
|
|
||||||
buffer_init(&buffer);
|
buffer_init(&buffer);
|
||||||
snprintf(buf, sizeof buf, "The following connections are open:\r\n");
|
snprintf(buf, sizeof buf, "The following connections are open:\r\n");
|
||||||
@ -1674,7 +1676,7 @@ static void
|
|||||||
channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset)
|
channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset)
|
||||||
{
|
{
|
||||||
static int did_init = 0;
|
static int did_init = 0;
|
||||||
int i;
|
u_int i;
|
||||||
Channel *c;
|
Channel *c;
|
||||||
|
|
||||||
if (!did_init) {
|
if (!did_init) {
|
||||||
@ -1697,10 +1699,9 @@ channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
|
channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
|
||||||
int *nallocp, int rekeying)
|
u_int *nallocp, int rekeying)
|
||||||
{
|
{
|
||||||
int n;
|
u_int n, sz;
|
||||||
u_int sz;
|
|
||||||
|
|
||||||
n = MAX(*maxfdp, channel_max_fd);
|
n = MAX(*maxfdp, channel_max_fd);
|
||||||
|
|
||||||
@ -1736,8 +1737,7 @@ void
|
|||||||
channel_output_poll(void)
|
channel_output_poll(void)
|
||||||
{
|
{
|
||||||
Channel *c;
|
Channel *c;
|
||||||
int i;
|
u_int i, len;
|
||||||
u_int len;
|
|
||||||
|
|
||||||
for (i = 0; i < channels_alloc; i++) {
|
for (i = 0; i < channels_alloc; i++) {
|
||||||
c = channels[i];
|
c = channels[i];
|
||||||
@ -2270,7 +2270,8 @@ channel_setup_fwd_listener(int type, const char *listen_addr, u_short listen_por
|
|||||||
int
|
int
|
||||||
channel_cancel_rport_listener(const char *host, u_short port)
|
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++) {
|
for(i = 0; i < channels_alloc; i++) {
|
||||||
Channel *c = channels[i];
|
Channel *c = channels[i];
|
||||||
@ -2572,7 +2573,7 @@ channel_connect_to(const char *host, u_short port)
|
|||||||
void
|
void
|
||||||
channel_send_window_changes(void)
|
channel_send_window_changes(void)
|
||||||
{
|
{
|
||||||
int i;
|
u_int i;
|
||||||
struct winsize ws;
|
struct winsize ws;
|
||||||
|
|
||||||
for (i = 0; i < channels_alloc; i++) {
|
for (i = 0; i < channels_alloc; i++) {
|
||||||
|
@ -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>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
@ -184,7 +184,7 @@ void channel_input_window_adjust(int, u_int32_t, void *);
|
|||||||
|
|
||||||
/* file descriptor handling (read/write) */
|
/* 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_after_select(fd_set *, fd_set *);
|
||||||
void channel_output_poll(void);
|
void channel_output_poll(void);
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#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 "ssh.h"
|
||||||
#include "ssh1.h"
|
#include "ssh1.h"
|
||||||
@ -348,7 +348,7 @@ server_alive_check(void)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp,
|
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;
|
struct timeval tv, *tvp;
|
||||||
int ret;
|
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;
|
fd_set *readset = NULL, *writeset = NULL;
|
||||||
double start_time, total_time;
|
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];
|
char buf[100];
|
||||||
|
|
||||||
debug("Entering interactive session.");
|
debug("Entering interactive session.");
|
||||||
|
4
misc.c
4
misc.c
@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#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 "misc.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@ -314,7 +314,7 @@ addargs(arglist *args, char *fmt, ...)
|
|||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
int nalloc;
|
u_int nalloc;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsnprintf(buf, sizeof(buf), fmt, ap);
|
vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||||
|
6
misc.h
6
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>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
@ -29,8 +29,8 @@ struct passwd *pwcopy(struct passwd *);
|
|||||||
typedef struct arglist arglist;
|
typedef struct arglist arglist;
|
||||||
struct arglist {
|
struct arglist {
|
||||||
char **list;
|
char **list;
|
||||||
int num;
|
u_int num;
|
||||||
int nalloc;
|
u_int nalloc;
|
||||||
};
|
};
|
||||||
void addargs(arglist *, char *, ...) __attribute__((format(printf, 2, 3)));
|
void addargs(arglist *, char *, ...) __attribute__((format(printf, 2, 3)));
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#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 "xmalloc.h"
|
||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
@ -240,7 +240,7 @@ client_alive_check(void)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
|
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;
|
struct timeval tv, *tvp;
|
||||||
int ret;
|
int ret;
|
||||||
@ -486,7 +486,8 @@ void
|
|||||||
server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
|
server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
|
||||||
{
|
{
|
||||||
fd_set *readset = NULL, *writeset = NULL;
|
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(). */
|
int wait_status; /* Status returned by wait(). */
|
||||||
pid_t wait_pid; /* pid returned by wait(). */
|
pid_t wait_pid; /* pid returned by wait(). */
|
||||||
int waiting_termination = 0; /* Have displayed waiting close message. */
|
int waiting_termination = 0; /* Have displayed waiting close message. */
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
#include "openbsd-compat/sys-queue.h"
|
#include "openbsd-compat/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/evp.h>
|
||||||
#include <openssl/md5.h>
|
#include <openssl/md5.h>
|
||||||
@ -816,7 +816,7 @@ new_socket(sock_type type, int fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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;
|
u_int i, sz;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
@ -1002,7 +1002,8 @@ int
|
|||||||
main(int ac, char **av)
|
main(int ac, char **av)
|
||||||
{
|
{
|
||||||
int c_flag = 0, d_flag = 0, k_flag = 0, s_flag = 0;
|
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;
|
char *shell, *format, *pidstr, *agentsocket = NULL;
|
||||||
fd_set *readsetp = NULL, *writesetp = NULL;
|
fd_set *readsetp = NULL, *writesetp = NULL;
|
||||||
struct sockaddr_un sunaddr;
|
struct sockaddr_un sunaddr;
|
||||||
|
Loading…
Reference in New Issue
Block a user