added basic ssl support to ircu
[ircu2.10.12-pk.git] / ircd / convert-conf.c
index da88adb9b5da54cc18dcaa1520235bd16187f08c..2e103eacf05c8b0d17c0ca8428ec3d7d89a81d80 100644 (file)
@@ -100,7 +100,7 @@ static void simple_line(const char *block, const char **names, const char *extra
     fputs("};\n", stdout);
 }
 
-#define dupstring(TARGET, SOURCE) do { free(TARGET); if (SOURCE) { size_t len = strlen(SOURCE); (TARGET) = malloc(len+1); memcpy((TARGET), (SOURCE), len); } else (TARGET) = 0; } while(0)
+#define dupstring(TARGET, SOURCE) do { free(TARGET); if (SOURCE) { size_t len = strlen(SOURCE) + 1; (TARGET) = malloc(len); memcpy((TARGET), (SOURCE), len); } else (TARGET) = 0; } while(0)
 
 /*** MANAGING LISTS OF STRINGS ***/
 
@@ -213,12 +213,11 @@ static void finish_connects(void)
     {
         for (sl = conn->origins; sl; sl = sl->next)
             fprintf(stdout, "# %s\n", sl->value);
-       if (conn->name == NULL
-            || conn->host == NULL
+       if (conn->host == NULL
             || conn->password == NULL
             || conn->class == NULL)
         {
-           fprintf(stderr, "H:line missing C:line for %s\n",sl->value);
+           fprintf(stderr, "H:line missing C:line for %s\n", conn->name);
            continue;
        }
 
@@ -354,6 +353,14 @@ static void finish_features(void)
             continue;
         }
 
+        /* If it had no value before, drop it now since the lexer does
+         * not accept empty strings and the grammar does not accept
+         * empty stringlists.*/
+        if (!feat->values) {
+            fprintf(stdout, "# Above feature had no value.\n");
+            continue;
+        }
+
         /* Wasn't remapped, wasn't removed: print it out. */
         fprintf(stdout, "\t\"%s\" =", feat->name);
         for (sl = feat->values; sl; sl = sl->next)