]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
touch up clear and verbose.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 1 Nov 2007 13:22:12 +0000 (13:22 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 1 Nov 2007 13:22:12 +0000 (13:22 +0000)
git-svn-id: file:///svn/unbound/trunk@728 be551aaa-1e26-0410-a405-d3ace91eadb9

daemon/unbound.c
doc/Changelog
util/storage/lruhash.c
util/storage/lruhash.h

index 7d4ecce76fd0e36895b0f2ccfb85248d308f1891..c2e541d2e7728e57a9833972cc43a02b51d1a9c8 100644 (file)
@@ -263,11 +263,13 @@ do_chroot(struct daemon* daemon, struct config_file* cfg, int debug_mode)
        log_assert(cfg);
 
        /* daemonize last to be able to print error to user */
-       if(cfg->directory && cfg->directory[0])
+       if(cfg->directory && cfg->directory[0]) {
                if(chdir(cfg->directory)) {
                        fatal_exit("Could not chdir to %s: %s",
                                cfg->directory, strerror(errno));
                }
+               verbose(VERB_DETAIL, "chdir to %s", cfg->directory);
+       }
        if(cfg->username && cfg->username[0]) {
                struct passwd *pwd;
                if((pwd = getpwnam(cfg->username)) == NULL)
@@ -277,11 +279,15 @@ do_chroot(struct daemon* daemon, struct config_file* cfg, int debug_mode)
                if(setuid(pwd->pw_uid) != 0)
                        fatal_exit("unable to set user id: %s", strerror(errno));
                endpwent();
+               verbose(VERB_DETAIL, "drop user privileges, run as %s", 
+                       cfg->username);
        }
-       if(cfg->chrootdir && cfg->chrootdir[0])
+       if(cfg->chrootdir && cfg->chrootdir[0]) {
                if(chroot(cfg->chrootdir))
                        fatal_exit("unable to chroot to %s: %s", 
                                cfg->chrootdir, strerror(errno));
+               verbose(VERB_DETAIL, "chroot to %s", cfg->chrootdir);
+       }
        /* check old pid file before forking */
        if(cfg->pidfile && cfg->pidfile[0]) {
                checkoldpid(cfg);
index ed4e54ccb269d74bed687b2451f3920cb1d620fa..8709e9410505ee3a5800400a45b6cac21c14bba5 100644 (file)
@@ -3,6 +3,8 @@
          dealloc during deinit.
        - Fixup of chroot call. Happens after privileges are dropped, so
          that checking the passwd entry still works.
+       - minor touch up of clear() hashtable function.
+       - VERB_DETAIL prints out what chdir, username, chroot is being done.
 
 31 October 2007: Wouter
        - cache-max-ttl config option.
index 3f33e7f76b18a43210a1ce1c91aa3c3ed6f2b9ea..3c85f60e040fdf179dbc35cadf6e900410c97ec3 100644 (file)
@@ -426,10 +426,10 @@ void
 lruhash_clear(struct lruhash* table)
 {
        size_t i;
-       log_assert(fptr_whitelist_hash_delkeyfunc(table->delkeyfunc));
-       log_assert(fptr_whitelist_hash_deldatafunc(table->deldatafunc));
        if(!table)
                return;
+       log_assert(fptr_whitelist_hash_delkeyfunc(table->delkeyfunc));
+       log_assert(fptr_whitelist_hash_deldatafunc(table->deldatafunc));
 
        lock_quick_lock(&table->lock);
        for(i=0; i<table->size; i++) {
index d1ea80588633aabe7a89b907a43eeae4d6b2948f..b0a36eb6749854ed63fcd14751232df0cc805b81 100644 (file)
@@ -134,6 +134,7 @@ typedef int (*lruhash_compfunc_t)(void*, void*);
  * If is_locked is not set, then this item is not locked. This allows the 
  * routine to perform operations within the critical region of the lock 
  * of the key. The critical region has been locked before the delete happened.
+ * The RRset type has to revoke its ID number inside the critical region.
  * This function is called: func(key, userarg, is_locked) */
 typedef void (*lruhash_delkeyfunc_t)(void*, void*, int);