mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
touch up clear and verbose.
git-svn-id: file:///svn/unbound/trunk@728 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
5b966557cc
commit
27c8952a2c
4 changed files with 13 additions and 4 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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++) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue