migrating towards XDG configuration specification (#3000)
authorChristian Grothoff <christian@grothoff.org>
Wed, 9 Oct 2013 10:05:42 +0000 (10:05 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 9 Oct 2013 10:05:42 +0000 (10:05 +0000)
57 files changed:
README
src/arm/arm.conf.in
src/arm/gnunet-arm.c
src/arm/test_arm_api_data.conf
src/ats/ats.conf.in
src/ats/test_ats_api.conf
src/ats/test_ats_mlp.conf
src/consensus/consensus.conf.in
src/consensus/test_consensus.conf
src/conversation/conversation.conf.in
src/core/core.conf.in
src/core/test_core_api_send_to_self.conf
src/datastore/datastore.conf.in
src/dht/dht.conf.in
src/dns/dns.conf.in
src/dv/dv.conf.in
src/experimentation/experimentation.conf.in
src/fs/fs.conf.in
src/fs/test_pseudonym_data.conf
src/gns/gns.conf.in
src/gns/test_gns_simple_lookup.conf
src/hostlist/hostlist.conf
src/identity/identity.conf.in
src/include/gnunet_configuration_lib.h
src/include/gnunet_crypto_lib.h
src/include/gnunet_disk_lib.h
src/mesh/mesh.conf.in
src/multicast/multicast.conf.in
src/namestore/namestore.conf.in
src/nat/test_nat_data.conf
src/nse/nse.conf.in
src/peerinfo/peerinfo.conf.in
src/psyc/psyc.conf.in
src/psyc/test_psyc.conf
src/psycstore/psycstore.conf.in
src/psycstore/test_psycstore.conf
src/regex/regex.conf.in
src/revocation/revocation.conf.in
src/scalarproduct/scalarproduct.conf.in
src/set/set.conf.in
src/set/test_set.conf
src/statistics/gnunet-service-statistics.c
src/statistics/statistics.conf.in
src/template/template.conf
src/testbed/gnunet-daemon-testbed-blacklist.c
src/testbed/test_testbed_api_barriers.conf.in
src/testbed/testbed.conf.in
src/testing/testing.c
src/transport/plugin_transport_http_server.c
src/transport/transport.conf.in
src/util/configuration.c
src/util/disk.c
src/util/os_installation.c
src/util/resolver.conf.in
src/util/test_disk.c
src/util/util.conf
src/vpn/vpn.conf.in

diff --git a/README b/README
index b9777f6252118f831a0cfd24293a0320c8ea9301..f3d57a4f31ea811ffe7dbf0edba05d773337e545 100644 (file)
--- a/README
+++ b/README
@@ -46,6 +46,7 @@ These are the direct dependencies for running GNUnet:
 - libunistring  >= 0.9.2
 - gnutls        >= 2.12.0
 - libidn        >= 1.0
+- libglpk       >= 4.45
 - openssl       >= 1.0 (binary, used to generate X.509 certificate)
 - libltdl       >= 2.2 (part of GNU libtool)
 - sqlite        >= 3.8 (default database, required)
index b9a33242f055a1cacf440e437fb0edf99f56ae5c..1b079c98c12c831a96a7091d10fdcad3bb50b104 100644 (file)
@@ -2,7 +2,6 @@
 [arm]
 @UNIXONLY@ PORT = 2087
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-arm
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
@@ -16,7 +15,7 @@ UNIX_MATCH_GID = YES
 # service.  Thus the following option would introduce per-service
 # logging with a new log file each day.  Note that only the last 3
 # log files are preserved.
-# GLOBAL_POSTFIX = -l $SERVICEHOME/{}-%Y-%m-%d.log
+# GLOBAL_POSTFIX = -l $GNUNET_CACHE_HOME/{}-%Y-%m-%d.log
 GLOBAL_PREFIX = @MONKEYPREFIX@
 # USERNAME =
 # MAXBUF =
index 80d3e9c034eb52614d2852c51bb54702b0a32f10..a492fac5b14ea502888ec2fb75463c26dce615d1 100644 (file)
@@ -147,7 +147,7 @@ static unsigned int no_stderr;
 
 
 /**
- * Attempts to delete configuration file and SERVICEHOME
+ * Attempts to delete configuration file and GNUNET_HOME
  * on ARM shutdown provided the end and delete options
  * were specified when gnunet-arm was run.
  */
@@ -158,15 +158,17 @@ delete_files ()
              "Will attempt to remove configuration file %s and service directory %s\n",
              config_file, dir);
 
-  if (UNLINK (config_file) != 0)
+  if (0 != UNLINK (config_file))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-               _("Failed to remove configuration file %s\n"), config_file);
+               _("Failed to remove configuration file %s\n"),
+                config_file);
   }
-  if (GNUNET_DISK_directory_remove (dir) != GNUNET_OK)
+  if (GNUNET_OK != GNUNET_DISK_directory_remove (dir))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-               _("Failed to remove servicehome directory %s\n"), dir);
+               _("Failed to remove servicehome directory %s\n"),
+                dir);
 
   }
 }
@@ -192,8 +194,8 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     GNUNET_ARM_monitor_disconnect_and_free (m);
     m = NULL;
   }
-  if ((end == GNUNET_YES) && (delete == GNUNET_YES))
-    delete_files ();   
+  if ((GNUNET_YES == end) && (GNUNET_YES == delete))
+    delete_files ();
   GNUNET_CONFIGURATION_destroy (cfg);
   cfg = NULL;
 }
@@ -588,7 +590,7 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
       if (list)
       {
        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                   "Going to list all running services controlled by ARM.\n"); 
+                   "Going to list all running services controlled by ARM.\n");
         GNUNET_ARM_request_service_list (h,
                                         (0 == timeout.rel_value_us) ? LIST_TIMEOUT : timeout,
                                         &list_callback, &list);
@@ -673,10 +675,10 @@ run (void *cls,
   cfg = GNUNET_CONFIGURATION_dup (c);
   config_file = cfgfile;
   if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_string (cfg, "PATHS", "SERVICEHOME", &dir))
+      GNUNET_CONFIGURATION_get_value_string (cfg, "PATHS", "GNUNET_HOME", &dir))
   {
     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                              "PATHS", "SERVICEHOME");
+                              "PATHS", "GNUNET_HOME");
     return;
   }
   if (NULL != cfgfile)
index 157a0302795c10822523d12489746fe103aa6ad2..1f1ac282fd9fd6759683370963b0b42c674050c8 100644 (file)
@@ -16,7 +16,6 @@ PORT = 23355
 AUTOSTART = NO
 PORT = 2223
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = /will/be/overwritten/by/test_exponential_backoff
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
index 457e86c6560153a8512af1a9c4e0f60ca350ab34..d5116304fcc7e623251910b1f1d89c5e8d5b0b3a 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = YES
 @UNIXONLY@ PORT = 2098
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-ats
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
index 5601a1227e8b4435fd90886098d50acac7fe5b04..8a1b6a14f6c7bea9fe22a9ff48b0cfe04e1bc031 100644 (file)
@@ -11,7 +11,6 @@ UNIXPATH = /tmp/test-ats-scheduling-arm.sock
 AUTOSTART = YES
 PORT = 12002
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-ats
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
index f64c783f6fc422a8971e47b57bf9807c31ee6b05..05e444f09b46aeb5f0334dda4693cd6b09fec693 100644 (file)
@@ -11,7 +11,6 @@ UNIXPATH = /tmp/test-ats-scheduling-arm.sock
 AUTOSTART = YES
 PORT = 12002
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-ats
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
index 18e976deb9b8f455d8e318711d33094b04da32fc..de526305cd60eeeccb9fadf7f7255125847a4bde 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = YES
 @UNIXONLY@ PORT = 2103
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-consensus
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
index bcfdaba0f5c2683771ccbb3a09833effbfaf4fec..a59a1012afdab694c14557bf1a44d07141282033 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = YES
 PORT = 2110
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-consensus
 #PREFIX = gdbserver :12345
 #PREFIX = valgrind --leak-check=full 
index f1efa03ba2c0ffb2cda5b0e1ac5b5f4febb5afb0..b4386e80db36de3eff057b54a81b0b438b813c17 100644 (file)
@@ -2,6 +2,5 @@
 AUTOSTART = YES
 BINARY = gnunet-service-conversation
 UNIXPATH = /tmp/gnunet-service-conversation.sock
-HOME = $SERVICEHOME
 @UNIXONLY@ PORT = 2106
 
index 839c21eeb3867e2b63841c11eaa1a3495522730e..f8e71957ac5e713e8870fa31bd2162966fc67df6 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = YES
 @JAVAPORT@PORT = 2092
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-core
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
@@ -21,4 +20,4 @@ UNIX_MATCH_GID = YES
 
 # Note: this MUST be set to YES in production, only set to NO for testing
 # for performance (testbed/cluster-scale use!).
-USE_EPHEMERAL_KEYS = YES
\ No newline at end of file
+USE_EPHEMERAL_KEYS = YES
index 704a2b6daeddf1f332fc49eef886315ff0293655..8df557226c80e05cda849dad840ebf18404289c7 100644 (file)
@@ -20,7 +20,6 @@ UNIXPATH = /tmp/gnunet-p1-service-ats.sock
 AUTOSTART = YES
 PORT = 9252 
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = test_core_api_send_to_self
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
index 7a92070d7e7bb468b125babd7a437c87c1c1be87..7d9efff6e71a4a848b9ec6ab0950166f52c26d56 100644 (file)
@@ -5,17 +5,16 @@ UNIX_MATCH_UID = NO
 UNIX_MATCH_GID = YES
 @UNIXONLY@ PORT = 2093
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-datastore
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
 QUOTA = 5 GB
-BLOOMFILTER = $SERVICEHOME/datastore/bloomfilter
+BLOOMFILTER = $GNUNET_DATA_HOME/datastore/bloomfilter
 DATABASE = sqlite
 # DISABLE_SOCKET_FORWARDING = NO
 
 [datastore-sqlite]
-FILENAME = $SERVICEHOME/datastore/sqlite.db
+FILENAME = $GNUNET_DATA_HOME/datastore/sqlite.db
 
 [datastore-postgres]
 CONFIG = connect_timeout=10; dbname=gnunet
@@ -24,7 +23,7 @@ CONFIG = connect_timeout=10; dbname=gnunet
 DATABASE = gnunet
 CONFIG = ~/.my.cnf
 # USER = gnunet
-# PASSWORD = 
+# PASSWORD =
 # HOST = localhost
 # PORT = 3306
 
index 59c5bc1b7c15588669af0bd4e49cd47f8d4266c6..7a9781a3aaa1ba8f16eddbe53472aa86ead94f0c 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = YES
 @JAVAPORT@PORT = 2095
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-dht
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
index 7944b410a350037c6f0e04babd0f7087659293f1..ee9a653023b106834f32f057073fb2ec8b54d5f4 100644 (file)
@@ -1,7 +1,6 @@
 [dns]
 AUTOSTART = YES
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-dns
 UNIXPATH = /tmp/gnunet-service-dns.sock
 
index c0dc21bfd3d9890aca5d733719c0adc549b8daae..65f54613a59361f74b1a5be47b6328b876f4f9ef 100644 (file)
@@ -3,7 +3,6 @@ AUTOSTART = YES
 ACCEPT_FROM6 = ::1;
 ACCEPT_FROM = 127.0.0.1;
 BINARY = gnunet-service-dv
-HOME = $SERVICEHOME
 HOSTNAME = localhost
 @UNIXONLY@ PORT = 2571
 UNIXPATH = /tmp/gnunet-service-dv.sock
index 6597dd0c1766d7ac8552c0be75e74449d414184e..5bfffad86a52e34abaa38aa50778f8857d2a9d0a 100644 (file)
@@ -2,11 +2,10 @@
 AUTOSTART = NO
 # PORT = 2106
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-daemon-experimentation
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
 UNIXPATH = /tmp/gnunet-daemon-experimentation.sock
 UNIX_MATCH_UID = YES
 UNIX_MATCH_GID = YES
-ISSUERS = TFRM29O2RQNKLVBQIGODJ6GD58LSQ2NM9TNFBC6N48BRJHQO38Q73N2OM3V4CLKDM6CILQV4CU8PMJDRG0FNB0PDI057DBRANMLPLRG
\ No newline at end of file
+ISSUERS = TFRM29O2RQNKLVBQIGODJ6GD58LSQ2NM9TNFBC6N48BRJHQO38Q73N2OM3V4CLKDM6CILQV4CU8PMJDRG0FNB0PDI057DBRANMLPLRG
index 2375dc7ec24b364704f15dac55f4c2a7cb31fc9a..bb4cae99a14624a95eac6ea817e488806dbea666 100644 (file)
@@ -1,13 +1,11 @@
 [fs]
 AUTOSTART = YES
-INDEXDB = $SERVICEHOME/fs/idxinfo.lst
-RESPECT = $SERVICEHOME/fs/credit/
-IDENTITY_DIR = $SERVICEHOME/fs/identities/
-STATE_DIR = $SERVICEHOME/fs/persistence/
-UPDATE_DIR = $SERVICEHOME/fs/updates/
+INDEXDB = $GNUNET_DATA_HOME/fs/idxinfo.lst
+RESPECT = $GNUNET_DATA_HOME/fs/credit/
+STATE_DIR = $GNUNET_DATA_HOME/fs/persistence/
+UPDATE_DIR = $GNUNET_DATA_HOME/fs/updates/
 @UNIXONLY@ PORT = 2094
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-fs
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
@@ -24,7 +22,7 @@ CONTENT_PUSHING = YES
 
 UNIXPATH = /tmp/gnunet-service-fs.sock
 
-# Do we require users that want to access file-sharing to run this process 
+# Do we require users that want to access file-sharing to run this process
 # (usually not a good idea)
 UNIX_MATCH_UID = NO
 
@@ -40,7 +38,7 @@ MAX_PENDING_REQUESTS = 65536
 DATASTORE_QUEUE_SIZE = 1024
 
 # Maximum frequency we're allowed to poll the datastore
-# for content for migration (can be used to reduce 
+# for content for migration (can be used to reduce
 # GNUnet's disk-IO rate)
 MIN_MIGRATION_DELAY = 100 ms
 
@@ -65,4 +63,4 @@ BINARY = gnunet-auto-share
 
 # Note: MUST specify path to auto-share directory and CAN specify other options
 # to gnunet-auto-share here!
-OPTIONS = $SERVICEHOME/fs/share/
+OPTIONS = $GNUNET_DATA_HOME/fs/share/
index 837908e5167e3b40401341bd777a4332eff2dd0c..5827721b8e1254c37d318bdabd94d41a54a3e5c3 100644 (file)
@@ -1,6 +1,5 @@
 # General settings
 [fs]
-HOME = "/tmp/gnunet-pseudonym-test"
 
 [TESTING]
 WEAKRANDOM = YES
index 5529db2015b588b539c98970bfe61a0113056852..99f7dcc549c995bd9dec3096c1a93c42afc55154 100644 (file)
@@ -1,14 +1,11 @@
 [gns]
 AUTOSTART = YES
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-gns
 UNIXPATH = /tmp/gnunet-service-gns.sock
 @UNIXONLY@PORT = 2102
 
-ZONE_DIR = $SERVICEHOME/gns/
-
-# Do we require users that want to access GNS to run this process 
+# Do we require users that want to access GNS to run this process
 # (usually not a good idea)
 UNIX_MATCH_UID = NO
 
@@ -28,7 +25,7 @@ BINARY = gnunet-gns-proxy
 AUTOSTART = NO
 
 # Where is the certificate for the GNS proxy stored?
-PROXY_CACERT = $SERVICEHOME/gns/gnsCAcert.pem
+PROXY_CACERT = $GNUNET_DATA_HOME/gns/gns_ca_cert.pem
 PROXY_UNIXPATH = /tmp/gnunet-gns-proxy.sock
 
 
index 687dff71e2fccc31ba45072c9c51b020b4b42a14..c7f9f7132f04e756d15bccda4e9b3c496d744446 100644 (file)
@@ -70,7 +70,6 @@ SHORTEN_ZONEKEY = zonefiles/188JSUMKEF25GVU8TTV0PBNNN8JVCPUEDFV1UHJJU884JD25V0T0
 #ZONEKEY =  $SERVICEHOME/gns/zonekey.zkey
 HIJACK_DNS = NO
 UNIXPATH = /tmp/gnunet-service-gns.sock
-HOME = $SERVICEHOME
 AUTO_IMPORT_PKEY = YES
 MAX_PARALLEL_BACKGROUND_QUERIES = 10
 DEFAULT_LOOKUP_TIMEOUT = 15 s
@@ -89,7 +88,6 @@ UNIXPATH = /tmp/gnunet-service-namestore-default.sock
 UNIX_MATCH_UID = YES
 UNIX_MATCH_GID = YES
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-namestore
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
index 278c35f8cc63e43a976fcd60d4f0b9bba4ef8f5b..40e7c7f7e36692cc927cf22ac3feb15f5167d469 100644 (file)
@@ -1,7 +1,6 @@
 [hostlist]
 # port for hostlist http server
 HTTPPORT = 8080
-HOME = $SERVICEHOME
 HOSTLISTFILE = $SERVICEHOME/hostlist/learned.data
 BINARY = gnunet-daemon-hostlist
 # consider having "-e" as default as well once implemented
index 621b601fba03ed7c9d7f410338583fad44f33e54..1b68775b935d341fce736503d69473828ac0417d 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = YES
 @JAVAPORT@PORT = 2108
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-identity
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
@@ -11,7 +10,7 @@ UNIX_MATCH_UID = NO
 UNIX_MATCH_GID = YES
 
 # Directory where we store information about our egos
-EGODIR = $SERVICEHOME/egos/
+EGODIR = $GNUNET_DATA_HOME/identity/egos/
 
 # File where we store default identities for subsystems
-SUBSYSTEM_CFG = $SERVICEHOME/subsystem_defaults.conf
+SUBSYSTEM_CFG = $GNUNET_CONFIG_HOME/identity/subsystem_defaults.conf
index 08cf1558ab746aa87bda0f72c257270ee541f8c4..6d0c04dbbad4f1dc7a6e48e7c672900ceb931359 100644 (file)
@@ -415,8 +415,13 @@ GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Handle
 
 /**
  * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR"
- * where either in the "PATHS" section or the environtment
- * "FOO" is set to "DIRECTORY".
+ * where either in the "PATHS" section or the environtment "FOO" is
+ * set to "DIRECTORY".  We also support default expansion,
+ * i.e. ${VARIABLE:-default} will expand to $VARIABLE if VARIABLE is
+ * set in PATHS or the environment, and otherwise to "default".  Note
+ * that "default" itself can also be a $-expression, thus
+ * "${VAR1:-{$VAR2}}" will expand to VAR1 and if that is not defined
+ * to VAR2.
  *
  * @param cfg configuration to use for path expansion
  * @param orig string to $-expand (will be freed!)
index c9cae17a2391b633d6601b32cc7a647d7892d3dc..bd1a2f3bf1f676ef1f08c87186380b8a3e2cdeac 100644 (file)
@@ -963,7 +963,7 @@ GNUNET_CRYPTO_ecc_key_get_anonymous (void);
  * configuration file (!).  This function is used so that
  * at a later point code can be certain that reading a
  * hostkey is fast (for example in time-dependent testcases).
- *
+*
  * @param cfg_name name of the configuration file to use
  */
 void
index bf49b71f89e02834e9f47e296891a558686c4fc2..f6aa3d0700af2f21255646def15fd8080131c22d 100644 (file)
@@ -797,25 +797,6 @@ int
 GNUNET_DISK_file_change_owner (const char *filename, const char *user);
 
 
-/**
- * Construct full path to a file inside of the private
- * directory used by GNUnet.  Also creates the corresponding
- * directory.  If the resulting name is supposed to be
- * a directory, end the last argument in '/' (or pass
- * DIR_SEPARATOR_STR as the last argument before NULL).
- *
- * @param cfg configuration to use
- * @param service_name name of the service asking
- * @param ... is NULL-terminated list of
- *                path components to append to the
- *                private directory name.
- * @return the constructed filename
- */
-char *
-GNUNET_DISK_get_home_filename (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                               const char *service_name, ...);
-
-
 /**
  * Opaque handle for a memory-mapping operation.
  */
index 504e2ecb155838cd83bbc18cc1b153f13c6a78a2..39ede6750ff8dbeb2b68c8999b070f665f2c4803 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = YES
 @JAVAPORT@PORT = 2096
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-mesh
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
index bd37cb4749cd7c84fa2de749491549959b575b0f..65299cecfc9d0ea962da6623ca36f37d183f5902 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = YES
 PORT = 2109
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-multicast
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
index 2d92f2e7b002b450f3f943af728e00b683ac1e72..91dbaabad9b77edc4e937c08db29f690c0d2f783 100644 (file)
@@ -5,15 +5,13 @@ UNIX_MATCH_UID = NO
 UNIX_MATCH_GID = YES
 @UNIXONLY@ PORT = 2099
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-namestore
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
 DATABASE = sqlite
-ZONEFILE_DIRECTORY = $SERVICEHOME/zones/
 
 [namestore-sqlite]
-FILENAME = $SERVICEHOME/namestore/sqlite.db
+FILENAME = $GNUNET_DATA_HOME/namestore/sqlite.db
 
 [namestore-postgres]
 CONFIG = connect_timeout=10; dbname=gnunet
@@ -31,6 +29,4 @@ AUTOSTART = NO
 # On what port does the FCFS daemon listen for HTTP clients?
 HTTPPORT = 18080
 
-# Where is the zone key for the FCFS zone stored?
-ZONEKEY = $SERVICEHOME/fcfsd/zonekey.zkey
 
index 9314e066ad860390d00d73515f9046cceb41f44b..03467d1e6f767fa8ffa272b4cb8b1e8cf25f2d49 100644 (file)
@@ -11,7 +11,6 @@ HOSTKEY = $SERVICEHOME/.hostkey
 WEAKRANDOM = NO
 
 [client]
-HOME = $SERVICEHOME
 
 
 [nat]
@@ -48,7 +47,6 @@ DISABLEV6 = NO
 [arm]
 PORT = 2087
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-arm
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
@@ -71,7 +69,6 @@ UNIX_MATCH_GID = YES
 AUTOSTART = YES
 PORT = 2088
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-statistics
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
@@ -92,7 +89,6 @@ UNIX_MATCH_GID = YES
 AUTOSTART = YES
 PORT = 2089
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-resolver
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
index c96830c426966be310bd41461912992bb2b4be44..fbc2722353dab5a5be91f1acfb9b446d26cbcb4f 100644 (file)
@@ -2,19 +2,18 @@
 AUTOSTART = YES
 @JAVAPORT@PORT = 2097
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-nse
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
 UNIXPATH = /tmp/gnunet-service-nse.unix
 UNIX_MATCH_UID = NO
 UNIX_MATCH_GID = YES
-PROOFFILE = $SERVICEHOME/.nse-proof
+PROOFFILE = $GNUNET_DATA_HOME/nse/proof.dat
 
-# The directory where the NSE services logs timestamps everytime 
+# The directory where the NSE services logs timestamps everytime
 # a size estime flooding message is received
 # This option is only used for benchmarking, not in production.
-HISTOGRAM_DIR = $SERVICEHOME
+HISTOGRAM_DIR = $GNUNET_CACHE_HOME/nse/histogram/
 
 # How 'slowly' should the proof-of-work be constructed (delay
 # between rounds); sane values between 0 and ~1000.
index 11302211de6244289cc38d7f154a9740a7f383ec..5604004987e3b386412e9da5f83fc52c1792451e 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = YES
 @JAVAPORT@PORT = 2090
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-peerinfo
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
@@ -10,15 +9,15 @@ UNIXPATH = /tmp/gnunet-service-peerinfo.sock
 UNIX_MATCH_UID = NO
 UNIX_MATCH_GID = YES
 # DISABLE_SOCKET_FORWARDING = NO
-# USERNAME = 
+# USERNAME =
 # MAXBUF =
 # TIMEOUT =
 # DISABLEV6 =
-# BINDTO = 
+# BINDTO =
 # REJECT_FROM =
 # REJECT_FROM6 =
 # PREFIX =
-HOSTS = $SERVICEHOME/peerinfo/
+HOSTS = $GNUNET_DATA_HOME/peerinfo/hosts/
 
 # Option to disable all disk IO; only useful for testbed runs
 # (large-scale experiments); disables persistence of HELLOs!
index 5a1eebf61f7f44826e3a5f9f83022c80cac28997..7dfeb0d979dec74dd475c3d6fe9e6934152f59f0 100644 (file)
@@ -1,6 +1,5 @@
 [psyc]
 AUTOSTART = YES
-HOME = $SERVICEHOME
 BINARY = gnunet-service-psyc
 UNIXPATH = /tmp/gnunet-service-psyc.sock
 UNIX_MATCH_UID = NO
index b5d3fd3fcdcf287ceff3a066d11b7a1f234c7757..da2dde680f3601db84d93f8a5abfdfcec84ca6cc 100644 (file)
@@ -4,7 +4,6 @@ DEFAULTSERVICES = psyc
 
 [psyc]
 AUTOSTART = YES
-HOME = $SERVICEHOME
 BINARY = gnunet-service-psyc
 UNIXPATH = /tmp/test-gnunet-service-psyc.sock
 UNIX_MATCH_UID = NO
index c43c5158e80a765d258e9809c84a9dc3cb9b675a..98c6aeda8230d3de7bffebfef4865a59e56c41d3 100644 (file)
@@ -1,6 +1,5 @@
 [psycstore]
 AUTOSTART = YES
-HOME = $SERVICEHOME
 BINARY = gnunet-service-psycstore
 UNIXPATH = /tmp/gnunet-service-psycstore.sock
 @UNIXONLY@PORT = 2111
@@ -9,4 +8,4 @@ UNIX_MATCH_GID = YES
 DATABASE = sqlite
 
 [psycstore-sqlite]
-FILENAME = $SERVICEHOME/psycstore/sqlite.db
+FILENAME = $GNUNET_DATA_HOME/psycstore/sqlite.db
index a7d33461730f228ee66fa2fe81249996f0eb4e79..c524f2ae661ea9a7cbb3078d696eb3a34d701188 100644 (file)
@@ -4,7 +4,6 @@ DEFAULTSERVICES = psycstore
 
 [psycstore]
 AUTOSTART = YES
-HOME = $SERVICEHOME
 BINARY = gnunet-service-psycstore
 UNIXPATH = /tmp/test-gnunet-service-psycstore.sock
 UNIX_MATCH_UID = NO
index 2ff48c5aefa2fd56a646f8d912e4db203ac5dfb9..59376a61ec780658b4ac686db3b5a54ba1dba574 100644 (file)
@@ -3,7 +3,6 @@ AUTOSTART = YES
 @UNIXONLY@ PORT = 2107
 UNIXPATH = /tmp/gnunet-service-regex.sock
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-regex
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
index d179c162988be8cffcb1763214b2de0cecea0dd4..6e84b84d673325ed976eecbc5e2c1662f8e59e35 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = YES
 @JAVAPORT@PORT = 2112
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-revocation
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
@@ -15,4 +14,4 @@ UNIX_MATCH_GID = YES
 # DO NOT CHANGE THIS VALUE, doing so will break the protocol!
 WORKBITS = 25
 
-DATABASE = $SERVICEHOME/revocation.db
+DATABASE = $GNUNET_DATA_HOME/revocation.dat
index e47af6f6a0ed080e0e6daa3dd6db5929a3bfd7f8..064b7fd8c1b3ddda3731f5aea6f20a24e2889ed3 100644 (file)
@@ -1,7 +1,6 @@
 [vectorproduct]
 BINARY = gnunet-service-vectorproduct
 UNIXPATH = /tmp/gnunet-service-vectorproduct.sock
-HOME = $SERVICEHOME
 # PORT = 2106
 @UNIXONLY@ PORT = 2087
 
index 2dc1c21d2fceef192f1b0f64fecfa75ad3c7f3aa..81e11cff0454244ca92735e7542a33b81bb23efd 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = NO
 @UNIXONLY@PORT = 2106
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-set
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
index 6bac3a55ece88874c2e92baa805a463f96897809..0eeb1cb727ce7eb60bd85492b95104c7a78bdd06 100644 (file)
@@ -6,7 +6,6 @@ SERVICEHOME = /tmp/test-gnunet-set/
 AUTOSTART = YES
 PORT = 2106
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-set
 #PREFIX = valgrind
 #PREFIX = gdbserver :1234
index acf2a965f1d8e82b3aacc885b913cf0a8bcdc494..6c3d173c44b78b19eb0386bd4e08745ebce21e80 100644 (file)
@@ -241,11 +241,20 @@ load (struct GNUNET_SERVER_Handle *server)
   struct GNUNET_SERVER_MessageStreamTokenizer *mst;
   char *emsg;
 
-  fn = GNUNET_DISK_get_home_filename (cfg, "statistics", "statistics.data",
-                                      NULL);
-  if (fn == NULL)
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_filename (cfg,
+                                               "STATISTICS",
+                                               "DATABASE",
+                                               &fn))
+  {
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               "STATISTICS",
+                               "DATABASE");
     return;
-  if ((GNUNET_OK != GNUNET_DISK_file_size (fn, &fsize, GNUNET_NO, GNUNET_YES)) || (fsize == 0))
+  }
+  if ( (GNUNET_OK !=
+        GNUNET_DISK_file_size (fn, &fsize, GNUNET_NO, GNUNET_YES)) ||
+       (0 == fsize) )
   {
     GNUNET_free (fn);
     return;
@@ -291,15 +300,22 @@ save ()
   struct StatsEntry *pos;
   char *fn;
   struct GNUNET_BIO_WriteHandle *wh;
-
   uint16_t size;
   unsigned long long total;
 
-  wh = NULL;
-  fn = GNUNET_DISK_get_home_filename (cfg, "statistics", "statistics.data",
-                                      NULL);
-  if (fn != NULL)
-    wh = GNUNET_BIO_write_open (fn);
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_filename (cfg,
+                                               "STATISTICS",
+                                               "DATABASE",
+                                               &fn))
+  {
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               "STATISTICS",
+                               "DATABASE");
+    return;
+  }
+  (void) GNUNET_DISK_directory_create_for_file (fn);
+  wh = GNUNET_BIO_write_open (fn);
   total = 0;
   while (NULL != (pos = start))
   {
index 669e89bd766b80c0063556700ef478a5de2a96e8..b08c737f2da83a8c1f956491e9c5b5f9a6b649da 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = YES
 @JAVAPORT@PORT = 2088
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-statistics
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
index 439bbd2e6674b7aba9c95b2271664d3d843ffcc4..ac1479b48a4109b11298c8bdcf8b34e902435f51 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = NO
 PORT = 9999
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-template
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
index 6be43999cadfac68c1b8089958bd61a1a6a2c2d9..55cd35e1008771081869760e9452ea7dfd3599cf 100644 (file)
@@ -215,7 +215,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   char fname[PATH_MAX];
 
   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (c, "PATHS",
-                                                          "SERVICEHOME",
+                                                          "GNUNET_HOME",
                                                           &shome))
   {
     GNUNET_break (0);
index 5dd0dadcdc1bce6d8575585325ad001a61552e6c..8255ba152970bb96c5bffb2425d5d90b752d862f 100644 (file)
@@ -52,9 +52,6 @@ USE_EPHEMERAL_KEYS = NO
 TIMEOUT = 300 s
 PORT = 12368
 
-[gnunetd]
-HOSTKEY = $SERVICEHOME/.hostkey
-
 [PATHS]
 SERVICEHOME = /tmp/test-testbed/
 
index 40bdae16d022156f025a37e62299c9efabad30e4..108142d5ebffd4c7774b5054ed3529ae56cd77ff 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = NO
 @JAVAPORT@ PORT = 2101
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-testbed
 
 # How long should operations wait?
index c2033935d4cc75324accd8af22f45d85758d91cd..a0d8e261b1d5749a28690b8bfeb77a26affc1f50 100644 (file)
@@ -103,7 +103,8 @@ struct GNUNET_TESTING_System
 {
   /**
    * Prefix (i.e. "/tmp/gnunet-testing/") we prepend to each
-   * SERVICEHOME.    */
+   * GNUNET_HOME.
+   */
   char *tmppath;
 
   /**
@@ -747,7 +748,7 @@ struct UpdateContext
   /**
    * The customized service home path for this peer
    */
-  char *service_home;
+  char *gnunet_home;
 
   /**
    * Array of ports currently allocated to this peer.  These ports will be
@@ -839,7 +840,7 @@ update_config (void *cls, const char *section, const char *option,
                                               single_variable))
     {
       GNUNET_snprintf (uval, sizeof (uval), "%s/%s.sock",
-                       uc->service_home, section);
+                       uc->gnunet_home, section);
       value = uval;
     }
     else if ((GNUNET_YES ==
@@ -970,7 +971,7 @@ associate_shared_service (struct GNUNET_TESTING_System *system,
 {
   struct SharedServiceInstance *i;
   struct GNUNET_CONFIGURATION_Handle *temp;
-  char *service_home;
+  char *gnunet_home;
   uint32_t port;
 
   ss->n_peers++;
@@ -979,25 +980,25 @@ associate_shared_service (struct GNUNET_TESTING_System *system,
        ( (0 != ss->share)
          && (ss->n_instances < ((ss->n_peers + ss->share - 1) / ss->share)) ) )
   {
-    i = GNUNET_malloc (sizeof (struct SharedServiceInstance));
+    i = GNUNET_new (struct SharedServiceInstance);
     i->ss = ss;
-    (void) GNUNET_asprintf (&service_home, "%s/shared/%s/%u",
+    (void) GNUNET_asprintf (&gnunet_home, "%s/shared/%s/%u",
                             system->tmppath, ss->sname, ss->n_instances);
-    (void) GNUNET_asprintf (&i->unix_sock, "%s/sock", service_home);
+    (void) GNUNET_asprintf (&i->unix_sock, "%s/sock", gnunet_home);
     port = GNUNET_TESTING_reserve_port (system);
     if (0 == port)
     {
-      GNUNET_free (service_home);
+      GNUNET_free (gnunet_home);
       cleanup_shared_service_instance (i);
       return NULL;
     }
     GNUNET_array_append (ss->instances, ss->n_instances, i);
     temp = GNUNET_CONFIGURATION_dup (ss->cfg);
     (void) GNUNET_asprintf (&i->port_str, "%u", port);
-    (void) GNUNET_asprintf (&i->cfg_fn, "%s/config", service_home);
-    GNUNET_CONFIGURATION_set_value_string (temp, "PATHS", "SERVICEHOME",
-                                           service_home);
-    GNUNET_free (service_home);
+    (void) GNUNET_asprintf (&i->cfg_fn, "%s/config", gnunet_home);
+    GNUNET_CONFIGURATION_set_value_string (temp, "PATHS", "GNUNET_HOME",
+                                           gnunet_home);
+    GNUNET_free (gnunet_home);
     GNUNET_CONFIGURATION_set_value_string (temp, ss->sname, "UNIXPATH",
                                            i->unix_sock);
     GNUNET_CONFIGURATION_set_value_string (temp, ss->sname, "PORT",
@@ -1029,9 +1030,9 @@ associate_shared_service (struct GNUNET_TESTING_System *system,
  * Create a new configuration using the given configuration as a template;
  * ports and paths will be modified to select available ports on the local
  * system. The default configuration will be available in PATHS section under
- * the option DEFAULTCONFIG after the call. SERVICE_HOME is also set in PATHS
+ * the option DEFAULTCONFIG after the call. GNUNET_HOME is also set in PATHS
  * section to the temporary directory specific to this configuration. If we run
- * out of "*port" numbers, return SYSERR.
+ * out of "*port" numbers, return #GNUNET_SYSERR.
  *
  * This is primarily a helper function used internally
  * by 'GNUNET_TESTING_peer_configure'.
@@ -1041,7 +1042,7 @@ associate_shared_service (struct GNUNET_TESTING_System *system,
  * @param ports array with port numbers used in the created configuration.
  *          Will be updated upon successful return.  Can be NULL
  * @param nports the size of the `ports' array.  Will be updated.
- * @return GNUNET_OK on success, GNUNET_SYSERR on error - the configuration will
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error - the configuration will
  *           be incomplete and should not be used there upon
  */
 static int
@@ -1058,16 +1059,16 @@ GNUNET_TESTING_configuration_create_ (struct GNUNET_TESTING_System *system,
   uc.status = GNUNET_OK;
   uc.ports = NULL;
   uc.nports = 0;
-  GNUNET_asprintf (&uc.service_home, "%s/%u", system->tmppath,
+  GNUNET_asprintf (&uc.gnunet_home, "%s/%u", system->tmppath,
                    system->path_counter++);
-  GNUNET_asprintf (&default_config, "%s/config", uc.service_home);
+  GNUNET_asprintf (&default_config, "%s/config", uc.gnunet_home);
   GNUNET_CONFIGURATION_set_value_string (cfg, "PATHS", "DEFAULTCONFIG",
                                          default_config);
   GNUNET_CONFIGURATION_set_value_string (cfg, "arm", "CONFIG",
                                          default_config);
   GNUNET_free (default_config);
-  GNUNET_CONFIGURATION_set_value_string (cfg, "PATHS", "SERVICEHOME",
-                                         uc.service_home);
+  GNUNET_CONFIGURATION_set_value_string (cfg, "PATHS", "GNUNET_HOME",
+                                         uc.gnunet_home);
   /* make PORTs and UNIXPATHs unique */
   GNUNET_CONFIGURATION_iterate (cfg, &update_config, &uc);
   /* allow connections to services from system trusted_ip host */
@@ -1076,7 +1077,7 @@ GNUNET_TESTING_configuration_create_ (struct GNUNET_TESTING_System *system,
   GNUNET_CONFIGURATION_set_value_string (cfg,
                                         "nat",
                                         "USE_LOCALADDR", "YES");
-  GNUNET_free (uc.service_home);
+  GNUNET_free (uc.gnunet_home);
   if ((NULL != ports) && (NULL != nports))
   {
     *ports = uc.ports;
@@ -1092,7 +1093,7 @@ GNUNET_TESTING_configuration_create_ (struct GNUNET_TESTING_System *system,
  * Create a new configuration using the given configuration as a template;
  * ports and paths will be modified to select available ports on the local
  * system. The default configuration will be available in PATHS section under
- * the option DEFAULTCONFIG after the call. SERVICE_HOME is also set in PATHS
+ * the option DEFAULTCONFIG after the call. GNUNET_HOME is also set in PATHS
  * section to the temporary directory specific to this configuration. If we run
  * out of "*port" numbers, return SYSERR.
  *
index 323379d3ed6fcb83a147a711df1375f79fd81b95..8e6eff072e1cc715047d61be5fa8673d05fbf7ce 100644 (file)
@@ -1868,61 +1868,47 @@ server_load_file (const char *file)
  * Load ssl certificate
  *
  * @param plugin the plugin
- * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
  */
 static int
 server_load_certificate (struct HTTP_Server_Plugin *plugin)
 {
   int res = GNUNET_OK;
-
-  char *sh;
   char *key_file;
   char *cert_file;
 
-  /* Get crypto init string from config
-   * If not present just use default values */
-
-  if (GNUNET_OK !=
-                 GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg,
-                                                        "PATHS",
-                                                        "SERVICEHOME",
-                                                        &sh))
-  {
-      GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
-                       "Failed to get servicehome!\n");
-      return GNUNET_SYSERR;
-  }
-
-
-  if (GNUNET_OK ==
-                 GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg,
-                                                        plugin->name,
-                                                        "CRYPTO_INIT",
-                                                        &plugin->crypto_init))
-      GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                       "Using crypto init string `%s'\n",
-                       plugin->crypto_init);
-  else
-    GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                     "Using default crypto init string \n");
 
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_filename (plugin->env->cfg, plugin->name,
                                                "KEY_FILE", &key_file))
   {
-    GNUNET_break (0);
-    GNUNET_asprintf (&key_file, "%s/%s", sh, "https_key.key");
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               plugin->name, "CERT_FILE");
+    return GNUNET_SYSERR;
   }
-
-
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_filename (plugin->env->cfg, plugin->name,
                                                "CERT_FILE", &cert_file))
   {
-      GNUNET_break (0);
-    GNUNET_asprintf (&cert_file, "%s/%s", sh, "https_cert.crt");
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               plugin->name, "CERT_FILE");
+    GNUNET_free (key_file);
+    return GNUNET_SYSERR;
   }
-  GNUNET_free (sh);
+  /* Get crypto init string from config. If not present, use
+   * default values */
+  if (GNUNET_OK ==
+      GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg,
+                                             plugin->name,
+                                             "CRYPTO_INIT",
+                                             &plugin->crypto_init))
+    GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+                     "Using crypto init string `%s'\n",
+                     plugin->crypto_init);
+  else
+    GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+                     "Using default crypto init string \n");
+
   /* read key & certificates from file */
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Trying to loading TLS certificate from key-file `%s' cert-file`%s'\n",
index fd8b5dbbbe3d40e36bd818547d25cb429b8f9044..d9abdbf11d9910097edb846b3836865a01da21d6 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = YES
 @UNIXONLY@ PORT = 2091
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-transport
 #PREFIX = valgrind
 NEIGHBOUR_LIMIT = 50
@@ -10,11 +9,11 @@ ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
 PLUGINS = tcp udp
 UNIXPATH = /tmp/gnunet-service-transport.sock
-BLACKLIST_FILE = $SERVICEHOME/blacklist
+BLACKLIST_FILE = $GNUNET_CONFIG_HOME/transport/blacklist
 UNIX_MATCH_UID = NO
 UNIX_MATCH_GID = YES
 # DISABLE_SOCKET_FORWARDING = NO
-# USERNAME = 
+# USERNAME =
 # MAXBUF =
 # TIMEOUT =
 # DISABLEV6 =
@@ -26,11 +25,11 @@ UNIX_MATCH_GID = YES
 # Configuration settings related to traffic manipulation for testing purposes
 # Distance
 # MANIPULATE_DISTANCE_IN = 1
-# MANIPULATE_DISTANCE_OUT = 1 
+# MANIPULATE_DISTANCE_OUT = 1
 # Delay; WARNING: to large values may lead to peers not connecting!
 # MANIPULATE_DELAY_IN = 1 ms
 # MANIPULATE_DELAY_OUT = 1 ms
-  
+
 
 [transport-unix]
 PORT = 22086
@@ -79,16 +78,16 @@ TESTING_IGNORE_KEYS = ACCEPT_FROM;
 [transport-https_server]
 # EXTERNAL_HOSTNAME = <your hostname/path>
 # EXTERNAL_HOSTNAME_ONLY = YES
-# If you have a valid SSL certificate for your external hostname tell, 
-# clients to verify it  
+# If you have a valid SSL certificate for your external hostname tell,
+# clients to verify it
 # VERIFY_EXTERNAL_HOSTNAME = YES
 # Does the external hostname use the same port?
 # EXTERNAL_HOSTNAME_USE_PORT = YES
 PORT = 4433
 ADVERTISED_PORT = 4433
 CRYPTO_INIT = NORMAL
-KEY_FILE = $SERVICEHOME/https.key
-CERT_FILE = $SERVICEHOME/https.cert
+KEY_FILE = $GNUNET_DATA_HOME/transport/https.key
+CERT_FILE = $GNUNET_DATA_HOME/transport/https.cert
 MAX_CONNECTIONS = 128
 TESTING_IGNORE_KEYS = ACCEPT_FROM;
 
index 1b600b4c8fb5083c27ab92baaf3149ba7128cff5..d7076fac18edeb80ca90dd4ea6ab7c40dfb6dc3c 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors)
+     (C) 2006, 2007, 2008, 2009, 2013 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -414,7 +414,7 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
        }
        /* For each key = value pair we need to add 4 characters (2
           spaces and 1 equal-to character and 1 new line) */
-       m_size += strlen (ent->key) + strlen (ent->val) + 4;    
+       m_size += strlen (ent->key) + strlen (ent->val) + 4;
       }
     }
     /* A new line after section end */
@@ -449,7 +449,7 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
        GNUNET_free (val);
        memcpy (mem + c_size, cbuf, len);
        c_size += len;
-       GNUNET_free (cbuf);     
+       GNUNET_free (cbuf);
       }
     }
     memcpy (mem + c_size, "\n", 1);
@@ -993,7 +993,7 @@ GNUNET_CONFIGURATION_get_value_choice (const struct GNUNET_CONFIGURATION_Handle
  * @param cfg configuration to inspect
  * @param section section of interest
  * @param option option of interest
- * @return GNUNET_YES if so, GNUNET_NO if not.
+ * @return #GNUNET_YES if so, #GNUNET_NO if not.
  */
 int
 GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -1009,70 +1009,182 @@ GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg,
 
 /**
  * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR"
- * where either in the "PATHS" section or the environtment
- * "FOO" is set to "DIRECTORY".
+ * where either in the "PATHS" section or the environtment "FOO" is
+ * set to "DIRECTORY".  We also support default expansion,
+ * i.e. ${VARIABLE:-default} will expand to $VARIABLE if VARIABLE is
+ * set in PATHS or the environment, and otherwise to "default".  Note
+ * that "default" itself can also be a $-expression, thus
+ * "${VAR1:-{$VAR2}}" will expand to VAR1 and if that is not defined
+ * to VAR2.
  *
  * @param cfg configuration to use for path expansion
  * @param orig string to $-expand (will be freed!)
+ * @param depth recursion depth, used to detect recursive expansions
  * @return $-expanded string
  */
-char *
-GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle
-                                    *cfg, char *orig)
+static char *
+expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg,
+               char *orig,
+               unsigned int depth)
 {
   int i;
   char *prefix;
   char *result;
+  char *start;
   const char *post;
   const char *env;
+  char *def;
+  char *end;
+  unsigned int lopen;
 
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to $-expand %s\n", orig);
-
-  if (orig[0] != '$')
+  if (depth > 128)
+  {
+    LOG (GNUNET_ERROR_TYPE_WARNING,
+         _("Recursive expansion suspected, aborting $-expansion for term `%s'\n"),
+         orig);
+    return orig;
+  }
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Asked to $-expand %s\n", orig);
+  if ('$' != orig[0])
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "Doesn't start with $ - not expanding\n");
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Doesn't start with $ - not expanding\n");
     return orig;
   }
-  i = 0;
-  while ((orig[i] != '/') && (orig[i] != '\\') && (orig[i] != '\0'))
-    i++;
-  if (orig[i] == '\0')
+  if ('{' == orig[1])
   {
-    post = "";
+    start = &orig[2];
+    lopen = 1;
+    end = &orig[1];
+    while (lopen > 0)
+    {
+      end++;
+      switch (*end)
+      {
+      case '}':
+        lopen--;
+        break;
+      case '{':
+        lopen++;
+        break;
+      case '\0':
+        LOG (GNUNET_ERROR_TYPE_WARNING,
+             _("Missing closing `%s' in option `%s'\n"),
+             "}",
+             orig);
+        return orig;
+      default:
+        break;
+      }
+    }
+    *end = '\0';
+    post = end + 1;
+    def = strchr (orig, ':');
+    if (NULL != def)
+    {
+      *def = '\0';
+      def++;
+      if ( ('-' == *def) ||
+           ('=' == *def) )
+        def++;
+      def = GNUNET_strdup (def);
+    }
   }
   else
   {
-    orig[i] = '\0';
-    post = &orig[i + 1];
+    start = &orig[1];
+    def = NULL;
+    i = 0;
+    while ( (orig[i] != '/') &&
+            (orig[i] != '\\') &&
+            (orig[i] != '\0') )
+      i++;
+    if (orig[i] == '\0')
+    {
+      post = "";
+    }
+    else
+    {
+      orig[i] = '\0';
+      post = &orig[i + 1];
+    }
   }
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Split into `%s' and `%s'\n", orig, post);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Split into `%s' and `%s' with default %s\n",
+       start,
+       post,
+       def);
   if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_filename (cfg, "PATHS", &orig[1], &prefix))
+      GNUNET_CONFIGURATION_get_value_filename (cfg,
+                                               "PATHS",
+                                               start,
+                                               &prefix))
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "Filename for `%s' is not in PATHS config section\n", &orig[1]);
-    if (NULL == (env = getenv (&orig[1])))
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Filename for `%s' is not in PATHS config section\n",
+         start);
+    if (NULL == (env = getenv (start)))
+    {
+      LOG (GNUNET_ERROR_TYPE_DEBUG,
+           "`%s' is not an environment variable\n",
+           start);
+      /* try default */
+      def = expand_dollar (cfg, def, depth + 1);
+      env = def;
+    }
+    if (NULL == env)
     {
-      LOG (GNUNET_ERROR_TYPE_DEBUG, "`%s' is not an environment variable\n", &orig[1]);
-      orig[i] = DIR_SEPARATOR;
-      LOG (GNUNET_ERROR_TYPE_DEBUG, "Expanded to `%s' (returning orig)\n", orig);
+      orig[strlen (orig)] = DIR_SEPARATOR;
+      LOG (GNUNET_ERROR_TYPE_DEBUG,
+           "Expanded to `%s' (returning orig)\n",
+           orig);
       return orig;
     }
     prefix = GNUNET_strdup (env);
   }
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Prefix is `%s'\n", prefix);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Prefix is `%s'\n",
+       prefix);
   result = GNUNET_malloc (strlen (prefix) + strlen (post) + 2);
   strcpy (result, prefix);
-  if ((strlen (prefix) == 0) ||
-      ((prefix[strlen (prefix) - 1] != DIR_SEPARATOR) && (strlen (post) > 0)))
+  if ( (0 == strlen (prefix)) ||
+       ( (prefix[strlen (prefix) - 1] != DIR_SEPARATOR) &&
+         (strlen (post) > 0) ) )
     strcat (result, DIR_SEPARATOR_STR);
   strcat (result, post);
+  GNUNET_free_non_null (def);
   GNUNET_free (prefix);
   GNUNET_free (orig);
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Expanded to `%s'\n", result);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Expanded to `%s'\n",
+       result);
   return result;
 }
 
 
+/**
+ * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR"
+ * where either in the "PATHS" section or the environtment "FOO" is
+ * set to "DIRECTORY".  We also support default expansion,
+ * i.e. ${VARIABLE:-default} will expand to $VARIABLE if VARIABLE is
+ * set in PATHS or the environment, and otherwise to "default".  Note
+ * that "default" itself can also be a $-expression, thus
+ * "${VAR1:-{$VAR2}}" will expand to VAR1 and if that is not defined
+ * to VAR2.
+ *
+ * @param cfg configuration to use for path expansion
+ * @param orig string to $-expand (will be freed!)
+ * @return $-expanded string
+ */
+char *
+GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                                    char *orig)
+{
+  return expand_dollar (cfg, orig, 0);
+}
+
+
 /**
  * Get a configuration value that should be a string.
  *
index 8dc1e35bf5b30ed834a12b4797950a12499e798e..0d24d5a095bd1a8fd518c1009cd8ab2cea59b261 100644 (file)
@@ -1927,78 +1927,6 @@ GNUNET_DISK_get_handle_from_native (FILE *fd)
 }
 
 
-/**
- * Construct full path to a file inside of the private
- * directory used by GNUnet.  Also creates the corresponding
- * directory.  If the resulting name is supposed to be
- * a directory, end the last argument in '/' (or pass
- * DIR_SEPARATOR_STR as the last argument before NULL).
- *
- * @param cfg configuration to use (determines HOME)
- * @param service_name name of the service
- * @param ... is NULL-terminated list of
- *                path components to append to the
- *                private directory name.
- * @return the constructed filename
- */
-char *
-GNUNET_DISK_get_home_filename (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                               const char *service_name, ...)
-{
-  const char *c;
-  char *pfx;
-  char *ret;
-  va_list ap;
-  unsigned int needed;
-
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_filename (cfg, service_name, "HOME", &pfx))
-    return NULL;
-  if (pfx == NULL)
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         _("No `%s' specified for service `%s' in configuration.\n"), "HOME",
-         service_name);
-    return NULL;
-  }
-  needed = strlen (pfx) + 2;
-  if ((pfx[strlen (pfx) - 1] != '/') && (pfx[strlen (pfx) - 1] != '\\'))
-    needed++;
-  va_start (ap, service_name);
-  while (1)
-  {
-    c = va_arg (ap, const char *);
-
-    if (c == NULL)
-      break;
-    needed += strlen (c);
-    if ((c[strlen (c) - 1] != '/') && (c[strlen (c) - 1] != '\\'))
-      needed++;
-  }
-  va_end (ap);
-  ret = GNUNET_malloc (needed);
-  strcpy (ret, pfx);
-  GNUNET_free (pfx);
-  va_start (ap, service_name);
-  while (1)
-  {
-    c = va_arg (ap, const char *);
-
-    if (c == NULL)
-      break;
-    if ((c[strlen (c) - 1] != '/') && (c[strlen (c) - 1] != '\\'))
-      strcat (ret, DIR_SEPARATOR_STR);
-    strcat (ret, c);
-  }
-  va_end (ap);
-  if ((ret[strlen (ret) - 1] != '/') && (ret[strlen (ret) - 1] != '\\'))
-    (void) GNUNET_DISK_directory_create_for_file (ret);
-  else
-    (void) GNUNET_DISK_directory_create (ret);
-  return ret;
-}
-
-
 /**
  * Handle for a memory-mapping operation.
  */
index 98ac7b989c18d90897a7d4aa737e39848742e108..8649fac6fb69b64be748be5c7e0f91acb4c64425 100644 (file)
@@ -43,6 +43,7 @@
 
 #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename)
 
+
 #if LINUX
 /**
  * Try to determine path by reading /proc/PID/exe
@@ -115,12 +116,13 @@ get_path_from_proc_exe ()
 }
 #endif
 
-#if WINDOWS
 
+#if WINDOWS
 static HINSTANCE dll_instance;
 
 
-/* GNUNET_util_cl_init() in common_logging.c is preferred.
+/**
+ * GNUNET_util_cl_init() in common_logging.c is preferred.
  * This function is only for thread-local storage (not used in GNUnet)
  * and hInstance saving.
  */
@@ -226,6 +228,7 @@ get_path_from_module_filename ()
 }
 #endif
 
+
 #if DARWIN
 /**
  * Signature of the '_NSGetExecutablePath" function.
@@ -415,8 +418,7 @@ os_get_gnunet_path ()
     return ret;
   /* other attempts here */
   LOG (GNUNET_ERROR_TYPE_ERROR,
-       _
-       ("Could not determine installation path for %s.  Set `%s' environment variable.\n"),
+       _("Could not determine installation path for %s.  Set `%s' environment variable.\n"),
        "GNUnet", "GNUNET_PREFIX");
   return NULL;
 }
@@ -452,7 +454,7 @@ os_get_exec_path ()
 
 /**
  * @brief get the path to a specific GNUnet installation directory or,
- * with GNUNET_IPK_SELF_PREFIX, the current running apps installation directory
+ * with #GNUNET_IPK_SELF_PREFIX, the current running apps installation directory
  * @author Milan
  * @return a pointer to the dir path (to be freed by the caller)
  */
@@ -657,9 +659,9 @@ GNUNET_OS_get_libexec_binary_path (const char *progname)
  *             binary with the -d flag. -d omits a programs main loop and only
  *             executes all privileged operations in an binary.
  * @param params parameters used for w32 privilege checking (can be NULL for != w32 )
- * @return GNUNET_YES if the file is SUID (*nix) or can be executed with current privileges (W32),
- *         GNUNET_NO if not SUID (but binary exists),
- *         GNUNET_SYSERR on error (no such binary or not executable)
+ * @return #GNUNET_YES if the file is SUID (*nix) or can be executed with current privileges (W32),
+ *         #GNUNET_NO if not SUID (but binary exists),
+ *         #GNUNET_SYSERR on error (no such binary or not executable)
  */
 int
 GNUNET_OS_check_helper_binary (const char *binary, int check_suid, const char *params)
@@ -704,7 +706,8 @@ GNUNET_OS_check_helper_binary (const char *binary, int check_suid, const char *p
 #endif
   if (NULL == p)
   {
-    LOG (GNUNET_ERROR_TYPE_INFO, _("Could not find binary `%s' in PATH!\n"),
+    LOG (GNUNET_ERROR_TYPE_INFO,
+         _("Could not find binary `%s' in PATH!\n"),
          binary);
     return GNUNET_SYSERR;
   }
index cccb60c2f314095351afb1321938d17d65f6f265..42cc5855ff46cd323b792da1cffc70c25b052e54 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = YES
 @JAVAPORT@PORT = 2089
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-resolver
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
index 7579ac7dc7788a53e1ae778996cb2275d00dd40b..40e6b079c5513fe75302fc4768e27a1a4f5a2102 100644 (file)
@@ -168,27 +168,6 @@ testDirIter ()
 }
 
 
-static int
-testGetHome ()
-{
-  struct GNUNET_CONFIGURATION_Handle *cfg;
-  char *fn;
-  int ret;
-
-  cfg = GNUNET_CONFIGURATION_create ();
-  GNUNET_assert (cfg != NULL);
-  GNUNET_CONFIGURATION_set_value_string (cfg, "service", "HOME",
-                                         "/tmp/test-gnunet-disk-a/b/c");
-  fn = GNUNET_DISK_get_home_filename (cfg, "service", "d", "e", NULL);
-  GNUNET_assert (fn != NULL);
-  GNUNET_CONFIGURATION_destroy (cfg);
-  ret = strcmp ("/tmp/test-gnunet-disk-a/b/c/d/e", fn);
-  GNUNET_free (fn);
-  GNUNET_break (GNUNET_OK ==
-                GNUNET_DISK_directory_remove ("/tmp/test-gnunet-disk-a"));
-  return ret;
-}
-
 static int
 testCanonicalize ()
 {
@@ -246,7 +225,6 @@ main (int argc, char *argv[])
   failureCount += testOpenClose ();
   failureCount += testDirScan ();
   failureCount += testDirIter ();
-  failureCount += testGetHome ();
   failureCount += testCanonicalize ();
   failureCount += testChangeOwner ();
   failureCount += testDirMani ();
index ade7786adeaa8aad95fdd21fdf1f6299ac4bc003..b7f9deb04565f360a02c1483a16e15f8435b5ee9 100644 (file)
@@ -1,20 +1,41 @@
 [PATHS]
+# The PATHS section is special, as filenames including $-expression are
+# expanded using the values from PATHS or the system environment (PATHS
+# is checked first).  GNUnet also supports expanding $-expressions using
+# defaults with the syntax "${VAR:-default}".  Here, "default" can again
+# be a $-expression.
+#
 GNUNET_HOME = $HOME
-GNUNET_DATA_HOME = $GNUNET_HOME/.local/share/gnunet/
-GNUNET_CONFIG_HOME = $GNUNET_HOME/.config/gnunet/
-GNUNET_CACHE_HOME = $GNUNET_HOME/.cache/gnunet/
-GNUNET_RUNTIME_DIR = $GNUNET_HOME/.runtime/gnunet/
 
+# see XDG Base Directory Specification at
+# http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
+# for how these should be used.
 
+# Persistant data storage
+GNUNET_DATA_HOME = ${XDG_DATA_HOME:-$GNUNET_HOME/.local/share}/gnunet/
+
+# Configuration files
+GNUNET_CONFIG_HOME = ${XDG_CONFIG_HOME:-GNUNET_HOME/.config/}gnunet/
+
+# Cached data, no big deal if lost
+GNUNET_CACHE_HOME = ${XDG_CACHE_HOME:-$GNUNET_HOME/.cache/}gnunet/
+
+# Runtime data (i.e UNIX domain sockets, locks, always lost on system boot)
+GNUNET_RUNTIME_DIR = ${XDG_RUNTIME_DIR:-${TMPDIR:-${TMP:-/tmp}}}gnunet/
+
+# Legacy option...
 SERVICEHOME = ~/.gnunet/
 # SERVICEHOME = /var/lib/gnunet/
+
 # DEFAULTCONFIG = /etc/gnunet.conf
 # If 'DEFAULTCONFIG' is not defined, the current
 # configuration file is assumed to be the default,
 # which is what we want by default...
 
+
 [PEER]
-PRIVATE_KEY = $SERVICEHOME/private_key.ecc
+PRIVATE_KEY = $GNUNET_DATA_HOME/private_key.ecc
+
 
 [TESTING]
 SPEEDUP_INTERVAL = 0 ms
index 57657b94f6e822acf63edf22e8649b75111d1443..91610eb2af14523423008adcc9299bd196a5481e 100644 (file)
@@ -2,7 +2,6 @@
 AUTOSTART = YES
 @UNIXONLY@ PORT = 2105
 HOSTNAME = localhost
-HOME = $SERVICEHOME
 BINARY = gnunet-service-vpn
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;