Release Notes:
+fetchmail-4.6.1 ():
+* Fixed a minor memory leak in the IP-address-comparison code.
+* Mark Staveley's patch to suppress progress dots from non-detached daemon
+ fetchmails.
+
fetchmail-4.6.0 (Fri Sep 18 13:17:17 EDT 1998):
* Added Bill Adams's mailqueue.pl to the contrib directory.
* Try to enable KPOP initialization to work even if `no dns' is on.
#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"
{
struct in_addr in;
(void) memcpy(&in.s_addr, *p, sizeof (in.s_addr));
- host_a_addr = (address_e *)xmalloc(sizeof( address_e));
+ host_a_addr = (address_e *)alloca(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));
{
struct in_addr in;
(void) memcpy(&in.s_addr, *p, sizeof (in.s_addr));
- host_b_addr = (address_e *)xmalloc(sizeof( address_e));
+ host_b_addr = (address_e *)alloca(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));
#else
/*
* The only code that calls the BIND library is here and in the
- * start-of-run probe with gethostbyname(3).
+ * start-of-run probe with gethostbyname(3) under ETRN/Kerberos.
*
* We know DNS service was up at the beginning of the run.
* If it's down, our nameserver has crashed. We don't want to try
Key_schedule schedule;
int rem;
- ticket = ((KTEXT) (malloc (sizeof (KTEXT_ST))));
+ ticket = ((KTEXT) (alloca (sizeof (KTEXT_ST))));
rem = (krb_sendauth (0L, socket, ticket, "pop",
canonical,
((char *) (krb_realmofhost (canonical))),
((struct sockaddr_in *) 0),
((struct sockaddr_in *) 0),
"KPOPV0.1"));
- free (ticket);
if (rem != KSUCCESS)
{
error(0, -1, "kerberos error %s", (krb_get_err_text (rem)));
/* set up to do lock protocol */
#define FETCHMAIL_PIDFILE "fetchmail.pid"
- tmpbuf = xmalloc(strlen(home) + strlen(FETCHMAIL_PIDFILE) + 3);
+ tmpbuf = alloca(strlen(home) + strlen(FETCHMAIL_PIDFILE) + 3);
if (!getuid())
sprintf(tmpbuf, "%s/%s", PID_DIR, FETCHMAIL_PIDFILE);
else {
}
/* parse the ~/.netrc file (if present) for future password lookups. */
- netrc_file = (char *) xmalloc (strlen (home) + 8);
+ netrc_file = (char *) alloca (strlen (home) + 8);
strcpy (netrc_file, home);
strcat (netrc_file, "/.netrc");
netrc_list = parse_netrc(netrc_file);
#endif /* GSSAPI */
&& !ctl->password)
{
- free(tmpbuf);
#define PASSWORD_PROMPT "Enter password for %s@%s: "
- tmpbuf = xmalloc(strlen(PASSWORD_PROMPT) +
+ tmpbuf = alloca(strlen(PASSWORD_PROMPT) +
strlen(ctl->remotename) +
strlen(ctl->server.pollname) + 1);
(void) sprintf(tmpbuf, PASSWORD_PROMPT,
}
}
- /* we don't need tmpbuf anymore */
- free(tmpbuf);
- tmpbuf = NULL; /* firewall code */
-
/*
* Maybe time to go to demon mode...
*/
}
else
#endif
- error_init(run.poll_interval == 0 && !run.logfile);
+ error_init((run.poll_interval == 0 || nodetach) && !run.logfile);
if (run.poll_interval)
{
#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>
break;
case 'r':
case LA_FOLDER:
- buf = xmalloc(strlen(optarg));
+ buf = alloca(strlen(optarg));
strcpy(buf, optarg);
cp = strtok(buf, ",");
do {
save_str(&ctl->mailboxes, cp, 0);
} while
((cp = strtok((char *)NULL, ",")));
- free(buf);
break;
case 'S':
case LA_SMTPHOST:
- buf = xmalloc(strlen(optarg));
+ buf = alloca(strlen(optarg));
strcpy(buf, optarg);
cp = strtok(buf, ",");
do {
} while
((cp = strtok((char *)NULL, ",")));
ocount++;
- free(buf);
break;
case 'D':
case LA_SMTPADDR:
break;
case 'Z':
case LA_ANTISPAM:
- buf = xmalloc(strlen(optarg));
+ buf = alloca(strlen(optarg));
strcpy(buf, optarg);
cp = strtok(buf, ",");
do {
idp->val.status.num = atoi(cp);
} while
((cp = strtok((char *)NULL, ",")));
- free(buf);
break;
case 'b':
case LA_BATCHLIMIT:
#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)
*++end = '\0';
/* copy timestamp and password into digestion buffer */
- msg = (char *)xmalloc((end-start+1) + strlen(ctl->password) + 1);
+ msg = (char *)alloca((end-start+1) + strlen(ctl->password) + 1);
strcpy(msg,start);
strcat(msg,ctl->password);
strcpy(ctl->digest, MD5Digest(msg));
- free(msg);
ok = gen_transact(sock, "APOP %s %s", ctl->remotename, ctl->digest);
break;
#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"
XferEncOfs = NxtHdr;
p = nxtaddr(NxtHdr);
if (p != NULL) {
- XferEnc = (char *)xmalloc(strlen(p) + 1);
+ XferEnc = (char *)alloca(strlen(p) + 1);
strcpy(XferEnc, p);
HdrsFound++;
}
} while ( (p != NULL) && ((*(p+1) == '\t') || (*(p+1) == ' ')) );
if (p == NULL) p = NxtHdr + strlen(NxtHdr);
- CntType = (char *)xmalloc(p-NxtHdr+2);
+ CntType = (char *)alloca(p-NxtHdr+2);
strncpy(CntType, NxtHdr, (p-NxtHdr));
*(CntType+(p-NxtHdr)) = '\0';
HdrsFound++;
else if (strncasecmp("MIME-Version:", NxtHdr, 13) == 0) {
p = nxtaddr(NxtHdr);
if (p != NULL) {
- MimeVer = (char *)xmalloc(strlen(p) + 1);
+ MimeVer = (char *)alloca(strlen(p) + 1);
strcpy(MimeVer, p);
HdrsFound++;
}
}
- if (MimeVer) free(MimeVer);
- if (XferEnc) free(XferEnc);
- if (CntType) free(CntType);
-
return BodyType;
}