gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r3647 - in GNUnet: . contrib src/applications/fs/ecrs src/a


From: grothoff
Subject: [GNUnet-SVN] r3647 - in GNUnet: . contrib src/applications/fs/ecrs src/applications/fs/fsui src/applications/gap src/applications/sqstore_sqlite src/include src/server src/setup src/setup/gtk src/util/boot src/util/config src/util/config_impl src/util/disk src/util/loggers src/util/string
Date: Sat, 4 Nov 2006 21:06:18 -0800 (PST)

Author: grothoff
Date: 2006-11-04 21:06:04 -0800 (Sat, 04 Nov 2006)
New Revision: 3647

Modified:
   GNUnet/contrib/config-client.scm
   GNUnet/contrib/config-daemon.scm
   GNUnet/src/applications/fs/ecrs/ecrstest.c
   GNUnet/src/applications/fs/fsui/downloadtest.c
   GNUnet/src/applications/fs/fsui/searchtest.c
   GNUnet/src/applications/fs/fsui/serializetest.c
   GNUnet/src/applications/gap/gaptest.c
   GNUnet/src/applications/sqstore_sqlite/sqlite.c
   GNUnet/src/include/gnunet_util_config.h
   GNUnet/src/include/gnunet_util_config_impl.h
   GNUnet/src/include/gnunet_util_disk.h
   GNUnet/src/server/gnunet-transport-check.c
   GNUnet/src/setup/gnunet-setup.c
   GNUnet/src/setup/gtk/wizard_gtk.c
   GNUnet/src/util/boot/startup.c
   GNUnet/src/util/config/config.c
   GNUnet/src/util/config_impl/impl.c
   GNUnet/src/util/disk/storage.c
   GNUnet/src/util/loggers/file.c
   GNUnet/src/util/string/dlmalloc.c
   GNUnet/src/util/string/xmalloc.c
   GNUnet/todo
Log:
bugfixes

Modified: GNUnet/contrib/config-client.scm
===================================================================
--- GNUnet/contrib/config-client.scm    2006-11-04 18:43:18 UTC (rev 3646)
+++ GNUnet/contrib/config-client.scm    2006-11-05 05:06:04 UTC (rev 3647)
@@ -112,85 +112,31 @@
 
 ;; logging options
 
-(define (log-conf-user-urgency-severity-logger description user urgency 
severity logger builder def opt)
+(define (log-level description option builder)
  (builder
    "LOGGING"
-   (string-append user "-" urgency "-" severity "-" logger)
+   option
    description
-   ""
-   '()
-   #t
-   def
-   opt
-   (if (string=? urgency "STDOUT") 'rare 'always)))
-
-
-;; FIXME: set default to /dev/null for DEVELOPER, INFO, STATUS and REQUEST 
file-logs
-(define (log-conf-user-urgency-severity description user urgency severity 
builder)
- (builder
-   "LOGGING"
-   (string-append user "-" urgency "-" severity)
-   description
-   ""
-   (list
-     (log-conf-user-urgency-severity-logger (_"Log using standard error 
(YES/NO)") user urgency severity "STDERR" builder #f #f)
-     (log-conf-user-urgency-severity-logger (_"Log using standard output 
(YES/NO)") user urgency severity "STDOUT" builder #f #f)
-     (log-conf-user-urgency-severity-logger (_"Log this event type to a file 
(specify filename)") user urgency severity "FILE" builder "~/.gnunet/logs" '())
-   )
-   #t
-   #f
-   #f
-   (if (string=? severity "DEBUG") 'rare 
-     (if (string=? severity "STATUS") 'advanced
-        (if (string=? severity "INFO") 'advanced 'always )))))
-
-(define (log-conf-user-urgency description user urgency builder)
- (builder
-   "LOGGING"
-   (string-append user "-" urgency)
-   description
-   ""
-   (list
-     (log-conf-user-urgency-severity (_"Logging of events that are fatal to 
some operation") user urgency "FATAL" builder)
-     (log-conf-user-urgency-severity (_"Logging of non-fatal errors") user 
urgency "ERROR" builder)
-     (log-conf-user-urgency-severity (_"Logging of warnings") user urgency 
"WARNING" builder)
-     (log-conf-user-urgency-severity (_"Logging of information messages") user 
urgency "INFO" builder)
-     (log-conf-user-urgency-severity (_"Logging of status messages") user 
urgency "STATUS" builder)
-     (log-conf-user-urgency-severity (_"Logging of debug messages") user 
urgency "DEBUG" builder)
-   )
-   #t
-   #f
-   #f
-   (if (string=? urgency "REQUEST") 'rare 'always)))
-
-(define (log-conf-user description user builder)
- (builder
-   "LOGGING"
-   user
-   description
-   ""
-   (list
-     (log-conf-user-urgency (_"Logging of events that usually require 
immediate attention") user "IMMEDIATE" builder)
-     (log-conf-user-urgency (_"Logging of events that can be processed in 
bulk") user "BULK" builder)
-     (log-conf-user-urgency (_"Logging of events that are to be shown only on 
request") user "REQUEST" builder)
-   )
-   #t
-   #f
-   #f
-   (if (string=? user "DEVELOPER") 'advanced 'always)))
-
-(define (log-conf-date builder)
- (builder
-   "LOGGING"
-   "DATE"
-   (_ "Log the date of the event")
    (nohelp)
    '()
    #t
-   #t
-   #t
-   'advanced))
+   "WARNING"
+   (list "NOTHING" "FATAL" "ERROR" "WARNING" "INFO" "STATUS" "DEBUG")
+   'always))
 
+;; option not supported / used at the moment (useful?)
+;(define (log-conf-date builder)
+; (builder
+;   "LOGGING"
+;   "DATE"
+;   (_ "Log the date of the event")
+;   (nohelp)
+;   '()
+;   #t
+;   #t
+;   #t
+;   'advanced))
+
 (define (log-keeplog builder)
  (builder
   "GNUNETD"
@@ -204,6 +150,18 @@
   (cons 0 36500)
   'advanced) )
 
+(define (log-logfile builder)
+ (builder
+  "GNUNETD"
+  "LOGFILE"
+  (_ "Where should gnunetd write the logs?")
+  (nohelp)
+  '()
+  #f
+  "$HOME/.gnunet/logs"
+  '()
+  'rare) )
+
 (define (logging builder)
  (builder
    "LOGGING"
@@ -211,11 +169,10 @@
    (_ "Configuration of the logging system") 
    (_ "Specify which system messages should be logged how")
    (list 
-     (log-conf-date builder)
      (log-keeplog builder)
-     (log-conf-user (_ "Logging of events for users") "USER" builder) 
-     (log-conf-user (_ "Logging of events for the system administrator") 
"ADMIN" builder) 
-     (log-conf-user (_ "Logging of events for developers") "DEVELOPER" 
builder) 
+     (log-logfile builder)
+     (log-level (_ "Logging of events for users") "USER-LEVEL" builder) 
+     (log-level (_ "Logging of events for the system administrator") 
"ADMIN-LEVEL" builder) 
    )
    #t
    #f

Modified: GNUnet/contrib/config-daemon.scm
===================================================================
--- GNUnet/contrib/config-daemon.scm    2006-11-04 18:43:18 UTC (rev 3646)
+++ GNUnet/contrib/config-daemon.scm    2006-11-05 05:06:04 UTC (rev 3647)
@@ -193,89 +193,33 @@
   'advanced) )
 
 
-
-
 ;; logging options
 
-(define (log-conf-user-urgency-severity-logger description user urgency 
severity logger builder def opt)
+(define (log-level description option builder)
  (builder
    "LOGGING"
-   (string-append user "-" urgency "-" severity "-" logger)
+   option
    description
-   ""
-   '()
-   #t
-   def
-   opt
-   (if (string=? urgency "STDOUT") 'rare 'always)))
-
-
-;; FIXME: set default to /dev/null for DEVELOPER, INFO, STATUS and REQUEST 
file-logs
-(define (log-conf-user-urgency-severity description user urgency severity 
builder)
- (builder
-   "LOGGING"
-   (string-append user "-" urgency "-" severity)
-   description
-   ""
-   (list
-     (log-conf-user-urgency-severity-logger (_"Log using standard error 
(YES/NO)") user urgency severity "STDERR" builder #f #f)
-     (log-conf-user-urgency-severity-logger (_"Log using standard output 
(YES/NO)") user urgency severity "STDOUT" builder #f #f)
-     (log-conf-user-urgency-severity-logger (_"Log this event type to a file 
(specify filename)") user urgency severity "FILE" builder "~/.gnunet/logs" '())
-   )
-   #t
-   #f
-   #f
-   (if (string=? severity "DEBUG") 'rare 
-     (if (string=? severity "STATUS") 'advanced
-        (if (string=? severity "INFO") 'advanced 'always )))))
-
-(define (log-conf-user-urgency description user urgency builder)
- (builder
-   "LOGGING"
-   (string-append user "-" urgency)
-   description
-   ""
-   (list
-     (log-conf-user-urgency-severity (_"Logging of events that are fatal to 
some operation") user urgency "FATAL" builder)
-     (log-conf-user-urgency-severity (_"Logging of non-fatal errors") user 
urgency "ERROR" builder)
-     (log-conf-user-urgency-severity (_"Logging of warnings") user urgency 
"WARNING" builder)
-     (log-conf-user-urgency-severity (_"Logging of information messages") user 
urgency "INFO" builder)
-     (log-conf-user-urgency-severity (_"Logging of status messages") user 
urgency "STATUS" builder)
-     (log-conf-user-urgency-severity (_"Logging of debug messages") user 
urgency "DEBUG" builder)
-   )
-   #t
-   #f
-   #f
-   (if (string=? urgency "REQUEST") 'rare 'always)))
-
-(define (log-conf-user description user builder)
- (builder
-   "LOGGING"
-   user
-   description
-   ""
-   (list
-     (log-conf-user-urgency (_"Logging of events that usually require 
immediate attention") user "IMMEDIATE" builder)
-     (log-conf-user-urgency (_"Logging of events that can be processed in 
bulk") user "BULK" builder)
-     (log-conf-user-urgency (_"Logging of events that are to be shown only on 
request") user "REQUEST" builder)
-   )
-   #t
-   #f
-   #f
-   (if (string=? user "DEVELOPER") 'advanced 'always)))
-
-(define (log-conf-date builder)
- (builder
-   "LOGGING"
-   "DATE"
-   (_ "Log the date of the event")
    (nohelp)
    '()
    #t
-   #t
-   #t
-   'advanced))
+   "WARNING"
+   (list "NOTHING" "FATAL" "ERROR" "WARNING" "INFO" "STATUS" "DEBUG")
+   'always))
 
+;; option not supported / used at the moment (useful?)
+;(define (log-conf-date builder)
+; (builder
+;   "LOGGING"
+;   "DATE"
+;   (_ "Log the date of the event")
+;   (nohelp)
+;   '()
+;   #t
+;   #t
+;   #t
+;   'advanced))
+
 (define (log-keeplog builder)
  (builder
   "GNUNETD"
@@ -289,6 +233,18 @@
   (cons 0 36500)
   'advanced) )
 
+(define (log-logfile builder)
+ (builder
+  "GNUNETD"
+  "LOGFILE"
+  (_ "Where should gnunetd write the logs?")
+  (nohelp)
+  '()
+  #f
+  "/var/lib/GNUnet/client-logs"
+  '()
+  'rare) )
+
 (define (logging builder)
  (builder
    "LOGGING"
@@ -296,11 +252,10 @@
    (_ "Configuration of the logging system") 
    (_ "Specify which system messages should be logged how")
    (list 
-     (log-conf-date builder)
      (log-keeplog builder)
-     (log-conf-user (_ "Logging of events for users") "USER" builder) 
-     (log-conf-user (_ "Logging of events for the system administrator") 
"ADMIN" builder) 
-     (log-conf-user (_ "Logging of events for developers") "DEVELOPER" 
builder) 
+     (log-logfile builder)
+     (log-level (_ "Logging of events for users") "USER-LEVEL" builder) 
+     (log-level (_ "Logging of events for the system administrator") 
"ADMIN-LEVEL" builder) 
    )
    #t
    #f
@@ -317,7 +272,7 @@
 "In which file should gnunetd write the process-id of the server?  If you run 
gnunetd as root, you may want to choose /var/run/gnunetd.pid. It's not the 
default since gnunetd may not have write rights at that location." )
   '()
   #f
-  "$GNUNET_HOME/gnunetd.pid"
+  "/var/run/gnunetd.pid"
   '()
   'rare) )
 
@@ -347,7 +302,7 @@
 Loading the 'nat' and 'tcp' modules is required for peers behind NAT boxes 
that cannot directly be reached from the outside.  Peers that are NOT behind a 
NAT box and that want to *allow* peers that ARE behind a NAT box to connect 
must ALSO load the 'nat' module.  Note that the actual transfer will always be 
via tcp initiated by the peer behind the NAT box.  The nat transport requires 
the use of tcp, http, smtp and/or tcp6 in addition to nat itself.")
   '()
   #t
-  "udp tcp http nat"
+  "udp tcp nat"
   '()
   'advanced) )
  
@@ -506,6 +461,7 @@
     (network-disable-autoconnect builder) 
     (limit-allow builder) 
     (limit-deny builder) 
+ )
   #t
   #f
   #f
@@ -634,6 +590,8 @@
   (_ "Configuration of the MySQL database")
   (nohelp)
   (list
+    (mysql-config builder)
+    (mysql-database builder)
   )
   #t
   #f

Modified: GNUnet/src/applications/fs/ecrs/ecrstest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/ecrstest.c  2006-11-04 18:43:18 UTC (rev 
3646)
+++ GNUnet/src/applications/fs/ecrs/ecrstest.c  2006-11-05 05:06:04 UTC (rev 
3647)
@@ -40,19 +40,16 @@
 static struct GC_Configuration * cfg;
 
 static char * makeName(unsigned int i) {
-  char * name;
   char * fn;
 
-  name = STRDUP("/tmp/gnunet-ecrstest");
-  disk_directory_create(NULL, name);
-  fn = MALLOC(strlen(name) + 40);
+  fn = MALLOC(strlen("/tmp/gnunet-ecrstest/ECRSTEST") + 14);
   SNPRINTF(fn,
-          strlen(name) + 40,
-          "%s%sECRSTEST%u",
+          strlen("/tmp/gnunet-ecrstest/ECRSTEST") + 14,
+          "/tmp/gnunet-ecrstest/ECRSTEST%u",
           DIR_SEPARATOR_STR,
           name,
           i);
-  FREE(name);
+  disk_directory_create_for_file(NULL, fn);
   return fn;
 }
 

Modified: GNUnet/src/applications/fs/fsui/downloadtest.c
===================================================================
--- GNUnet/src/applications/fs/fsui/downloadtest.c      2006-11-04 18:43:18 UTC 
(rev 3646)
+++ GNUnet/src/applications/fs/fsui/downloadtest.c      2006-11-05 05:06:04 UTC 
(rev 3647)
@@ -44,19 +44,16 @@
 static struct GE_Context * ectx;
 
 static char * makeName(unsigned int i) {
-  char * name;
   char * fn;
 
-  name = STRDUP("/tmp/gnunet-fsuidownloadtest");
-  disk_directory_create(ectx, name);
-  fn = MALLOC(strlen(name) + 40);
+  fn = MALLOC(strlen("/tmp/gnunet-fsui-downloadtest/FSUITEST") + 14);
   SNPRINTF(fn,
-          strlen(name) + 40,
-          "%s%sFSUITEST%u",
-          name,
+          strlen("/tmp/gnunet-fsui-downloadtest/FSUITEST") + 14,
+          "/tmp/gnunet-fsui-downloadtest/FSUITEST%u",
           DIR_SEPARATOR_STR,
+          name,
           i);
-  FREE(name);
+  disk_directory_create_for_file(NULL, fn);
   return fn;
 }
 

Modified: GNUnet/src/applications/fs/fsui/searchtest.c
===================================================================
--- GNUnet/src/applications/fs/fsui/searchtest.c        2006-11-04 18:43:18 UTC 
(rev 3646)
+++ GNUnet/src/applications/fs/fsui/searchtest.c        2006-11-05 05:06:04 UTC 
(rev 3647)
@@ -33,18 +33,16 @@
 #define CHECK(a) if (!(a)) { ok = NO; GE_BREAK(NULL, 0); goto FAILURE; }
 
 static char * makeName(unsigned int i) {
-  const char * name;
   char * fn;
 
-  name = "/tmp/gnunet-fsuisearchtest";
-  disk_directory_create(NULL, name);
-  fn = MALLOC(strlen(name) + 40);
+  fn = MALLOC(strlen("/tmp/gnunet-fsui-searchtest/FSUITEST") + 14);
   SNPRINTF(fn,
-          strlen(name) + 40,
-          "%s%sFSUITEST%u",
-          name,
+          strlen("/tmp/gnunet-fsui-searchtest/FSUITEST") + 14,
+          "/tmp/gnunet-fsui-searchtest/FSUITEST%u",
           DIR_SEPARATOR_STR,
+          name,
           i);
+  disk_directory_create_for_file(NULL, fn);
   return fn;
 }
 

Modified: GNUnet/src/applications/fs/fsui/serializetest.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serializetest.c     2006-11-04 18:43:18 UTC 
(rev 3646)
+++ GNUnet/src/applications/fs/fsui/serializetest.c     2006-11-05 05:06:04 UTC 
(rev 3647)
@@ -40,19 +40,16 @@
 static struct GE_Context * ectx;
 
 static char * makeName(unsigned int i) {
-  char * name;
   char * fn;
 
-  name = STRDUP("/tmp/gnunet-fsuidownloadtest");
-  disk_directory_create(ectx, name);
-  fn = MALLOC(strlen(name) + 40);
+  fn = MALLOC(strlen("/tmp/gnunet-fsui-serializetest/FSUITEST") + 14);
   SNPRINTF(fn,
-          strlen(name) + 40,
-          "%s%sFSUITEST%u",
-          name,
+          strlen("/tmp/gnunet-fsui-serializetest/FSUITEST") + 14,
+          "/tmp/gnunet-fsui-serializetest/FSUITEST%u",
           DIR_SEPARATOR_STR,
+          name,
           i);
-  FREE(name);
+  disk_directory_create_for_file(NULL, fn);
   return fn;
 }
 

Modified: GNUnet/src/applications/gap/gaptest.c
===================================================================
--- GNUnet/src/applications/gap/gaptest.c       2006-11-04 18:43:18 UTC (rev 
3646)
+++ GNUnet/src/applications/gap/gaptest.c       2006-11-05 05:06:04 UTC (rev 
3647)
@@ -58,21 +58,16 @@
 }
 
 static char * makeName(unsigned int i) {
-  char * name;
   char * fn;
 
-  fn = STRDUP("/tmp/gnunet-ecrstest");
-  name = string_expandFileName(ectx, fn);
-  disk_directory_create(ectx, name);
-  FREE(fn);
-  fn = MALLOC(strlen(name) + 40);
+  fn = MALLOC(strlen("/tmp/gnunet-gaptest/GAPTEST") + 14);
   SNPRINTF(fn,
-          strlen(name) + 40,
-          "%s%sECRSTEST%u",
+          strlen("/tmp/gnunet-gaptest/GAPTEST") + 14,
+          "/tmp/gnunet-gaptest/GAPTEST%u",
           DIR_SEPARATOR_STR,
           name,
           i);
-  FREE(name);
+  disk_directory_create_for_file(NULL, fn);
   return fn;
 }
 

Modified: GNUnet/src/applications/sqstore_sqlite/sqlite.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlite.c     2006-11-04 18:43:18 UTC 
(rev 3646)
+++ GNUnet/src/applications/sqstore_sqlite/sqlite.c     2006-11-05 05:06:04 UTC 
(rev 3647)
@@ -1172,23 +1172,18 @@
                                      "DIR",
                                      VAR_DAEMON_DIRECTORY "/data/fs/",
                                      &afsdir);
-  dir = MALLOC(strlen(afsdir) + 8 + 2); /* 8 = "content/" */
+  dir = MALLOC(strlen(afsdir) + strlen("/content/gnunet.dat") + 2); 
   strcpy(dir, afsdir);
-  strcat(dir, "/content/");
+  strcat(dir, "/content/gnunet.dat");
   FREE(afsdir);
-  if (OK != disk_directory_create(ectx,
-                                 dir)) {
+  if (OK != disk_directory_create_for_file(ectx,
+                                          dir)) {
     FREE(dir);
     FREE(db);
     return NULL;
   }
-  nX = strlen(dir) + 6 + 4 + 256;  /* 6 = "gnunet", 4 = ".dat" */
-  db->fn = MALLOC(strlen(dir) + 6 + 4 + 256);
-  SNPRINTF(db->fn, nX, "%s/gnunet.dat", dir);
-  FREE(dir);
-
   db->DATABASE_Lock_ = MUTEX_CREATE(NO);
-
+  db->fn = dir;
   dbh = getDBHandle();
   if (dbh == NULL) {
     MUTEX_DESTROY(db->DATABASE_Lock_);
@@ -1251,7 +1246,6 @@
   sqliteHandle *dbh;
   char *dir;
   char *afsdir;
-  size_t nX;
 
   db = MALLOC(sizeof(sqliteDatabase));
   memset(db,
@@ -1275,10 +1269,7 @@
     FREE(db);
     return;
   }
-  nX = strlen(dir) + 6 + 4 + 256;  /* 6 = "gnunet", 4 = ".dat" */
-  db->fn = MALLOC(strlen(dir) + 6 + 4 + 256);
-  SNPRINTF(db->fn, nX, "%s/gnunet.dat", dir);
-  FREE(dir);
+  db->fn = dir;
   db->DATABASE_Lock_ = MUTEX_CREATE(NO);
   dbh = getDBHandle();
   if (dbh == NULL) {

Modified: GNUnet/src/include/gnunet_util_config.h
===================================================================
--- GNUnet/src/include/gnunet_util_config.h     2006-11-04 18:43:18 UTC (rev 
3646)
+++ GNUnet/src/include/gnunet_util_config.h     2006-11-05 05:06:04 UTC (rev 
3647)
@@ -95,6 +95,13 @@
                                      unsigned long long def,
                                      unsigned long long * number);
 
+/**
+ * Test if we have a value for a particular option
+ * @return YES if so, NO if not.
+ */
+int GC_have_configuration_value(struct GC_Configuration * cfg,
+                               const char * section,
+                               const char * option);
 
 /**
  * Get a configuration value that should be a string.

Modified: GNUnet/src/include/gnunet_util_config_impl.h
===================================================================
--- GNUnet/src/include/gnunet_util_config_impl.h        2006-11-04 18:43:18 UTC 
(rev 3646)
+++ GNUnet/src/include/gnunet_util_config_impl.h        2006-11-05 05:06:04 UTC 
(rev 3647)
@@ -216,6 +216,10 @@
                                GC_ChangeListener callback,
                                void * ctx);
 
+  int (*have_configuration_value)(struct GC_Configuration * cfg,
+                                 const char * section,
+                                 const char * option);
+
 } GC_Configuration;
 
 /**

Modified: GNUnet/src/include/gnunet_util_disk.h
===================================================================
--- GNUnet/src/include/gnunet_util_disk.h       2006-11-04 18:43:18 UTC (rev 
3646)
+++ GNUnet/src/include/gnunet_util_disk.h       2006-11-05 05:06:04 UTC (rev 
3647)
@@ -150,7 +150,18 @@
                        DirectoryEntryCallback callback,
                        void * data);
 
+
 /**
+ * Create the directory structure for storing
+ * a file.
+ *
+ * @param filename name of a file in the directory
+ * @returns OK on success, SYSERR on failure
+ */
+int disk_directory_create_for_file(struct GE_Context * ectx,
+                                  const char * filename);
+
+/**
  * Test if fil is a directory that can be accessed.
  * Will not print an error message if the directory
  * does not exist.  Will log errors if SYSERR is

Modified: GNUnet/src/server/gnunet-transport-check.c
===================================================================
--- GNUnet/src/server/gnunet-transport-check.c  2006-11-04 18:43:18 UTC (rev 
3646)
+++ GNUnet/src/server/gnunet-transport-check.c  2006-11-05 05:06:04 UTC (rev 
3647)
@@ -451,27 +451,27 @@
                                      ectx,
                                      "TCP",
                                      "BLACKLIST",
-                                     NULL);
+                                     "");
     GC_set_configuration_value_string(cfg,
                                      ectx,
                                      "TCP6",
                                      "BLACKLIST",
-                                     NULL);
+                                     "");
     GC_set_configuration_value_string(cfg,
                                      ectx,
                                      "UDP",
                                      "BLACKLIST",
-                                     NULL);
+                                     "");
     GC_set_configuration_value_string(cfg,
                                      ectx,
                                      "UDP6",
                                      "BLACKLIST",
-                                     NULL);
+                                     "");
     GC_set_configuration_value_string(cfg,
                                      ectx,
                                      "HTTP",
                                      "BLACKLIST",
-                                     NULL);
+                                     "");
   }
   cron = cron_create(ectx);
   initCore(ectx, cfg, cron, NULL);

Modified: GNUnet/src/setup/gnunet-setup.c
===================================================================
--- GNUnet/src/setup/gnunet-setup.c     2006-11-04 18:43:18 UTC (rev 3646)
+++ GNUnet/src/setup/gnunet-setup.c     2006-11-05 05:06:04 UTC (rev 3647)
@@ -81,26 +81,20 @@
   if ( (pos->section == NULL) ||
        (pos->option == NULL) )
     return;
-  val = NULL;
-  if (0 == GC_get_configuration_value_string(cfg,
-                                            pos->section,
-                                            pos->option,
-                                            "",
-                                            &val)) {
-    FREE(val);
-    return;
+  if (NO == GC_have_configuration_value(cfg,
+                                       pos->section,
+                                       pos->option)) {
+    val = GNS_get_default_value_as_string(pos->type,
+                                         &pos->value);
+    if (val != NULL) {
+      GC_set_configuration_value_string(cfg,
+                                       ectx,
+                                       pos->section,
+                                       pos->option,
+                                       val);
+      FREE(val);
+    }
   }
-  FREE(val);
-  val = GNS_get_default_value_as_string(pos->type,
-                                       &pos->value);
-  if (val != NULL) {
-    GC_set_configuration_value_string(cfg,
-                                     ectx,
-                                     pos->section,
-                                     pos->option,
-                                     val);
-    FREE(val);
-  }
 }
 
 static int dyn_config(const char * module,

Modified: GNUnet/src/setup/gtk/wizard_gtk.c
===================================================================
--- GNUnet/src/setup/gtk/wizard_gtk.c   2006-11-04 18:43:18 UTC (rev 3646)
+++ GNUnet/src/setup/gtk/wizard_gtk.c   2006-11-05 05:06:04 UTC (rev 3647)
@@ -134,7 +134,7 @@
 
   utf8_name = g_locale_to_utf8(name, -1, NULL, &unused, NULL);
   if (!utf8_name)
-    utf8_name = strdup(_("(unknown connection)"));
+    utf8_name = STRDUP(_("(unknown connection)"));
 
   gtk_combo_box_append_text(GTK_COMBO_BOX(cmbNIC), utf8_name);
   free(utf8_name);

Modified: GNUnet/src/util/boot/startup.c
===================================================================
--- GNUnet/src/util/boot/startup.c      2006-11-04 18:43:18 UTC (rev 3646)
+++ GNUnet/src/util/boot/startup.c      2006-11-05 05:06:04 UTC (rev 3647)
@@ -24,11 +24,32 @@
  * @author Christian Grothoff
  */
 
+#include "gnunet_directories.h"
 #include "gnunet_util_boot.h"
 #include "gnunet_util_config_impl.h"
 #include "gnunet_util_error_loggers.h"
 #include "platform.h"
 
+static GE_KIND 
+convertLogLevel(const char * level) {
+  GE_KIND ret;
+
+  ret = GE_NOTHING;
+  if (ret || (0 == strcasecmp("debug", level)))
+    ret |= GE_DEBUG;
+  if (ret || (0 == strcasecmp("status", level)))
+    ret |= GE_STATUS;
+  if (ret || (0 == strcasecmp("info", level)))
+    ret |= GE_INFO;
+  if (ret || (0 == strcasecmp("warning", level)))
+    ret |= GE_WARNING;
+  if (ret || (0 == strcasecmp("error", level)))
+    ret |= GE_ERROR;
+  if (ret || (0 == strcasecmp("fatal", level)))
+    ret = ret | GE_FATAL;
+  return ret;
+}
+
 /**
  * Configure logging mechanism as specified by
  * user (and supported by system).  
@@ -37,7 +58,68 @@
  */
 static int configure_logging(struct GE_Context ** ectx,
                             struct GC_Configuration * cfg) {
-  
+  char * admin_log_file;
+  char * admin_log_level;
+  char * user_log_level;
+  GE_KIND all;
+  GE_KIND ull;
+  struct GE_Context * nctx;
+  struct GE_Context * tetx;
+  unsigned long long logrotate;
+
+  nctx = NULL;
+  admin_log_file = NULL;
+  admin_log_level = NULL;
+  user_log_level = NULL;
+  logrotate = 7;
+  if (-1 == GC_get_configuration_value_number(cfg,
+                                             "GNUNETD",
+                                             "KEEPLOG",
+                                             0,
+                                             36500,
+                                             3,
+                                             &logrotate))
+    return 1; /* error! */
+  GC_get_configuration_value_filename(cfg,
+                                     "GNUNETD",
+                                     "LOGFILE",
+                                     VAR_DAEMON_DIRECTORY "/logs",
+                                     &admin_log_file);
+  disk_directory_create_for_file(ectx,
+                                admin_log_file);
+  GC_get_configuration_value_string(cfg,
+                                   "LOGGING",
+                                   "ADMIN-LEVEL",
+                                   "WARNING",
+                                   &admin_log_level);
+  GC_get_configuration_value_string(cfg,
+                                   "LOGGING",
+                                   "USER-LEVEL",
+                                   "WARNING",
+                                   &user_log_level);
+  all = convertLogLevel(admin_log_level);
+  ull = convertLogLevel(user_log_level);
+  FREE(admin_log_level);
+  FREE(user_log_level);
+  if (all != 0) {
+    nctx = GE_create_context_logfile(NULL,
+                                    all | GE_ADMIN | GE_BULK | GE_IMMEDIATE,
+                                    admin_log_file,
+                                    YES,
+                                    (int) logrotate);
+  }
+  FREE(admin_log_file);
+  if (ull != 0) {
+    tetx = GE_create_context_stderr(NO,
+                                   ull | GE_USERKIND | GE_BULK | GE_IMMEDIATE);
+    if (nctx == NULL)
+      nctx = tetx;
+    else
+      nctx = GE_create_context_multiplexer(nctx,
+                                          tetx);
+  }
+  GE_free_context(*ectx);
+  *ectx = nctx;
   return 0;
 }
 
@@ -94,3 +176,4 @@
   GE_free_context(ectx);
 }
                
+/* end of startup.c */

Modified: GNUnet/src/util/config/config.c
===================================================================
--- GNUnet/src/util/config/config.c     2006-11-04 18:43:18 UTC (rev 3646)
+++ GNUnet/src/util/config/config.c     2006-11-05 05:06:04 UTC (rev 3647)
@@ -249,3 +249,10 @@
   return cfg->detach_change_listener(cfg, callback, ctx);
 }
 
+int GC_have_configuration_value(struct GC_Configuration * cfg,
+                               const char * section,
+                               const char * option) {
+  return cfg->have_configuration_value(cfg,
+                                      section,
+                                      option);
+}

Modified: GNUnet/src/util/config_impl/impl.c
===================================================================
--- GNUnet/src/util/config_impl/impl.c  2006-11-04 18:43:18 UTC (rev 3646)
+++ GNUnet/src/util/config_impl/impl.c  2006-11-05 05:06:04 UTC (rev 3647)
@@ -258,6 +258,16 @@
                                                 tag,
                                                 &value[i]))
        ret = -1; /* could not set value */
+    } else if (1 == sscanf(line,
+                          " %63[^= ] =[^\n]",
+                          tag)) {
+      /* tag = */
+      if (0 != GC_set_configuration_value_string(cfg,
+                                                cfg->data->ectx,
+                                                section,
+                                                tag,
+                                                ""))
+       ret = -1; /* could not set value */
     } else {
       /* parse error */
       GE_LOG(cfg->data->ectx,
@@ -299,20 +309,10 @@
   FILE *fp;
   int error;
   int ret;
-  char * dirname;
-  size_t pos;
   char * fn;
 
   fn = string_expandFileName(NULL, filename);
-  dirname = STRDUP(fn);
-  pos = strlen(dirname);
-  while ( (pos > 0) &&
-         (dirname[pos] != DIR_SEPARATOR) )
-    pos--;
-  dirname[pos] = '\0';
-  disk_directory_create(NULL, dirname);
-  FREE(dirname);
-  
+  disk_directory_create_for_file(NULL, fn);
   data = cfg->data;
   if (NULL == (fp = FOPEN(fn, "w"))) {
     GE_LOG_STRERROR_FILE(data->ectx,
@@ -413,6 +413,115 @@
 }
 
 static int
+_set_configuration_value_string(struct GC_Configuration * cfg,
+                               struct GE_Context * ectx,
+                               const char * section,
+                               const char * option,
+                               const char * value) {
+  GC_ConfigurationData * data;
+  GC_Section * sec;
+  GC_Section nsec;
+  GC_Entry * e;
+  GC_Entry ne;
+  int ret;
+  int i;
+
+  data = cfg->data;
+  MUTEX_LOCK(data->lock);
+  e = findEntry(data, section, option);
+  if (e == NULL) {
+    sec = findSection(data, section);
+    if (sec == NULL) {
+      nsec.name = STRDUP(section);
+      nsec.size = 0;
+      nsec.entries = NULL;
+      APPEND(data->sections,
+            data->ssize,
+            nsec);
+      sec = findSection(data, section);
+    }
+    ne.key = STRDUP(option);
+    ne.val = NULL;
+    ne.dirty_val = NULL;
+    APPEND(sec->entries,
+          sec->size,
+          ne);
+    e = findEntry(data, section, option);
+  }
+  if (e->dirty_val != NULL) {
+    if (0 == strcmp(e->dirty_val,
+                   value)) {
+      ret = 0;
+    } else {
+      /* recursive update to different value -- not allowed! */
+      GE_BREAK(ectx, 0);
+      ret = -1;
+    }
+  } else {
+    e->dirty_val = STRDUP(value);
+    i = data->lsize - 1;
+    while (i >= 0) {
+      if (0 != data->listeners[i].listener(data->listeners[i].ctx,
+                                          cfg,
+                                          ectx,
+                                          section,
+                                          option))
+       break; /* update refused */
+      i--;
+      e = findEntry(data, section, option); /* side-effects of callback are 
possible! */
+    }
+    e = findEntry(data, section, option); /* side-effects of callback are 
possible! */
+    if (i >= 0) {
+      /* update refused, revert! */
+      FREE(e->dirty_val);
+      e->dirty_val = NULL;
+      i++; /* the callback that refused does not need refreshing */
+      while (i < data->lsize) {
+       if (0 != data->listeners[i].listener(data->listeners[i].ctx,
+                                            cfg,
+                                            ectx,
+                                            section,
+                                            option))
+         GE_ASSERT(ectx, 0); /* refused the refusal!? */
+       e = findEntry(data, section, option); /* side-effects of callback are 
possible! */
+       i++;
+      }
+      ret = -1; /* error -- update refused */
+    } else {
+      /* all confirmed, commit! */
+      if ( (e->val == NULL) ||
+          (0 != strcmp(e->val,
+                       e->dirty_val)) )
+       data->dirty = 1;
+      FREENONNULL(e->val);
+      e->val = e->dirty_val;
+      e->dirty_val = NULL;
+      ret = 0;
+    }
+  }
+  if (ret == -1)
+    GE_LOG(ectx,
+          GE_USER | GE_BULK | GE_WARNING,
+          _("Setting option `%s' in section `%s' to value `%s' was 
refused.\n"),
+          option,
+          section,
+          value);
+  MUTEX_UNLOCK(data->lock);
+  return ret;
+}
+
+static int
+_set_configuration_value_number(struct GC_Configuration * cfg,
+                               struct GE_Context * ectx,
+                               const char * section,
+                               const char * option,
+                               unsigned long long number) {
+  char s[64];
+  SNPRINTF(s, 64, "%llu", number);
+  return _set_configuration_value_string(cfg, ectx, section, option, s);
+}
+
+static int
 _get_configuration_value_number(struct GC_Configuration * cfg,
                                const char * section,
                                const char * option,
@@ -462,6 +571,11 @@
     }
   } else {
     *number = def;
+    _set_configuration_value_number(cfg,
+                                   cfg->data->ectx,
+                                   section,
+                                   option,
+                                   def);
     ret = 1; /* default */
   }
   MUTEX_UNLOCK(cfg->data->lock);
@@ -497,6 +611,11 @@
       return -1;
     }
     *value = STRDUP(def);
+    _set_configuration_value_string(cfg,
+                                   cfg->data->ectx,
+                                   section,
+                                   option,
+                                   def);
     ret = 1; /* default */
   }
   MUTEX_UNLOCK(cfg->data->lock);
@@ -552,105 +671,6 @@
   return ret;
 }
 
-static int
-_set_configuration_value_string(struct GC_Configuration * cfg,
-                               struct GE_Context * ectx,
-                               const char * section,
-                               const char * option,
-                               const char * value) {
-  GC_ConfigurationData * data;
-  GC_Section * sec;
-  GC_Section nsec;
-  GC_Entry * e;
-  GC_Entry ne;
-  int ret;
-  int i;
-
-  data = cfg->data;
-  MUTEX_LOCK(data->lock);
-  e = findEntry(data, section, option);
-  if (e == NULL) {
-    sec = findSection(data, section);
-    if (sec == NULL) {
-      nsec.name = STRDUP(section);
-      nsec.size = 0;
-      nsec.entries = NULL;
-      APPEND(data->sections,
-            data->ssize,
-            nsec);
-      sec = findSection(data, section);
-    }
-    ne.key = STRDUP(option);
-    ne.val = NULL;
-    ne.dirty_val = NULL;
-    APPEND(sec->entries,
-          sec->size,
-          ne);
-    e = findEntry(data, section, option);
-  }
-  if (e->dirty_val != NULL) {
-    if (0 == strcmp(e->dirty_val,
-                   value)) {
-      ret = 0;
-    } else {
-      /* recursive update to different value -- not allowed! */
-      GE_BREAK(ectx, 0);
-      ret = -1;
-    }
-  } else {
-    e->dirty_val = STRDUP(value);
-    i = data->lsize - 1;
-    while (i >= 0) {
-      if (0 != data->listeners[i].listener(data->listeners[i].ctx,
-                                          cfg,
-                                          ectx,
-                                          section,
-                                          option))
-       break; /* update refused */
-      i--;
-      e = findEntry(data, section, option); /* side-effects of callback are 
possible! */
-    }
-    e = findEntry(data, section, option); /* side-effects of callback are 
possible! */
-    if (i >= 0) {
-      /* update refused, revert! */
-      FREE(e->dirty_val);
-      e->dirty_val = NULL;
-      i++; /* the callback that refused does not need refreshing */
-      while (i < data->lsize) {
-       if (0 != data->listeners[i].listener(data->listeners[i].ctx,
-                                            cfg,
-                                            ectx,
-                                            section,
-                                            option))
-         GE_ASSERT(ectx, 0); /* refused the refusal!? */
-       e = findEntry(data, section, option); /* side-effects of callback are 
possible! */
-       i++;
-      }
-      ret = -1; /* error -- update refused */
-    } else {
-      /* all confirmed, commit! */
-      if ( (e->val == NULL) ||
-          (0 != strcmp(e->val,
-                       e->dirty_val)) )
-       data->dirty = 1;
-      FREENONNULL(e->val);
-      e->val = e->dirty_val;
-      e->dirty_val = NULL;
-      ret = 0;
-    }
-  }
-  if (ret == -1)
-    GE_LOG(ectx,
-          GE_USER | GE_BULK | GE_WARNING,
-          _("Setting option `%s' in section `%s' to value `%s' was 
refused.\n"),
-          option,
-          section,
-          value);
-  MUTEX_UNLOCK(data->lock);
-  return ret;
-}
-
-
 /**
  * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR"
  * where either in the current section or globally FOO is set to
@@ -734,7 +754,11 @@
 
   data = cfg->data;
   tmp = NULL;
-  ret = _get_configuration_value_string(cfg, section, option, def, &tmp);
+  ret = _get_configuration_value_string(cfg,
+                                       section, 
+                                       option,
+                                       def, 
+                                       &tmp);
   if (tmp != NULL) {
     tmp = _configuration_expand_dollar(cfg,
                                       section,
@@ -749,17 +773,6 @@
 }
 
 static int
-_set_configuration_value_number(struct GC_Configuration * cfg,
-                               struct GE_Context * ectx,
-                               const char * section,
-                               const char * option,
-                               unsigned long long number) {
-  char s[64];
-  SNPRINTF(s, 64, "%llu", number);
-  return _set_configuration_value_string(cfg, ectx, section, option, s);
-}
-
-static int
 _set_configuration_value_choice(struct GC_Configuration * cfg,
                                struct GE_Context * ectx,
                                const char * section,
@@ -827,6 +840,30 @@
 }
 
 /**
+ * Test if we have a value for a particular option
+ * @return YES if so, NO if not.
+ */
+static int
+_have_configuration_value(struct GC_Configuration * cfg,
+                         const char * section,
+                         const char * option) {
+  GC_Entry * e;
+  const char * val;
+  int ret;
+
+  MUTEX_LOCK(cfg->data->lock);
+  e = findEntry(cfg->data,
+               section,
+               option);
+  if (e == NULL)
+    ret = NO;
+  else
+    ret = YES;
+  MUTEX_UNLOCK(cfg->data->lock);
+  return ret;
+}
+
+/**
  * Create a GC_Configuration (C implementation).
  */
 GC_Configuration *
@@ -852,6 +889,7 @@
   ret->set_configuration_value_choice = &_set_configuration_value_choice;
   ret->attach_change_listener = &_attach_change_listener;
   ret->detach_change_listener = &_detach_change_listener;
+  ret->have_configuration_value = &_have_configuration_value;
   return ret;
 }
 

Modified: GNUnet/src/util/disk/storage.c
===================================================================
--- GNUnet/src/util/disk/storage.c      2006-11-04 18:43:18 UTC (rev 3646)
+++ GNUnet/src/util/disk/storage.c      2006-11-05 05:06:04 UTC (rev 3647)
@@ -359,7 +359,35 @@
   return ret;
 }
 
+
 /**
+ * Create the directory structure for storing
+ * a file.
+ *
+ * @param filename name of a file in the directory
+ * @returns OK on success, SYSERR on failure
+ */
+int disk_directory_create_for_file(struct GE_Context * ectx,
+                                  const char * dir) {
+  char * rdir;
+  int len;
+  int ret;
+
+  rdir = string_expandFileName(ectx,
+                              dir);
+  if (rdir == NULL)
+    return SYSERR;
+  len = strlen(rdir);
+  while ( (len > 0) &&
+         (rdir[len] != '/') )
+    len--;
+  rdir[len] = '\0';
+  ret = disk_directory_create(ectx, rdir);
+  FREE(rdir);
+  return ret;
+}
+
+/**
  * Read the contents of a binary file into a buffer.
  * @param fileName the name of the file, not freed,
  *        must already be expanded!

Modified: GNUnet/src/util/loggers/file.c
===================================================================
--- GNUnet/src/util/loggers/file.c      2006-11-04 18:43:18 UTC (rev 3646)
+++ GNUnet/src/util/loggers/file.c      2006-11-05 05:06:04 UTC (rev 3647)
@@ -288,9 +288,10 @@
   }
   fd = FOPEN(name, "w+");
   if (fd == NULL) {
-    GE_LOG_STRERROR(ectx,
-                   GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE | GE_BULK,
-                   "fopen");
+    GE_LOG_STRERROR_FILE(ectx,
+                        GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE | GE_BULK,
+                        "fopen",
+                        name);
     FREE(name);
     return NULL; /* ERROR! */
   }

Modified: GNUnet/src/util/string/dlmalloc.c
===================================================================
--- GNUnet/src/util/string/dlmalloc.c   2006-11-04 18:43:18 UTC (rev 3646)
+++ GNUnet/src/util/string/dlmalloc.c   2006-11-05 05:06:04 UTC (rev 3647)
@@ -13,7 +13,7 @@
 #endif
 
 #define USE_LOCKS 1
-#define USE_DL_PREFIX 1
+#define USE_DL_PREFIX 0
 
 /* END changes */
 

Modified: GNUnet/src/util/string/xmalloc.c
===================================================================
--- GNUnet/src/util/string/xmalloc.c    2006-11-04 18:43:18 UTC (rev 3646)
+++ GNUnet/src/util/string/xmalloc.c    2006-11-05 05:06:04 UTC (rev 3647)
@@ -29,8 +29,6 @@
 #include "platform.h"
 #include "dlmalloc.h"
 
-/* #define USE_DLMALLOC */
-
 #ifndef INT_MAX
 #define INT_MAX 0x7FFFFFFF
 #endif
@@ -75,11 +73,7 @@
                filename,
                linenumber,
                function);
-#ifdef USE_DLMALLOC
-  result = dlmalloc(size);
-#else
   result = malloc(size);
-#endif
   if (result == NULL)
     GE_DIE_STRERROR_FLF(NULL,
                        GE_IMMEDIATE | GE_USER | GE_DEVELOPER | GE_FATAL,
@@ -110,11 +104,7 @@
                 const char * filename,
                 int linenumber,
                 const char * function) {
-#ifdef USE_DLMALLOC
-  ptr = dlrealloc(ptr, n);
-#else
   ptr = realloc(ptr, n);
-#endif
 
   if (!ptr)
     GE_DIE_STRERROR_FLF(NULL,
@@ -143,11 +133,7 @@
                filename,
                linenumber,
                function);
-#ifdef USE_DLMALLOC
-  dlfree(ptr);
-#else
   free(ptr);
-#endif
 }
 
 /**

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2006-11-04 18:43:18 UTC (rev 3646)
+++ GNUnet/todo 2006-11-05 05:06:04 UTC (rev 3647)
@@ -13,18 +13,15 @@
 
 
 0.7.1 [11'06] (aka "stabilization")
-- fix connection problem reported by Nils!
-- fix critical known bugs (see Mantis for updates):
+- fix critical known bugs:
+  * keyword extraction does NOT happen with gnunet-insert [RCpre0]
+  * gnunet-download stopped working [RCpre0]
+  * fix connection problem reported by Nils! [RCpre0]
   * Windows installer [Nils]
     + uninstall: Remove account
     + libcurl, guile [RCpre0]
-* provide HTTP transport (new binaries can't load old transport if activated
-     in config)
   * file/socket leak (#955) - possibly fixed
-- finish util refactoring: [RCpre0]
-  * logger configuration:
-    + util/boot code to parse configuration
-      -- and improve scm code as well!
+- finish util refactoring:
   * error handling: [RCpre1]
     + tcpio
     + fs/module





reply via email to

[Prev in Thread] Current Thread [Next in Thread]