* applied patch from John Hay
authorBernd Petrovitsch <bernd@firmix.at>
Thu, 19 Apr 2007 22:21:34 +0000 (22:21 +0000)
committerBernd Petrovitsch <bernd@firmix.at>
Thu, 19 Apr 2007 22:21:34 +0000 (22:21 +0000)
lib/nameservice/src/compat.c
lib/nameservice/src/nameservice.c

index 2f73c10..10b1ac8 100644 (file)
@@ -11,9 +11,6 @@ strndup(const char *ptr, size_t size)
   size_t len = strlen(ptr);
   char *ret = NULL;
 
-  if(!len)
-    return NULL;
-
   if(len > size)
     len = size;
 
index fa88205..19e2021 100644 (file)
@@ -30,7 +30,7 @@
  *
  */
 
-/* $Id: nameservice.c,v 1.18 2007/02/06 21:07:11 bernd67 Exp $ */
+/* $Id: nameservice.c,v 1.19 2007/04/19 22:21:34 bernd67 Exp $ */
 
 /*
  * Dynamic linked library for UniK OLSRd
@@ -187,7 +187,7 @@ olsrd_plugin_register_param(char *key, char *value)
                if (strlen(value) == 0) {
             my_forwarders = add_name_to_list(my_forwarders, "", NAME_FORWARDER, NULL);
             olsr_printf(1,"\nNAME PLUGIN: parameter dns-server: (main address)");
-        } else if (inet_pton(olsr_cnf->ip_version, value, &ip)) {
+        } else if (inet_pton(olsr_cnf->ip_version, value, &ip) == 1) {
             my_forwarders = add_name_to_list(my_forwarders, "", NAME_FORWARDER, &ip);
             olsr_printf(1,"\nNAME PLUGIN: parameter dns-server: (%s)", value);
         } else {
@@ -1280,7 +1280,7 @@ allowed_hostname_or_ip_in_service(char *service_line, regmatch_t *hostname_or_ip
     }
     
     //ip in service-line is allowed 
-    if (inet_pton(olsr_cnf->ip_version, hostname_or_ip, &olsr_ip)) {
+    if (inet_pton(olsr_cnf->ip_version, hostname_or_ip, &olsr_ip) == 1) {
         if (allowed_ip(&olsr_ip)) {
             olsr_printf(2, "NAME PLUGIN: ip %s in service %s is OK\n", olsr_ip_to_string(&olsr_ip), service_line);
             free(hostname_or_ip);