From: Eric S. Raymond Date: Wed, 4 Jul 2001 02:46:22 +0000 (-0000) Subject: Don't rely on snprintf. X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;h=f6f4def1a28b6a3528e0391a5eccd9c403881765;p=~andy%2Ffetchmail Don't rely on snprintf. svn path=/trunk/; revision=3393 --- diff --git a/Makefile.in b/Makefile.in index 046a3c80..d6875abc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -4,7 +4,7 @@ # So just uncomment all the lines marked QNX. PACKAGE = fetchmail -VERSION = 5.8.11 +VERSION = 5.9.0 # Ultrix 2.2 make doesn't expand the value of VPATH. srcdir = @srcdir@ diff --git a/fetchmailconf b/fetchmailconf index a92e542c..1c75e798 100755 --- a/fetchmailconf +++ b/fetchmailconf @@ -1273,6 +1273,13 @@ camel dung identified to me as `popa3d written by Solar Designer'. Beware! The UIDL support in this thing is known to be completely broken, and other things probably are too. +""" + if string.find(greetline, "MercuryP/NLM v1.48") > 0: + warnings = warnings + """ +This is not a POP3 server. It has delusions of being one, but after +RETR all messages are automatically marked to be deleted. The only +way to prevent this is to issue an RSET before leaving the server. + """ if string.find(greetline, "POP-Max") > 0: warnings = warnings + """ diff --git a/interface.c b/interface.c index 1d61b367..682b788d 100644 --- a/interface.c +++ b/interface.c @@ -270,7 +270,12 @@ get_ifinfo(const char *ifname, ifinfo_t *ifinfo) { kvm_read(kvmfd, ifnet_addr, &ifnet, sizeof(ifnet)); kvm_read(kvmfd, (unsigned long) ifnet.if_name, tname, sizeof tname); - snprintf(tname, sizeof tname - 1, "%s%d", tname, ifnet.if_unit); +#ifdef HAVE_SNPRINTF + snprintf(tname, sizeof tname - 1, +#else + sprintf(tname, +#endif + "%s%d", tname, ifnet.if_unit); if (!strcmp(tname, iname)) { diff --git a/ipv6-connect.c b/ipv6-connect.c index 2da1edb7..2e545c5b 100644 --- a/ipv6-connect.c +++ b/ipv6-connect.c @@ -78,13 +78,23 @@ int inner_connect(struct addrinfo *ai, void *request, int requestlen, int (*tryi continue; if ((fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol)) < 0) { - snprintf(errorbuf, sizeof(errorbuf), "socket: %s(%d)", strerror(errno), errno); +#ifdef HAVE_SNPRINTF + snprintf(errorbuf, sizeof(errorbuf), +#else + sprintf(errorbuf, +#endif + "socket: %s(%d)", strerror(errno), errno); error_callback(myname, errorbuf); continue; }; if (connect(fd, ai->ai_addr, ai->ai_addrlen) < 0) { - snprintf(errorbuf, sizeof(errorbuf), "connect: %s(%d)", strerror(errno), errno); +#ifdef HAVE_SNPRINTF + snprintf(errorbuf, sizeof(errorbuf), +#else + sprintf(errorbuf, +#endif + "connect: %s(%d)", strerror(errno), errno); error_callback(myname, errorbuf); close(fd); /* just after a connect; no reads or writes yet */ continue; @@ -96,7 +106,12 @@ int inner_connect(struct addrinfo *ai, void *request, int requestlen, int (*tryi if (pai) *pai = ai; } else { - snprintf(errorbuf, sizeof(errorbuf), "no connections result"); +#ifdef HAVE_SNPRINTF + snprintf(errorbuf, sizeof(errorbuf), +#else + sprintf(errorbuf, +#endif + "no connections result"); error_callback(myname, errorbuf); fd = -1; }; diff --git a/socket.c b/socket.c index 12dca7ab..3ae38016 100644 --- a/socket.c +++ b/socket.c @@ -750,7 +750,11 @@ 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++) { +#ifdef HAVE_SNPRINTF esz = snprintf(tp, te - tp, i > 0 ? ":%02X" : "%02X", digest[i]); +#else + esz = sprintf(tp, i > 0 ? ":%02X" : "%02X", digest[i]); +#endif if (esz >= te - tp) { report(stderr, _("Digest text buffer too small!\n")); return (0);