- (djm) [loginrec.c ssh-rand-helper.c] Fix -Wsign-compare for portable,

tested and fixes tim@
This commit is contained in:
Damien Miller 2005-06-19 10:19:43 +10:00
parent 1060753147
commit 52c8afeec5
5 changed files with 14 additions and 11 deletions

View File

@ -6,6 +6,8 @@
polish dtucker@) polish dtucker@)
- djm@cvs.openbsd.org 2005/06/17 02:44:33 - djm@cvs.openbsd.org 2005/06/17 02:44:33
[auth1.c] make this -Wsign-compare clean; ok avsm@ markus@ [auth1.c] make this -Wsign-compare clean; ok avsm@ markus@
- (djm) [loginrec.c ssh-rand-helper.c] Fix -Wsign-compare for portable,
tested and fixes tim@
20050617 20050617
- (djm) OpenBSD CVS Sync - (djm) OpenBSD CVS Sync
@ -2747,4 +2749,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.3826 2005/06/18 21:36:10 djm Exp $ $Id: ChangeLog,v 1.3827 2005/06/19 00:19:43 djm Exp $

View File

@ -1,4 +1,4 @@
# $Id: configure.ac,v 1.275 2005/06/07 07:53:40 dtucker Exp $ # $Id: configure.ac,v 1.276 2005/06/19 00:19:43 djm Exp $
# #
# Copyright (c) 1999-2004 Damien Miller # Copyright (c) 1999-2004 Damien Miller
# #
@ -82,6 +82,7 @@ AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
if test "$GCC" = "yes" || test "$GCC" = "egcs"; then if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized" CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
CFLAGS="$CFLAGS -Wsign-compare"
if test -z "$have_llong_max"; then if test -z "$have_llong_max"; then
# retry LLONG_MAX with -std=gnu99, needed on some Linuxes # retry LLONG_MAX with -std=gnu99, needed on some Linuxes

View File

@ -165,7 +165,7 @@
# include <libutil.h> # include <libutil.h>
#endif #endif
RCSID("$Id: loginrec.c,v 1.67 2005/02/15 11:19:28 dtucker Exp $"); RCSID("$Id: loginrec.c,v 1.68 2005/06/19 00:19:43 djm Exp $");
/** /**
** prototypes for helper functions in this file ** prototypes for helper functions in this file
@ -534,7 +534,7 @@ getlast_entry(struct logininfo *li)
* sure dst has enough space, if not just copy src (ugh) * sure dst has enough space, if not just copy src (ugh)
*/ */
char * char *
line_fullname(char *dst, const char *src, int dstsize) line_fullname(char *dst, const char *src, u_int dstsize)
{ {
memset(dst, '\0', dstsize); memset(dst, '\0', dstsize);
if ((strncmp(src, "/dev/", 5) == 0) || (dstsize < (strlen(src) + 5))) if ((strncmp(src, "/dev/", 5) == 0) || (dstsize < (strlen(src) + 5)))

View File

@ -35,7 +35,7 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/socket.h> #include <sys/socket.h>
/* RCSID("$Id: loginrec.h,v 1.9 2005/02/02 06:10:11 dtucker Exp $"); */ /* RCSID("$Id: loginrec.h,v 1.10 2005/06/19 00:19:44 djm Exp $"); */
/** /**
** you should use the login_* calls to work around platform dependencies ** you should use the login_* calls to work around platform dependencies
@ -128,7 +128,7 @@ struct logininfo *login_get_lastlog(struct logininfo *li, const int uid);
unsigned int login_get_lastlog_time(const int uid); unsigned int login_get_lastlog_time(const int uid);
/* produce various forms of the line filename */ /* produce various forms of the line filename */
char *line_fullname(char *dst, const char *src, int dstsize); char *line_fullname(char *dst, const char *src, u_int dstsize);
char *line_stripname(char *dst, const char *src, int dstsize); char *line_stripname(char *dst, const char *src, int dstsize);
char *line_abbrevname(char *dst, const char *src, int dstsize); char *line_abbrevname(char *dst, const char *src, int dstsize);

View File

@ -39,7 +39,7 @@
#include "pathnames.h" #include "pathnames.h"
#include "log.h" #include "log.h"
RCSID("$Id: ssh-rand-helper.c,v 1.23 2005/02/16 02:32:30 dtucker Exp $"); RCSID("$Id: ssh-rand-helper.c,v 1.24 2005/06/19 00:19:44 djm Exp $");
/* Number of bytes we write out */ /* Number of bytes we write out */
#define OUTPUT_SEED_SIZE 48 #define OUTPUT_SEED_SIZE 48
@ -123,7 +123,7 @@ get_random_bytes_prngd(unsigned char *buf, int len,
unsigned short tcp_port, char *socket_path) unsigned short tcp_port, char *socket_path)
{ {
int fd, addr_len, rval, errors; int fd, addr_len, rval, errors;
char msg[2]; u_char msg[2];
struct sockaddr_storage addr; struct sockaddr_storage addr;
struct sockaddr_in *addr_in = (struct sockaddr_in *)&addr; struct sockaddr_in *addr_in = (struct sockaddr_in *)&addr;
struct sockaddr_un *addr_un = (struct sockaddr_un *)&addr; struct sockaddr_un *addr_un = (struct sockaddr_un *)&addr;
@ -135,8 +135,8 @@ get_random_bytes_prngd(unsigned char *buf, int len,
if (socket_path != NULL && if (socket_path != NULL &&
strlen(socket_path) >= sizeof(addr_un->sun_path)) strlen(socket_path) >= sizeof(addr_un->sun_path))
fatal("Random pool path is too long"); fatal("Random pool path is too long");
if (len > 255) if (len <= 0 || len > 255)
fatal("Too many bytes to read from PRNGD"); fatal("Too many bytes (%d) to read from PRNGD", len);
memset(&addr, '\0', sizeof(addr)); memset(&addr, '\0', sizeof(addr));
@ -190,7 +190,7 @@ reopen:
goto done; goto done;
} }
if (atomicio(read, fd, buf, len) != len) { if (atomicio(read, fd, buf, len) != (size_t)len) {
if (errno == EPIPE && errors < 10) { if (errno == EPIPE && errors < 10) {
close(fd); close(fd);
errors++; errors++;