aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-07-05 19:08:18 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-07-05 19:08:18 +0000
commit4640f5541a1699ea3805e8a0801811201d9c24ef (patch)
treeaa5c89f92e5d1426386f71faefbf1c13eadd16d3
parent3fdc882c9627f13b63eb087c71e96caf045da05d (diff)
downloadfetchmail-4640f5541a1699ea3805e8a0801811201d9c24ef.tar.gz
fetchmail-4640f5541a1699ea3805e8a0801811201d9c24ef.tar.bz2
fetchmail-4640f5541a1699ea3805e8a0801811201d9c24ef.zip
Allow duplicate hostnames again.
svn path=/trunk/; revision=1152
-rw-r--r--NEWS6
-rw-r--r--fetchmail.c53
-rw-r--r--fetchmail.h3
-rw-r--r--rcfile_y.y23
4 files changed, 19 insertions, 66 deletions
diff --git a/NEWS b/NEWS
index 640ab935..c74e505c 100644
--- a/NEWS
+++ b/NEWS
@@ -10,11 +10,6 @@
return a zero exit status if *any* host had mail, not just the last one
checked.
-* Remove restriction that no two poll entries can have identical hostnames?
- The problem is with a skip entry following a poll entry for the same host.
- This corrupts a data structure leading to core dump, but I'm not sure
- exactly how.
-
* Generate bounce messages when delivery is refused. See RFC1891, RFC1894.
* More log levels?
@@ -34,6 +29,7 @@ And about time, too, I've been hacking on this code for a year now!
* Removed the popclient backward-compatibility hacks.
* Leif Erlingsson <leif@lege.com> sent a patch to avoid colliding with
the busy-lock after authentication failure on a POP3 server.
+* Allow duplicate server hostnames again.
There are 252 people on the fetchmail-friends list.
diff --git a/fetchmail.c b/fetchmail.c
index 3700b0e8..86f7e15d 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -49,7 +49,6 @@
static int load_params(int, char **, int);
static void dump_params (struct query *);
static int query_host(struct query *);
-static char *visbuf(const char *);
/* controls the detail level of status/progress messages written to stderr */
int outlevel; /* see the O_.* constants above */
@@ -579,16 +578,6 @@ static int load_params(int argc, char **argv, int optind)
}
#endif /* !HAVE_GETHOSTBYNAME || !HAVE_RES_SEARCH */
- /* compute server leaders for queries */
- for (mp = querylist; mp && mp != ctl; mp = mp->next)
- if (strcmp(mp->server.names->id, ctl->server.names->id) == 0)
- {
- ctl->server.lead_server = mp->server.lead_server;
- goto no_new_server;
- }
- ctl->server.lead_server = &(ctl->server);
- no_new_server:;
-
/* this code enables flags to be turned off */
#define DEFAULT(flag, dflt) if (flag == FLAG_TRUE)\
flag = TRUE;\
@@ -597,8 +586,8 @@ static int load_params(int argc, char **argv, int optind)
else\
flag = (dflt)
DEFAULT(ctl->keep, FALSE);
- DEFAULT(ctl->flush, FALSE);
DEFAULT(ctl->fetchall, FALSE);
+ DEFAULT(ctl->flush, FALSE);
DEFAULT(ctl->rewrite, TRUE);
DEFAULT(ctl->stripcr, (ctl->mda != (char *)NULL));
DEFAULT(ctl->forcecr, FALSE);
@@ -954,44 +943,4 @@ void dump_params (struct query *ctl)
}
}
-static char *visbuf(const char *buf)
-/* visibilize a given string */
-{
- static char vbuf[BUFSIZ];
- char *tp = vbuf;
-
- while (*buf)
- {
- if (isprint(*buf) || *buf == ' ')
- *tp++ = *buf++;
- else if (*buf == '\n')
- {
- *tp++ = '\\'; *tp++ = 'n';
- buf++;
- }
- else if (*buf == '\r')
- {
- *tp++ = '\\'; *tp++ = 'r';
- buf++;
- }
- else if (*buf == '\b')
- {
- *tp++ = '\\'; *tp++ = 'b';
- buf++;
- }
- else if (*buf < ' ')
- {
- *tp++ = '\\'; *tp++ = '^'; *tp++ = '@' + *buf;
- buf++;
- }
- else
- {
- (void) sprintf(tp, "\\0x%02x", *buf++);
- tp += strlen(tp);
- }
- }
- *tp++ = '\0';
- return(vbuf);
-}
-
/* fetchmail.c ends here */
diff --git a/fetchmail.h b/fetchmail.h
index 30b848e3..1ff759a2 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -132,10 +132,10 @@ struct query
/* internal use */
bool active; /* should we actually poll this server? */
int errcount; /* count transient errors in last pass */
- struct query *next; /* next query control block in chain */
int smtp_socket; /* socket descriptor for SMTP connection */
unsigned int uid; /* UID of user to deliver to */
char digest [DIGESTLEN]; /* md5 digest buffer */
+ struct query *next; /* next query control block in chain */
};
#define MULTIDROP(ctl) (ctl->wildcard || \
@@ -254,6 +254,7 @@ int interface_approve(struct hostdata *);
char *getpassword(char *);
void escapes(const char *, char *);
+char *visbuf(const char *);
char *showproto(int);
void yyerror(const char *);
diff --git a/rcfile_y.y b/rcfile_y.y
index ce46e64c..0c0f2a17 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -36,6 +36,8 @@ int yydebug; /* in case we didn't generate with -- debug */
static struct query current; /* current server record */
static int prc_errflag;
+static struct hostdata *leadentry;
+static bool trailer;
static void record_current();
static void user_reset();
@@ -334,13 +336,7 @@ const bool securecheck; /* check for a secure rc file? */
static int reset_server(char *name, int skip)
/* clear the entire global record and initialize it with a new name */
{
- struct query *ctl;
-
- /* don't allow name collisions, this screws up the data structures */
- for (ctl = querylist; ctl; ctl = ctl->next)
- if (strcmp(name, ctl->server.names->id) == 0)
- return(FALSE);
-
+ trailer = FALSE;
memset(&current,'\0',sizeof(current));
current.smtp_socket = -1;
save_str(&current.server.names, -1, name);
@@ -350,7 +346,7 @@ static int reset_server(char *name, int skip)
static void user_reset(void)
-/* clear the global current record (server parameters) used by the parser */
+/* clear the global current record (user parameters) used by the parser */
{
struct hostdata save;
@@ -386,6 +382,15 @@ struct query *init; /* pointer to block containing initial values */
else
querylist = node; /* list is empty */
hosttail = node;
+
+ if (trailer)
+ node->server.lead_server = leadentry;
+ else
+ {
+ node->server.lead_server = NULL;
+ leadentry = &node->server;
+ }
+
return(node);
}
@@ -431,6 +436,8 @@ static void record_current(void)
#undef FLAG_FORCE
(void) hostalloc(&current);
+
+ trailer = TRUE;
}
void optmerge(struct query *h2, struct query *h1)