#ifndef __BEOS__
case NO_ADDRESS: /* valid, but does not have an IP address */
return(FALSE);
- break;
#endif
case NO_RECOVERY: /* non-recoverable name server error */
case TRY_AGAIN: /* temporary error on authoritative server */
#ifdef SSL_ENABLE
printf("'ssl',");
#endif /* SSL_ENABLE */
-#if OPIE_ENABLE
+#ifdef OPIE_ENABLE
printf("'opie',");
#endif /* OPIE_ENABLE */
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
printf("'inet6',");
#endif /* INET6_ENABLE */
-#if NET_SECURITY
+#ifdef NET_SECURITY
printf("'netsec',");
#endif /* NET_SECURITY */
printf(")\n");
using_kpop =
(ctl->server.protocol == P_POP3 &&
-#if !INET6_ENABLE
+#ifndef INET6_ENABLE
ctl->server.port == KPOP_PORT &&
#else
ctl->server.service && !strcmp(ctl->server.service, KPOP_PORT ) &&
{
char buf[MSGBUFSIZE+1], *realhost;
int count, new, bytes;
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
int fetches, dispatches, oldphase;
#else /* INET6_ENABLE */
int port, fetches, dispatches, oldphase;
oldphase = phase;
phase = OPEN_WAIT;
set_timeout(mytimeout);
-#if !INET6_ENABLE
+#ifndef INET6_ENABLE
#ifdef SSL_ENABLE
port = ctl->server.port ? ctl->server.port : ( ctl->use_ssl ? ctl->server.base_protocol->sslport : ctl->server.base_protocol->port );
#else
/* allow time for the port to be set up if we have a plugin */
if (ctl->server.plugin)
(void)sleep(1);
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
if ((mailserver_socket = SockOpen(realhost,
ctl->server.service ? ctl->server.service : ( ctl->use_ssl ? ctl->server.base_protocol->sslservice : ctl->server.base_protocol->service ),
ctl->server.netsec, ctl->server.plugin)) == -1)
#endif /* INET6_ENABLE */
{
char errbuf[BUFSIZ];
-#if !INET6_ENABLE
+#ifndef INET6_ENABLE
int err_no = errno;
#ifdef HAVE_RES_SEARCH
if (err_no != 0 && h_errno != 0)
for (qnp = ctl->domainlist; qnp; qnp = qnp->next)
{
/* ship the actual poll and get the response */
- gen_send(sock, "ETRN %s", qnp->id);
+ gen_send(sock, "ETRN %s", (char *)qnp->id);
if ((ok = gen_recv(sock, buf, sizeof(buf))))
return(ok);
static const struct method etrn =
{
"ETRN", /* ESMTP ETRN extension */
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
"smtp", /* standard SMTP port */
"smtps", /* ssl SMTP port */
#else /* INET6_ENABLE */
flag configdump; /* dump control blocks for configurator */
char *fetchmailhost; /* either `localhost' or the host's FQDN */
-#if NET_SECURITY
+#ifdef NET_SECURITY
void *request = NULL;
int requestlen = 0;
#endif /* NET_SECURITY */
#ifdef SSL_ENABLE
printf("+SSL");
#endif
-#if OPIE_ENABLE
+#ifdef OPIE_ENABLE
printf("+OPIE");
#endif /* OPIE_ENABLE */
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
printf("+INET6");
#endif /* INET6_ENABLE */
-#if NET_SECURITY
+#ifdef NET_SECURITY
printf("+NETSEC");
#endif /* NET_SECURITY */
#ifdef HAVE_SOCKS
printf("+SOCKS");
#endif /* HAVE_SOCKS */
-#if ENABLE_NLS
+#ifdef ENABLE_NLS
printf("+NLS");
#endif /* ENABLE_NLS */
putchar('\n');
}
}
-#if (defined(linux) && !INET6_ENABLE) || defined(__FreeBSD__)
+#if (defined(linux) && !defined(INET6_ENABLE)) || defined(__FreeBSD__)
/*
* Don't do monitoring if we were woken by a signal.
* Note that interface_approve() does its own error logging.
break;
}
-#if (defined(linux) && !INET6_ENABLE) || defined (__FreeBSD__)
+#if (defined(linux) && !defined(INET6_ENABLE)) || defined (__FreeBSD__)
if (ctl->server.monitor)
{
/*
#define FLAG_MERGE(fld) if (force ? !!h1->fld : !h2->fld) h2->fld = h1->fld
FLAG_MERGE(server.via);
FLAG_MERGE(server.protocol);
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
FLAG_MERGE(server.service);
FLAG_MERGE(server.netsec);
#else /* INET6_ENABLE */
if (ctl->server.timeout == -1)
ctl->server.timeout = CLIENT_TIMEOUT;
-#if !INET6_ENABLE
+#ifndef INET6_ENABLE
/* sanity checks */
if (ctl->server.port < 0)
{
}
if (ctl->server.protocol == P_POP3
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
&& ctl->server.service && !strcmp(ctl->server.service, KPOP_PORT)
#else /* INET6_ENABLE */
&& ctl->server.port == KPOP_PORT
ctl->server.authenticate == A_KERBEROS_V5 ? "V" : "IV");
else
printf(GT_(" Protocol is %s"), showproto(ctl->server.protocol));
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
if (ctl->server.service)
printf(GT_(" (using service %s)"), ctl->server.service);
if (ctl->server.netsec)
printf(GT_(" Selected mailboxes are:"));
for (idp = ctl->mailboxes; idp; idp = idp->next)
- printf(" %s", idp->id);
+ printf(" %s", (char *)idp->id);
printf("\n");
}
printf(GT_(" %s messages will be retrieved (--all %s).\n"),
printf(GT_(" Domains for which mail will be fetched are:"));
for (idp = ctl->domainlist; idp; idp = idp->next)
{
- printf(" %s", idp->id);
+ printf(" %s", (char *)idp->id);
if (!idp->val.status.mark)
printf(GT_(" (default)"));
}
ctl->listener);
for (idp = ctl->smtphunt; idp; idp = idp->next)
{
- printf(" %s", idp->id);
+ printf(" %s", (char *)idp->id);
if (!idp->val.status.mark)
printf(GT_(" (default)"));
}
{
for (idp = ctl->localnames; idp; idp = idp->next)
if (idp->val.id2)
- printf("\t%s -> %s\n", idp->id, idp->val.id2);
+ printf("\t%s -> %s\n", (char *)idp->id, (char *)idp->val.id2);
else
- printf("\t%s\n", idp->id);
+ printf("\t%s\n", (char *)idp->id);
if (ctl->wildcard)
fputs("\t*\n", stdout);
}
printf(GT_(" Predeclared mailserver aliases:"));
for (idp = ctl->server.akalist; idp; idp = idp->next)
- printf(" %s", idp->id);
+ printf(" %s", (char *)idp->id);
putchar('\n');
}
if (ctl->server.localdomains)
printf(GT_(" Local domains:"));
for (idp = ctl->server.localdomains; idp; idp = idp->next)
- printf(" %s", idp->id);
+ printf(" %s", (char *)idp->id);
putchar('\n');
}
}
printf(GT_(" %d UIDs saved.\n"), count);
if (outlevel >= O_VERBOSE)
for (idp = ctl->oldsaved; idp; idp = idp->next)
- printf("\t%s\n", idp->id);
+ printf("\t%s\n", (char *)idp->id);
}
}
#define P_ETRN 7
#define P_ODMR 8
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
#define SMTP_PORT "smtp"
#define KPOP_PORT "kpop"
#else /* INET6_ENABLE */
struct method /* describe methods for protocol state machine */
{
const char *name; /* protocol name */
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
const char *service;
const char *sslservice;
#else /* INET6_ENABLE */
struct idlist *akalist; /* server name first, then akas */
struct idlist *localdomains; /* list of pass-through domains */
int protocol; /* protocol type */
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
char *service; /* IPv6 service name */
void *netsec; /* IPv6 security request */
#else /* INET6_ENABLE */
#define ROOT_UID 0
#endif /* __CYGWIN__ */
+extern int mailserver_socket_temp;
+extern char *program_name;
+
/* fetchmail.h ends here */
#include "i18n.h"
-#if OPIE_ENABLE
+#ifdef OPIE_ENABLE
#endif /* OPIE_ENABLE */
#ifndef strstr /* glibc-2.1 declares this as a macro */
}
}
-#if NTLM_ENABLE
+#ifdef NTLM_ENABLE
#include "ntlm.h"
static tSmbNtlmAuthRequest request;
return ok;
}
-#if OPIE_ENABLE
+#ifdef OPIE_ENABLE
if ((ctl->server.authenticate == A_ANY
|| ctl->server.authenticate == A_OTP)
&& strstr(capabilities, "AUTH=X-OTP"))
static const struct method imap =
{
"IMAP", /* Internet Message Access Protocol */
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
"imap",
"imaps",
#else /* INET6_ENABLE */
#define HEADER_MD5_H
#endif
+#include "config.h"
+
#if SIZEOF_INT == 4
typedef unsigned int uint32;
#else
if (host && login)
{
- int i, status;
+ int status;
status = 0;
printf("Host: %s, Login: %s\n", host, login);
static const struct method odmr =
{
"ODMR", /* ODMR protocol */
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
"odmr", /* standard SMTP port */
"odmrs", /* ssl SMTP port */
#else /* INET6_ENABLE */
#include "i18n.h"
#include "md5.h"
-#if OPIE_ENABLE
+#ifdef OPIE_ENABLE
#include <opie.h>
int do_otp(int sock, char *command, struct query *ctl)
{"principal", required_argument, (int *) 0, LA_PRINCIPAL },
-#if (defined(linux) && !INET6_ENABLE) || defined(__FreeBSD__)
+#if (defined(linux) && !defined(INET6_ENABLE)) || defined(__FreeBSD__)
{"interface", required_argument, (int *) 0, LA_INTERFACE },
{"monitor", required_argument, (int *) 0, LA_MONITOR },
#endif /* (defined(linux) && !INET6_ENABLE) || defined(__FreeBSD__) */
else if (strcasecmp(optarg,"kpop") == 0)
{
ctl->server.protocol = P_POP3;
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
ctl->server.service = KPOP_PORT;
#else /* INET6_ENABLE */
ctl->server.port = KPOP_PORT;
break;
case 'P':
case LA_PORT:
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
ctl->server.service = optarg;
#else /* INET6_ENABLE */
ctl->server.port = xatoi(optarg, &errflag);
case 'T':
case LA_NETSEC:
-#if NET_SECURITY
+#ifdef NET_SECURITY
ctl->server.netsec = (void *)optarg;
#else
fprintf(stderr, GT_("fetchmail: network security support is disabled\n"));
#endif /* NET_SECURITY */
break;
-#if (defined(linux) && !INET6_ENABLE) || defined(__FreeBSD__)
+#if (defined(linux) && !defined(INET6_ENABLE)) || defined(__FreeBSD__)
case 'I':
case LA_INTERFACE:
interface_parse(optarg, &ctl->server);
P(GT_(" -i, --idfile specify alternate UIDs file\n"));
P(GT_(" --postmaster specify recipient of last resort\n"));
P(GT_(" --nobounce redirect bounces from user to postmaster.\n"));
-#if (defined(linux) && !INET6_ENABLE) || defined(__FreeBSD__)
+#if (defined(linux) && !defined(INET6_ENABLE)) || defined(__FreeBSD__)
P(GT_(" -I, --interface interface required specification\n"));
P(GT_(" -M, --monitor monitor interface for activity\n"));
#endif
P(GT_(" -l, --limit don't fetch messages over given size\n"));
P(GT_(" -w, --warnings interval between warning mail notification\n"));
-#if NET_SECURITY
+#ifdef NET_SECURITY
P(GT_(" -T, --netsec set IP security request\n"));
#endif /* NET_SECURITY */
P(GT_(" -S, --smtphost set SMTP forwarding host\n"));
#include "socket.h"
#include "i18n.h"
-#if OPIE_ENABLE
+#ifdef OPIE_ENABLE
#include <opie.h>
#endif /* OPIE_ENABLE */
char *sdps_envto;
#endif /* SDPS_ENABLE */
-#if OPIE_ENABLE
+#ifdef OPIE_ENABLE
static char lastok[POPBUFSIZE+1];
#endif /* OPIE_ENABLE */
flag has_ssl = FALSE;
#endif /* SSL_ENABLE */
-#if NTLM_ENABLE
+#ifdef NTLM_ENABLE
#include "ntlm.h"
static tSmbNtlmAuthRequest request;
if (strcmp(buf,"+OK") == 0)
{
-#if OPIE_ENABLE
+#ifdef OPIE_ENABLE
strcpy(lastok, bufp);
#endif /* OPIE_ENABLE */
ok = 0;
int ok;
char *start,*end;
char *msg;
-#if OPIE_ENABLE
+#ifdef OPIE_ENABLE
char *challenge;
#endif /* OPIE_ENABLE */
#ifdef SSL_ENABLE
* rather than doing SASL.
*/
if (has_kerberos &&
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
ctl->server.service && (strcmp(ctl->server.service, KPOP_PORT)!=0)
#else /* INET6_ENABLE */
ctl->server.port != KPOP_PORT
/* ordinary validation, no one-time password or RPA */
gen_transact(sock, "USER %s", ctl->remotename);
-#if OPIE_ENABLE
+#ifdef OPIE_ENABLE
/* see RFC1938: A One-Time Password System */
if (challenge = strstr(lastok, "otp-")) {
char response[OPIE_RESPONSE_MAX+1];
static const struct method pop3 =
{
"POP3", /* Post Office Protocol v3 */
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
"pop3", /* standard POP3 port */
"pop3s", /* ssl POP3 port */
#else /* INET6_ENABLE */
#include "i18n.h"
#include "fetchmail.h"
-#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC || HAVE_STDARG_H
+#if defined(HAVE_VPRINTF) || defined(HAVE_DOPRNT) || defined(_LIBC) || defined(HAVE_STDARG_H)
# if HAVE_STDARG_H
# include <stdarg.h>
# define VA_START(args, lastarg) va_start(args, lastarg)
#else
-/* The calling program should define program_name and set it to the
- name of the executing program. */
-extern char *program_name;
-
# if !HAVE_STRERROR && !defined(strerror)
char *strerror (int errnum)
{
#ifdef VA_START
VA_START (args, message);
-# if HAVE_VPRINTF || _LIBC
+# if defined(HAVE_VPRINTF) || defined(_LIBC)
vfprintf (errfp, message, args);
# else
_doprnt (message, args, errfp);
#if defined(VA_START)
VA_START (args, message);
-#if HAVE_VSNPRINTF || _LIBC
+#if defined(HAVE_VSNPRINTF) || defined(_LIBC)
for ( ; ; )
{
n = vsnprintf (partial_message + partial_message_size_used,
#if defined(VA_START)
VA_START (args, message);
-#if HAVE_VSNPRINTF || _LIBC
+#if defined(HAVE_VSNPRINTF) || defined(_LIBC)
for ( ; ; )
{
n = vsnprintf (partial_message + partial_message_size_used,
\f
/* Sometimes we want to have at most one error per line. This
variable controls whether this mode is selected or not. */
-int error_one_per_line;
+static int error_one_per_line;
void
#ifdef HAVE_STDARG_H
}
if (file_name != NULL)
- fprintf (errfp, "%s:%d: ", file_name, line_number);
+ fprintf (errfp, "%s:%u: ", file_name, line_number);
#ifdef VA_START
VA_START (args, message);
-# if HAVE_VPRINTF || _LIBC
+# if defined(HAVE_VPRINTF) || defined(_LIBC)
vfprintf (errfp, message, args);
# else
_doprnt (message, args, errfp);
#ifdef MAIN
if (verbose)
{
- printf("state %d: %s", state, buf);
+ printf("state %d: %s", state, (char *)buf);
printf("%*s^\n", from - buf + 10, " ");
}
#endif /* MAIN */
#ifdef MAIN
if (verbose)
{
- printf("state %d: %s", state, orighdr);
+ printf("state %d: %s", state, (char *)orighdr);
printf("%*s^\n", hp - orighdr + 10, " ");
}
#endif /* MAIN */
if (reply)
{
reply_hack(longbuf, "HOSTNAME.NET", &dummy);
- printf("Rewritten buffer: %s", longbuf);
+ printf("Rewritten buffer: %s", (char *)longbuf);
}
else
if ((cp = nxtaddr(longbuf)) != (unsigned char *)NULL)
do {
- printf("\t-> \"%s\"\n", cp);
+ printf("\t-> \"%s\"\n", (char *)cp);
} while
((cp = nxtaddr((unsigned char *)NULL)) != (unsigned char *)NULL);
}
#endif /* ndef h_errno */
-extern int mailserver_socket_temp; /* Socket to close if connect timeout */
-
-#if NET_SECURITY
+#ifdef NET_SECURITY
#include <net/security.h>
#endif /* NET_SECURITY */
/* error */
report(stderr, GT_("fetchmail: fork failed\n"));
return -1;
- break;
case 0: /* child */
/* fds[1] is the parent's end; close it for proper EOF
** detection */
return sock;
}
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
int SockOpen(const char *host, const char *service, const char *options,
const char *plugin)
{
struct addrinfo *ai, *ai0, req;
int i;
-#if NET_SECURITY
+#ifdef NET_SECURITY
void *request = NULL;
int requestlen;
#endif /* NET_SECURITY */
#define SOCKET__
/* Create a new client socket; returns (FILE *)NULL on error */
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
int SockOpen(const char *host, const char *service, const char *options,
const char *plugin);
#else /* INET6_ENABLE */
*/
int UnixOpen(const char *path);
-#if SSL_ENABLE
+#ifdef SSL_ENABLE
int SSLOpen(int sock, char *mycert, char *mykey, char *myproto, int certck, char *certpath,
char *fingerprint, char *servercname, char *label);
#endif /* SSL_ENABLE */
#endif /* HAVE_SNPRINTF */
"Received: from %s [%u.%u.%u.%u]\r\n",
ctl->server.truename,
- (unsigned char)ctl->server.trueaddr[0],
- (unsigned char)ctl->server.trueaddr[1],
- (unsigned char)ctl->server.trueaddr[2],
- (unsigned char)ctl->server.trueaddr[3]);
+ (unsigned int)(unsigned char)ctl->server.trueaddr[0],
+ (unsigned int)(unsigned char)ctl->server.trueaddr[1],
+ (unsigned int)(unsigned char)ctl->server.trueaddr[2],
+ (unsigned int)(unsigned char)ctl->server.trueaddr[3]);
} else {
#ifdef HAVE_SNPRINTF
snprintf(buf, sizeof(buf),
report_build(stdout, GT_("Old UID list from %s:"),
ctl->server.pollname);
for (idp = ctl->oldsaved; idp; idp = idp->next)
- report_build(stdout, " %s", idp->id);
+ report_build(stdout, " %s", (char *)idp->id);
if (!idp)
report_build(stdout, GT_(" <empty>"));
report_complete(stdout, "\n");
{
report_build(stdout, GT_("Scratch list of UIDs:"));
for (idp = scratchlist; idp; idp = idp->next)
- report_build(stdout, " %s", idp->id);
+ report_build(stdout, " %s", (char *)idp->id);
if (!idp)
report_build(stdout, GT_(" <empty>"));
report_complete(stdout, "\n");
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", idp->id, idp->val.status.mark);
+ report_build(stdout, " %s = %d", (char *)idp->id, idp->val.status.mark);
if (!idp)
report_build(stdout, GT_(" <empty>"));
report_complete(stdout, "\n");
* 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", idp->id, idp->val.status.mark);
+ report_build(stdout, " %s = %d", (char *)idp->id, idp->val.status.mark);
if (!idp)
report_build(stdout, GT_(" <empty>"));
report_complete(stdout, "\n");
if (idp->val.status.mark == UID_SEEN
|| idp->val.status.mark == UID_DELETED)
fprintf(tmpfp, "%s@%s %s\n",
- ctl->remotename, ctl->server.queryname, idp->id);
+ ctl->remotename, ctl->server.queryname, (char *)idp->id);
}
for (idp = scratchlist; idp; idp = idp->next)
fputs(idp->id, tmpfp);