Fixed some compiler warnings
This commit is contained in:
parent
69d4e13520
commit
51940ae330
@ -238,6 +238,9 @@
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef uid_t
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef ssize_t
|
||||
|
||||
/* Define as `fork' if `vfork' does not work. */
|
||||
#undef vfork
|
||||
|
||||
|
63
configure
vendored
63
configure
vendored
@ -7793,6 +7793,69 @@ _ACEOF
|
||||
|
||||
fi
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for ssize_t" >&5
|
||||
echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_type_ssize_t+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
typedef ssize_t ac__type_new_;
|
||||
int
|
||||
main ()
|
||||
{
|
||||
if ((ac__type_new_ *) 0)
|
||||
return 0;
|
||||
if (sizeof (ac__type_new_))
|
||||
return 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_cv_type_ssize_t=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_type_ssize_t=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5
|
||||
echo "${ECHO_T}$ac_cv_type_ssize_t" >&6; }
|
||||
if test $ac_cv_type_ssize_t = yes; then
|
||||
:
|
||||
else
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define ssize_t int
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for struct stat.st_blksize" >&5
|
||||
echo $ECHO_N "checking for struct stat.st_blksize... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_member_struct_stat_st_blksize+set}" = set; then
|
||||
|
@ -230,6 +230,7 @@ AC_TYPE_OFF_T
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_MODE_T
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_SSIZE_T
|
||||
AC_STRUCT_ST_BLKSIZE
|
||||
AC_HEADER_STAT
|
||||
AC_STRUCT_TM
|
||||
|
172
lib/nntp.c
172
lib/nntp.c
@ -44,99 +44,99 @@ struct sockaddr_in nntp_rem; /* For remote socket address */
|
||||
|
||||
int nntp_connect(void)
|
||||
{
|
||||
int addrlen;
|
||||
char *p;
|
||||
socklen_t addrlen;
|
||||
char *p;
|
||||
|
||||
if (nntpsock != -1)
|
||||
return nntpsock;
|
||||
if (nntpsock != -1)
|
||||
return nntpsock;
|
||||
|
||||
if (!strlen(CFG.nntpnode)) {
|
||||
WriteError("NNTP: host not configured");
|
||||
return -1;
|
||||
if (!strlen(CFG.nntpnode)) {
|
||||
WriteError("NNTP: host not configured");
|
||||
return -1;
|
||||
}
|
||||
|
||||
Syslog('+', "NNTP: connecting host: %s", CFG.nntpnode);
|
||||
memset(&nntp_loc, 0, sizeof(struct sockaddr_in));
|
||||
memset(&nntp_rem, 0, sizeof(struct sockaddr_in));
|
||||
|
||||
nntp_rem.sin_family = AF_INET;
|
||||
|
||||
if ((nhp = gethostbyname(CFG.nntpnode)) == NULL) {
|
||||
WriteError("NNTP: can't find host %s", CFG.nntpnode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
nntp_rem.sin_addr.s_addr = ((struct in_addr *)(nhp->h_addr))->s_addr;
|
||||
|
||||
if ((nsp = getservbyname("nntp", "tcp")) == NULL) {
|
||||
WriteError("NNTP: can't find service port for nntp/tcp");
|
||||
return -1;
|
||||
}
|
||||
nntp_rem.sin_port = nsp->s_port;
|
||||
|
||||
if ((nntpsock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
|
||||
WriteError("$NNTP: unable to create tcp socket");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (connect(nntpsock, (struct sockaddr *)&nntp_rem, sizeof(struct sockaddr_in)) == -1) {
|
||||
WriteError("$NNTP: cannot connect tcp socket");
|
||||
return -1;
|
||||
}
|
||||
|
||||
addrlen = sizeof(struct sockaddr_in);
|
||||
|
||||
if (getsockname(nntpsock, (struct sockaddr *)&nntp_loc, &addrlen) == -1) {
|
||||
WriteError("$NNTP: unable to read socket address");
|
||||
return -1;
|
||||
}
|
||||
|
||||
p = nntp_receive();
|
||||
if (strlen(p) == 0) {
|
||||
WriteError("NNTP: no response");
|
||||
nntp_close();
|
||||
return -1;
|
||||
}
|
||||
Syslog('+', "NNTP: %s", p);
|
||||
|
||||
if (strncmp(p, "480", 3) == 0) {
|
||||
/*
|
||||
* Must login with username and password
|
||||
*/
|
||||
if (nntp_auth() == FALSE) {
|
||||
WriteError("Authorisation failure");
|
||||
nntp_close();
|
||||
return -1;
|
||||
}
|
||||
|
||||
Syslog('+', "NNTP: connecting host: %s", CFG.nntpnode);
|
||||
memset(&nntp_loc, 0, sizeof(struct sockaddr_in));
|
||||
memset(&nntp_rem, 0, sizeof(struct sockaddr_in));
|
||||
|
||||
nntp_rem.sin_family = AF_INET;
|
||||
|
||||
if ((nhp = gethostbyname(CFG.nntpnode)) == NULL) {
|
||||
WriteError("NNTP: can't find host %s", CFG.nntpnode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
nntp_rem.sin_addr.s_addr = ((struct in_addr *)(nhp->h_addr))->s_addr;
|
||||
|
||||
if ((nsp = getservbyname("nntp", "tcp")) == NULL) {
|
||||
WriteError("NNTP: can't find service port for nntp/tcp");
|
||||
return -1;
|
||||
}
|
||||
nntp_rem.sin_port = nsp->s_port;
|
||||
|
||||
if ((nntpsock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
|
||||
WriteError("$NNTP: unable to create tcp socket");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (connect(nntpsock, (struct sockaddr *)&nntp_rem, sizeof(struct sockaddr_in)) == -1) {
|
||||
WriteError("$NNTP: cannot connect tcp socket");
|
||||
return -1;
|
||||
}
|
||||
|
||||
addrlen = sizeof(struct sockaddr_in);
|
||||
|
||||
if (getsockname(nntpsock, (struct sockaddr *)&nntp_loc, &addrlen) == -1) {
|
||||
WriteError("$NNTP: unable to read socket address");
|
||||
return -1;
|
||||
}
|
||||
|
||||
p = nntp_receive();
|
||||
if (strlen(p) == 0) {
|
||||
WriteError("NNTP: no response");
|
||||
nntp_close();
|
||||
return -1;
|
||||
}
|
||||
Syslog('+', "NNTP: %s", p);
|
||||
|
||||
if (strncmp(p, "480", 3) == 0) {
|
||||
/*
|
||||
* Must login with username and password
|
||||
*/
|
||||
if (nntp_auth() == FALSE) {
|
||||
WriteError("Authorisation failure");
|
||||
nntp_close();
|
||||
return -1;
|
||||
}
|
||||
} else if (strncmp(p, "200", 3)) {
|
||||
WriteError("NNTP: bad response: %s", p);
|
||||
} else if (strncmp(p, "200", 3)) {
|
||||
WriteError("NNTP: bad response: %s", p);
|
||||
// nntp_close(); FIXME: Don't close, the other end might have done that already
|
||||
// If we do also, this program hangs. Must be fixed!
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (CFG.modereader) {
|
||||
Syslog('+', "NNTP: setting mode reader");
|
||||
nntp_send((char *)"MODE READER\r\n");
|
||||
p = nntp_receive();
|
||||
Syslog('+', "NNTP: %s", p);
|
||||
if (strncmp(p, "480", 3) == 0) {
|
||||
/*
|
||||
* Must login with username and password
|
||||
*/
|
||||
Syslog('+', "NNTP: %s", p);
|
||||
if (nntp_auth() == FALSE) {
|
||||
WriteError("NNTP: authorisation failure");
|
||||
nntp_close();
|
||||
return -1;
|
||||
}
|
||||
} else if (strncmp(p, "200", 3)) {
|
||||
WriteError("NNTP: bad response: %s", p);
|
||||
nntp_close();
|
||||
return -1;
|
||||
}
|
||||
if (CFG.modereader) {
|
||||
Syslog('+', "NNTP: setting mode reader");
|
||||
nntp_send((char *)"MODE READER\r\n");
|
||||
p = nntp_receive();
|
||||
Syslog('+', "NNTP: %s", p);
|
||||
if (strncmp(p, "480", 3) == 0) {
|
||||
/*
|
||||
* Must login with username and password
|
||||
*/
|
||||
Syslog('+', "NNTP: %s", p);
|
||||
if (nntp_auth() == FALSE) {
|
||||
WriteError("NNTP: authorisation failure");
|
||||
nntp_close();
|
||||
return -1;
|
||||
}
|
||||
} else if (strncmp(p, "200", 3)) {
|
||||
WriteError("NNTP: bad response: %s", p);
|
||||
nntp_close();
|
||||
return -1;
|
||||
}
|
||||
return nntpsock;
|
||||
}
|
||||
return nntpsock;
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,7 +43,7 @@ struct sockaddr_in pop3_rem; /* For remote socket address */
|
||||
|
||||
int pop3_connect(void)
|
||||
{
|
||||
int addrlen;
|
||||
socklen_t addrlen;
|
||||
char *p;
|
||||
|
||||
if (!strlen(CFG.popnode)) {
|
||||
|
@ -43,7 +43,7 @@ struct sockaddr_in smtp_rem; /* For remote socket address */
|
||||
|
||||
int smtp_connect(void)
|
||||
{
|
||||
int addrlen;
|
||||
socklen_t addrlen;
|
||||
char *p, temp[40];
|
||||
|
||||
if (smtpsock != -1)
|
||||
|
@ -1805,7 +1805,7 @@ int binkp_send_frame(int cmd, char *buf, int len)
|
||||
#ifdef HAVE_ZLIB_H
|
||||
int rcz, last;
|
||||
uLongf zlen;
|
||||
char *zbuf;
|
||||
Bytef *zbuf;
|
||||
|
||||
if ((len >= BINKP_PLZ_BLOCK) && (bp.PLZwe == Active)) {
|
||||
WriteError("Can't send block of %d bytes in PLZ mode", len);
|
||||
@ -1841,7 +1841,7 @@ int binkp_send_frame(int cmd, char *buf, int len)
|
||||
if ((bp.PLZwe == Active) && (len > 20) && (!cmd) && (bp.tmode != CompGZ) && (bp.tmode != CompBZ2)) {
|
||||
zbuf = calloc(BINKP_ZIPBUFLEN, sizeof(char));
|
||||
zlen = BINKP_PLZ_BLOCK -1;
|
||||
rcz = compress2(zbuf, &zlen, buf, len, 9);
|
||||
rcz = compress2(zbuf, &zlen, (Bytef *)buf, (uLong)len, 9);
|
||||
if (rcz == Z_OK) {
|
||||
Syslog('b', "Binkp: compressed OK, srclen=%d, destlen=%d, will send compressed=%s",
|
||||
len, zlen, (zlen < len) ?"yes":"no");
|
||||
@ -1867,7 +1867,7 @@ int binkp_send_frame(int cmd, char *buf, int len)
|
||||
if (!rc)
|
||||
rc = PUTCHAR(header & 0x00ff);
|
||||
if (zlen && !rc)
|
||||
rc = PUT(zbuf, zlen);
|
||||
rc = PUT((char *)zbuf, (int)zlen);
|
||||
} else {
|
||||
rc = PUTCHAR((header >> 8) & 0x00ff);
|
||||
if (!rc)
|
||||
@ -2357,7 +2357,7 @@ int binkp_poll_frame(void)
|
||||
if ((bp.PLZthey == Active) && (bp.header & BINKP_PLZ_BLOCK) && (bp.rmode == CompNone) && bp.blklen) {
|
||||
zbuf = calloc(BINKP_ZIPBUFLEN, sizeof(char));
|
||||
zlen = BINKP_PLZ_BLOCK -1;
|
||||
rc = uncompress(zbuf, &zlen, bp.rxbuf, bp.rxlen -1);
|
||||
rc = uncompress((Bytef *)zbuf, &zlen, (Bytef *)bp.rxbuf, bp.rxlen -1);
|
||||
if (rc == Z_OK) {
|
||||
bp.rxcompressed += (zlen - (bp.rxlen -1));
|
||||
memmove(bp.rxbuf, zbuf, zlen);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: MD5 for binkp protocol driver
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2004
|
||||
* Copyright (C) 1997-2007
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -514,7 +514,7 @@ char *MD_buildDigest(char *pw, unsigned char *challenge)
|
||||
if ((!pw) || (!challenge))
|
||||
return rs;
|
||||
|
||||
hmac_md5(challenge+1, challenge[0], pw, strlen(pw), digest);
|
||||
hmac_md5(challenge+1, challenge[0], (unsigned char *)pw, strlen(pw), digest);
|
||||
rs = (char *)xmalloc(MD5_DIGEST_LEN * 2 + 10);
|
||||
MD_toString(rs, MD5_DIGEST_LEN, digest);
|
||||
return rs;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Fidonet mailer
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2005
|
||||
* Copyright (C) 1997-2007
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -356,7 +356,7 @@ SM_STATE(recvblk)
|
||||
|
||||
if (crcmode && (header != SYN)) {
|
||||
remotecrc = (short)xmblk.c1 << 8 | xmblk.c2;
|
||||
localcrc = crc16xmodem(xmblk.data, sizeof(xmblk.data));
|
||||
localcrc = crc16xmodem((char *)xmblk.data, sizeof(xmblk.data));
|
||||
if (remotecrc != localcrc) {
|
||||
Syslog('x', "bad crc: 0x%04x/0x%04x",remotecrc,localcrc);
|
||||
if (recv_blk == (ackd_blk+1)) {
|
||||
@ -367,7 +367,7 @@ SM_STATE(recvblk)
|
||||
}
|
||||
} else {
|
||||
remotecs = xmblk.c1;
|
||||
localcs = checksum(xmblk.data, sizeof(xmblk.data));
|
||||
localcs = checksum((char *)xmblk.data, sizeof(xmblk.data));
|
||||
if (remotecs != localcs) {
|
||||
Syslog('x', "bad checksum: 0x%02x/0x%02x",remotecs,localcs);
|
||||
if (recv_blk == (ackd_blk+1)) {
|
||||
@ -394,7 +394,7 @@ SM_STATE(recvblk)
|
||||
SM_PROCEED(waitblk);
|
||||
}
|
||||
|
||||
Syslog('X', "received block %ld \"%s\"", recv_blk,printable(xmblk.data,128));
|
||||
Syslog('X', "received block %d \"%s\"", recv_blk,printable((char *)xmblk.data,128));
|
||||
|
||||
if (fp == NULL) {
|
||||
if ((fp = openfile(tmpfname,remtime,remsize,&resofs,resync)) == NULL) {
|
||||
@ -434,9 +434,9 @@ SM_STATE(recvblk)
|
||||
|
||||
SM_STATE(checktelink)
|
||||
|
||||
Syslog('x', "checktelink got \"%s\"",printable(xmblk.data,45));
|
||||
Syslog('x', "checktelink got \"%s\"",printable((char *)xmblk.data,45));
|
||||
if (tmpfname[0] == '\0') {
|
||||
strncpy(tmpfname,xmblk.data+8,16);
|
||||
strncpy(tmpfname,(char *)xmblk.data+8,16);
|
||||
/*
|
||||
* Some systems fill the rest of the filename with spaces, sigh.
|
||||
*/
|
||||
@ -447,8 +447,8 @@ SM_STATE(checktelink)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
Syslog('+', "Remote uses %s",printable(xmblk.data+25,-14));
|
||||
Syslog('x', "Remote file name \"%s\" discarded", printable(xmblk.data+8,-16));
|
||||
Syslog('+', "Remote uses %s",printable((char *)xmblk.data+25,-14));
|
||||
Syslog('x', "Remote file name \"%s\" discarded", printable((char *)xmblk.data+8,-16));
|
||||
}
|
||||
remsize = ((off_t)xmblk.data[0]) + ((off_t)xmblk.data[1]<<8) + ((off_t)xmblk.data[2]<<16) + ((off_t)xmblk.data[3]<<24);
|
||||
last_blk = (remsize-1)/XMBLKSIZ+1;
|
||||
|
Reference in New Issue
Block a user