aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2006-03-14 09:10:20 +0000
committerMatthias Andree <matthias.andree@gmx.de>2006-03-14 09:10:20 +0000
commit9dc0b8bd674f71f8ee422b037dc409f2dd4f9487 (patch)
tree32e04cf0045782e10fc3eecc8fa82101b3fb94ec
parent20a0097f74bfdec16c17dd7d3eb5968f81ec90c1 (diff)
downloadfetchmail-9dc0b8bd674f71f8ee422b037dc409f2dd4f9487.tar.gz
fetchmail-9dc0b8bd674f71f8ee422b037dc409f2dd4f9487.tar.bz2
fetchmail-9dc0b8bd674f71f8ee422b037dc409f2dd4f9487.zip
merge Mirek's fetchmail-signed.patch
svn path=/branches/BRANCH_6-3/; revision=4734
-rw-r--r--NEWS1
-rw-r--r--base64.c7
-rw-r--r--checkalias.c3
-rw-r--r--conf.c6
-rw-r--r--cram.c16
-rw-r--r--driver.c5
-rw-r--r--etrn.c2
-rw-r--r--fetchmail.c23
-rw-r--r--fetchmail.h22
-rw-r--r--gssapi.c7
-rw-r--r--imap.c12
-rw-r--r--kerberos.c4
-rw-r--r--lock.c10
-rw-r--r--md5.h5
-rw-r--r--md5c.c5
-rw-r--r--mx.h4
-rw-r--r--mxget.c10
-rw-r--r--odmr.c4
-rw-r--r--pop3.c6
-rw-r--r--report.c16
-rw-r--r--rfc822.c60
-rw-r--r--rpa.c101
-rw-r--r--smbutil.c4
-rw-r--r--socket.c18
-rw-r--r--transact.c15
-rw-r--r--uid.c16
-rw-r--r--unmime.c43
27 files changed, 220 insertions, 205 deletions
diff --git a/NEWS b/NEWS
index 1caf66e8..e932fd9f 100644
--- a/NEWS
+++ b/NEWS
@@ -50,6 +50,7 @@ fetchmail 6.3.3 (not yet released):
Lynch.
* ./configure --quiet is now quieter (no SSL and fallback-related output).
* fix bug in LMTP port validation (patch by Miloslav Trmac).
+* Miloslav Trmac's patch (with minor changes) to fix char * sign consistency.
# CHANGES:
* --idle can now be specified on the command line, too.
diff --git a/base64.c b/base64.c
index 21e1db9e..4fd9a30c 100644
--- a/base64.c
+++ b/base64.c
@@ -27,9 +27,11 @@ static const char base64val[] = {
};
#define DECODE64(c) (isascii((unsigned char)(c)) ? base64val[c] : BAD)
-void to64frombits(unsigned char *out, const unsigned char *in, int inlen)
+void to64frombits(char *out, const void *in_, int inlen)
/* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */
{
+ const unsigned char *in = in_;
+
for (; inlen >= 3; inlen -= 3)
{
*out++ = base64digits[in[0] >> 2];
@@ -53,12 +55,13 @@ void to64frombits(unsigned char *out, const unsigned char *in, int inlen)
*out = '\0';
}
-int from64tobits(char *out, const char *in, int maxlen)
+int from64tobits(void *out_, const char *in, int maxlen)
/* base 64 to raw bytes in quasi-big-endian order, returning count of bytes */
/* maxlen limits output buffer size, set to zero to ignore */
{
int len = 0;
register unsigned char digit1, digit2, digit3, digit4;
+ unsigned char *out = out_;
if (in[0] == '+' && in[1] == ' ')
in += 2;
diff --git a/checkalias.c b/checkalias.c
index 9447ec20..8214b40a 100644
--- a/checkalias.c
+++ b/checkalias.c
@@ -88,7 +88,8 @@ int is_host_alias(const char *name, struct query *ctl)
{
struct mxentry *mxp, *mxrecords;
struct idlist *idl;
- int namelen, e;
+ size_t namelen;
+ int e;
struct addrinfo hints, *res, *res_st;
struct hostdata *lead_server =
diff --git a/conf.c b/conf.c
index edec8ee0..30c2e482 100644
--- a/conf.c
+++ b/conf.c
@@ -103,7 +103,7 @@ static void listdump(const char *name, struct idlist *list)
for (idp = list; idp; idp = idp->next)
if (idp->id)
{
- fprintf(stdout, "\"%s\"", visbuf((const char *)idp->id));
+ fprintf(stdout, "\"%s\"", visbuf(idp->id));
if (idp->next)
fputs(", ", stdout);
}
@@ -325,9 +325,9 @@ void dump_config(struct runctl *runp, struct query *querylist)
{
char namebuf[USERNAMELEN + 1];
- strlcpy(namebuf, visbuf((const char *)idp->id), sizeof(namebuf));
+ strlcpy(namebuf, visbuf(idp->id), sizeof(namebuf));
if (idp->val.id2)
- fprintf(stdout, "(\"%s\", %s)", namebuf, visbuf((const char *)idp->val.id2));
+ fprintf(stdout, "(\"%s\", %s)", namebuf, visbuf(idp->val.id2));
else
fprintf(stdout, "\"%s\"", namebuf);
if (idp->next)
diff --git a/cram.c b/cram.c
index 548b542b..c29d51af 100644
--- a/cram.c
+++ b/cram.c
@@ -17,14 +17,14 @@
#include "i18n.h"
#include "md5.h"
-void hmac_md5 (unsigned char *password, size_t pass_len,
- unsigned char *challenge, size_t chal_len,
+void hmac_md5 (char *password, size_t pass_len,
+ char *challenge, size_t chal_len,
unsigned char *response, size_t resp_len)
{
int i;
unsigned char ipad[64];
unsigned char opad[64];
- unsigned char hash_passwd[16];
+ char hash_passwd[16];
MD5_CTX ctx;
@@ -65,11 +65,11 @@ int do_cram_md5 (int sock, char *command, struct query *ctl, char *strip)
{
int result;
int len;
- unsigned char buf1[1024];
- unsigned char msg_id[768];
+ char buf1[1024];
+ char msg_id[768];
unsigned char response[16];
- unsigned char reply[1024];
- unsigned char *respdata;
+ char reply[1024];
+ char *respdata;
gen_send (sock, "%s CRAM-MD5", command);
@@ -94,7 +94,7 @@ int do_cram_md5 (int sock, char *command, struct query *ctl, char *strip)
if (len < 0) {
report (stderr, GT_("could not decode BASE64 challenge\n"));
return PS_AUTHFAIL;
- } else if (len < sizeof (msg_id)) {
+ } else if ((size_t)len < sizeof (msg_id)) {
msg_id[len] = 0;
} else {
msg_id[sizeof (msg_id)-1] = 0;
diff --git a/driver.c b/driver.c
index 08d320a9..93e8a086 100644
--- a/driver.c
+++ b/driver.c
@@ -358,7 +358,7 @@ static void send_size_warnings(struct query *ctl)
if (current->val.status.num == 0 && current->val.status.mark)
{
nbr = current->val.status.mark;
- size = atoi((const char *)current->id);
+ size = atoi(current->id);
if (ctl->limitflush)
stuff_warning(NULL, ctl,
GT_(" %d msg %d octets long deleted by fetchmail."),
@@ -1304,8 +1304,7 @@ is restored."));
/* compute # of messages and number of new messages waiting */
stage = STAGE_GETRANGE;
- err = (ctl->server.base_protocol->getrange)(mailserver_socket, ctl, (const char *)idp->id, &count, &newm, &bytes);
- if (err != 0)
+ err = (ctl->server.base_protocol->getrange)(mailserver_socket, ctl, idp->id, &count, &newm, &bytes);
goto cleanUp;
/* show user how many messages we downloaded */
diff --git a/etrn.c b/etrn.c
index 98f2f7b4..f4b05f09 100644
--- a/etrn.c
+++ b/etrn.c
@@ -65,7 +65,7 @@ static int etrn_getrange(int sock, struct query *ctl, const char *id,
for (qnp = ctl->domainlist; qnp; qnp = qnp->next)
{
/* ship the actual poll and get the response */
- gen_send(sock, "ETRN %s", (char *)qnp->id);
+ gen_send(sock, "ETRN %s", qnp->id);
if ((ok = gen_recv(sock, buf, sizeof(buf))))
return(ok);
diff --git a/fetchmail.c b/fetchmail.c
index 868a45c1..4e56c08a 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -975,7 +975,7 @@ static int load_params(int argc, char **argv, int optind)
/* get the location of rcfile */
rcfiledir[0] = 0;
p = strrchr (rcfile, '/');
- if (p && (p - rcfile) < sizeof (rcfiledir)) {
+ if (p && (size_t)(p - rcfile) < sizeof (rcfiledir)) {
*p = 0; /* replace '/' by '0' */
strlcpy (rcfiledir, rcfile, sizeof(rcfiledir));
*p = '/'; /* restore '/' */
@@ -1254,7 +1254,7 @@ static int load_params(int argc, char **argv, int optind)
{
char *cp;
- if (!(cp = strrchr((char *)idp->id, '/'))
+ if (!(cp = strrchr(idp->id, '/'))
|| (0 == strcmp(cp + 1, SMTP_PORT))
|| servport(cp + 1) == SMTP_PORT_NUM)
{
@@ -1362,7 +1362,8 @@ static const int autoprobe[] =
static int query_host(struct query *ctl)
/* perform fetch transaction with single host */
{
- int i, st = 0;
+ size_t i;
+ int st = 0;
/*
* If we're syslogging the progress messages are automatically timestamped.
@@ -1607,7 +1608,7 @@ static void dump_params (struct runctl *runp,
printf(GT_(" Selected mailboxes are:"));
for (idp = ctl->mailboxes; idp; idp = idp->next)
- printf(" %s", (char *)idp->id);
+ printf(" %s", idp->id);
printf("\n");
}
printf(ctl->fetchall
@@ -1697,7 +1698,7 @@ static void dump_params (struct runctl *runp,
printf(GT_(" Domains for which mail will be fetched are:"));
for (idp = ctl->domainlist; idp; idp = idp->next)
{
- printf(" %s", (char *)idp->id);
+ printf(" %s", idp->id);
if (!idp->val.status.mark)
printf(GT_(" (default)"));
}
@@ -1717,7 +1718,7 @@ static void dump_params (struct runctl *runp,
ctl->listener);
for (idp = ctl->smtphunt; idp; idp = idp->next)
{
- printf(" %s", (char *)idp->id);
+ printf(" %s", idp->id);
if (!idp->val.status.mark)
printf(GT_(" (default)"));
}
@@ -1775,9 +1776,9 @@ static void dump_params (struct runctl *runp,
{
for (idp = ctl->localnames; idp; idp = idp->next)
if (idp->val.id2)
- printf("\t%s -> %s\n", (char *)idp->id, (char *)idp->val.id2);
+ printf("\t%s -> %s\n", idp->id, idp->val.id2);
else
- printf("\t%s\n", (char *)idp->id);
+ printf("\t%s\n", idp->id);
if (ctl->wildcard)
fputs("\t*\n", stdout);
}
@@ -1816,7 +1817,7 @@ static void dump_params (struct runctl *runp,
printf(GT_(" Predeclared mailserver aliases:"));
for (idp = ctl->server.akalist; idp; idp = idp->next)
- printf(" %s", (char *)idp->id);
+ printf(" %s", idp->id);
putchar('\n');
}
if (ctl->server.localdomains)
@@ -1825,7 +1826,7 @@ static void dump_params (struct runctl *runp,
printf(GT_(" Local domains:"));
for (idp = ctl->server.localdomains; idp; idp = idp->next)
- printf(" %s", (char *)idp->id);
+ printf(" %s", idp->id);
putchar('\n');
}
}
@@ -1866,7 +1867,7 @@ static void dump_params (struct runctl *runp,
printf(GT_(" %d UIDs saved.\n"), count);
if (outlevel >= O_VERBOSE)
for (idp = ctl->oldsaved; idp; idp = idp->next)
- printf("\t%s\n", (char *)idp->id);
+ printf("\t%s\n", idp->id);
}
}
diff --git a/fetchmail.h b/fetchmail.h
index d450afc1..3deeb63e 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -173,7 +173,7 @@ struct runctl
struct idlist
{
- unsigned char *id;
+ char *id;
union
{
struct
@@ -186,7 +186,7 @@ struct idlist
#define UID_EXPUNGED 3 /* this message has been expunged */
}
status;
- unsigned char *id2;
+ char *id2;
} val;
struct idlist *next;
};
@@ -559,8 +559,8 @@ void stuff_warning();
void close_warning_by_mail(struct query *, struct msgblk *);
/* rfc822.c: RFC822 header parsing */
-unsigned char *reply_hack(unsigned char *, const unsigned char *, size_t *);
-unsigned char *nxtaddr(const unsigned char *);
+char *reply_hack(char *, const char *, size_t *);
+char *nxtaddr(const char *);
/* uid.c: UID support */
extern int dofastuidl;
@@ -593,17 +593,17 @@ int prc_parse_file(const char *, const flag);
int prc_filecheck(const char *, const flag);
/* base64.c */
-void to64frombits(unsigned char *, const unsigned char *, int);
-int from64tobits(char *, const char *, int maxlen);
+void to64frombits(char *, const void *, int);
+int from64tobits(void *, const char *, int maxlen);
/* unmime.c */
/* Bit-mask returned by MimeBodyType */
#define MSG_IS_7BIT 0x01
#define MSG_IS_8BIT 0x02
#define MSG_NEEDS_DECODE 0x80
-extern void UnMimeHeader(unsigned char *buf);
-extern int MimeBodyType(unsigned char *hdrs, int WantDecode);
-extern int UnMimeBodyline(unsigned char **buf, flag delimited, flag issoftline);
+extern void UnMimeHeader(char *buf);
+extern int MimeBodyType(char *hdrs, int WantDecode);
+extern int UnMimeBodyline(char **buf, flag delimited, flag issoftline);
/* interface.c */
void interface_init(void);
@@ -644,8 +644,8 @@ struct query *hostalloc(struct query *);
int parsecmdline (int, char **, struct runctl *, struct query *);
char *prependdir (const char *, const char *);
char *MD5Digest (unsigned const char *);
-void hmac_md5 (unsigned char *, size_t, unsigned char *, size_t, unsigned char *, size_t);
-int POP3_auth_rpa(unsigned char *, unsigned char *, int socket);
+void hmac_md5 (char *, size_t, char *, size_t, unsigned char *, size_t);
+int POP3_auth_rpa(char *, char *, int socket);
typedef RETSIGTYPE (*SIGHANDLERTYPE) (int);
void deal_with_sigchld(void);
RETSIGTYPE null_signal_handler(int sig);
diff --git a/gssapi.c b/gssapi.c
index 103d2916..883f748f 100644
--- a/gssapi.c
+++ b/gssapi.c
@@ -69,7 +69,8 @@ int do_gssauth(int sock, char *command, char *service, char *hostname, char *use
else if (outlevel >= O_DEBUG) {
maj_stat = gss_display_name(&min_stat, target_name, &request_buf,
&mech_name);
- report(stderr, GT_("Using service name [%s]\n"),request_buf.value);
+ report(stderr, GT_("Using service name [%s]\n"),
+ (char *)request_buf.value);
maj_stat = gss_release_buffer(&min_stat, &request_buf);
}
@@ -126,7 +127,7 @@ int do_gssauth(int sock, char *command, char *service, char *hostname, char *use
return result;
}
request_buf.length = from64tobits(buf2, buf1 + 2, sizeof(buf2));
- if (request_buf.length == -1) /* in case of bad data */
+ if ((int)request_buf.length == -1) /* in case of bad data */
request_buf.length = 0;
request_buf.value = buf2;
sec_token = &request_buf;
@@ -141,7 +142,7 @@ int do_gssauth(int sock, char *command, char *service, char *hostname, char *use
return result;
request_buf.length = from64tobits(buf2, buf1 + 2, sizeof(buf2));
- if (request_buf.length == -1) /* in case of bad data */
+ if ((int)request_buf.length == -1) /* in case of bad data */
request_buf.length = 0;
request_buf.value = buf2;
diff --git a/imap.c b/imap.c
index b88f2b71..619c0a6a 100644
--- a/imap.c
+++ b/imap.c
@@ -233,7 +233,7 @@ static int do_imap_ntlm(int sock, struct query *ctl)
dumpSmbNtlmAuthRequest(stdout, &request);
memset(msgbuf,0,sizeof msgbuf);
- to64frombits (msgbuf, (unsigned char*)&request, SmbLength(&request));
+ to64frombits (msgbuf, &request, SmbLength(&request));
if (outlevel >= O_MONITOR)
report(stdout, "IMAP> %s\n", msgbuf);
@@ -244,7 +244,7 @@ static int do_imap_ntlm(int sock, struct query *ctl)
if ((gen_recv(sock, msgbuf, sizeof msgbuf)))
return result;
- len = from64tobits ((char*)&challenge, msgbuf, sizeof(challenge));
+ len = from64tobits (&challenge, msgbuf, sizeof(challenge));
if (outlevel >= O_DEBUG)
dumpSmbNtlmAuthChallenge(stdout, &challenge);
@@ -255,7 +255,7 @@ static int do_imap_ntlm(int sock, struct query *ctl)
dumpSmbNtlmAuthResponse(stdout, &response);
memset(msgbuf,0,sizeof msgbuf);
- to64frombits (msgbuf, (unsigned char*)&response, SmbLength(&response));
+ to64frombits (msgbuf, &response, SmbLength(&response));
if (outlevel >= O_MONITOR)
report(stdout, "IMAP> %s\n", msgbuf);
@@ -273,10 +273,10 @@ static int do_imap_ntlm(int sock, struct query *ctl)
}
#endif /* NTLM */
-static int imap_canonicalize(char *result, char *raw, int maxlen)
+static void imap_canonicalize(char *result, char *raw, size_t maxlen)
/* encode an IMAP password as per RFC1730's quoting conventions */
{
- int i, j;
+ size_t i, j;
j = 0;
for (i = 0; i < strlen(raw) && i < maxlen; i++)
@@ -286,8 +286,6 @@ static int imap_canonicalize(char *result, char *raw, int maxlen)
result[j++] = raw[i];
}
result[j] = '\0';
-
- return(i);
}
static void capa_probe(int sock, struct query *ctl)
diff --git a/kerberos.c b/kerberos.c
index b329b12f..15c8ee7e 100644
--- a/kerberos.c
+++ b/kerberos.c
@@ -216,7 +216,7 @@ int do_rfc1731(int sock, char *command, char *truename)
des_ecb_encrypt((des_cblock *)buf2, (des_cblock *)buf2, schedule, 0);
memcpy(challenge2.cstr, buf2, 4);
- if (ntohl(challenge2.cint) != challenge1.cint + 1) {
+ if ((int32)ntohl(challenge2.cint) != challenge1.cint + 1) {
report(stderr, GT_("challenge mismatch\n"));
return PS_AUTHFAIL;
}
@@ -236,7 +236,7 @@ int do_rfc1731(int sock, char *command, char *truename)
authenticator.dat[4] = 1;
len = strlen(tktuser);
- strncpy(authenticator.dat+8, tktuser, len);
+ strncpy((char *)authenticator.dat+8, tktuser, len);
authenticator.length = len + 8 + 1;
while (authenticator.length & 7) {
authenticator.length++;
diff --git a/lock.c b/lock.c
index 5d41c587..89f767da 100644
--- a/lock.c
+++ b/lock.c
@@ -118,12 +118,18 @@ void lock_or_die(void)
int e = 0;
if ((fd = open(lockfile, O_WRONLY|O_CREAT|O_EXCL, 0666)) != -1) {
+ ssize_t wr;
+
snprintf(tmpbuf, sizeof(tmpbuf), "%ld\n", (long)getpid());
- if (write(fd, tmpbuf, strlen(tmpbuf)) < strlen(tmpbuf)) e = 1;
+ wr = write(fd, tmpbuf, strlen(tmpbuf));
+ if (wr == -1 || (size_t)wr != strlen(tmpbuf))
+ e = 1;
if (run.poll_interval)
{
snprintf(tmpbuf, sizeof(tmpbuf), "%d\n", run.poll_interval);
- if (write(fd, tmpbuf, strlen(tmpbuf)) < strlen(tmpbuf)) e = 1;
+ wr = write(fd, tmpbuf, strlen(tmpbuf));
+ if (wr == -1 || (size_t)wr != strlen(tmpbuf))
+ e = 1;
}
if (fsync(fd)) e = 1;
if (close(fd)) e = 1;
diff --git a/md5.h b/md5.h
index 77e70e66..19530bca 100644
--- a/md5.h
+++ b/md5.h
@@ -20,9 +20,8 @@ struct MD5Context {
};
void MD5Init(struct MD5Context *context);
-void MD5Update(struct MD5Context *context, unsigned char const *buf,
- unsigned len);
-void MD5Final(unsigned char digest[16], struct MD5Context *context);
+void MD5Update(struct MD5Context *context, const void *buf, unsigned len);
+void MD5Final(void *digest, struct MD5Context *context);
void MD5Transform(uint32 buf[4], uint32 const in[16]);
char *MD5Digest (unsigned const char *s);
diff --git a/md5c.c b/md5c.c
index bdf11c28..ae36de49 100644
--- a/md5c.c
+++ b/md5c.c
@@ -54,8 +54,9 @@ void MD5Init(struct MD5Context *ctx)
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
-void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
+void MD5Update(struct MD5Context *ctx, const void *buf_, unsigned len)
{
+ const unsigned char *buf = buf_;
register uint32 t;
/* Update bitcount */
@@ -102,7 +103,7 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
* Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*/
-void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
+void MD5Final(void *digest, struct MD5Context *ctx)
{
unsigned int count;
unsigned char *p;
diff --git a/mx.h b/mx.h
index 511eba78..da422758 100644
--- a/mx.h
+++ b/mx.h
@@ -4,8 +4,8 @@
struct mxentry
{
- unsigned char *name;
- int pref;
+ char *name;
+ int pref;
};
extern struct mxentry * getmxrecords(const char *);
diff --git a/mxget.c b/mxget.c
index 30f2a287..21a36682 100644
--- a/mxget.c
+++ b/mxget.c
@@ -68,7 +68,7 @@ struct mxentry *getmxrecords(const char *name)
n = res_search(name, C_IN,T_MX, (unsigned char *)&answer, sizeof(answer));
if (n == -1)
return((struct mxentry *)NULL);
- if (n > sizeof(answer))
+ if ((size_t)n > sizeof(answer))
n = sizeof(answer);
hp = (HEADER *)&answer;
@@ -76,7 +76,7 @@ struct mxentry *getmxrecords(const char *name)
eom = answer + n;
h_errno = 0;
for (qdcount = ntohs(hp->qdcount); qdcount--; cp += n + QFIXEDSZ)
- if ((n = dn_skipname(cp, eom)) < 0)
+ if ((n = dn_skipname((unsigned char *)cp, (unsigned char *)eom)) < 0)
return((struct mxentry *)NULL);
buflen = sizeof(MXHostBuf) - 1;
bp = MXHostBuf;
@@ -84,7 +84,8 @@ struct mxentry *getmxrecords(const char *name)
ancount = ntohs(hp->ancount);
while (--ancount >= 0 && cp < eom)
{
- if ((n = dn_expand(answer, eom, cp, bp, buflen)) < 0)
+ if ((n = dn_expand((unsigned char *)answer, (unsigned char *)eom,
+ (unsigned char *)cp, bp, buflen)) < 0)
break;
cp += n;
GETSHORT(type, cp);
@@ -96,7 +97,8 @@ struct mxentry *getmxrecords(const char *name)
continue;
}
GETSHORT(pref, cp);
- if ((n = dn_expand(answer, eom, cp, bp, buflen)) < 0)
+ if ((n = dn_expand((unsigned char *)answer, (unsigned char *)eom,
+ (unsigned char *)cp, bp, buflen)) < 0)
break;
cp += n;
diff --git a/odmr.c b/odmr.c
index e1fce32d..18ef2e63 100644
--- a/odmr.c
+++ b/odmr.c
@@ -80,11 +80,11 @@ static int odmr_getrange(int sock, struct query *ctl, const char *id,
*/
buf[0] = '\0';
for (qnp = ctl->domainlist; qnp; qnp = qnp->next)
- if (strlen(buf) + strlen((const char *)qnp->id) + 1 >= sizeof(buf))
+ if (strlen(buf) + strlen(qnp->id) + 1 >= sizeof(buf))
break;
else
{
- strcat(buf, (const char *)qnp->id);
+ strcat(buf, qnp->id);
strcat(buf, ",");
}
buf[strlen(buf) - 1] = '\0'; /* nuke final comma */
diff --git a/pop3.c b/pop3.c
index 0570a3cc..9fa37ba0 100644
--- a/pop3.c
+++ b/pop3.c
@@ -96,7 +96,7 @@ static int do_pop3_ntlm(int sock, struct query *ctl,
dumpSmbNtlmAuthRequest(stdout, &request);
memset(msgbuf,0,sizeof msgbuf);
- to64frombits (msgbuf, (unsigned char*)&request, SmbLength(&request));
+ to64frombits (msgbuf, &request, SmbLength(&request));
if (outlevel >= O_MONITOR)
report(stdout, "POP3> %s\n", msgbuf);
@@ -107,7 +107,7 @@ static int do_pop3_ntlm(int sock, struct query *ctl,
if ((gen_recv(sock, msgbuf, sizeof msgbuf)))
return result;
- len = from64tobits ((unsigned char*)&challenge, msgbuf, sizeof(msgbuf));
+ len = from64tobits (&challenge, msgbuf, sizeof(msgbuf));
if (outlevel >= O_DEBUG)
dumpSmbNtlmAuthChallenge(stdout, &challenge);
@@ -118,7 +118,7 @@ static int do_pop3_ntlm(int sock, struct query *ctl,
dumpSmbNtlmAuthResponse(stdout, &response);
memset(msgbuf,0,sizeof msgbuf);
- to64frombits (msgbuf, (unsigned char*)&response, SmbLength(&response));
+ to64frombits (msgbuf, &response, SmbLength(&response));
if (outlevel >= O_MONITOR)
report(stdout, "POP3> %s\n", msgbuf);
diff --git a/report.c b/report.c
index 969395be..31d4e482 100644
--- a/report.c
+++ b/report.c
@@ -241,11 +241,11 @@ report_build (FILE *errfp, message, va_alist)
VA_START (args, message);
for ( ; ; )
{
- n = vsnprintf (partial_message + partial_message_size_used,
- partial_message_size - partial_message_size_used,
+ n = vsnprintf (partial_message + partial_message_size_used, partial_message_size - partial_message_size_used,
message, args);
- if (n < partial_message_size - partial_message_size_used)
+ if (n >= 0
+ && (unsigned)n < partial_message_size - partial_message_size_used)
{
partial_message_size_used += n;
break;
@@ -262,7 +262,8 @@ report_build (FILE *errfp, message, va_alist)
partial_message_size - partial_message_size_used,
message, a1, a2, a3, a4, a5, a6, a7, a8);
- if (n < partial_message_size - partial_message_size_used)
+ if (n >= 0
+ && (unsigned)n < partial_message_size - partial_message_size_used)
{
partial_message_size_used += n;
break;
@@ -310,7 +311,9 @@ report_complete (FILE *errfp, message, va_alist)
partial_message_size - partial_message_size_used,
message, args);
- if (n < partial_message_size - partial_message_size_used)
+ /* old glibc versions return -1 for truncation */
+ if (n >= 0
+ && (unsigned)n < partial_message_size - partial_message_size_used)
{
partial_message_size_used += n;
break;
@@ -327,7 +330,8 @@ report_complete (FILE *errfp, message, va_alist)
partial_message_size - partial_message_size_used,
message, a1, a2, a3, a4, a5, a6, a7, a8);
- if (n < partial_message_size - partial_message_size_used)
+ if (n >= 0
+ && (unsigned)n < partial_message_size - partial_message_size_used)
{
partial_message_size_used += n;
break;
diff --git a/rfc822.c b/rfc822.c
index 8654816b..38ff48b7 100644
--- a/rfc822.c
+++ b/rfc822.c
@@ -41,13 +41,13 @@ char *program_name = "rfc822";
#define HEADER_END(p) ((p)[0] == '\n' && ((p)[1] != ' ' && (p)[1] != '\t'))
-unsigned char *reply_hack(
- unsigned char *buf /* header to be hacked */,
- const unsigned char *host /* server hostname */,
+char *reply_hack(
+ char *buf /* header to be hacked */,
+ const char *host /* server hostname */,
size_t *length)
/* hack message headers so replies will work properly */
{
- unsigned char *from, *cp, last_nws = '\0', *parens_from = NULL;
+ char *from, *cp, last_nws = '\0', *parens_from = NULL;
int parendepth, state, has_bare_name_part, has_host_part;
#ifndef MAIN
int addresscount = 1;
@@ -77,9 +77,9 @@ unsigned char *reply_hack(
/* make room to hack the address; buf must be malloced */
for (cp = buf; *cp; cp++)
- if (*cp == ',' || isspace(*cp))
+ if (*cp == ',' || isspace((unsigned char)*cp))
addresscount++;
- buf = (unsigned char *)xrealloc(buf, strlen(buf) + addresscount * (strlen(host) + 1) + 1);
+ buf = xrealloc(buf, strlen(buf) + addresscount * (strlen(host) + 1) + 1);
#endif /* MAIN */
/*
@@ -95,7 +95,7 @@ unsigned char *reply_hack(
#ifdef MAIN
if (verbose)
{
- printf("state %d: %s", state, (char *)buf);
+ printf("state %d: %s", state, buf);
printf("%*s^\n", from - buf + 10, " ");
}
#endif /* MAIN */
@@ -116,7 +116,7 @@ unsigned char *reply_hack(
break;
case 1: /* we've seen the colon, we're looking for addresses */
- if (!isspace(*from))
+ if (!isspace((unsigned char)*from))
last_nws = *from;
if (*from == '<')
state = 3;
@@ -135,12 +135,12 @@ unsigned char *reply_hack(
&& last_nws != ';')
{
int hostlen;
- unsigned char *p;
+ char *p;
p = from;
if (parens_from)
from = parens_from;
- while (isspace(*from) || (*from == ','))
+ while (isspace((unsigned char)*from) || (*from == ','))
--from;
from++;
hostlen = strlen(host);
@@ -158,7 +158,7 @@ unsigned char *reply_hack(
{
parens_from = from;
}
- else if (!isspace(*from))
+ else if (!isspace((unsigned char)*from))
has_bare_name_part = TRUE;
break;
@@ -215,15 +215,15 @@ unsigned char *reply_hack(
return(buf);
}
-unsigned char *nxtaddr(const unsigned char *hdr /* header to be parsed, NUL to continue previous hdr */)
+char *nxtaddr(const char *hdr /* header to be parsed, NUL to continue previous hdr */)
/* parse addresses in succession out of a specified RFC822 header */
{
- static unsigned char address[BUFSIZ];
- static int tp;
- static const unsigned char *hp;
+ static char address[BUFSIZ];
+ static size_t tp;
+ static const char *hp;
static int state, oldstate;
#ifdef MAIN
- static const unsigned char *orighdr;
+ static const char *orighdr;
#endif /* MAIN */
int parendepth = 0;
@@ -252,7 +252,7 @@ unsigned char *nxtaddr(const unsigned char *hdr /* header to be parsed, NUL to c
#ifdef MAIN
if (verbose)
{
- printf("state %d: %s", state, (char *)orighdr);
+ printf("state %d: %s", state, orighdr);
printf("%*s^\n", hp - orighdr + 10, " ");
}
#endif /* MAIN */
@@ -264,13 +264,13 @@ unsigned char *nxtaddr(const unsigned char *hdr /* header to be parsed, NUL to c
state = ENDIT_ALL;
if (tp)
{
- while (tp >= 0 && isspace(address[tp--]))
- continue;
- address[++tp] = '\0';
+ while (tp > 0 && isspace((unsigned char)address[tp - 1]))
+ tp--;
+ address[tp] = '\0';
tp = 0;
return (address);
}
- return((unsigned char *)NULL);
+ return(NULL);
}
else if (*hp == '\\') /* handle RFC822 escaping */
{
@@ -305,7 +305,7 @@ unsigned char *nxtaddr(const unsigned char *hdr /* header to be parsed, NUL to c
state = INSIDE_BRACKETS;
tp = 0;
}
- else if (*hp != ',' && !isspace(*hp))
+ else if (*hp != ',' && !isspace((unsigned char)*hp))
{
--hp;
state = BARE_ADDRESS;
@@ -340,7 +340,7 @@ unsigned char *nxtaddr(const unsigned char *hdr /* header to be parsed, NUL to c
state = INSIDE_DQUOTE;
address[NEXTTP()] = *hp;
}
- else if (!isspace(*hp)) /* just take it, ignoring whitespace */
+ else if (!isspace((unsigned char)*hp)) /* just take it, ignoring whitespace */
address[NEXTTP()] = *hp;
break;
@@ -386,10 +386,10 @@ unsigned char *nxtaddr(const unsigned char *hdr /* header to be parsed, NUL to c
}
#ifdef MAIN
-static void parsebuf(unsigned char *longbuf, int reply)
+static void parsebuf(char *longbuf, int reply)
{
- unsigned char *cp;
- size_t dummy;
+ char *cp;
+ size_t dummy;
if (reply)
{
@@ -397,19 +397,19 @@ static void parsebuf(unsigned char *longbuf, int reply)
printf("Rewritten buffer: %s", (char *)longbuf);
}
else
- if ((cp = nxtaddr(longbuf)) != (unsigned char *)NULL)
+ if ((cp = nxtaddr(longbuf)) != (char *)NULL)
do {
printf("\t-> \"%s\"\n", (char *)cp);
} while
- ((cp = nxtaddr((unsigned char *)NULL)) != (unsigned char *)NULL);
+ ((cp = nxtaddr((char *)NULL)) != (char *)NULL);
}
int main(int argc, char *argv[])
{
- unsigned char buf[BUFSIZ], longbuf[BUFSIZ];
- int ch, reply;
+ char buf[BUFSIZ], longbuf[BUFSIZ];
+ int ch, reply;
verbose = reply = FALSE;
while ((ch = getopt(argc, argv, "rv")) != EOF)
diff --git a/rpa.c b/rpa.c
index e52a889e..ccc7d509 100644
--- a/rpa.c
+++ b/rpa.c
@@ -37,20 +37,20 @@ extern int linecount;
#ifndef NO_PROTO
/* prototypes for internal functions */
- static int POP3_rpa_resp(unsigned char* argbuf, int socket );
- static void LenAppend(unsigned char** pptr, int len);
- static int LenSkip(unsigned char** pptr, int rxlen);
- static int DecBase64(unsigned char* bufp);
- static void EncBase64(unsigned char* bufp, int len);
- static void ToUnicode(unsigned char** pptr, unsigned char delim,
- unsigned char* buf, int* plen, int conv);
- static int SetRealmService(unsigned char* bufp);
+ static int POP3_rpa_resp(char* argbuf, int socket );
+ static void LenAppend(char** pptr, int len);
+ static int LenSkip(char** pptr, int rxlen);
+ static int DecBase64(char* bufp);
+ static void EncBase64(char* bufp, int len);
+ static void ToUnicode(char** pptr, char delim, unsigned char* buf, int* plen,
+ int conv);
+ static int SetRealmService(char* bufp);
static void GenChallenge(unsigned char* buf, int len);
- static int DigestPassphrase(unsigned char* passphrase,
+ static int DigestPassphrase(char* passphrase,
unsigned char* rbuf, int unicodeit);
static void CompUserResp();
static int CheckUserAuth();
- static void md5(unsigned char* in, int len, unsigned char* out);
+ static void md5(void* in, int len, unsigned char* out);
#endif
/* RPA protocol definitions */
@@ -108,11 +108,11 @@ unsigned char Kus[Kusl]; /* Session key */
globals: read outlevel.
*********************************************************************/
-int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket)
+int POP3_auth_rpa (char *userid, char *passphrase, int socket)
{
int ok,rxlen,verh,verl,i,rll;
- unsigned char buf [POPBUFSIZE];
- unsigned char *bufp;
+ char buf [POPBUFSIZE];
+ char *bufp;
int status,aulin,kuslin;
char* stdec[4] = { N_("Success") ,
N_("Restricted user (something wrong with account)") ,
@@ -179,10 +179,10 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket)
/* Interpret Token 2 */
- verh = *(bufp++); verl = *(bufp++);
+ verh = (unsigned char)*(bufp++); verl = (unsigned char)*(bufp++);
if (outlevel >= O_DEBUG)
report(stdout, GT_("Service chose RPA version %d.%d\n"),verh,verl);
- Csl = *(bufp++);
+ Csl = (unsigned char)*(bufp++);
memcpy(Cs, bufp, Csl);
bufp += Csl;
if (outlevel >= O_DEBUG)
@@ -197,7 +197,7 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket)
bufp += Tsl;
if (outlevel >= O_DEBUG)
report(stdout, GT_("Service timestamp %s\n"),Ts);
- rll = *(bufp++) << 8; rll = rll | *(bufp++);
+ rll = (unsigned char)*(bufp++) << 8; rll = rll | (unsigned char)*(bufp++);
if ((bufp-buf+rll) != rxlen)
{
if (outlevel > O_SILENT)
@@ -254,7 +254,7 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket)
/* Interpret Token 4 */
- aulin = *(bufp++);
+ aulin = (unsigned char)*(bufp++);
if (outlevel >= O_DEBUG)
{
report(stdout, GT_("User authentication (l=%d):\n"),aulin);
@@ -361,7 +361,7 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket)
*********************************************************************/
static int POP3_rpa_resp (argbuf,socket)
-unsigned char *argbuf;
+char *argbuf;
int socket;
{
int ok;
@@ -420,7 +420,7 @@ int socket;
*********************************************************************/
static void LenAppend(pptr,len)
-unsigned char **pptr;
+char **pptr;
int len;
{
if (len < 0x80)
@@ -454,30 +454,30 @@ int len;
*********************************************************************/
int LenSkip(pptr,rxlen)
-unsigned char **pptr;
+char **pptr;
int rxlen;
{
int len;
- unsigned char *save;
+ char *save;
save = *pptr;
- if (**pptr != HDR)
+ if ((unsigned char)**pptr != HDR)
{
if (outlevel > O_SILENT)
report(stderr, GT_("Hdr not 60\n"));
return(0);
}
(*pptr)++;
- if (((**pptr) & 0x80) == 0 )
+ if (((unsigned char)(**pptr) & 0x80) == 0 )
{
- len = **pptr; (*pptr)++;
+ len = (unsigned char)**pptr; (*pptr)++;
}
- else if ((**pptr) == 0x81)
+ else if ((unsigned char)(**pptr) == 0x81)
{
- len = *(*pptr+1); (*pptr) += 2;
+ len = (unsigned char)*(*pptr+1); (*pptr) += 2;
}
- else if ((**pptr) == 0x82)
+ else if ((unsigned char)(**pptr) == 0x82)
{
- len = ((*(*pptr+1)) << 8) | *(*pptr+2);
+ len = ((unsigned char)(*(*pptr+1)) << 8) | (unsigned char)*(*pptr+2);
(*pptr) += 3;
}
else len = 0;
@@ -516,13 +516,13 @@ int rxlen;
*********************************************************************/
static int DecBase64(bufp)
-unsigned char *bufp;
+char *bufp;
{
unsigned int newx, bits=0, cnt=0, i, part=0;
unsigned char ch;
- unsigned char* outp=bufp;
- unsigned char* inp=bufp;
- while((ch=*(inp++)) != 0)
+ char* outp=bufp;
+ char* inp=bufp;
+ while((ch=(unsigned char)*(inp++)) != 0)
{
if ((ch != '=') && (ch != ' ') && (ch != '\n') && (ch != '\r'))
{
@@ -550,7 +550,7 @@ unsigned char *bufp;
report(stdout, GT_("Inbound binary data:\n"));
for (i=0; i<cnt; i++)
{
- report_build(stdout, "%02X ",bufp[i]);
+ report_build(stdout, "%02X ",(unsigned char)bufp[i]);
if (((i % 16)==15) || (i==(cnt-1)))
report_complete(stdout, "\n");
}
@@ -575,10 +575,10 @@ unsigned char *bufp;
*********************************************************************/
static void EncBase64(bufp,len)
-unsigned char *bufp;
+char *bufp;
int len;
{
- unsigned char* outp;
+ char* outp;
unsigned char c1,c2,c3;
char x[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
int i;
@@ -588,7 +588,7 @@ int len;
report(stdout, GT_("Outbound data:\n"));
for (i=0; i<len; i++)
{
- report_build(stdout, "%02X ",bufp[i]);
+ report_build(stdout, "%02X ",(unsigned char)bufp[i]);
if (((i % 16)==15) || (i==(len-1)))
report_complete(stdout, "\n");
}
@@ -598,9 +598,9 @@ int len;
/* So we can do the update in place, start at the far end! */
for (i=((len-1)/3)*3; i>=0; i-=3)
{
- c1 = bufp[i];
- if ((i+1) < len) c2 = bufp[i+1]; else c2=0;
- if ((i+2) < len) c3 = bufp[i+2]; else c3=0;
+ c1 = (unsigned char)bufp[i];
+ if ((i+1) < len) c2 = (unsigned char)bufp[i+1]; else c2=0;
+ if ((i+2) < len) c3 = (unsigned char)bufp[i+2]; else c3=0;
*(outp) = x[c1/4];
*(outp+1) = x[((c1 & 3)*16) + (c2/16)];
if ((i+1) < len) *(outp+2) = x[((c2 & 0x0F)*4) + (c3/64)];
@@ -628,8 +628,8 @@ int len;
globals: reads outlevel;
*********************************************************************/
-static void ToUnicode(unsigned char **pptr /* input string*/,
- unsigned char delim, unsigned char *buf /* output buffer */,
+static void ToUnicode(char **pptr /* input string*/,
+ char delim, unsigned char *buf /* output buffer */,
int *plen, int conv)
{
unsigned char *p;
@@ -639,7 +639,7 @@ static void ToUnicode(unsigned char **pptr /* input string*/,
{
*(p++) = 0;
if (conv)
- *(p++) = tolower(**pptr);
+ *(p++) = tolower((unsigned char)**pptr);
else
*(p++) = (**pptr);
(*plen) += 2;
@@ -676,7 +676,7 @@ static void ToUnicode(unsigned char **pptr /* input string*/,
writes Ns Nsl Nr Nrl
*********************************************************************/
-static int SetRealmService(unsigned char *bufp)
+static int SetRealmService(char *bufp)
{
/* For the moment we pick the first available realm. It would */
/* make more sense to verify that the realm which the user */
@@ -753,12 +753,12 @@ static void GenChallenge(unsigned char *buf, int len)
writes Pu.
*********************************************************************/
-static int DigestPassphrase(unsigned char *passphrase,unsigned char *rbuf,
+static int DigestPassphrase(char *passphrase,unsigned char *rbuf,
int unicodeit)
{
int len;
unsigned char workarea[STRMAX];
- unsigned char* ptr;
+ char* ptr;
if (unicodeit) /* Option in spec. Yuck. */
{
@@ -766,14 +766,10 @@ static int DigestPassphrase(unsigned char *passphrase,unsigned char *rbuf,
ToUnicode(&ptr, '\0', workarea, &len, 0); /* No case conv here */
if (len == 0)
return(PS_SYNTAX);
- ptr = workarea;
+ md5(workarea,len,rbuf);
}
else
- {
- ptr = rbuf;
- len = strlen(passphrase);
- }
- md5(ptr,len,rbuf);
+ md5(rbuf,strlen(passphrase),rbuf);
return(0);
}
@@ -873,10 +869,11 @@ static int CheckUserAuth(void)
globals: reads outlevel
*********************************************************************/
-static void md5(unsigned char *in,int len,unsigned char *out)
+static void md5(void *in_,int len,unsigned char *out)
{
int i;
MD5_CTX md5context;
+ unsigned char *in = in_;
if (outlevel >= O_DEBUG)
{
diff --git a/smbutil.c b/smbutil.c
index cbe18b99..74bd5ba2 100644
--- a/smbutil.c
+++ b/smbutil.c
@@ -74,7 +74,7 @@ dumpRaw(fp,((unsigned char*)structPtr)+IVAL(&structPtr->header.offset,0),SVAL(&s
static void dumpRaw(FILE *fp, unsigned char *buf, size_t len)
{
- int i;
+ size_t i;
for (i=0; i<len; ++i)
fprintf(fp,"%02x ",buf[i]);
@@ -84,7 +84,7 @@ static void dumpRaw(FILE *fp, unsigned char *buf, size_t len)
static char *unicodeToString(char *p, size_t len)
{
- int i;
+ size_t i;
static char buf[1024];
assert(len+1 < sizeof buf);
diff --git a/socket.c b/socket.c
index 7a62ffc1..b1119ca5 100644
--- a/socket.c
+++ b/socket.c
@@ -604,11 +604,11 @@ static int SSL_verify_callback( int ok_return, X509_STORE_CTX *ctx, int strict )
{
char buf[257];
X509 *x509_cert;
- int err, depth;
+ int err, depth, i;
unsigned char digest[EVP_MAX_MD_SIZE];
char text[EVP_MAX_MD_SIZE * 3 + 1], *tp, *te;
const EVP_MD *digest_tp;
- unsigned int dsz, i, esz;
+ unsigned int dsz, esz;
X509_NAME *subj, *issuer;
x509_cert = X509_STORE_CTX_get_current_cert(ctx);
@@ -624,13 +624,13 @@ static int SSL_verify_callback( int ok_return, X509_STORE_CTX *ctx, int strict )
if (outlevel >= O_VERBOSE) {
if ((i = X509_NAME_get_text_by_NID(issuer, NID_organizationName, buf, sizeof(buf))) != -1) {
report(stdout, GT_("Issuer Organization: %s\n"), buf);
- if (i >= sizeof(buf) - 1)
+ if ((size_t)i >= sizeof(buf) - 1)
report(stdout, GT_("Warning: Issuer Organization Name too long (possibly truncated).\n"));
} else
report(stdout, GT_("Unknown Organization\n"));
if ((i = X509_NAME_get_text_by_NID(issuer, NID_commonName, buf, sizeof(buf))) != -1) {
report(stdout, GT_("Issuer CommonName: %s\n"), buf);
- if (i >= sizeof(buf) - 1)
+ if ((size_t)i >= sizeof(buf) - 1)
report(stdout, GT_("Warning: Issuer CommonName too long (possibly truncated).\n"));
} else
report(stdout, GT_("Unknown Issuer CommonName\n"));
@@ -638,7 +638,7 @@ static int SSL_verify_callback( int ok_return, X509_STORE_CTX *ctx, int strict )
if ((i = X509_NAME_get_text_by_NID(subj, NID_commonName, buf, sizeof(buf))) != -1) {
if (outlevel >= O_VERBOSE)
report(stdout, GT_("Server CommonName: %s\n"), buf);
- if (i >= sizeof(buf) - 1) {
+ if ((size_t)i >= sizeof(buf) - 1) {
/* Possible truncation. In this case, this is a DNS name, so this
* is really bad. We do not tolerate this even in the non-strict case. */
report(stderr, GT_("Bad certificate: Subject CommonName too long!\n"));
@@ -707,6 +707,8 @@ static int SSL_verify_callback( int ok_return, X509_STORE_CTX *ctx, int strict )
/* Print the finger print. Note that on errors, we might print it more than once
* normally; we kluge around that by using a global variable. */
if (_check_fp) {
+ unsigned dp;
+
_check_fp = 0;
digest_tp = EVP_md5();
if (digest_tp == NULL) {
@@ -719,9 +721,9 @@ static int SSL_verify_callback( int ok_return, X509_STORE_CTX *ctx, int strict )
}
tp = text;
te = text + sizeof(text);
- for (i = 0; i < dsz; i++) {
- esz = snprintf(tp, te - tp, i > 0 ? ":%02X" : "%02X", digest[i]);
- if (esz >= te - tp) {
+ for (dp = 0; dp < dsz; dp++) {
+ esz = snprintf(tp, te - tp, dp > 0 ? ":%02X" : "%02X", digest[dp]);
+ if (esz >= (size_t)(te - tp)) {
report(stderr, GT_("Digest text buffer too small!\n"));
return (0);
}
diff --git a/transact.c b/transact.c
index 73ec9d31..d2a241c5 100644
--- a/transact.c
+++ b/transact.c
@@ -91,9 +91,7 @@ static void find_server_names(const char *hdr,
{
char *cp;
- for (cp = nxtaddr((const unsigned char *)hdr);
- cp != NULL;
- cp = nxtaddr(NULL))
+ for (cp = nxtaddr(hdr); cp != NULL; cp = nxtaddr(NULL))
{
char *atsign;
@@ -129,10 +127,10 @@ static void find_server_names(const char *hdr,
for (idp = ctl->server.localdomains; idp; idp = idp->next) {
char *rhs;
- rhs = atsign + (strlen(atsign) - strlen((char *)idp->id));
+ rhs = atsign + (strlen(atsign) - strlen(idp->id));
if (rhs > atsign &&
(rhs[-1] == '.' || rhs[-1] == '@') &&
- strcasecmp(rhs, (char *)idp->id) == 0)
+ strcasecmp(rhs, idp->id) == 0)
{
if (outlevel >= O_DEBUG)
report(stdout, GT_("passed through %s matching %s\n"),
@@ -1316,8 +1314,8 @@ int readbody(int sock, struct query *ctl, flag forward, int len)
/* forward: TRUE to forward */
{
int linelen;
- unsigned char buf[MSGBUFSIZE+4];
- unsigned char *inbufp = buf;
+ char buf[MSGBUFSIZE+4];
+ char *inbufp = buf;
flag issoftline = FALSE;
/*
@@ -1545,7 +1543,8 @@ va_dcl
va_end(ap);
snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "\r\n");
- if (SockWrite(sock, buf, strlen(buf)) < strlen(buf)) {
+ ok = SockWrite(sock, buf, strlen(buf));
+ if (ok == -1 || (size_t)ok != strlen(buf)) {
/* short write, bail out */
return PS_SOCKET;
}
diff --git a/uid.c b/uid.c
index ff993f59..6516c329 100644
--- a/uid.c
+++ b/uid.c
@@ -248,7 +248,7 @@ void initialize_saved_lists(struct query *hostlist, const char *idfile)
report_build(stdout, GT_("Old UID list from %s:"),
ctl->server.pollname);
for (idp = ctl->oldsaved; idp; idp = idp->next)
- report_build(stdout, " %s", (char *)idp->id);
+ report_build(stdout, " %s", idp->id);
if (!idp)
report_build(stdout, GT_(" <empty>"));
report_complete(stdout, "\n");
@@ -259,7 +259,7 @@ void initialize_saved_lists(struct query *hostlist, const char *idfile)
{
report_build(stdout, GT_("Scratch list of UIDs:"));
for (idp = scratchlist; idp; idp = idp->next)
- report_build(stdout, " %s", (char *)idp->id);
+ report_build(stdout, " %s", idp->id);
if (!idp)
report_build(stdout, GT_(" <empty>"));
report_complete(stdout, "\n");
@@ -282,7 +282,7 @@ void initialize_saved_lists(struct query *hostlist, const char *idfile)
continue;
*end = (struct idlist *)xmalloc(sizeof(struct idlist));
- (*end)->id = (unsigned char *)str;
+ (*end)->id = str;
(*end)->val.status.mark = status;
(*end)->val.status.num = 0;
(*end)->next = NULL;
@@ -349,11 +349,11 @@ struct idlist *str_in_list(struct idlist **idl, const char *str, const flag case
struct idlist *walk;
if (caseblind) {
for( walk = *idl; walk; walk = walk->next )
- if( strcasecmp( str, (char *)walk->id) == 0 )
+ if( strcasecmp( str, walk->id) == 0 )
return walk;
} else {
for( walk = *idl; walk; walk = walk->next )
- if( strcmp( str, (char *)walk->id) == 0 )
+ if( strcmp( str, walk->id) == 0 )
return walk;
}
return NULL;
@@ -515,7 +515,7 @@ void uid_swap_lists(struct query *ctl)
else
report_build(stdout, GT_("New UID list from %s:"), ctl->server.pollname);
for (idp = dofastuidl ? ctl->oldsaved : ctl->newsaved; idp; idp = idp->next)
- report_build(stdout, " %s = %d", (char *)idp->id, idp->val.status.mark);
+ report_build(stdout, " %s = %d", idp->id, idp->val.status.mark);
if (!idp)
report_build(stdout, GT_(" <empty>"));
report_complete(stdout, "\n");
@@ -565,7 +565,7 @@ void uid_discard_new_list(struct query *ctl)
* poll are marked here. */
report_build(stdout, GT_("Merged UID list from %s:"), ctl->server.pollname);
for (idp = ctl->oldsaved; idp; idp = idp->next)
- report_build(stdout, " %s = %d", (char *)idp->id, idp->val.status.mark);
+ report_build(stdout, " %s = %d", idp->id, idp->val.status.mark);
if (!idp)
report_build(stdout, GT_(" <empty>"));
report_complete(stdout, "\n");
@@ -627,7 +627,7 @@ void write_saved_lists(struct query *hostlist, const char *idfile)
if (idp->val.status.mark == UID_SEEN
|| idp->val.status.mark == UID_DELETED)
fprintf(tmpfp, "%s@%s %s\n",
- ctl->remotename, ctl->server.queryname, (char *)idp->id);
+ ctl->remotename, ctl->server.queryname, idp->id);
}
for (idp = scratchlist; idp; idp = idp->next)
fputs(idp->id, tmpfp);
diff --git a/unmime.c b/unmime.c
index 936ca459..f68e51fb 100644
--- a/unmime.c
+++ b/unmime.c
@@ -33,7 +33,7 @@ static unsigned char unhex(unsigned char c)
return 16; /* invalid hex character */
}
-static int qp_char(unsigned char c1, unsigned char c2, unsigned char *c_out)
+static int qp_char(unsigned char c1, unsigned char c2, char *c_out)
{
c1 = unhex(c1);
c2 = unhex(c2);
@@ -59,7 +59,7 @@ static int qp_char(unsigned char c1, unsigned char c2, unsigned char *c_out)
static const char MIMEHDR_INIT[] = "=?"; /* Start of coded sequence */
static const char MIMEHDR_END[] = "?="; /* End of coded sequence */
-void UnMimeHeader(unsigned char *hdr)
+void UnMimeHeader(char *hdr)
{
/* Decode a buffer containing data encoded according to RFC
* 2047. This only handles content-transfer-encoding; conversion
@@ -75,8 +75,8 @@ void UnMimeHeader(unsigned char *hdr)
*/
int state = S_COPY_PLAIN;
- unsigned char *p_in, *p_out, *p;
- unsigned char enc = '\0'; /* initialization pacifies -Wall */
+ char *p_in, *p_out, *p;
+ char enc = '\0'; /* initialization pacifies -Wall */
int i;
/* Speed up in case this is not a MIME-encoded header */
@@ -123,7 +123,7 @@ void UnMimeHeader(unsigned char *hdr)
/* *(p+1) is the transfer encoding, *(p+2) must be a '?' */
if (*(p+2) == '?') {
- enc = tolower(*(p+1));
+ enc = tolower((unsigned char)*(p+1));
p_in = p+3;
state = S_COPY_MIME;
}
@@ -200,11 +200,11 @@ void UnMimeHeader(unsigned char *hdr)
* There is more MIME data later on. Is there
* whitespace only before the delimiter?
*/
- unsigned char *q;
+ char *q;
int wsp_only = 1;
for (q=p_in; (wsp_only && (q < p)); q++)
- wsp_only = isspace(*q);
+ wsp_only = isspace((unsigned char)*q);
if (wsp_only) {
/*
@@ -259,7 +259,7 @@ static int CurrTypeNeedsDecode = 0;
* at the beginning, and a terminating null.
*/
#define MAX_DELIM_LEN 70
-static unsigned char MultipartDelimiter[MAX_DELIM_LEN+3];
+static char MultipartDelimiter[MAX_DELIM_LEN+3];
/* This string replaces the "Content-Transfer-Encoding: quoted-printable"
@@ -267,15 +267,16 @@ static unsigned char MultipartDelimiter[MAX_DELIM_LEN+3];
* must be no longer than the original string.
*/
static const char ENC8BIT[] = "Content-Transfer-Encoding: 8bit";
-static void SetEncoding8bit(unsigned char *XferEncOfs)
+static void SetEncoding8bit(char *XferEncOfs)
{
- unsigned char *p;
+ char *p;
if (XferEncOfs != NULL) {
memcpy(XferEncOfs, ENC8BIT, sizeof(ENC8BIT) - 1);
/* If anything left, in this header, replace with whitespace */
- for (p=XferEncOfs+sizeof(ENC8BIT)-1; (*p >= ' '); p++) *p=' ';
+ for (p=XferEncOfs+sizeof(ENC8BIT)-1; ((unsigned char)*p >= ' '); p++)
+ *p=' ';
}
}
@@ -377,10 +378,10 @@ static int CheckContentType(char *CntType)
*
* The return value is a bitmask.
*/
-int MimeBodyType(unsigned char *hdrs, int WantDecode)
+int MimeBodyType(char *hdrs, int WantDecode)
{
- unsigned char *NxtHdr = hdrs;
- unsigned char *XferEnc, *XferEncOfs, *CntType, *MimeVer, *p;
+ char *NxtHdr = hdrs;
+ char *XferEnc, *XferEncOfs, *CntType, *MimeVer, *p;
int HdrsFound = 0; /* We only look for three headers */
int BodyType; /* Return value */
@@ -510,10 +511,10 @@ int MimeBodyType(unsigned char *hdrs, int WantDecode)
* Return flag set if this line ends with a soft line-break.
* 'bufp' is modified to point to the end of the output buffer.
*/
-static int DoOneQPLine(unsigned char **bufp, flag delimited, flag issoftline)
+static int DoOneQPLine(char **bufp, flag delimited, flag issoftline)
{
- unsigned char *buf = *bufp;
- unsigned char *p_in, *p_out, *p;
+ char *buf = *bufp;
+ char *p_in, *p_out, *p;
int n;
int ret = 0;
@@ -592,9 +593,9 @@ static int DoOneQPLine(unsigned char **bufp, flag delimited, flag issoftline)
* 'bufp' is modified to point to the end of the output buffer.
*/
-int UnMimeBodyline(unsigned char **bufp, flag delimited, flag softline)
+int UnMimeBodyline(char **bufp, flag delimited, flag softline)
{
- unsigned char *buf = *bufp;
+ char *buf = *bufp;
int ret = 0;
switch (BodyState) {
@@ -664,7 +665,7 @@ int outlevel = 0;
int main(int argc, char *argv[])
{
unsigned int BufSize;
- unsigned char *buffer, *buf_p;
+ char *buffer, *buf_p;
int nl_count, i, bodytype;
#ifdef DEBUG
@@ -681,7 +682,7 @@ int main(int argc, char *argv[])
#endif
BufSize = BUFSIZE_INCREMENT; /* Initial size of buffer */
- buf_p = buffer = (unsigned char *) xmalloc(BufSize);
+ buf_p = buffer = (char *) xmalloc(BufSize);
nl_count = 0;
do {