[Olsr-dev] [PATCH] Using domains in nameserver plugin

Andrés Ambrois (spam-protected)
Thu Jul 24 08:02:46 CEST 2008


  I've been having problems using domain names on service entries in the nameservice plugin. 
For what I can see, the plugin is validating the contents of my_names, against a string captured in a 
regex pass over the service string. However, the captured string includes the suffix, while the names 
in my_names don't include it. This patch hopefully fixes it. 

  -- Andrés Ambrois

---
diff -r b6267d7c660f lib/nameservice/src/nameservice.c
--- a/lib/nameservice/src/nameservice.c Thu Jul 03 00:11:36 2008 +0200
+++ b/lib/nameservice/src/nameservice.c Thu Jul 24 02:56:33 2008 -0300
@@ -342,9 +342,9 @@
        //regex_service = "^[[:alnum:]]+://(([[:alnum:]_.-]+.olsr)|([[:digit:]]{1,3}\\.[[:digit:]]{1,3}\\.[[:digit:]]{1,3}\\.[[:digit:]]{1,3}))
        //                 :    port              /path      |(tcp OR udp) |short description
        //                 :[[:digit:]]+[[:alnum:]/?._=#-]*\\|(tcp|udp)\\|[^|[:cntrl:]]+$";
-    strcpy(regex_service, "^[[:alnum:]]+://(([[:alnum:]_.-]+");
+    strcpy(regex_service, "^[[:alnum:]]+://(([[:alnum:]_.-]+)");
     strcat(regex_service, my_suffix);
-       strcat(regex_service, ")|([[:digit:]]{1,3}\\.[[:digit:]]{1,3}\\.[[:digit:]]{1,3}\\.[[:digit:]]{1,3})):[[:digit:]]+[[:alnum:]/?._=#-]*\\|(tcp|udp)\\|[^|[:cntrl:]]+$");
+       strcat(regex_service, "|([[:digit:]]{1,3}\\.[[:digit:]]{1,3}\\.[[:digit:]]{1,3}\\.[[:digit:]]{1,3})):[[:digit:]]+[[:alnum:]/?._=#-]*\\|(tcp|udp)\\|[^|[:cntrl:]]+$");

        /* #1: call regcomp() to compile the regex */
        if ((ret = regcomp(&regex_t_service, regex_service , REG_EXTENDED )) != 0)
@@ -1543,7 +1543,7 @@
         * see regexec(3) for more infos */
        if (!is_service_wellformed(service_line)) {
                return OLSR_FALSE;
-       } else if (!allowed_hostname_or_ip_in_service(service_line, &(regmatch_t_service[1]))) {
+       } else if (!allowed_hostname_or_ip_in_service(service_line, &(regmatch_t_service[2]))) {
                return OLSR_FALSE;
        }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20080724/c96a6f22/attachment.sig>


More information about the Olsr-dev mailing list