aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-13 17:04:35 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-13 17:04:35 +0000
commitf491ac4fab469421986f77df0bbf79fefc417786 (patch)
tree1a99677ca3fc3489d6a0dd91443cc9a83bfcea74 /src/util
parent85f65a86a9ea908907a89ce7862768b90ca9d084 (diff)
downloadgnunet-f491ac4fab469421986f77df0bbf79fefc417786.tar.gz
gnunet-f491ac4fab469421986f77df0bbf79fefc417786.zip
change default configurations on systems with UNIX domain sockets to NOT specify any port for TCP-based IPC (and interpret that as no TCP-based IPC desired), as we can and want to use UNIX domain sockets in this case by default
Diffstat (limited to 'src/util')
-rw-r--r--src/util/Makefile.am5
-rw-r--r--src/util/client.c46
-rw-r--r--src/util/resolver.conf.in (renamed from src/util/resolver.conf)2
3 files changed, 33 insertions, 20 deletions
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index ec3884dc8..7f2e0cd48 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -5,7 +5,10 @@ plugindir = $(libdir)/gnunet
5pkgcfgdir= $(pkgdatadir)/config.d/ 5pkgcfgdir= $(pkgdatadir)/config.d/
6 6
7dist_pkgcfg_DATA = \ 7dist_pkgcfg_DATA = \
8 util.conf resolver.conf 8 util.conf
9
10pkgcfg_DATA = \
11 resolver.conf
9 12
10if MINGW 13if MINGW
11noinst_LTLIBRARIES = \ 14noinst_LTLIBRARIES = \
diff --git a/src/util/client.c b/src/util/client.c
index e71ccdf39..2f09a9046 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -289,25 +289,35 @@ do_connect (const char *service_name,
289 } 289 }
290#endif 290#endif
291 291
292 if ((GNUNET_OK != 292 if (GNUNET_YES ==
293 GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "PORT", &port)) 293 GNUNET_CONFIGURATION_have_value (cfg, service_name, "PORT"))
294 || (port > 65535) ||
295 (GNUNET_OK !=
296 GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "HOSTNAME",
297 &hostname)))
298 { 294 {
299 LOG (GNUNET_ERROR_TYPE_WARNING, 295 if ((GNUNET_OK !=
300 _ 296 GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "PORT", &port))
301 ("Could not determine valid hostname and port for service `%s' from configuration.\n"), 297 || (port > 65535) ||
302 service_name); 298 (GNUNET_OK !=
303 return NULL; 299 GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "HOSTNAME",
300 &hostname)))
301 {
302 LOG (GNUNET_ERROR_TYPE_WARNING,
303 _
304 ("Could not determine valid hostname and port for service `%s' from configuration.\n"),
305 service_name);
306 return NULL;
307 }
308 if (0 == strlen (hostname))
309 {
310 GNUNET_free (hostname);
311 LOG (GNUNET_ERROR_TYPE_WARNING,
312 _("Need a non-empty hostname for service `%s'.\n"), service_name);
313 return NULL;
314 }
304 } 315 }
305 if (0 == strlen (hostname)) 316 else
306 { 317 {
307 GNUNET_free (hostname); 318 /* unspecified means 0 (disabled) */
308 LOG (GNUNET_ERROR_TYPE_WARNING, 319 port = 0;
309 _("Need a non-empty hostname for service `%s'.\n"), service_name); 320 hostname = NULL;
310 return NULL;
311 } 321 }
312 if (port == 0) 322 if (port == 0)
313 { 323 {
@@ -326,7 +336,7 @@ do_connect (const char *service_name,
326 if (sock != NULL) 336 if (sock != NULL)
327 { 337 {
328 GNUNET_free (unixpath); 338 GNUNET_free (unixpath);
329 GNUNET_free (hostname); 339 GNUNET_free_non_null (hostname);
330 return sock; 340 return sock;
331 } 341 }
332 } 342 }
@@ -338,7 +348,7 @@ do_connect (const char *service_name,
338 "Port is 0 for service `%s', UNIXPATH did not work, returning NULL!\n", 348 "Port is 0 for service `%s', UNIXPATH did not work, returning NULL!\n",
339 service_name); 349 service_name);
340#endif 350#endif
341 GNUNET_free (hostname); 351 GNUNET_free_non_null (hostname);
342 return NULL; 352 return NULL;
343 } 353 }
344 354
diff --git a/src/util/resolver.conf b/src/util/resolver.conf.in
index a2690fcc3..671ea0ed6 100644
--- a/src/util/resolver.conf
+++ b/src/util/resolver.conf.in
@@ -1,6 +1,6 @@
1[resolver] 1[resolver]
2AUTOSTART = YES 2AUTOSTART = YES
3PORT = 2089 3@UNIXONLY@ PORT = 2089
4HOSTNAME = localhost 4HOSTNAME = localhost
5HOME = $SERVICEHOME 5HOME = $SERVICEHOME
6CONFIG = $DEFAULTCONFIG 6CONFIG = $DEFAULTCONFIG