]> Pileus Git - ~andy/fetchmail/commitdiff
Better restoration of server options.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 13 Jan 1997 20:56:00 +0000 (20:56 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 13 Jan 1997 20:56:00 +0000 (20:56 -0000)
svn path=/trunk/; revision=753

fetchmail.h
rcfile_y.y

index f848ab649795515f16bffbdce725ab917fdc4bc2..105275a073fd68256374a5e9dab735c64451fdb1 100644 (file)
@@ -63,9 +63,7 @@ struct query
 {
     /* per-host data */
     struct idlist *servernames;                /* servername first, then akas */
-    struct idlist *localnames;         /* including calling user's name */
     struct idlist *localdomains;       /* list of pass-through domains */
-    int wildcard;              /* should unmatched names be passed through */
     int protocol;
     int port;
     int authenticate;
@@ -74,6 +72,8 @@ struct query
     int skip;
 
     /* per-user data */
+    struct idlist *localnames;         /* including calling user's name */
+    int wildcard;              /* should unmatched names be passed through */
     char remotename [USERNAMELEN+1];
     char password [PASSWORDLEN+1];
     char mailbox [FOLDERLEN+1];
index f96f59a0674b1961a02fc19da30b145a39992940..28a88973954546bbd54b609403df31734ac86c6f 100644 (file)
@@ -272,8 +272,7 @@ const char *pathname;               /* pathname for the configuration file */
 static void prc_reset(void)
 /* clear the global current record (server parameters) used by the parser */
 {
-    int                saveport, saveproto, saveauth, saveskip;
-    struct idlist *saveservernames;
+    struct query save;
 
     /*
      * Purpose of this code is to initialize the new server block, but
@@ -281,18 +280,18 @@ static void prc_reset(void)
      * preserve server options unless the command-line explicitly
      * overrides them.
      */
-    saveport = current.port;
-    saveproto = current.protocol;
-    saveauth = current.authenticate;
-    saveskip = current.skip;
-    saveservernames = current.servernames;
+    save = current;
 
     memset(&current, '\0', sizeof(current));
 
-    current.protocol = saveproto;
-    current.authenticate = saveauth;
-    current.skip = saveskip;
-    current.servernames = saveservernames;
+    current.servernames = save.servernames;
+    current.localdomains = save.localdomains;
+    current.protocol = save.protocol;
+    current.port = save.port;
+    current.authenticate = save.authenticate;
+    current.timeout = save.timeout;
+    current.envelope = save.envelope;
+    current.skip = save.skip;
 }
 
 struct query *hostalloc(init)
@@ -331,14 +330,16 @@ static void prc_register(void)
     
 #define FLAG_FORCE(fld) if (cmd_opts.fld) current.fld = cmd_opts.fld
     FLAG_FORCE(protocol);
+    FLAG_FORCE(port);
+    FLAG_FORCE(authenticate);
+    FLAG_FORCE(timeout);
+    FLAG_FORCE(envelope);      /* yes, even though this is a string */
+    FLAG_FORCE(skip);
+
     FLAG_FORCE(keep);
     FLAG_FORCE(flush);
     FLAG_FORCE(fetchall);
     FLAG_FORCE(norewrite);
-    FLAG_FORCE(skip);
-    FLAG_FORCE(port);
-    FLAG_FORCE(authenticate);
-    FLAG_FORCE(timeout);
     FLAG_FORCE(limit);
     FLAG_FORCE(fetchlimit);
 #undef FLAG_FORCE
@@ -350,6 +351,7 @@ void optmerge(struct query *h2, struct query *h1)
 /* merge two options records; empty fields in h2 are filled in from h1 */
 {
     append_str_list(&h2->localnames, &h1->localnames);
+    append_str_list(&h2->localdomains, &h1->localdomains);
 
 #define STR_MERGE(fld, len) if (*(h2->fld) == '\0') strcpy(h2->fld, h1->fld)
     STR_MERGE(remotename, USERNAMELEN);
@@ -362,14 +364,16 @@ void optmerge(struct query *h2, struct query *h1)
 
 #define FLAG_MERGE(fld) if (!h2->fld) h2->fld = h1->fld
     FLAG_MERGE(protocol);
+    FLAG_MERGE(port);
+    FLAG_MERGE(authenticate);
+    FLAG_MERGE(timeout);
+    FLAG_MERGE(envelope);      /* yes, even though this is a string */
+    FLAG_MERGE(skip);
+
     FLAG_MERGE(keep);
     FLAG_MERGE(flush);
     FLAG_MERGE(fetchall);
     FLAG_MERGE(norewrite);
-    FLAG_MERGE(skip);
-    FLAG_MERGE(port);
-    FLAG_MERGE(authenticate);
-    FLAG_MERGE(timeout);
     FLAG_MERGE(limit);
     FLAG_MERGE(fetchlimit);
 #undef FLAG_MERGE