]> Pileus Git - ~andy/fetchmail/commitdiff
Correct the interface parsing.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 24 Jan 1997 00:37:30 +0000 (00:37 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 24 Jan 1997 00:37:30 +0000 (00:37 -0000)
svn path=/trunk/; revision=818

fetchmail.c
fetchmail.h
interface.c
rcfile_y.y

index ea973152fd4411eaec14b117427cbde3d535238d..46c77799177b68d0a416127d74e415b1e6ac9ff5 100644 (file)
@@ -634,11 +634,6 @@ static int load_params(int argc, char **argv, int optind)
            if (ctl->server.envelope == (char *)NULL)
                ctl->server.envelope = "X-Envelope-To:";
 
-#ifdef linux
-           /* interface_parse() does its own error logging */
-           interface_parse(&ctl->server);
-#endif /* linux */
-
            /* sanity checks */
            if (ctl->server.port < 0)
            {
index e18a7b5274404bb0b95d4801d144b07eb6280430..18bfbe1f097c3e794df69542223687053c009659 100644 (file)
@@ -224,7 +224,7 @@ int daemonize(const char *, void (*)(int));
 int prc_parse_file(const char *);
 int prc_filecheck(const char *);
 
-void interface_parse(struct hostdata *);
+void interface_parse(char *, struct hostdata *);
 void interface_note_activity(struct hostdata *);
 int interface_approve(struct hostdata *);
 
index 19bbd820a66dc9777b84d2181e64e739e62dd52f..6342df7c51ba5782f3fa52f85a17d1935fc67b54 100644 (file)
@@ -98,19 +98,16 @@ static int get_ifinfo(const char *ifname, ifinfo_t *ifinfo)
        return(result);
 }
 
-void interface_parse(struct hostdata *hp)
+void interface_parse(char *buf, struct hostdata *hp)
 /* parse 'interface' specification */
 {
        char *cp1, *cp2;
 
-       /* if no interface specification present, all done */
-       if (!hp->interface)
-               return;
-
        /* find and isolate just the IP address */
-       if (!(cp1 = strchr(hp->interface, '/')))
+       if (!(cp1 = strchr(buf, '/')))
                (void) error(PS_SYNTAX, 0, "missing IP interface address");
        *cp1++ = '\000';
+       hp->interface = xstrdup(buf);
 
        /* find and isolate just the netmask */
        if (!(cp2 = strchr(cp1, '/')))
index 8e6d0cd52758fa027624fc5a9bebe253e267a929..dfc3dbddc1e81a8c661e5cf4f5912ab60cd653c6 100644 (file)
@@ -116,7 +116,7 @@ serv_option : AKA alias_list
                | ENVELOPE STRING       {current.server.envelope = xstrdup($2);}
                | INTERFACE STRING      {
 #ifdef linux
-                                       current.server.interface = xstrdup($2);
+                                       interface_parse($2, &current.server);
 #else
                                        fprintf(stderr, "fetchmail: interface option is only supported under Linux\n");
 #endif /* linux */
@@ -337,6 +337,7 @@ static void prc_register(void)
 #ifdef linux
     FLAG_FORCE(server.interface);
     FLAG_FORCE(server.monitor);
+    FLAG_FORCE(server.interface_pair);
 #endif /* linux */
 
     FLAG_FORCE(remotename);
@@ -377,6 +378,7 @@ void optmerge(struct query *h2, struct query *h1)
 #ifdef linux
     FLAG_MERGE(server.interface);
     FLAG_MERGE(server.monitor);
+    FLAG_MERGE(server.interface_pair);
 #endif /* linux */
 
     FLAG_MERGE(remotename);