aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--checkalias.c11
-rw-r--r--driver.c13
-rw-r--r--fetchmail.c17
-rw-r--r--fetchmail.h8
-rw-r--r--options.c13
-rw-r--r--pop3.c9
-rw-r--r--report.c11
-rw-r--r--sink.c11
-rw-r--r--unmime.c13
9 files changed, 33 insertions, 73 deletions
diff --git a/checkalias.c b/checkalias.c
index 5d5320f6..5e4386b6 100644
--- a/checkalias.c
+++ b/checkalias.c
@@ -13,13 +13,6 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
-#if defined(HAVE_ALLOCA_H)
-#include <alloca.h>
-#else
-#ifdef _AIX
- #pragma alloca
-#endif
-#endif
#include "mx.h"
#include "fetchmail.h"
@@ -54,7 +47,7 @@ static int is_ip_alias(const char *name1,const char *name2)
{
struct in_addr in;
(void) memcpy(&in.s_addr, *p, sizeof (in.s_addr));
- host_a_addr = (address_e *)alloca(sizeof( address_e));
+ xalloca(host_a_addr, address_e *, sizeof (address_e));
memset (host_a_addr,0, sizeof (address_e));
host_a_addr->next = dummy_addr;
(void) memcpy(&host_a_addr->address, *p, sizeof (in.s_addr));
@@ -68,7 +61,7 @@ static int is_ip_alias(const char *name1,const char *name2)
{
struct in_addr in;
(void) memcpy(&in.s_addr, *p, sizeof (in.s_addr));
- host_b_addr = (address_e *)alloca(sizeof( address_e));
+ xalloca(host_b_addr, address_e *, sizeof (address_e));
memset (host_b_addr,0, sizeof (address_e));
host_b_addr->next = dummy_addr;
(void) memcpy(&host_b_addr->address, *p, sizeof (in.s_addr));
diff --git a/driver.c b/driver.c
index fe709197..25e2c819 100644
--- a/driver.c
+++ b/driver.c
@@ -25,13 +25,6 @@
#else
#include <varargs.h>
#endif
-#if defined(HAVE_ALLOCA_H)
-#include <alloca.h>
-#else
-#ifdef _AIX
- #pragma alloca
-#endif
-#endif
#if defined(HAVE_SYS_ITIMER_H)
#include <sys/itimer.h>
#endif
@@ -977,7 +970,7 @@ int num; /* index of message */
if (idp->val.status.mark == XMIT_ANTISPAM)
errlen += strlen(idp->id) + 2;
- errmsg = alloca(errlen+3);
+ xalloca(errmsg, char *, errlen+3);
(void) strcpy(errmsg, errhd);
for (idp = xmit_names; idp; idp = idp->next)
if (idp->val.status.mark == XMIT_ANTISPAM)
@@ -1116,7 +1109,7 @@ const char *canonical; /* server name */
Key_schedule schedule;
int rem;
- ticket = ((KTEXT) (alloca (sizeof (KTEXT_ST))));
+ xalloca(ticket, KTEXT, sizeof (KTEXT_ST));
rem = (krb_sendauth (0L, socket, ticket, "pop",
canonical,
((char *) (krb_realmofhost (canonical))),
@@ -1552,7 +1545,7 @@ const struct method *proto; /* protocol method table */
{
int i;
- msgsizes = (int *)alloca(sizeof(int) * count);
+ xalloca(msgsizes, int *, sizeof(int) * count);
for (i = 0; i < count; i++)
msgsizes[i] = -1;
diff --git a/fetchmail.c b/fetchmail.c
index 9e4d9240..b738cf9d 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -13,13 +13,6 @@
#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
-#if defined(HAVE_ALLOCA_H)
-#include <alloca.h>
-#else
-#ifdef _AIX
- #pragma alloca
-#endif
-#endif
#include <string.h>
#include <signal.h>
#if defined(HAVE_SYSLOG)
@@ -210,7 +203,7 @@ int main (int argc, char **argv)
/* set up to do lock protocol */
#define FETCHMAIL_PIDFILE "fetchmail.pid"
- tmpbuf = alloca(strlen(home) + strlen(FETCHMAIL_PIDFILE) + 3);
+ xalloca(tmpbuf, char *, strlen(home) + strlen(FETCHMAIL_PIDFILE) + 3);
if (!getuid())
sprintf(tmpbuf, "%s/%s", PID_DIR, FETCHMAIL_PIDFILE);
else {
@@ -352,7 +345,7 @@ int main (int argc, char **argv)
}
/* parse the ~/.netrc file (if present) for future password lookups. */
- netrc_file = (char *) alloca (strlen (home) + 8);
+ xalloca(netrc_file, char *, strlen (home) + 8);
strcpy (netrc_file, home);
strcat (netrc_file, "/.netrc");
netrc_list = parse_netrc(netrc_file);
@@ -404,7 +397,7 @@ int main (int argc, char **argv)
&& !ctl->password)
{
#define PASSWORD_PROMPT "Enter password for %s@%s: "
- tmpbuf = alloca(strlen(PASSWORD_PROMPT) +
+ xalloca(tmpbuf, char *, strlen(PASSWORD_PROMPT) +
strlen(ctl->remotename) +
strlen(ctl->server.pollname) + 1);
(void) sprintf(tmpbuf, PASSWORD_PROMPT,
@@ -1494,6 +1487,10 @@ void dump_params (struct runctl *runp, struct query *querylist, flag implicit)
for (idp = ctl->oldsaved; idp; idp = idp->next)
fprintf(stderr, "\t%s\n", idp->id);
}
+
+ if (ctl->properties)
+ printf(" Pass-through properties \"%s\".\n",
+ visbuf(ctl->properties));
}
}
diff --git a/fetchmail.h b/fetchmail.h
index 18de9f6c..f5fb1d41 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -397,6 +397,14 @@ int interface_approve(struct hostdata *);
XMALLOCTYPE *xmalloc(int);
XMALLOCTYPE *xrealloc(XMALLOCTYPE *, int);
char *xstrdup(const char *);
+#if defined(HAVE_ALLOCA_H)
+#include <alloca.h>
+#else
+#ifdef _AIX
+ #pragma alloca
+#endif
+#endif
+#define xalloca(ptr, t, n) if (!(ptr = (t) alloca(n))) error(PS_UNDEFINED, 0, "alloca failed")
/* protocol driver and methods */
int do_protocol(struct query *, const struct method *);
diff --git a/options.c b/options.c
index 4ac3813c..da8df81c 100644
--- a/options.c
+++ b/options.c
@@ -7,13 +7,6 @@
#include "config.h"
#include <stdio.h>
-#if defined(HAVE_ALLOCA_H)
-#include <alloca.h>
-#else
-#ifdef _AIX
- #pragma alloca
-#endif
-#endif
#include <pwd.h>
#include <string.h>
#include <errno.h>
@@ -418,7 +411,7 @@ struct query *ctl; /* option record to be initialized */
break;
case 'r':
case LA_FOLDER:
- buf = alloca(strlen(optarg));
+ xalloca(buf, char *, strlen(optarg));
strcpy(buf, optarg);
cp = strtok(buf, ",");
do {
@@ -428,7 +421,7 @@ struct query *ctl; /* option record to be initialized */
break;
case 'S':
case LA_SMTPHOST:
- buf = alloca(strlen(optarg));
+ xalloca(buf, char *, strlen(optarg));
strcpy(buf, optarg);
cp = strtok(buf, ",");
do {
@@ -443,7 +436,7 @@ struct query *ctl; /* option record to be initialized */
break;
case 'Z':
case LA_ANTISPAM:
- buf = alloca(strlen(optarg));
+ xalloca(buf, char *, strlen(optarg));
strcpy(buf, optarg);
cp = strtok(buf, ",");
do {
diff --git a/pop3.c b/pop3.c
index 7238e345..11c1f7a0 100644
--- a/pop3.c
+++ b/pop3.c
@@ -7,13 +7,6 @@
#include "config.h"
#ifdef POP3_ENABLE
#include <stdio.h>
-#if defined(HAVE_ALLOCA_H)
-#include <alloca.h>
-#else
-#ifdef _AIX
- #pragma alloca
-#endif
-#endif
#include <string.h>
#include <ctype.h>
#if defined(HAVE_UNISTD_H)
@@ -225,7 +218,7 @@ int pop3_getauth(int sock, struct query *ctl, char *greeting)
*++end = '\0';
/* copy timestamp and password into digestion buffer */
- msg = (char *)alloca((end-start+1) + strlen(ctl->password) + 1);
+ xalloca(msg, char *, (end-start+1) + strlen(ctl->password) + 1);
strcpy(msg,start);
strcat(msg,ctl->password);
diff --git a/report.c b/report.c
index 319acba5..d2f12348 100644
--- a/report.c
+++ b/report.c
@@ -31,13 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#if defined(HAVE_SYSLOG)
#include <syslog.h>
#endif
-#if defined(HAVE_ALLOCA_H)
-#include <alloca.h>
-#else
-#ifdef _AIX
- #pragma alloca
-#endif
-#endif
#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC || HAVE_STDARG_H
# if HAVE_STDARG_H
@@ -159,7 +152,9 @@ error (status, errnum, message, va_alist)
if (errnum > 0)
{
- char *msg = alloca (strlen (message) + 5);
+ char *msg;
+
+ xalloca(msg, char *, strlen (message) + 5);
strcpy (msg, message);
strcat (msg, ": %m");
diff --git a/sink.c b/sink.c
index 8b372d36..90af32ed 100644
--- a/sink.c
+++ b/sink.c
@@ -24,13 +24,6 @@
#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
-#if defined(HAVE_ALLOCA_H)
-#include <alloca.h>
-#else
-#ifdef _AIX
- #pragma alloca
-#endif
-#endif
#include "fetchmail.h"
#include "socket.h"
@@ -96,13 +89,15 @@ static int smtp_open(struct query *ctl)
set_timeout(ctl->server.timeout);
for (idp = ctl->smtphunt; idp; idp = idp->next)
{
- char *cp, *parsed_host = alloca(strlen(idp->id) + 1);
+ char *cp, *parsed_host;
#ifdef INET6
char *portnum = SMTP_PORT;
#else
int portnum = SMTP_PORT;
#endif /* INET6 */
+ xalloca(parsed_host, char *, strlen(idp->id) + 1);
+
ctl->smtphost = idp->id; /* remember last host tried. */
strcpy(parsed_host, idp->id);
diff --git a/unmime.c b/unmime.c
index 30eff6d4..2acc3f74 100644
--- a/unmime.c
+++ b/unmime.c
@@ -15,13 +15,6 @@
#include "config.h"
#include <string.h>
#include <stdlib.h>
-#if defined(HAVE_ALLOCA_H)
-#include <alloca.h>
-#else
-#ifdef _AIX
- #pragma alloca
-#endif
-#endif
#include <ctype.h>
#include "fetchmail.h"
@@ -371,7 +364,7 @@ int MimeBodyType(unsigned char *hdrs, int WantDecode)
XferEncOfs = NxtHdr;
p = nxtaddr(NxtHdr);
if (p != NULL) {
- XferEnc = (char *)alloca(strlen(p) + 1);
+ xalloca(XferEnc, char *, strlen(p) + 1);
strcpy(XferEnc, p);
HdrsFound++;
}
@@ -402,7 +395,7 @@ int MimeBodyType(unsigned char *hdrs, int WantDecode)
} while ( (p != NULL) && ((*(p+1) == '\t') || (*(p+1) == ' ')) );
if (p == NULL) p = NxtHdr + strlen(NxtHdr);
- CntType = (char *)alloca(p-NxtHdr+2);
+ xalloca(CntType, char *, p-NxtHdr+2);
strncpy(CntType, NxtHdr, (p-NxtHdr));
*(CntType+(p-NxtHdr)) = '\0';
HdrsFound++;
@@ -410,7 +403,7 @@ int MimeBodyType(unsigned char *hdrs, int WantDecode)
else if (strncasecmp("MIME-Version:", NxtHdr, 13) == 0) {
p = nxtaddr(NxtHdr);
if (p != NULL) {
- MimeVer = (char *)alloca(strlen(p) + 1);
+ xalloca(MimeVer, char *, strlen(p) + 1);
strcpy(MimeVer, p);
HdrsFound++;
}