[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15477 - gnunet-setup/src
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15477 - gnunet-setup/src |
Date: |
Wed, 8 Jun 2011 22:52:05 +0200 |
Author: grothoff
Date: 2011-06-08 22:52:05 +0200 (Wed, 08 Jun 2011)
New Revision: 15477
Modified:
gnunet-setup/src/gnunet-setup-options.c
Log:
fixes
Modified: gnunet-setup/src/gnunet-setup-options.c
===================================================================
--- gnunet-setup/src/gnunet-setup-options.c 2011-06-08 20:37:10 UTC (rev
15476)
+++ gnunet-setup/src/gnunet-setup-options.c 2011-06-08 20:52:05 UTC (rev
15477)
@@ -618,75 +618,85 @@
add_dns_entry_to_list_store (void *cls, const char *section)
{
GtkListStore *ls = cls;
-
- if (0 == strcmp (".gnunet.", section + ((strlen (section) - 8))))
+ char *sld;
+ long long unsigned int ttl;
+ char *altnames;
+ char *hostname;
+ char *hostport;
+ char *redirect;
+ char *cpy;
+ gboolean udp;
+
+ if (0 != strcmp (".gnunet.", section + ((strlen (section) - 8))))
+ return;
+ sld = GNUNET_strdup (section);
+ sld[strlen (section) - 8] = '\0';
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg, section, "TTL", &ttl))
+ ttl = 3600; /* sensible default */
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg, section,
+ "ALTERNATIVE_NAMES", &altnames))
+ altnames = GNUNET_strdup (""); /* empty */
+ udp = FALSE;
+ do
{
- char *sld = GNUNET_strdup (section);
- sld[strlen (section) - 8] = '\0';
- long long unsigned int ttl;
- char *altnames;
- char *hostname;
- char *hostport;
- char *redirect;
- char *cpy;
- gboolean udp = FALSE;
-
- GNUNET_CONFIGURATION_get_value_number (cfg, section, "TTL", &ttl);
- GNUNET_CONFIGURATION_get_value_string (cfg, section,
- "ALTERNATIVE_NAMES", &altnames);
-
- do
- {
- if (TRUE == udp)
- GNUNET_CONFIGURATION_get_value_string (cfg, section,
- "UDP_REDIRECTS", &cpy);
- else
- GNUNET_CONFIGURATION_get_value_string (cfg, section,
- "TCP_REDIRECTS", &cpy);
-
- for (redirect = strtok (cpy, " "); redirect != NULL;
- redirect = strtok (NULL, " "))
- {
- if (NULL == (hostname = strstr (redirect, ":")))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Warning: option %s is not formatted
correctly!\n",
- redirect);
- continue;
- }
- hostname[0] = '\0';
- hostname++;
- if (NULL == (hostport = strstr (hostname, ":")))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Warning: option %s is not formatted
correctly!\n",
- redirect);
- continue;
- }
- hostport[0] = '\0';
- hostport++;
-
- int local_port = atoi (redirect);
- if (!((local_port > 0) && (local_port < 65536)))
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Warning: %s is not a correct port.", redirect);
-
- gtk_list_store_insert_with_values (ls,
- NULL,
- 0,
- 0, sld,
- 1, local_port,
- 2, atoi (hostport),
- 3, hostname,
- 4, ttl, 5, altnames, 6, udp,
- -1);
- }
- udp = !udp;
- }
- while (udp != FALSE);
-
- GNUNET_free (altnames);
+ if (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_string (cfg, section,
+ (TRUE == udp)
+ ? "UDP_REDIRECTS"
+ : "TCP_REDIRECTS",
+ &cpy))
+ {
+ for (redirect = strtok (cpy, " "); redirect != NULL;
+ redirect = strtok (NULL, " "))
+ {
+ if (NULL == (hostname = strstr (redirect, ":")))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("Option `%s' is not formatted correctly!\n"),
+ redirect);
+ continue;
+ }
+ hostname[0] = '\0';
+ hostname++;
+ if (NULL == (hostport = strstr (hostname, ":")))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("Option `%s' is not formatted correctly!\n"),
+ redirect);
+ continue;
+ }
+ hostport[0] = '\0';
+ hostport++;
+
+ int local_port = atoi (redirect);
+ if (!((local_port > 0) && (local_port < 65536)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("`%s' is not a valid port number!\n"),
+ redirect);
+ continue;
+ }
+ gtk_list_store_insert_with_values (ls,
+ NULL,
+ 0,
+ 0, sld,
+ 1, (guint) local_port,
+ 2, atoi (hostport),
+ 3, hostname,
+ 4, (guint) ttl,
+ 5, altnames,
+ 6, udp,
+ -1);
+ }
+ GNUNET_free (cpy);
+ }
+ udp = !udp;
}
+ while (udp != FALSE);
+ GNUNET_free (sld);
+ GNUNET_free (altnames);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15477 - gnunet-setup/src,
gnunet <=