Univention Bugzilla – Attachment 8495 Details for
Bug 35707
Listener log level (listener.log) messages should be reviewed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Unify UDL log message format
0005-Bug-23367-UDL-Unify-logging-messages.patch (text/plain), 117.98 KB, created by
Philipp Hahn
on 2017-03-06 13:44:02 CET
(
hide
)
Description:
Unify UDL log message format
Filename:
MIME Type:
Creator:
Philipp Hahn
Created:
2017-03-06 13:44:02 CET
Size:
117.98 KB
patch
obsolete
>From c9aa1928fb5bd2ab63459f24d091a0da2a6c24c8 Mon Sep 17 00:00:00 2001 >Message-Id: <c9aa1928fb5bd2ab63459f24d091a0da2a6c24c8.1488803254.git.hahn@univention.de> >In-Reply-To: <c5a61c20515ccc774c5893d769ff3c3454e9c07f.1488803254.git.hahn@univention.de> >References: <c5a61c20515ccc774c5893d769ff3c3454e9c07f.1488803254.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Mon, 6 Mar 2017 12:58:49 +0100 >Subject: [PATCH 5/5] Bug #35707 UDL: Unify logging messages >Organization: Univention GmbH, Bremen, Germany > >Convert all other users as well so we have some consistent logging >format again. >- main.c logged as LDAP -> LISTENER >- transfile.c logged as LDAP -> TRANSFILE >- make hex_dump() internal > >sed -i -e 's/\<univention_debug( *UV_DEBUG_LISTENER *, *UV_DEBUG_\(\w\+\) *, */LOG(\1, /' src/*.c >--- > .../univention-directory-listener/src/cache.c | 115 ++++++++++----------- > .../univention-directory-listener/src/cache_bdb.c | 64 ++++++------ > .../univention-directory-listener/src/cache_dn.c | 63 ++++++----- > .../src/cache_entry.c | 55 +++++----- > .../src/cache_lowlevel.c | 68 ++++++------ > .../src/cache_lowlevel.h | 1 - > .../univention-directory-listener/src/change.c | 101 +++++++++--------- > .../univention-directory-listener/src/convert.c | 8 +- > .../univention-directory-listener/src/demo.c | 2 - > .../univention-directory-listener/src/dump.c | 4 +- > .../univention-directory-listener/src/handlers.c | 59 ++++++----- > .../univention-directory-listener/src/main.c | 56 +++++----- > .../univention-directory-listener/src/network.c | 53 +++++----- > .../univention-directory-listener/src/notifier.c | 29 +++--- > .../src/select_server.c | 14 +-- > .../univention-directory-listener/src/signals.c | 20 ++-- > .../univention-directory-listener/src/transfile.c | 23 ++--- > .../univention-directory-listener/src/verify.c | 2 - > 18 files changed, 355 insertions(+), 382 deletions(-) > >diff --git a/management/univention-directory-listener/src/cache.c b/management/univention-directory-listener/src/cache.c >index 703e451..8101788 100644 >--- a/management/univention-directory-listener/src/cache.c >+++ b/management/univention-directory-listener/src/cache.c >@@ -116,9 +116,8 @@ static void setup_cache_filter(void) { > > /* > int mdb_message_func(const char *msg, void *ctx) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, >- "%s\n", msg); >- return MDB_SUCCESS; >+ LOG(INFO, "%s\n", msg); >+ return MDB_SUCCESS; > } > */ > >@@ -135,15 +134,15 @@ int cache_lock(void) { > abort(); > > if ((lock_fp = fopen(lock_file, "a+e")) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "Could not open lock file [%s]", lock_file); >+ LOG(ERROR, "Could not open lock file [%s]", lock_file); > exit(EXIT_FAILURE); > } > fd = fileno(lock_fp); > > if (lockf(fd, F_TLOCK, 0) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "Could not get lock for database [%s]; " >- "Is another listener processs running?\n", >- lock_file); >+ LOG(ERROR, "Could not get lock for database [%s]; " >+ "Is another listener processs running?\n", >+ lock_file); > exit(EXIT_FAILURE); > } > >@@ -167,19 +166,19 @@ static size_t determine_mapsize_from_ucr() { > free(mapsize_str); > > if ((errno == ERANGE && (mapsize == LONG_MAX || mapsize == LONG_MIN)) || (errno != 0 && mapsize == 0)) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_init: Error parsing value of UCR variable %s as number: %s", ucr_var_mapsize, strerror(errno)); >+ LOG(ERROR, "cache_init: Error parsing value of UCR variable %s as number: %s", ucr_var_mapsize, strerror(errno)); > exit(EXIT_FAILURE); > } > if (endptr == mapsize_str) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_init: Value of UCR variable %s is not a number", ucr_var_mapsize); >+ LOG(ERROR, "Value of UCR variable %s is not a number", ucr_var_mapsize); > mapsize = default_mapsize; >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_init: using default mapsize: %zu", mapsize); >+ LOG(ERROR, "using default mapsize: %zu", mapsize); > } else { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "cache_init: using UCR defined mapsize: %zu", mapsize); >+ LOG(INFO, "using UCR defined mapsize: %zu", mapsize); > } > } else { > mapsize = default_mapsize; >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "cache_init: using default mapsize: %zu", mapsize); >+ LOG(INFO, "using default mapsize: %zu", mapsize); > } > return mapsize; > } >@@ -191,7 +190,7 @@ int cache_init(char *cache_mdb_dir, int mdb_flags) { > size_t mapsize = determine_mapsize_from_ucr(); > > if ((mdb_flags & MDB_RDONLY) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "cache_init: MDB_RDONLY"); >+ LOG(INFO, "MDB_RDONLY"); > mdb_readonly = MDB_RDONLY; > } else { > mdb_dbi_flags |= MDB_CREATE; >@@ -199,33 +198,33 @@ int cache_init(char *cache_mdb_dir, int mdb_flags) { > > rv = mdb_env_create(&env); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_init: creating environment handle failed"); >+ LOG(ERROR, "creating environment handle failed"); > ERROR_MDB(rv, "mdb_env_create"); > return rv; > } > > rv = mdb_env_set_mapsize(env, mapsize); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_init: setting mdb mapsize failed"); >+ LOG(ERROR, "setting mdb mapsize failed"); > ERROR_MDB(rv, "mdb_env_set_mapsize"); > return rv; > } > > rv = mdb_env_set_maxdbs(env, 2); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_init: setting mdb maxdbs failed"); >+ LOG(ERROR, "setting mdb maxdbs failed"); > ERROR_MDB(rv, "mdb_env_set_maxdbs"); > return rv; > } > > rv = mdb_env_open(env, cache_mdb_dir, mdb_readonly, 0600); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_init: opening database failed"); >+ LOG(ERROR, "opening database failed"); > ERROR_MDB(rv, "mdb_env_open"); > return rv; > } > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_init: Transaction begin"); >+ LOG(ALL, "Transaction begin"); > > rv = mdb_txn_begin(env, NULL, mdb_readonly, &cache_init_txn); > if (rv != MDB_SUCCESS) { >@@ -251,7 +250,7 @@ int cache_init(char *cache_mdb_dir, int mdb_flags) { > return rv; > } > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "Transaction commit"); >+ LOG(ALL, "Transaction commit"); > > rv = mdb_txn_commit(cache_init_txn); > if (rv != MDB_SUCCESS) { >@@ -271,7 +270,7 @@ int cache_set_schema_id(const NotifierID value) { > int rv, fd, len; > char file[PATH_MAX], buf[15]; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Set Schema ID to %ld", value); >+ LOG(WARN, "Set Schema ID to %ld", value); > len = snprintf(buf, sizeof buf, "%ld", value); > if (len < 0 || len >= sizeof buf) > return len; >@@ -357,7 +356,7 @@ int cache_get_master_entry(CacheMasterEntry *master_entry) { > key.mv_data = &MASTER_KEY; > key.mv_size = MASTER_KEY_SIZE; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_get_master_entry: Read Transaction begin"); >+ LOG(ALL, "Read Transaction begin"); > > rv = mdb_txn_begin(env, NULL, MDB_RDONLY, &read_txn); > if (rv != MDB_SUCCESS) { >@@ -367,23 +366,22 @@ int cache_get_master_entry(CacheMasterEntry *master_entry) { > > rv = mdb_get(read_txn, id2entry, &key, &data); > if (rv == MDB_NOTFOUND) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_get_master_entry: Read Transaction abort" >- ": %s", >- mdb_strerror(rv)); >+ LOG(ALL, "Read Transaction abort: %s", >+ mdb_strerror(rv)); > mdb_txn_abort(read_txn); > return rv; > } else if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_get_master_entry: reading master entry from database failed"); >+ LOG(ERROR, "reading master entry from database failed"); > ERROR_MDB(rv, "mdb_get"); > mdb_txn_abort(read_txn); > return rv; > } > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_get_master_entry: Read Transaction abort"); >+ LOG(ALL, "Read Transaction abort"); > mdb_txn_abort(read_txn); > > if (data.mv_size != sizeof(CacheMasterEntry)) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_get_master_entry: master entry has unexpected length"); >+ LOG(ERROR, "master entry has unexpected length"); > return 1; > } > >@@ -406,21 +404,21 @@ int cache_update_master_entry(CacheMasterEntry *master_entry) { > data.mv_data = (void *)master_entry; > data.mv_size = sizeof(CacheMasterEntry); > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_update_master_entry: Transaction begin"); >+ LOG(ALL, "Transaction begin"); > if ((rv = mdb_txn_begin(env, NULL, 0, &write_txn)) != MDB_SUCCESS) { > ERROR_MDB(rv, "mdb_txn_begin"); > return rv; > } > rv = mdb_put(write_txn, id2entry, &key, &data, 0); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_update_master_entry: storing master entry in database failed"); >+ LOG(ERROR, "storing master entry in database failed"); > ERROR_MDB(rv, "mdb_put"); > mdb_txn_abort(write_txn); > return rv; > } >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_update_master_entry: Transaction commit"); >+ LOG(ALL, "Transaction commit"); > if ((rv = mdb_txn_commit(write_txn)) != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_update_master_entry: storing master entry in database failed"); >+ LOG(ERROR, "storing master entry in database failed"); > ERROR_MDB(rv, "mdb_txn_commit"); > return rv; > } >@@ -443,7 +441,7 @@ static inline int cache_update_entry_in_transaction(NotifierID id, char *dn, Cac > rv = unparse_entry(&data.mv_data, &tmp_size, entry); > data.mv_size = tmp_size; > if (rv != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_update_entry: unparsing entry failed"); >+ LOG(ERROR, "unparsing entry failed"); > return rv; > } > >@@ -460,11 +458,11 @@ static inline int cache_update_entry_in_transaction(NotifierID id, char *dn, Cac > write_txn = mdb_cursor_txn(*id2dn_cursor_pp); > rv = mdb_put(write_txn, id2entry, &key, &data, 0); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_update_entry: storing entry in database failed: %s", dn); >+ LOG(ERROR, "storing entry in database failed: %s", dn); > ERROR_MDB(rv, "mdb_put"); > goto out; > } >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "put %zu bytes for %s", data.mv_size, dn); >+ LOG(ALL, "put %zu bytes for %s", data.mv_size, dn); > > out: > signals_unblock(); >@@ -478,7 +476,7 @@ inline int cache_update_entry(NotifierID id, char *dn, CacheEntry *entry) { > MDB_txn *write_txn; > MDB_cursor *id2dn_write_cursor_p; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_update_entry: Transaction begin"); >+ LOG(ALL, "Transaction begin"); > rv = mdb_txn_begin(env, NULL, 0, &write_txn); > if (rv != MDB_SUCCESS) { > ERROR_MDB(rv, "mdb_txn_begin"); >@@ -496,15 +494,15 @@ inline int cache_update_entry(NotifierID id, char *dn, CacheEntry *entry) { > mdb_cursor_close(id2dn_write_cursor_p); > > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_update_entry: Transaction abort"); >+ LOG(ALL, "Transaction abort"); > mdb_txn_abort(write_txn); > return rv; > } > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_update_entry: Transaction commit"); >+ LOG(ALL, "Transaction commit"); > rv = mdb_txn_commit(write_txn); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_update_entry: storing updated entry in database failed"); >+ LOG(ERROR, "storing updated entry in database failed"); > ERROR_MDB(rv, "mdb_txn_commit"); > return rv; > } >@@ -517,7 +515,7 @@ int cache_update_entry_lower(NotifierID id, char *dn, CacheEntry *entry) { > int rv = 0; > > if (cache_filter.filter && cache_entry_ldap_filter_match(cache_filters, dn, entry)) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "Not caching %s, filtered out.", dn); >+ LOG(ALL, "Not caching %s, filtered out.", dn); > return rv; > } > >@@ -548,7 +546,7 @@ static inline int cache_delete_entry_in_transaction(NotifierID id, char *dn, MDB > write_txn = mdb_cursor_txn(*id2dn_cursor_pp); > rv = mdb_del(write_txn, id2entry, &key, 0); > if (rv != MDB_SUCCESS && rv != MDB_NOTFOUND) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_delete_entry: removing from database failed: %s", dn); >+ LOG(ERROR, "removing from database failed: %s", dn); > ERROR_MDB(rv, "ERROR_MDB: mdb_del"); > signals_unblock(); > return rv; >@@ -570,7 +568,7 @@ int cache_delete_entry(NotifierID id, char *dn) { > MDB_txn *write_txn; > MDB_cursor *id2dn_write_cursor_p; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_delete_entry: Transaction begin"); >+ LOG(ALL, "Transaction begin"); > rv = mdb_txn_begin(env, NULL, 0, &write_txn); > if (rv != MDB_SUCCESS) { > ERROR_MDB(rv, "mdb_txn_begin"); >@@ -588,15 +586,15 @@ int cache_delete_entry(NotifierID id, char *dn) { > mdb_cursor_close(id2dn_write_cursor_p); > > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_update_entry: Transaction abort"); >+ LOG(ALL, "Transaction abort"); > mdb_txn_abort(write_txn); > return rv; > } > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_delete_entry: Transaction commit"); >+ LOG(ALL, "Transaction commit"); > rv = mdb_txn_commit(write_txn); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_delete_entry: storing entry removal from database failed"); >+ LOG(ERROR, "storing entry removal from database failed"); > ERROR_MDB(rv, "mdb_txn_commit"); > } > >@@ -643,7 +641,7 @@ int cache_get_entry(char *dn, CacheEntry *entry) { > memset(&data, 0, sizeof(MDB_val)); > memset(entry, 0, sizeof(CacheEntry)); > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_get_entry: Read Transaction begin"); >+ LOG(ALL, "Read Transaction begin"); > > rv = mdb_txn_begin(env, NULL, MDB_RDONLY, &read_txn); > if (rv != MDB_SUCCESS) { >@@ -661,7 +659,7 @@ int cache_get_entry(char *dn, CacheEntry *entry) { > rv = dntree_get_id4dn(id2dn_read_cursor_p, dn, &dnid, false); > mdb_cursor_close(id2dn_read_cursor_p); > if (rv == MDB_NOTFOUND) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_get_entry: Read Transaction abort"); >+ LOG(ALL, "Read Transaction abort"); > mdb_txn_abort(read_txn); > return rv; > } >@@ -673,16 +671,16 @@ int cache_get_entry(char *dn, CacheEntry *entry) { > rv = mdb_get(read_txn, id2entry, &key, &data); > // signals_unblock(); > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_get_entry: Read Transaction abort"); >+ LOG(ALL, "Read Transaction abort"); > mdb_txn_abort(read_txn); > > if (rv == MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "got %zu bytes for %s", data.mv_size, dn); >+ LOG(INFO, "got %zu bytes for %s", data.mv_size, dn); > } else if (rv == MDB_NOTFOUND) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "cache_get_entry: no cache entry found for %s", dn); >+ LOG(INFO, "no cache entry found for %s", dn); > return rv; > } else { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "reading %s from database failed", dn); >+ LOG(ERROR, "reading %s from database failed", dn); > ERROR_MDB(rv, "mdb_get"); > return rv; > } >@@ -690,7 +688,7 @@ int cache_get_entry(char *dn, CacheEntry *entry) { > assert(data.mv_size <= UINT32_MAX); > rv = parse_entry(data.mv_data, data.mv_size, entry); > if (rv != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_get_entry: parsing entry failed"); >+ LOG(ERROR, "parsing entry failed"); > exit(1); > } > >@@ -722,7 +720,7 @@ int cache_first_entry(MDB_cursor **id2entry_read_cursor_pp, MDB_cursor **id2dn_r > MDB_txn *read_txn; > int rv; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_first_entry: Transaction begin"); >+ LOG(ALL, "Transaction begin"); > > rv = mdb_txn_begin(env, NULL, mdb_readonly, &read_txn); > if (rv != MDB_SUCCESS) { >@@ -749,8 +747,7 @@ int cache_first_entry(MDB_cursor **id2entry_read_cursor_pp, MDB_cursor **id2dn_r > MDB_envinfo stat; > MDB_env *env = mdb_txn_env(read_txn); > mdb_env_info(env, &stat); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, >- "LAST COMMITTED TXN: %zu", stat.me_last_txnid); >+ LOG(ALL, "LAST COMMITTED TXN: %zu", stat.me_last_txnid); > */ > > return cache_next_entry(id2entry_read_cursor_pp, id2dn_read_cursor_pp, dn, entry); >@@ -779,12 +776,12 @@ int cache_next_entry(MDB_cursor **id2entry_read_cursor_pp, MDB_cursor **id2dn_re > return cache_next_entry(id2entry_read_cursor_pp, id2dn_read_cursor_pp, dn, entry); > } > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "got %zu bytes", data.mv_size); >+ LOG(ALL, "got %zu bytes", data.mv_size); > > assert(data.mv_size <= UINT32_MAX); > rv = parse_entry(data.mv_data, (u_int32_t)data.mv_size, entry); > if (rv != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_next_entry: parsing entry failed: %s", *dn); >+ LOG(ERROR, "parsing entry failed: %s", *dn); > printf("%zu\n", data.mv_size); > return rv; > } >@@ -797,7 +794,7 @@ int cache_next_entry(MDB_cursor **id2entry_read_cursor_pp, MDB_cursor **id2dn_re > > rv = dntree_lookup_dn4id(*id2dn_read_cursor_pp, dnid, dn); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_next_entry: DB corruption, DN entry for id %d not found", *(int *)key.mv_data); >+ LOG(ERROR, "DB corruption, DN entry for id %d not found", *(int *)key.mv_data); > ERROR_MDB(rv, "mdb_get"); > return rv; > } >@@ -813,10 +810,10 @@ int cache_free_cursor(MDB_cursor *id2entry_read_cursor_pp, MDB_cursor *id2dn_rea > mdb_cursor_close(id2entry_read_cursor_pp); > mdb_cursor_close(id2dn_read_cursor_pp); > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_free_cursor: Transaction commit"); >+ LOG(ALL, "Transaction commit"); > rv = mdb_txn_commit(read_txn); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_free_cursor: Transation commit failed"); >+ LOG(ERROR, "Transation commit failed"); > ERROR_MDB(rv, "mdb_txn_commit"); > } > return rv; >diff --git a/management/univention-directory-listener/src/cache_bdb.c b/management/univention-directory-listener/src/cache_bdb.c >index 1f84a2d..25cb089 100644 >--- a/management/univention-directory-listener/src/cache_bdb.c >+++ b/management/univention-directory-listener/src/cache_bdb.c >@@ -71,7 +71,6 @@ > #include <stdbool.h> > #include <assert.h> > >-#include <univention/debug.h> > #include <univention/config.h> > > #include "common.h" >@@ -117,7 +116,7 @@ static void bdb_cache_panic_call(DB_ENV *dbenvp, int errval) { > #endif > > static void bdb_cache_error_message(const char *errpfx, char *msg) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "database error: %s", msg); >+ LOG(ERROR, "database error: %s", msg); > } > > int bdb_cache_lock(void) { >@@ -131,15 +130,15 @@ int bdb_cache_lock(void) { > abort(); > > if ((lock_fp = fopen(lock_file, "a+e")) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "Could not open lock file [%s]", lock_file); >+ LOG(ERROR, "Could not open lock file [%s]", lock_file); > exit(EXIT_FAILURE); > } > fd = fileno(lock_fp); > > if (lockf(fd, F_TLOCK, 0) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "Could not get lock for database [%s]; " >- "Is another listener processs running?\n", >- lock_file); >+ LOG(ERROR, "Could not get lock for database [%s]; " >+ "Is another listener processs running?\n", >+ lock_file); > exit(EXIT_FAILURE); > } > >@@ -154,7 +153,7 @@ int bdb_cache_init(void) { > > #ifdef WITH_DB42 > if ((rv = db_env_create(&dbenvp, 0)) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "creating database environment failed"); >+ LOG(ERROR, "creating database environment failed"); > return rv; > } > dbenvp->set_errcall(dbenvp, bdb_cache_error_message); >@@ -162,27 +161,27 @@ int bdb_cache_init(void) { > if ((rv = dbenvp->open(dbenvp, bdb_cache_dir, DB_CREATE | DB_INIT_MPOOL | > /*DB_INIT_LOCK | */ DB_INIT_LOG | DB_INIT_TXN | DB_RECOVER, > 0600)) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "opening database environment failed"); >+ LOG(ERROR, "opening database environment failed"); > dbenvp->err(dbenvp, rv, "%s", "environment"); > return rv; > } > if ((rv = db_create(&dbp, dbenvp, 0)) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "creating database handle failed"); >+ LOG(ERROR, "creating database handle failed"); > return rv; > } > if ((rv = dbp->open(dbp, NULL, "cache.db", NULL, DB_BTREE, DB_CREATE | DB_CHKSUM | DB_AUTO_COMMIT, 0600)) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "opening database failed"); >+ LOG(ERROR, "opening database failed"); > dbp->err(dbp, rv, "open"); > // FIXME: free dbp > return rv; > } > #else > if ((rv = db_create(&dbp, NULL, 0)) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "creating database handle failed"); >+ LOG(ERROR, "creating database handle failed"); > return rv; > } > if ((rv = dbp->open(dbp, file, NULL, DB_BTREE, DB_CREATE, 0600)) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "opening database failed"); >+ LOG(ERROR, "opening database failed"); > dbp->err(dbp, rv, "open"); > // FIXME: free dbp > return rv; >@@ -203,7 +202,7 @@ int bdb_cache_set_schema_id(const NotifierID value) { > int rv, fd, len; > char file[PATH_MAX], buf[15]; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Set Schema ID to %ld", value); >+ LOG(WARN, "Set Schema ID to %ld", value); > len = snprintf(buf, sizeof buf, "%ld", value); > if (len < 0 || len >= sizeof buf) > return len; >@@ -292,13 +291,13 @@ int bdb_cache_get_master_entry(BdbCacheMasterEntry *master_entry) { > if ((rv = dbp->get(dbp, NULL, &key, &data, 0)) == DB_NOTFOUND) > return rv; > else if (rv != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "reading master entry from database failed"); >+ LOG(ERROR, "reading master entry from database failed"); > dbp->err(dbp, rv, "get"); > return rv; > } > > if (data.size != sizeof(BdbCacheMasterEntry)) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "master entry has unexpected length"); >+ LOG(ERROR, "master entry has unexpected length"); > return 1; > } > >@@ -330,7 +329,7 @@ int bdb_cache_update_master_entry(BdbCacheMasterEntry *master_entry, DB_TXN *dbt > flags = 0; > > if ((rv = dbp->put(dbp, dbtxnp, &key, &data, flags)) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "storing master entry in database failed"); >+ LOG(ERROR, "storing master entry in database failed"); > dbp->err(dbp, rv, "put"); > return rv; > } >@@ -360,9 +359,9 @@ DB_TXN *bdb_cache_new_transaction(NotifierID id, char *dn) { > old_id = &master_entry.id; > > if (*old_id >= id) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "New ID (%ld) is not greater than old" >- " ID (%ld): %s", >- id, *old_id, dn); >+ LOG(ERROR, "New ID (%ld) is not greater than old" >+ " ID (%ld): %s", >+ id, *old_id, dn); > dbtxnp->abort(dbtxnp); > return NULL; > } else >@@ -380,7 +379,6 @@ DB_TXN *bdb_cache_new_transaction(NotifierID id, char *dn) { > #endif > } > >- > /* XXX: The NotifierID is passed for future use. Once the journal is > implemented, entries other than the most recent one can be returned. > At the moment, the id parameters for bdb_cache_update_entry, and >@@ -394,11 +392,10 @@ inline int bdb_cache_update_entry(NotifierID id, char *dn, CacheEntry *entry) { > memset(&data, 0, sizeof(DBT)); > > if ((rv = unparse_entry(&data.data, &data.size, entry)) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "unparsing entry failed"); >+ LOG(ERROR, "unparsing entry failed"); > return rv; > } > >- > signals_block(); > #ifdef WITH_DB42 > dbtxnp = bdb_cache_new_transaction(id, dn); >@@ -416,7 +413,7 @@ inline int bdb_cache_update_entry(NotifierID id, char *dn, CacheEntry *entry) { > > if ((rv = dbp->put(dbp, dbtxnp, &key, &data, 0)) != 0) { > signals_unblock(); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "storing entry in database failed: %s", dn); >+ LOG(ERROR, "storing entry in database failed: %s", dn); > dbp->err(dbp, rv, "put"); > #ifdef WITH_DB42 > dbtxnp->abort(dbtxnp); >@@ -424,8 +421,7 @@ inline int bdb_cache_update_entry(NotifierID id, char *dn, CacheEntry *entry) { > free(data.data); > return rv; > } >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "put %d bytes for %s", data.size, dn); >- >+ LOG(ALL, "put %d bytes for %s", data.size, dn); > > #ifdef WITH_DB42 > dbtxnp->commit(dbtxnp, 0); >@@ -442,7 +438,7 @@ int bdb_cache_update_entry_lower(NotifierID id, char *dn, CacheEntry *entry) { > int rv = 0; > > if (cache_filter.filter && cache_entry_ldap_filter_match(cache_filters, dn, entry)) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "Not caching %s, filtered out.", dn); >+ LOG(ALL, "Not caching %s, filtered out.", dn); > return rv; > } > >@@ -476,7 +472,7 @@ int bdb_cache_delete_entry(NotifierID id, char *dn) { > > if ((rv = dbp->del(dbp, dbtxnp, &key, 0)) != 0 && rv != DB_NOTFOUND) { > signals_unblock(); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "removing from database failed: %s", dn); >+ LOG(ERROR, "removing from database failed: %s", dn); > dbp->err(dbp, rv, "del"); > } > >@@ -535,18 +531,18 @@ int bdb_cache_get_entry(char *dn, CacheEntry *entry) { > signals_unblock(); > > if (rv != 0 && rv != DB_NOTFOUND) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "reading %s from database failed", dn); >+ LOG(ERROR, "reading %s from database failed", dn); > dbp->err(dbp, rv, "get"); > return rv; > } else if (rv == DB_NOTFOUND) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "no cache entry found for %s", dn); >+ LOG(ALL, "no cache entry found for %s", dn); > return rv; > } > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "got %d bytes for %s", data.size, dn); >+ LOG(ALL, "got %d bytes for %s", data.size, dn); > > if ((rv = parse_entry(data.data, data.size, entry)) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "parsing entry failed"); >+ LOG(ERROR, "parsing entry failed"); > free(data.data); > exit(1); > } >@@ -636,10 +632,10 @@ int bdb_cache_next_entry(DBC **cur, char **dn, CacheEntry *entry) { > free(*dn); > *dn = strdup(key.data); > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "got %d bytes", data.size); >+ LOG(ALL, "got %d bytes", data.size); > > if ((rv = parse_entry(data.data, data.size, entry)) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "parsing entry failed: %s", *dn); >+ LOG(ERROR, "parsing entry failed: %s", *dn); > printf("%d\n", data.size); > free(key.data); > free(data.data); >@@ -665,7 +661,7 @@ int bdb_cache_close(void) { > dbp = NULL; > #ifdef WITH_DB42 > if ((rv = dbenvp->close(dbenvp, 0)) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "closing database environment failed"); >+ LOG(ERROR, "closing database environment failed"); > } > #endif > if (lock_fp != NULL) { >diff --git a/management/univention-directory-listener/src/cache_dn.c b/management/univention-directory-listener/src/cache_dn.c >index a3ba433..eca62ef 100644 >--- a/management/univention-directory-listener/src/cache_dn.c >+++ b/management/univention-directory-listener/src/cache_dn.c >@@ -47,8 +47,9 @@ > #include <sys/stat.h> > #include <unistd.h> > #include <assert.h> >+ > #include "cache_dn.h" >-#include <univention/debug.h> >+#include "common.h" > > static int mdb_dupsort(const MDB_val *a, const MDB_val *b) { > int diff; >@@ -92,7 +93,7 @@ static int dntree_lookup_id4ldapdn(MDB_cursor *cur, LDAPDN dn, DNID *dnid_out, i > for (iRDN--; iRDN >= 0; iRDN--) { > rv = ldap_rdn2str(dn[iRDN], &rdn, LDAP_DN_FORMAT_LDAPV3); > if (rv != LDAP_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: ldap_rdn2str failed: %s (%d)", __func__, ldap_err2string(rv), rv); >+ LOG(ERROR, "ldap_rdn2str failed: %s (%d)", ldap_err2string(rv), rv); > return rv; > } > >@@ -102,7 +103,7 @@ static int dntree_lookup_id4ldapdn(MDB_cursor *cur, LDAPDN dn, DNID *dnid_out, i > data.mv_size = sizeof(subDN) + strlen(rdn); > subdn = calloc(1, data.mv_size); > if (subdn == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: calloc failed", __func__); >+ LOG(ERROR, "calloc failed"); > ldap_memfree(rdn); > abort(); > } >@@ -118,7 +119,7 @@ static int dntree_lookup_id4ldapdn(MDB_cursor *cur, LDAPDN dn, DNID *dnid_out, i > break; > } > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: mdb_cursor_get failed: %s (%d)", __func__, ldap_err2string(rv), rv); >+ LOG(ERROR, "mdb_cursor_get failed: %s (%d)", ldap_err2string(rv), rv); > return rv; > }; > >@@ -128,9 +129,9 @@ static int dntree_lookup_id4ldapdn(MDB_cursor *cur, LDAPDN dn, DNID *dnid_out, i > } > > if (rv == MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "%s: found id=%lu", __func__, id); >+ LOG(INFO, "found id=%lu", id); > } else if (rv != MDB_NOTFOUND) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: failed: %s (%d)", __func__, mdb_strerror(rv), rv); >+ LOG(ERROR, "failed: %s (%d)", mdb_strerror(rv), rv); > } > > *dnid_out = id; >@@ -158,14 +159,14 @@ int dntree_lookup_dn4id(MDB_cursor *cur, DNID dnid, char **dn) { > data.mv_size = 0; > > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: mdb_cursor_get (MDB_GET_BOTH): %s (%d)", __func__, mdb_strerror(rv), rv); >+ LOG(ERROR, "mdb_cursor_get (MDB_GET_BOTH): %s (%d)", mdb_strerror(rv), rv); > return rv; > }; > > // Workaround for (ITS#8393) LMDB - MDB_GET_BOTH broken on non-dup value > rv = mdb_cursor_get(cur, &key, &data, MDB_GET_CURRENT); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: mdb_cursor_get: %s (%d)", __func__, mdb_strerror(rv), rv); >+ LOG(ERROR, "mdb_cursor_get: %s (%d)", mdb_strerror(rv), rv); > return rv; > }; > >@@ -177,9 +178,7 @@ int dntree_lookup_dn4id(MDB_cursor *cur, DNID dnid, char **dn) { > dbi = mdb_cursor_dbi(cur); > rv = mdb_get(txn, dbi, &key, &data); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, >- "%s: mdb_get: %s (%d)", >- __func__, mdb_strerror(rv), rv); >+ LOG(ERROR, "mdb_get: %s (%d)", mdb_strerror(rv), rv); > return rv; > }; > */ >@@ -188,7 +187,7 @@ int dntree_lookup_dn4id(MDB_cursor *cur, DNID dnid, char **dn) { > > *dn = strdup(subdn->data); > if (*dn == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: strdup failed", __func__); >+ LOG(ERROR, "strdup failed"); > abort(); > } > >@@ -207,7 +206,7 @@ static int next_free_dnid(MDB_cursor *cur, DNID *dnid_out) { > *dnid_out = 1; > return MDB_SUCCESS; > } else { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: mdb_cursor_get: %s (%d)", __func__, mdb_strerror(rv), rv); >+ LOG(ERROR, "mdb_cursor_get: %s (%d)", mdb_strerror(rv), rv); > return rv; > } > } >@@ -228,23 +227,23 @@ static int dntree_add_id(MDB_cursor *write_cursor_p, DNID child, LDAPDN dn, DNID > > rv = ldap_dn2str(dn, &dn_str, LDAP_DN_FORMAT_LDAPV3); > if (rv != LDAP_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: ldap_dn2str failed: %s (%d)", __func__, ldap_err2string(rv), rv); >+ LOG(ERROR, "ldap_dn2str failed: %s (%d)", ldap_err2string(rv), rv); > return rv; > } > > rv = ldap_rdn2str(dn[0], &rdn_str, LDAP_DN_FORMAT_LDAPV3); > if (rv != LDAP_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: ldap_rdn2str failed: %s (%d)", __func__, ldap_err2string(rv), rv); >+ LOG(ERROR, "ldap_rdn2str failed: %s (%d)", ldap_err2string(rv), rv); > ldap_memfree(dn_str); > return rv; > } > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "%s: child=%lu, parent=%lu: \"%s\"", __func__, child, parent, rdn_str); >+ LOG(INFO, "child=%lu, parent=%lu: \"%s\"", child, parent, rdn_str); > > dn_len = strlen(dn_str); > subdn = calloc(1, sizeof(subDN) + dn_len); > if (subdn == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: calloc failed", __func__); >+ LOG(ERROR, "calloc failed"); > ldap_memfree(dn_str); > ldap_memfree(rdn_str); > abort(); >@@ -272,10 +271,10 @@ static int dntree_add_id(MDB_cursor *write_cursor_p, DNID child, LDAPDN dn, DNID > > rv = mdb_cursor_put(write_cursor_p, &key, &data, MDB_NODUPDATA); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: mdb_cursor_put failed for child %lu: %s (%d)", __func__, id, mdb_strerror(rv), rv); >+ LOG(ERROR, "mdb_cursor_put failed for child %lu: %s (%d)", id, mdb_strerror(rv), rv); > } > } else { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: mdb_cursor_put failed for parent %lu: %s (%d)", __func__, id, mdb_strerror(rv), rv); >+ LOG(ERROR, "mdb_cursor_put failed for parent %lu: %s (%d)", id, mdb_strerror(rv), rv); > } > ldap_memfree(dn_str); > free(subdn); >@@ -314,18 +313,16 @@ int dntree_del_id(MDB_cursor *write_cursor_p, DNID dnid) { > dbi = mdb_cursor_dbi(write_cursor_p); > rv = mdb_cursor_open(txn, dbi, &local_read_cursor_p); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: mdb_cursor_open: %s (%d)", __func__, ldap_err2string(rv), rv); >+ LOG(ERROR, "mdb_cursor_open: %s (%d)", ldap_err2string(rv), rv); > return rv; > } > > rv = dntree_has_children(local_read_cursor_p, dnid); > if (rv == MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: delete failed:" >- " subordinate objects must be deleted first", >- __func__); >+ LOG(ERROR, "delete failed: subordinate objects must be deleted first"); > return -1; > } else if (rv != MDB_NOTFOUND) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: dntree_has_children failed: %s (%d)", __func__, mdb_strerror(rv), rv); >+ LOG(ERROR, "dntree_has_children failed: %s (%d)", mdb_strerror(rv), rv); > return -1; > } > mdb_cursor_close(local_read_cursor_p); >@@ -362,7 +359,7 @@ static int dntree_get_id4ldapdn(MDB_cursor *write_cursor_p, LDAPDN dn, DNID *dni > if (num_rdns(pdn) != found) { > rv = dntree_get_id4ldapdn(write_cursor_p, pdn, &parent); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: failed: %s (%d)", __func__, mdb_strerror(rv), rv); >+ LOG(ERROR, "failed: %s (%d)", mdb_strerror(rv), rv); > return rv; > } > } else { >@@ -386,25 +383,25 @@ int dntree_get_id4dn(MDB_cursor *id2dn_cursor_p, char *dn, DNID *dnid, bool crea > > rv = ldap_str2dn(dn, &ldapdn, LDAP_DN_FORMAT_LDAP); > if (rv != LDAP_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: ldap_str2dn failed: %s (%d)", __func__, ldap_err2string(rv), rv); >+ LOG(ERROR, "ldap_str2dn failed: %s (%d)", ldap_err2string(rv), rv); > return rv; > } > > if (ldapdn == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: ldap_str2dn NULL: %s (%d): %s", __func__, ldap_err2string(rv), rv, dn); >+ LOG(ERROR, "ldap_str2dn NULL: %s (%d): %s", ldap_err2string(rv), rv, dn); > return 1; > } > > if (create == true) { > rv = dntree_get_id4ldapdn(id2dn_cursor_p, ldapdn, dnid); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: failed for: %s", __func__, dn); >+ LOG(ERROR, "failed for: %s", dn); > } > > } else { > rv = dntree_lookup_id4ldapdn(id2dn_cursor_p, ldapdn, dnid, NULL); > if (rv == MDB_NOTFOUND) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "%s: DN %s not in id2dn", __func__, dn); >+ LOG(INFO, "DN %s not in id2dn", dn); > } > } > >@@ -421,19 +418,19 @@ int dntree_init(MDB_dbi *dbi_p, MDB_txn *cache_init_txn_p, int mdb_flags) { > bool readonly = (mdb_flags & MDB_RDONLY) != 0; > > if (readonly) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "dntree_init: MDB_RDONLY"); >+ LOG(INFO, "dntree_init: MDB_RDONLY"); > } else { > mdb_dbi_flags |= MDB_CREATE; > } > > rv = mdb_dbi_open(cache_init_txn_p, "id2dn", mdb_dbi_flags, dbi_p); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: mdb_dbi_open: %s (%d)", __func__, mdb_strerror(rv), rv); >+ LOG(ERROR, "mdb_dbi_open: %s (%d)", mdb_strerror(rv), rv); > return rv; > }; > rv = mdb_set_dupsort(cache_init_txn_p, *dbi_p, mdb_dupsort); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: mdb_set_dupsort: %s (%d)", __func__, mdb_strerror(rv), rv); >+ LOG(ERROR, "mdb_set_dupsort: %s (%d)", mdb_strerror(rv), rv); > return rv; > }; > >@@ -443,7 +440,7 @@ int dntree_init(MDB_dbi *dbi_p, MDB_txn *cache_init_txn_p, int mdb_flags) { > > rv = mdb_cursor_open(cache_init_txn_p, *dbi_p, &cur); > if (rv != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s: mdb_cursor_open: %s (%d)", __func__, mdb_strerror(rv), rv); >+ LOG(ERROR, "mdb_cursor_open: %s (%d)", mdb_strerror(rv), rv); > return rv; > }; > >diff --git a/management/univention-directory-listener/src/cache_entry.c b/management/univention-directory-listener/src/cache_entry.c >index 30650df..d7b6621 100644 >--- a/management/univention-directory-listener/src/cache_entry.c >+++ b/management/univention-directory-listener/src/cache_entry.c >@@ -37,7 +37,6 @@ > #include <assert.h> > #include <ldap.h> > >-#include <univention/debug.h> > #include <univention/config.h> > > #include "cache_entry.h" >@@ -190,12 +189,12 @@ int cache_new_entry_from_ldap(char **dn, CacheEntry *cache_entry, LDAP *ld, LDAP > struct berval **val, **v; > > if ((cache_entry->attributes = realloc(cache_entry->attributes, (cache_entry->attribute_count + 2) * sizeof(CacheEntryAttribute *))) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_new_entry_from_ldap: realloc of attributes array failed"); >+ LOG(ERROR, "realloc of attributes array failed"); > rv = 1; > goto result; > } > if ((cache_entry->attributes[cache_entry->attribute_count] = malloc(sizeof(CacheEntryAttribute))) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_new_entry_from_ldap: malloc for CacheEntryAttribute failed"); >+ LOG(ERROR, "malloc for CacheEntryAttribute failed"); > rv = 1; > goto result; > } >@@ -226,15 +225,15 @@ int cache_new_entry_from_ldap(char **dn, CacheEntry *cache_entry, LDAP *ld, LDAP > } > } > if ((val = ldap_get_values_len(ld, ldap_entry, attr)) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "ldap_get_values failed"); >+ LOG(ERROR, "ldap_get_values failed"); > rv = 1; > goto result; > } > for (v = val; *v != NULL; v++) { > if ((*v)->bv_val == NULL) { > // check here, strlen behavior might be undefined in this case >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_new_entry_from_ldap: ignoring bv_val of NULL with bv_len=%ld, ignoring, check attribute: %s of DN: %s", (*v)->bv_len, >- cache_entry->attributes[cache_entry->attribute_count]->name, *dn); >+ LOG(ERROR, "ignoring bv_val of NULL with bv_len=%ld, ignoring, check attribute: %s of DN: %s", >+ (*v)->bv_len, cache_entry->attributes[cache_entry->attribute_count]->name, *dn); > rv = 1; > goto result; > } >@@ -244,9 +243,9 @@ int cache_new_entry_from_ldap(char **dn, CacheEntry *cache_entry, LDAP *ld, LDAP > duplicateMemberUid = 0; > for (i = 0; i < cache_entry->attributes[cache_entry->attribute_count]->value_count; i++) { > if (!memcmp(cache_entry->attributes[cache_entry->attribute_count]->values[i], (*v)->bv_val, (*v)->bv_len + 1)) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "Found a duplicate memberUid entry:"); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "DN: %s", *dn); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "memberUid: %s", cache_entry->attributes[cache_entry->attribute_count]->values[i]); >+ LOG(ERROR, "Found a duplicate memberUid entry:"); >+ LOG(ERROR, "DN: %s", *dn); >+ LOG(ERROR, "memberUid: %s", cache_entry->attributes[cache_entry->attribute_count]->values[i]); > duplicateMemberUid = true; > break; > } >@@ -260,9 +259,9 @@ int cache_new_entry_from_ldap(char **dn, CacheEntry *cache_entry, LDAP *ld, LDAP > duplicateUniqueMember = false; > for (i = 0; i < cache_entry->attributes[cache_entry->attribute_count]->value_count; i++) { > if (!memcmp(cache_entry->attributes[cache_entry->attribute_count]->values[i], (*v)->bv_val, (*v)->bv_len + 1)) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "Found a duplicate uniqueMember entry:"); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "DN: %s", *dn); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "uniqueMember: %s", cache_entry->attributes[cache_entry->attribute_count]->values[i]); >+ LOG(ERROR, "Found a duplicate uniqueMember entry:"); >+ LOG(ERROR, "DN: %s", *dn); >+ LOG(ERROR, "uniqueMember: %s", cache_entry->attributes[cache_entry->attribute_count]->values[i]); > duplicateUniqueMember = true; > break; > } >@@ -273,19 +272,19 @@ int cache_new_entry_from_ldap(char **dn, CacheEntry *cache_entry, LDAP *ld, LDAP > } > if ((cache_entry->attributes[cache_entry->attribute_count]->values = > realloc(cache_entry->attributes[cache_entry->attribute_count]->values, (cache_entry->attributes[cache_entry->attribute_count]->value_count + 2) * sizeof(char *))) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_new_entry_from_ldap: realloc of values array failed"); >+ LOG(ERROR, "realloc of values array failed"); > rv = 1; > goto result; > } > if ((cache_entry->attributes[cache_entry->attribute_count]->length = > realloc(cache_entry->attributes[cache_entry->attribute_count]->length, (cache_entry->attributes[cache_entry->attribute_count]->value_count + 2) * sizeof(int))) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_new_entry_from_ldap: realloc of length array failed"); >+ LOG(ERROR, "realloc of length array failed"); > rv = 1; > goto result; > } > if ((*v)->bv_len == strlen((*v)->bv_val)) { > if ((cache_entry->attributes[cache_entry->attribute_count]->values[cache_entry->attributes[cache_entry->attribute_count]->value_count] = strdup((*v)->bv_val)) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_new_entry_from_ldap: strdup of value failed"); >+ LOG(ERROR, "strdup of value failed"); > rv = 1; > goto result; > } >@@ -295,7 +294,7 @@ int cache_new_entry_from_ldap(char **dn, CacheEntry *cache_entry, LDAP *ld, LDAP > // the legacy approach is to copy bv_len bytes, let's stick with this and just terminate to be safe > if ((cache_entry->attributes[cache_entry->attribute_count]->values[cache_entry->attributes[cache_entry->attribute_count]->value_count] = malloc(((*v)->bv_len + 1) * sizeof(char))) == > NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_new_entry_from_ldap: malloc for value failed"); >+ LOG(ERROR, "malloc for value failed"); > rv = 1; > goto result; > } >@@ -371,12 +370,12 @@ int copy_cache_entry(CacheEntry *cache_entry, CacheEntry *backup_cache_entry) { > memset(backup_cache_entry, 0, sizeof(CacheEntry)); > for (cur1 = cache_entry->attributes; cur1 != NULL && *cur1 != NULL; cur1++) { > if ((backup_cache_entry->attributes = realloc(backup_cache_entry->attributes, (backup_cache_entry->attribute_count + 2) * sizeof(CacheEntryAttribute *))) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "copy_cache_entry: realloc of attributes array failed"); >+ LOG(ERROR, "realloc of attributes array failed"); > rv = 1; > goto result; > } > if ((backup_cache_entry->attributes[backup_cache_entry->attribute_count] = malloc(sizeof(CacheEntryAttribute))) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "copy_cache_entry: malloc for CacheEntryAttribute failed"); >+ LOG(ERROR, "malloc for CacheEntryAttribute failed"); > rv = 1; > goto result; > } >@@ -389,25 +388,25 @@ int copy_cache_entry(CacheEntry *cache_entry, CacheEntry *backup_cache_entry) { > > for (i = 0; i < (*cur1)->value_count; i++) { > if (((*cur2)->values = realloc((*cur2)->values, ((*cur2)->value_count + 2) * sizeof(char *))) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "copy_cache_entry: realloc of values array failed"); >+ LOG(ERROR, "realloc of values array failed"); > rv = 1; > goto result; > } > if (((*cur2)->length = realloc((*cur2)->length, ((*cur2)->value_count + 2) * sizeof(int))) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "copy_cache_entry: realloc of length array failed"); >+ LOG(ERROR, "realloc of length array failed"); > rv = 1; > goto result; > } > if ((*cur1)->length[i] == strlen((*cur1)->values[i]) + 1) { > if (((*cur2)->values[(*cur2)->value_count] = strdup((*cur1)->values[i])) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "copy_cache_entry: strdup of value failed"); >+ LOG(ERROR, "strdup of value failed"); > rv = 1; > goto result; > } > (*cur2)->length[(*cur2)->value_count] = strlen((*cur2)->values[(*cur2)->value_count]) + 1; > } else { > if (((*cur2)->values[(*cur2)->value_count] = malloc(((*cur1)->length[i]) * sizeof(char))) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "copy_cache_entry: malloc for value failed"); >+ LOG(ERROR, "malloc for value failed"); > rv = 1; > goto result; > } >@@ -478,21 +477,21 @@ static CacheEntryAttribute *_cache_entry_force_value(CacheEntryAttribute *attr, > > tmp = realloc(attr->values, (attr->value_count + 2) * sizeof(char *)); > if (!tmp) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s:%d realloc() failed", __FILE__, __LINE__); >+ LOG(ERROR, "realloc() failed"); > return NULL; > } > attr->values = tmp; > > tmp = realloc(attr->length, (attr->value_count + 2) * sizeof(int)); > if (!tmp) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s:%d realloc() failed", __FILE__, __LINE__); >+ LOG(ERROR, "realloc() failed"); > return NULL; > } > attr->length = tmp; > > attr->length[attr->value_count] = BER2STR(&ava->la_value, &attr->values[attr->value_count]) + 1; > if (!attr->values[attr->value_count]) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s:%d BER2STR() failed", __FILE__, __LINE__); >+ LOG(ERROR, "BER2STR() failed"); > return NULL; > } > attr->value_count++; >@@ -503,21 +502,21 @@ static CacheEntryAttribute *_cache_entry_force_value(CacheEntryAttribute *attr, > static CacheEntryAttribute *_cache_entry_add_new_attribute(CacheEntry *entry, LDAPAVA *ava) { > CacheEntryAttribute *attr = malloc(sizeof(CacheEntryAttribute)); > if (!attr) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__); >+ LOG(ERROR, "malloc() failed"); > return NULL; > } > memset(attr, 0, sizeof(CacheEntryAttribute)); > > void *tmp = realloc(entry->attributes, (entry->attribute_count + 2) * sizeof(CacheEntryAttribute *)); > if (!tmp) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s:%d realloc() failed", __FILE__, __LINE__); >+ LOG(ERROR, "realloc() failed"); > goto error; > } > entry->attributes = tmp; > > BER2STR(&ava->la_attr, &attr->name); > if (!&attr->name) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s:%d BER2STR() failed", __FILE__, __LINE__); >+ LOG(ERROR, "BER2STR() failed"); > goto error; > } > if (!_cache_entry_force_value(attr, ava)) >diff --git a/management/univention-directory-listener/src/cache_lowlevel.c b/management/univention-directory-listener/src/cache_lowlevel.c >index c7f78ee..97929c7 100644 >--- a/management/univention-directory-listener/src/cache_lowlevel.c >+++ b/management/univention-directory-listener/src/cache_lowlevel.c >@@ -40,8 +40,6 @@ > #include <errno.h> > #include <sys/types.h> > >-#include <univention/debug.h> >- > #include "common.h" > #include "cache_lowlevel.h" > >@@ -52,7 +50,7 @@ struct cache_entry_header { > }; > > >-void hex_dump(int level, void *data, u_int32_t start, u_int32_t size) { >+static void hex_dump(void *data, u_int32_t start, u_int32_t size) { > int i; > int pos; > char hex[80]; >@@ -60,30 +58,30 @@ void hex_dump(int level, void *data, u_int32_t start, u_int32_t size) { > const int per_line = 10; > > pos = 0; >- memset(hex, 0, 80); >- memset(str, 0, 80); >+ memset(hex, 0, sizeof(hex)); >+ memset(str, 0, sizeof(str)); > > for (i = 0; i < size; i++) { > snprintf(hex + (pos * 3), 80 - (pos * 3), "%02x ", ((u_int8_t *)data + start)[i]); > snprintf(str + pos, 80 - pos, "%c", isprint(((char *)data + start)[i]) ? ((char *)data + start)[i] : '?'); > pos += 1; > if ((i + 1) % per_line == 0) { >- univention_debug(UV_DEBUG_LISTENER, level, "%s| %s (%08d)", hex, str, start + i - per_line); >+ LOG(ERROR, "%s | %s (%08d)", hex, str, start + i - per_line); > // fprintf(stderr, "%s| %s (%08d)\n", hex, str, start+i-per_line); >- memset(hex, 0, 80); >- memset(str, 0, 80); >+ memset(hex, 0, sizeof(hex)); >+ memset(str, 0, sizeof(str)); > pos = 0; > } > } > if (pos != 0) >- univention_debug(UV_DEBUG_LISTENER, level, "%s | %s", hex, str); >+ LOG(ERROR, "%s | %s", hex, str); > } > > /* assumption: enough memory as been allocated for us */ > static int append_buffer(void **data, u_int32_t *pos, void *blob_data, u_int32_t blob_size) { > if (blob_size > 0) { > memcpy((void *)(((char *)*data) + *pos), blob_data, blob_size); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "position was=%d is=%d", *pos, *pos + blob_size); >+ LOG(ALL, "position was=%d is=%d", *pos, *pos + blob_size); > *pos += blob_size; > } > return 0; >@@ -93,14 +91,14 @@ static int write_header(void **data, u_int32_t *size, u_int32_t *pos, u_int16_t > struct cache_entry_header h; > u_int32_t need_memory; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "write_header key_size=%d data_size=%d", key_size, data_size); >+ LOG(ALL, "key_size=%d data_size=%d", key_size, data_size); > > need_memory = sizeof(struct cache_entry_header) + key_size + data_size; > if (*size < *pos + need_memory) { > while (*size < *pos + need_memory) > *size += BUFSIZ; > if ((*data = realloc(*data, *size)) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "failed to allocate memory"); >+ LOG(ERROR, "failed to allocate memory"); > return 1; > } > } >@@ -143,17 +141,17 @@ static int read_header(void *data, u_int32_t size, u_int32_t *pos, void **key_da > struct cache_entry_header *h; > > if (*pos == size) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "end of buffer pos=size=%d", *pos); >+ LOG(ALL, "end of buffer pos=size=%d", *pos); > return 0; > } else if (*pos + sizeof(struct cache_entry_header) > size) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "buffer exceeded pos=%d size=%d", *pos, size); >+ LOG(ERROR, "buffer exceeded pos=%d size=%d", *pos, size); > return -1; > } > > h = (struct cache_entry_header *)((char *)data + *pos); > > if ((h->type != 1 && h->type != 2) || h->key_size == 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "read_header pos=%d type=%d key_size=%d data_size=%d", *pos, h->type, h->key_size, h->data_size); >+ LOG(ALL, "pos=%d type=%d key_size=%d data_size=%d", *pos, h->type, h->key_size, h->data_size); > *key_size = 0; > *key_data = NULL; > *data_size = 0; >@@ -162,7 +160,7 @@ static int read_header(void *data, u_int32_t size, u_int32_t *pos, void **key_da > } > *pos += sizeof(struct cache_entry_header); > if (*pos + h->key_size + h->data_size > size) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "buffer exceeded pos=%d size=%d", *pos, size); >+ LOG(ERROR, "buffer exceeded pos=%d size=%d", *pos, size); > return -1; > } > >@@ -178,8 +176,8 @@ static int read_header(void *data, u_int32_t size, u_int32_t *pos, void **key_da > *data_size = 0; > *data_data = NULL; > } >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "read_header pos=%d type=%d key_size=%d data_size=%d key_data=[%s] data_data=[%s]", *pos, h->type, h->key_size, h->data_size, (char *)*key_data, >- (char *)*data_data); >+ LOG(ALL, "pos=%d type=%d key_size=%d data_size=%d key_data=[%s] data_data=[%s]", >+ *pos, h->type, h->key_size, h->data_size, (char *)*key_data, (char *)*data_data); > > return h->type; > } >@@ -199,10 +197,10 @@ int parse_entry(void *data, u_int32_t size, CacheEntry *entry) { > if (type == 1) { > CacheEntryAttribute **attribute, *c_attr; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "attribute is \"%s\"", (char *)key_data); >+ LOG(ALL, "attribute is \"%s\"", (char *)key_data); > > for (attribute = entry->attributes, c_attr = NULL; attribute != NULL && *attribute != NULL; attribute++) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "current attribute is \"%s\"", (*attribute)->name); >+ LOG(ALL, "current attribute is \"%s\"", (*attribute)->name); > if (strcmp((*attribute)->name, (char *)key_data) == 0) { > c_attr = *attribute; > break; >@@ -210,15 +208,15 @@ int parse_entry(void *data, u_int32_t size, CacheEntry *entry) { > } > if (!c_attr) { > if (!(entry->attributes = realloc(entry->attributes, (entry->attribute_count + 2) * sizeof(CacheEntryAttribute *)))) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "realloc failed"); >+ LOG(ERROR, "realloc failed"); > abort(); // FIXME > } > if (!(c_attr = malloc(sizeof(CacheEntryAttribute)))) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "malloc failed"); >+ LOG(ERROR, "malloc failed"); > abort(); // FIXME > } > if (!(c_attr->name = strndup((char *)key_data, key_size))) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "strndup failed"); >+ LOG(ERROR, "strndup failed"); > abort(); // FIXME > } > c_attr->values = NULL; >@@ -227,28 +225,28 @@ int parse_entry(void *data, u_int32_t size, CacheEntry *entry) { > entry->attributes[entry->attribute_count++] = c_attr; > entry->attributes[entry->attribute_count] = NULL; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "%s is at %p", c_attr->name, c_attr); >+ LOG(ALL, "%s is at %p", c_attr->name, c_attr); > } > if (!(c_attr->values = realloc(c_attr->values, (c_attr->value_count + 2) * sizeof(char *)))) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "realloc failed"); >+ LOG(ERROR, "realloc failed"); > abort(); // FIXME > } > if (!(c_attr->length = realloc(c_attr->length, (c_attr->value_count + 2) * sizeof(int)))) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "realloc failed"); >+ LOG(ERROR, "realloc failed"); > abort(); // FIXME > } > if (!(c_attr->values[c_attr->value_count] = malloc(data_size))) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "malloc() failed"); >+ LOG(ERROR, "malloc() failed"); > abort(); // FIXME > } > c_attr->length[c_attr->value_count] = data_size; > memcpy(c_attr->values[c_attr->value_count], data_data, data_size); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "value is \"%s\"", c_attr->values[c_attr->value_count]); >+ LOG(ALL, "value is \"%s\"", c_attr->values[c_attr->value_count]); > c_attr->values[++c_attr->value_count] = NULL; > } else if (type == 2) { > entry->modules = realloc(entry->modules, (entry->module_count + 2) * sizeof(char *)); > if (!(entry->modules[entry->module_count] = strndup((char *)key_data, key_size))) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "strndup failed"); >+ LOG(ERROR, "strndup failed"); > abort(); // FIXME > } > entry->modules[++entry->module_count] = NULL; >@@ -258,13 +256,13 @@ int parse_entry(void *data, u_int32_t size, CacheEntry *entry) { > u_int32_t len; > int rv; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "bad data block at position %d:", pos); >+ LOG(ERROR, "bad data block at position %d:", pos); > len = pos < 1000 ? pos : 1000; >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "last %d bytes of previous entry:", len); >- hex_dump(UV_DEBUG_ERROR, data, pos < 1000 ? 0 : pos - 1000, len); >+ LOG(ERROR, "last %d bytes of previous entry:", len); >+ hex_dump(data, pos < 1000 ? 0 : pos - 1000, len); > len = pos + 1000 > size ? size - pos : 1000; >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "first %d bytes of current entry:", len); >- hex_dump(UV_DEBUG_ERROR, data, pos, len); >+ LOG(ERROR, "first %d bytes of current entry:", len); >+ hex_dump(data, pos, len); > > rv = snprintf(filename, PATH_MAX, "%s/bad_cache", cache_dir); > if (rv < 0 || rv >= PATH_MAX) >@@ -284,6 +282,6 @@ int parse_entry(void *data, u_int32_t size, CacheEntry *entry) { > } > > void abort_io(const char *func, const char *filename) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "Fatal %s(%s): %s", func, filename, strerror(errno)); >+ LOG(ERROR, "Fatal %s(%s): %s", func, filename, strerror(errno)); > abort(); > } >diff --git a/management/univention-directory-listener/src/cache_lowlevel.h b/management/univention-directory-listener/src/cache_lowlevel.h >index 5798dea..5af329d 100644 >--- a/management/univention-directory-listener/src/cache_lowlevel.h >+++ b/management/univention-directory-listener/src/cache_lowlevel.h >@@ -37,7 +37,6 @@ > > int unparse_entry(void **data, u_int32_t *size, CacheEntry *entry); > int parse_entry(void *data, u_int32_t size, CacheEntry *entry); >-void hex_dump(int level, void *data, u_int32_t start, u_int32_t size); > void abort_io(const char *func, const char *filename) __attribute__((noreturn)); > > #endif /* _CACHE_LOWLEVEL_ */ >diff --git a/management/univention-directory-listener/src/change.c b/management/univention-directory-listener/src/change.c >index 4677337..cdf3d85 100644 >--- a/management/univention-directory-listener/src/change.c >+++ b/management/univention-directory-listener/src/change.c >@@ -42,7 +42,6 @@ > #include <string.h> > #include <lmdb.h> > >-#include <univention/debug.h> > #include <univention/config.h> > > #include "common.h" >@@ -78,16 +77,16 @@ static int change_init_module(univention_ldap_parameters_t *lp, Handler *handler > int i; > bool abort_init = false; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "initializing module %s", handler->name); >+ LOG(WARN, "initializing module %s", handler->name); > > memset(&old_cache_entry, 0, sizeof(CacheEntry)); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "call handler_clean for module %s", handler->name); >+ LOG(INFO, "call handler_clean for module %s", handler->name); > handler_clean(handler); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "call handler_initialize for module %s", handler->name); >+ LOG(INFO, "call handler_initialize for module %s", handler->name); > handler_initialize(handler); > > /* remove old entries for module */ >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "remove old entries for module %s", handler->name); >+ LOG(INFO, "remove old entries for module %s", handler->name); > for (rv = cache_first_entry(&id2entry_cursor_p, &id2dn_cursor_p, &dn, &cache_entry); rv != MDB_NOTFOUND; rv = cache_next_entry(&id2entry_cursor_p, &id2dn_cursor_p, &dn, &cache_entry)) { > if (rv == -1) > continue; >@@ -99,14 +98,14 @@ static int change_init_module(univention_ldap_parameters_t *lp, Handler *handler > cache_free_entry(&dn, &cache_entry); > } > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "call cache_free_cursor for module %s", handler->name); >+ LOG(INFO, "call cache_free_cursor for module %s", handler->name); > cache_free_cursor(id2entry_cursor_p, id2dn_cursor_p); > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "initialize schema for module %s", handler->name); >+ LOG(INFO, "initialize schema for module %s", handler->name); > /* initialize schema; if it's not in cache yet (it really should be), it'll > be initialized on the regular schema check after ldapsearches */ > if ((rv = cache_get_entry_lower_upper("cn=Subschema", &cache_entry)) != 0 && rv != MDB_NOTFOUND) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "error while reading from database"); >+ LOG(WARN, "error while reading from database"); > return LDAP_OTHER; > } else if (rv == 0) { > signals_block(); >@@ -116,7 +115,7 @@ static int change_init_module(univention_ldap_parameters_t *lp, Handler *handler > cache_free_entry(NULL, &cache_entry); > } > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "module %s for relating objects", handler->name); >+ LOG(INFO, "module %s for relating objects", handler->name); > rv = LDAP_SUCCESS; > for (f = handler->filters; !abort_init && f != NULL && *f != NULL; f++) { > /* When initializing a module, only search for the DNs. If the >@@ -136,7 +135,7 @@ static int change_init_module(univention_ldap_parameters_t *lp, Handler *handler > int sizelimit0 = 0; > rv = LDAP_RETRY(lp, ldap_search_ext_s(lp->ld, (*f)->base, (*f)->scope, (*f)->filter, _attrs, attrsonly1, serverctrls, clientctrls, &timeout, sizelimit0, &res)); > if (rv != LDAP_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "could not get DNs when initializing %s: %s", handler->name, ldap_err2string(rv)); >+ LOG(ERROR, "could not get DNs when initializing %s: %s", handler->name, ldap_err2string(rv)); > return rv; > } > >@@ -150,7 +149,7 @@ static int change_init_module(univention_ldap_parameters_t *lp, Handler *handler > } > > if (!(dns = malloc(dn_count * sizeof(struct dn_list)))) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "malloc failed"); >+ LOG(ERROR, "malloc failed"); > abort(); // FIXME > } > >@@ -172,7 +171,7 @@ static int change_init_module(univention_ldap_parameters_t *lp, Handler *handler > } > > for (i = 0; i < dn_count; i++) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "DN: %s", dns[i].dn); >+ LOG(ALL, "DN: %s", dns[i].dn); > > if ((rv = cache_get_entry_lower_upper(dns[i].dn, &cache_entry)) == MDB_NOTFOUND) { /* XXX */ > LDAPMessage *res2, *first; >@@ -183,7 +182,7 @@ static int change_init_module(univention_ldap_parameters_t *lp, Handler *handler > cache_new_entry_from_ldap(NULL, &cache_entry, lp->ld, first); > ldap_msgfree(res2); > } else if (rv != LDAP_NO_SUCH_OBJECT) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "could not get DN %s for handler %s: %s", dns[i].dn, handler->name, ldap_err2string(rv)); >+ LOG(ERROR, "could not get DN %s for handler %s: %s", dns[i].dn, handler->name, ldap_err2string(rv)); > cache_free_entry(NULL, &cache_entry); > abort_init = true; > goto cleanup; >@@ -192,7 +191,7 @@ static int change_init_module(univention_ldap_parameters_t *lp, Handler *handler > deleted after we do the ldapsearch. We > shouldn't need to care here. */ > } else if (rv != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "error while reading from database"); >+ LOG(WARN, "error while reading from database"); > rv = LDAP_OTHER; > abort_init = true; > goto cleanup; >@@ -211,7 +210,7 @@ static int change_init_module(univention_ldap_parameters_t *lp, Handler *handler > free(dns); > } > cache_free_entry(NULL, &old_cache_entry); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "finished initializing module %s with rv=%d", handler->name, rv); >+ LOG(WARN, "finished initializing module %s with rv=%d", handler->name, rv); > return rv; > } > >@@ -250,17 +249,17 @@ int change_update_entry(univention_ldap_parameters_t *lp, NotifierID id, LDAPMes > memset(&old_cache_entry, 0, sizeof(CacheEntry)); > > if ((rv = cache_new_entry_from_ldap(&dn, &cache_entry, lp->ld, ldap_entry)) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "error while converting LDAP entry to cache entry"); >+ LOG(WARN, "error while converting LDAP entry to cache entry"); > goto result; > } > if ((rv = cache_get_entry_lower_upper(dn, &old_cache_entry)) != 0 && rv != MDB_NOTFOUND) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "error while reading from database"); >+ LOG(WARN, "error while reading from database"); > rv = LDAP_OTHER; > } else { > signals_block(); > handlers_update(dn, &cache_entry, &old_cache_entry, command); > if ((rv = cache_update_entry_lower(id, dn, &cache_entry)) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "error while writing to database"); >+ LOG(WARN, "error while writing to database"); > } > rv = 0; > signals_unblock(); >@@ -281,15 +280,15 @@ static void change_delete(struct transaction *trans) { > > rv = handlers_delete(trans->cur.notify.dn, &trans->cur.cache, 'd'); > if (rv == 0) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "deleted from cache: %s", trans->cur.notify.dn); >+ LOG(INFO, "deleted from cache: %s", trans->cur.notify.dn); > if (cache_entry_valid(&trans->cur.cache)) { > if (rv != 0) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "at least one delete handler failed"); >+ LOG(WARN, "at least one delete handler failed"); > cache_delete_entry_lower_upper(trans->cur.notify.id, trans->cur.notify.dn); > cache_free_entry(NULL, &trans->cur.cache); > } else { > if (rv != 0) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "not in cache: %s", trans->cur.notify.dn); >+ LOG(INFO, "not in cache: %s", trans->cur.notify.dn); > } > > signals_unblock(); >@@ -320,7 +319,7 @@ int change_update_schema(univention_ldap_parameters_t *lp) { > free(server_role); > > if ((notifier_get_schema_id_s(NULL, &new_id)) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "failed to get schema DN"); >+ LOG(ERROR, "failed to get schema DN"); > return LDAP_OTHER; > } > >@@ -328,19 +327,19 @@ int change_update_schema(univention_ldap_parameters_t *lp) { > rv = LDAP_RETRY(lp, ldap_search_ext_s(lp->ld, "cn=Subschema", LDAP_SCOPE_BASE, "(objectClass=*)", attrs, attrsonly0, serverctrls, clientctrls, &timeout, sizelimit0, &res)); > if (rv == LDAP_SUCCESS) { > if ((cur = ldap_first_entry(lp->ld, res)) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "got no entry for schema"); >+ LOG(ERROR, "got no entry for schema"); > return LDAP_OTHER; > } else { > rv = change_update_entry(lp, new_id, cur, 'n'); > } > ldap_memfree(res); > } else { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "could not receive schema (%s)", ldap_err2string(rv)); >+ LOG(ERROR, "could not receive schema (%s)", ldap_err2string(rv)); > } > cache_master_entry.schema_id = new_id; > rv = cache_update_master_entry(&cache_master_entry); > if (cache_set_schema_id(new_id)) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "failed to write schema ID"); >+ LOG(WARN, "failed to write schema ID"); > } > > return rv; >@@ -384,7 +383,7 @@ static int fake_container(struct transaction *trans, char *dn) { > } else if (!strcasecmp(name, "dc")) { > cache_entry_add1(&cache_entry, "objectClass", "domain"); > } else { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "unknown container: %s", name); >+ LOG(ERROR, "unknown container: %s", name); > goto out; > } > free(name); >@@ -400,7 +399,7 @@ static int fake_container(struct transaction *trans, char *dn) { > > // 5. Store cache entry at intermediate location > if ((rv = cache_update_entry_lower(trans->cur.notify.id, dn, &cache_entry)) != 0) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "error while writing to database"); >+ LOG(WARN, "error while writing to database"); > > out: > free(name); >@@ -418,7 +417,7 @@ static int check_parent_dn(struct transaction *trans, char *dn) { > return LDAP_SUCCESS; > > if (same_dn(dn, trans->lp_local->base)) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "Ignore parent_dn check because dn is ldap base."); >+ LOG(INFO, "Ignore parent_dn check because dn is ldap base."); > return LDAP_SUCCESS; > } > >@@ -433,7 +432,7 @@ static int check_parent_dn(struct transaction *trans, char *dn) { > return rv; > > if (same_dn(parent_dn, trans->lp_local->base)) { >- // univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "parent of DN: %s is base", dn); >+ // LOG(INFO, "parent of DN: %s is base", dn); > goto out; > } > >@@ -449,13 +448,13 @@ static int check_parent_dn(struct transaction *trans, char *dn) { > }; > int sizelimit0 = 0; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "checking parent_dn of %s in local LDAP", dn); >+ LOG(INFO, "checking parent_dn of %s in local LDAP", dn); > > /* try to open a connection to the local LDAP for the parent DN check */ > if (trans->lp_local->ld == NULL) { > rv = univention_ldap_open(trans->lp_local); > if (rv != LDAP_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "check_parent_dn: bind to local LDAP failed"); >+ LOG(ERROR, "bind to local LDAP failed"); > goto out; > } > } >@@ -469,7 +468,7 @@ static int check_parent_dn(struct transaction *trans, char *dn) { > /* lookup parent_dn object in remote LDAP */ > rv = LDAP_RETRY(trans->lp, ldap_search_ext_s(trans->lp->ld, parent_dn, LDAP_SCOPE_BASE, filter, attrs, attrsonly0, serverctrls, clientctrls, &timeout, sizelimit0, &res)); > if (rv == LDAP_NO_SUCH_OBJECT) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "could not find parent container of dn: %s from %s (%s)", dn, trans->lp->host, ldap_err2string(rv)); >+ LOG(ERROR, "could not find parent container of dn: %s from %s (%s)", dn, trans->lp->host, ldap_err2string(rv)); > if (is_move(trans)) > rv = fake_container(trans, parent_dn); > } else { /* parent_dn found in remote LDAP */ >@@ -478,13 +477,13 @@ static int check_parent_dn(struct transaction *trans, char *dn) { > /* entry exists (since we didn't get NO_SUCH_OBJECT), > * but was probably excluded through ACLs which makes it > * non-existent for us */ >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "could not get parent object of dn: %s from %s (%s)", dn, trans->lp->host, ldap_err2string(rv)); >+ LOG(ERROR, "could not get parent object of dn: %s from %s (%s)", dn, trans->lp->host, ldap_err2string(rv)); > if (is_move(trans)) > rv = fake_container(trans, parent_dn); > else > rv = LDAP_INSUFFICIENT_ACCESS; > } else { /* found data for parent_dn in remote LDAP */ >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_PROCESS, "change_update_entry for parent_dn: %s", parent_dn); >+ LOG(PROCESS, "change_update_entry for parent_dn: %s", parent_dn); > rv = change_update_entry(trans->lp, trans->cur.notify.id, cur, 'n'); /* add parent_dn object */ > } > } >@@ -560,19 +559,19 @@ static int process_move(struct transaction *trans) { > rv = check_parent_dn(trans, current_dn); > signals_block(); > if (same_dn(trans->prev.notify.dn, current_dn)) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_PROCESS, "move_same_dn(%s)", current_dn); >+ LOG(PROCESS, "move_same_dn(%s)", current_dn); > rv = handlers_delete(trans->prev.notify.dn, &trans->prev.cache, 'r'); > rv = handlers_update(current_dn, &trans->cur.cache, &dummy, 'a'); > signals_unblock(); > > // 5. Store cache entry at new location > if ((rv = cache_update_entry_lower(trans->cur.notify.id, current_dn, &trans->cur.cache)) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "error while writing to database"); >+ LOG(WARN, "error while writing to database"); > } > > // 6. Check for final destination > if (final) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "Object finally moved to '%s'", current_dn); >+ LOG(ALL, "Object finally moved to '%s'", current_dn); > rv = change_update_entry(trans->lp, trans->cur.notify.id, trans->ldap, 'm'); > } > >@@ -592,14 +591,14 @@ static int change_update_cache(struct transaction *trans) { > > trans->cur.ldap_dn = ldap_get_dn(trans->lp->ld, trans->ldap); > if (!trans->cur.ldap_dn) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "failed to get current DN %s", trans->cur.notify.dn); >+ LOG(ERROR, "failed to get current DN %s", trans->cur.notify.dn); > goto out; > } > > switch (trans->cur.notify.command) { > case 'm': // modify > if (!same_dn(trans->cur.notify.dn, trans->cur.ldap_dn)) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_PROCESS, "Delaying update for '%s' until moved to '%s'", trans->cur.notify.dn, trans->cur.ldap_dn); >+ LOG(PROCESS, "Delaying update for '%s' until moved to '%s'", trans->cur.notify.dn, trans->cur.ldap_dn); > } else { > rv = check_parent_dn(trans, trans->cur.ldap_dn); > rv = change_update_entry(trans->lp, trans->cur.notify.id, trans->ldap, trans->cur.notify.command); >@@ -610,14 +609,15 @@ static int change_update_cache(struct transaction *trans) { > rv = process_move(trans); > } else { // add > if (!same_dn(trans->cur.notify.dn, trans->cur.ldap_dn)) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Schizophrenia: a NEW object '%s' is added, which ALREADY is in our cache for '%s'?", trans->cur.ldap_dn, trans->cur.notify.dn); >+ LOG(WARN, "Schizophrenia: a NEW object '%s' is added, which ALREADY is in our cache for '%s'?", >+ trans->cur.ldap_dn, trans->cur.notify.dn); > rv = check_parent_dn(trans, trans->cur.ldap_dn); > rv = change_update_entry(trans->lp, trans->cur.notify.id, trans->ldap, trans->cur.notify.command); > } > break; > case 'd': // delete > if (!same_dn(trans->cur.notify.dn, trans->cur.ldap_dn)) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Resurrection: DELETED object '%s' will re-appear at '%s'?", trans->cur.notify.dn, trans->cur.ldap_dn); >+ LOG(WARN, "Resurrection: DELETED object '%s' will re-appear at '%s'?", trans->cur.notify.dn, trans->cur.ldap_dn); > change_delete(trans); > rv = 0; > break; >@@ -628,7 +628,7 @@ static int change_update_cache(struct transaction *trans) { > rv = 0; > break; > default: >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "Unknown command: %c", trans->cur.notify.command); >+ LOG(ERROR, "Unknown command: %c", trans->cur.notify.command); > } > > out: >@@ -655,11 +655,11 @@ int change_update_dn(struct transaction *trans) { > int rv; > const char *uuid = NULL; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_PROCESS, "updating '%s' command %c", trans->cur.notify.dn, trans->cur.notify.command); >+ LOG(PROCESS, "updating '%s' command %c", trans->cur.notify.dn, trans->cur.notify.command); > > rv = cache_get_entry_lower_upper(trans->cur.notify.dn, &trans->cur.cache); > if (rv != 0 && rv != MDB_NOTFOUND) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "error reading database for %s", trans->cur.notify.dn); >+ LOG(WARN, "error reading database for %s", trans->cur.notify.dn); > return LDAP_OTHER; > } > switch (trans->prev.notify.command) { >@@ -669,11 +669,11 @@ int change_update_dn(struct transaction *trans) { > break; > case 'r': // move_from ... move_to > if (!cache_entry_valid(&trans->prev.cache)) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "move_to without history '%s'", trans->prev.notify.dn); >+ LOG(ERROR, "move_to without history '%s'", trans->prev.notify.dn); > break; > } > if (rv == 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "move_to collision at '%s'", trans->cur.notify.dn); >+ LOG(INFO, "move_to collision at '%s'", trans->cur.notify.dn); > cache_free_entry(NULL, &trans->cur.cache); > } > if (is_move(trans)) { >@@ -684,21 +684,20 @@ int change_update_dn(struct transaction *trans) { > break; > } > default: >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "non consecutive move: %ld:%c:%s << %ld:%c:%s", trans->prev.notify.id, trans->prev.notify.command, trans->prev.notify.dn, trans->cur.notify.id, >- trans->cur.notify.command, trans->cur.notify.dn); >+ LOG(ERROR, "non consecutive move: %ld:%c:%s << %ld:%c:%s", trans->prev.notify.id, trans->prev.notify.command, trans->prev.notify.dn, trans->cur.notify.id, trans->cur.notify.command, trans->cur.notify.dn); > rv = 1; > goto out; > } > > if (uuid) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "updating by UUID %s", uuid); >+ LOG(ALL, "updating by UUID %s", uuid); > base = trans->lp->base; > scope = LDAP_SCOPE_SUBTREE; > snprintf(filter, sizeof(filter), "(entryUUID=%s)", uuid); > trans->cur.uuid = strdup(uuid); > } else { > retry_dn: >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "updating by DN %s", trans->cur.notify.dn); >+ LOG(ALL, "updating by DN %s", trans->cur.notify.dn); > base = trans->cur.notify.dn; > scope = LDAP_SCOPE_BASE; > snprintf(filter, sizeof(filter), "(objectClass=*)"); >@@ -719,7 +718,7 @@ int change_update_dn(struct transaction *trans) { > } > trans->ldap = NULL; > } else { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "error searching DN %s: %d", trans->cur.notify.dn, rv); >+ LOG(WARN, "error searching DN %s: %d", trans->cur.notify.dn, rv); > _free_transaction_op(&trans->cur); > } > ldap_msgfree(res); >diff --git a/management/univention-directory-listener/src/convert.c b/management/univention-directory-listener/src/convert.c >index 01c2d28..98a98ba 100644 >--- a/management/univention-directory-listener/src/convert.c >+++ b/management/univention-directory-listener/src/convert.c >@@ -39,8 +39,6 @@ > #include <pwd.h> > #include <sys/types.h> > >-#include <univention/debug.h> >- > #include "cache_bdb.h" > #include "cache.h" > #include "common.h" >@@ -54,7 +52,7 @@ static void exit_if_cache_mdb_exists(void) { > abort(); > > if (access(cache_mdb_filename, F_OK) != -1) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "%s already exists", cache_mdb_filename); >+ LOG(ERROR, "%s already exists", cache_mdb_filename); > exit(EXIT_FAILURE); > } > } >@@ -131,9 +129,9 @@ int main(int argc, char *argv[]) { > > for (rv = bdb_cache_first_entry(&cur, &dn, &entry); rv != DB_NOTFOUND; rv = bdb_cache_next_entry(&cur, &dn, &entry)) { > if (rv != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "error while reading database"); >+ LOG(ERROR, "error while reading database"); > } else if ((rv = cache_update_entry_lower(0, dn, &entry)) != MDB_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "error while writing to database"); >+ LOG(ERROR, "error while writing to database"); > } > cache_free_entry(&dn, &entry); > if (rv < -1) >diff --git a/management/univention-directory-listener/src/demo.c b/management/univention-directory-listener/src/demo.c >index 65d4104..4f3cc59 100644 >--- a/management/univention-directory-listener/src/demo.c >+++ b/management/univention-directory-listener/src/demo.c >@@ -35,8 +35,6 @@ > #include <unistd.h> > #include <string.h> > >-#include <univention/debug.h> >- > #include "network.h" > #include "common.h" > >diff --git a/management/univention-directory-listener/src/dump.c b/management/univention-directory-listener/src/dump.c >index daa6333..6327adc 100644 >--- a/management/univention-directory-listener/src/dump.c >+++ b/management/univention-directory-listener/src/dump.c >@@ -40,8 +40,6 @@ > #include <pwd.h> > #include <sys/types.h> > >-#include <univention/debug.h> >- > #include "cache.h" > #include "common.h" > >@@ -120,7 +118,7 @@ int main(int argc, char *argv[]) { > fp = stdout; > } > if (fp == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "Couldn't open dump file"); >+ LOG(ERROR, "Couldn't open dump file"); > exit(1); > } > rv = snprintf(cache_mdb_dir, PATH_MAX, "%s/cache", cache_dir); >diff --git a/management/univention-directory-listener/src/handlers.c b/management/univention-directory-listener/src/handlers.c >index f24c865..0dbf3ab 100644 >--- a/management/univention-directory-listener/src/handlers.c >+++ b/management/univention-directory-listener/src/handlers.c >@@ -45,7 +45,6 @@ > #include <python2.7/compile.h> > #include <python2.7/marshal.h> > #include <python2.7/node.h> >-#include <univention/debug.h> > > #include "cache_lowlevel.h" > #include "base64.h" >@@ -81,7 +80,7 @@ static PyObject *module_import(char *filename) { > > if ((fp = fopen(filename, "r")) == NULL) > return NULL; >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "Load file %s", filename); >+ LOG(ALL, "Load file %s", filename); > > namep = strrchr(filename, '.'); > if ((namep != NULL) && (strcmp(namep, ".pyo") == 0)) { >@@ -95,12 +94,12 @@ static PyObject *module_import(char *filename) { > } else { > node *n; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "Parse file %s", filename); >+ LOG(ALL, "Parse file %s", filename); > if ((n = PyParser_SimpleParseFile(fp, filename, Py_file_input)) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "Parse failed %s", filename); >+ LOG(ALL, "Parse failed %s", filename); > return NULL; > } >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "pyNode compile %s", filename); >+ LOG(ALL, "pyNode compile %s", filename); > co = PyNode_Compile(n, filename); > PyNode_Free(n); > } >@@ -112,10 +111,10 @@ static PyObject *module_import(char *filename) { > return NULL; > } > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "execCodeModuleEx %s", filename); >+ LOG(ALL, "execCodeModuleEx %s", filename); > m = PyImport_ExecCodeModuleEx(name, (PyObject *)co, filename); > free(name); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "Module done %s", filename); >+ LOG(ALL, "Module done %s", filename); > > return m; > } >@@ -184,14 +183,14 @@ static int handler_import(char *filename) { > Handler *handler; > int rv; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "importing handler %s", filename); >+ LOG(INFO, "importing handler %s", filename); > > if ((handler = malloc(sizeof(Handler))) == NULL) > return 1; > memset(handler, 0, sizeof(Handler)); > > if ((handler->module = module_import(filename)) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "import of filename=%s failed", filename); >+ LOG(ERROR, "import of filename=%s failed", filename); > error_msg = "module_import()"; > goto error; > } >@@ -259,7 +258,7 @@ static int handler_import(char *filename) { > } else { > rv = fscanf(state_fp, "%u", &handler->state); > if (rv != 1) >- univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Failed reading %s: %s", state_filename, strerror(errno)); >+ LOG(WARN, "Failed reading %s: %s", state_filename, strerror(errno)); > fclose(state_fp); > } > >@@ -304,7 +303,7 @@ error: > free(handler->modrdn); > free(handler->name); > free(handler); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "import of filename=%s failed in %s", filename, error_msg ? error_msg : "???"); >+ LOG(ERROR, "import of filename=%s failed in %s", filename, error_msg ? error_msg : "???"); > return 1; > } > >@@ -329,7 +328,7 @@ static int handler_prerun(Handler *handler) { > > /* run postrun handler */ > static int handler_postrun(Handler *handler) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "postrun handler: %s (prepared=%d)", handler->name, handler->prepared); >+ LOG(INFO, "%s (prepared=%d)", handler->name, handler->prepared); > if (!handler->prepared) > return 0; > if (handler->postrun) { >@@ -366,9 +365,9 @@ static int handler_exec(Handler *handler, const char *dn, CacheEntry *new, Cache > > if ((handler->state & HANDLER_READY) != HANDLER_READY) { > if (INIT_ONLY) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "handler: %s (not ready) (ignore)", handler->name); >+ LOG(WARN, "%s (not ready) (ignore)", handler->name); > } else { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "handler: %s (not ready)", handler->name); >+ LOG(WARN, "%s (not ready)", handler->name); > return 1; > } > } >@@ -533,7 +532,7 @@ void handler_write_state(Handler *handler) { > abort(); > state_fp = fopen(state_filename, "w"); > if (state_fp == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "could not open %s", state_filename); >+ LOG(ERROR, "could not open %s", state_filename); > } else { > fprintf(state_fp, "%d", handler->state); > rv = fclose(state_fp); >@@ -693,7 +692,7 @@ static int attribute_has_changed(char **changes, char *attribute) { > char **cur; > > for (cur = changes; cur != NULL && *cur != NULL; cur++) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "%s ? %s", *cur, attribute); >+ LOG(ALL, "%s ? %s", *cur, attribute); > if (strcmp(*cur, attribute) == 0) > return 1; > } >@@ -707,7 +706,7 @@ static int handler__update(Handler *handler, const char *dn, CacheEntry *new, Ca > int matched; > int rv = 0; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "handler: %s considered", handler->name); >+ LOG(ALL, "%s considered", handler->name); > > /* check if attributes for handler have changed > >@@ -733,7 +732,7 @@ static int handler__update(Handler *handler, const char *dn, CacheEntry *new, Ca > > up_to_date: > if (uptodate) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "handler: %s (up-to-date)", handler->name); >+ LOG(INFO, "%s (up-to-date)", handler->name); > cache_entry_module_add(new, handler->name); > return 0; > } >@@ -742,16 +741,16 @@ static int handler__update(Handler *handler, const char *dn, CacheEntry *new, Ca > /* check if the handler's search filter matches */ > matched = cache_entry_ldap_filter_match(handler->filters, dn, new); > if (!matched) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "handler: %s (filter doesn't match)", handler->name); >+ LOG(ALL, "%s (filter doesn't match)", handler->name); > return 0; > } > > /* run handler */ > if (handler_exec(handler, dn, new, old, command) == 0) { > cache_entry_module_add(new, handler->name); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "handler: %s (successful)", handler->name); >+ LOG(INFO, "%s (successful)", handler->name); > } else { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "handler: %s (failed)", handler->name); >+ LOG(WARN, "%s (failed)", handler->name); > rv = 1; > } > >@@ -765,7 +764,7 @@ int handlers_update(const char *dn, CacheEntry *new, CacheEntry *old, char comma > char **changes; > int rv = 0; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "running handlers for %s", dn); >+ LOG(INFO, "running handlers for %s", dn); > > changes = cache_entry_changed_attributes(new, old); > >@@ -790,7 +789,7 @@ int handler_update(const char *dn, CacheEntry *new, CacheEntry *old, Handler *ha > char **changes; > int rv = 0; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "running handlers [%s] for %s", handler->name, dn); >+ LOG(INFO, "running handlers [%s] for %s", handler->name, dn); > > changes = cache_entry_changed_attributes(new, old); > >@@ -807,19 +806,19 @@ int handlers_delete(const char *dn, CacheEntry *old, char command) { > Handler *handler; > int rv = 0; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "delete handlers for %s", dn); >+ LOG(INFO, "delete handlers for %s", dn); > > for (handler = handlers; handler != NULL; handler = handler->next) { > /* run the replication handler in any case, see Bug #29475 */ > if (!cache_entry_module_present(old, handler->name) && strcmp(handler->name, "replication")) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "handler: %s (skipped)", handler->name); >+ LOG(INFO, "%s (skipped)", handler->name); > continue; > } > if (handler_exec(handler, dn, NULL, old, command) == 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "handler: %s (successful)", handler->name); >+ LOG(INFO, "%s (successful)", handler->name); > cache_entry_module_remove(old, handler->name); > } else { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "handler: %s (failed)", handler->name); >+ LOG(INFO, "%s (failed)", handler->name); > rv = 1; > } > } >@@ -868,7 +867,7 @@ int handlers_set_data_all(char *key, char *value) { > PyObject *argtuple; > __attribute__((unused)) int rv = 1; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "setting data for all handlers: key=%s value=%s", key, strcmp("bindpw", key) ? value : "<HIDDEN>"); >+ LOG(INFO, "setting data for all handlers: key=%s value=%s", key, strcmp("bindpw", key) ? value : "<HIDDEN>"); > > /* make argument list */ > if ((argtuple = PyTuple_New(2)) == NULL) >@@ -877,12 +876,12 @@ int handlers_set_data_all(char *key, char *value) { > PyTuple_SetItem(argtuple, 0, PyString_FromString(key)); > PyTuple_SetItem(argtuple, 1, PyString_FromString(value)); > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "DEBUG: handlers=%p", handlers); >+ LOG(ALL, "handlers=%p", handlers); > if (handlers == NULL) > return 0; > > for (handler = handlers; handler != NULL; handler = handler->next) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "DEBUG: handler=%p", handler); >+ LOG(ALL, "handler=%p", handler); > if (handler_set_data(handler, argtuple) < 0) > rv = -1; > } >diff --git a/management/univention-directory-listener/src/main.c b/management/univention-directory-listener/src/main.c >index d8a4354..3e9236a 100644 >--- a/management/univention-directory-listener/src/main.c >+++ b/management/univention-directory-listener/src/main.c >@@ -42,7 +42,6 @@ > #include <pwd.h> > #include <sys/types.h> > >-#include <univention/debug.h> > #include <univention/ldap.h> > #include <univention/config.h> > >@@ -101,9 +100,9 @@ static void daemonize(int lock_fd) { > fd = open(pidfile, O_WRONLY | O_CREAT | O_EXCL, 0644); > if (fd < 0) { > if (errno == EEXIST) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "pidfile %s exists, aborting...%d %s", pidfile, errno, strerror(errno)); >+ LOG(ERROR, "pidfile %s exists, aborting...%d %s", pidfile, errno, strerror(errno)); > else >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "Can not create pidfile %s: %s, aborting...", pidfile, strerror(errno)); >+ LOG(ERROR, "Can not create pidfile %s: %s, aborting...", pidfile, strerror(errno)); > exit(EXIT_FAILURE); > } > >@@ -146,11 +145,11 @@ static void daemonize(int lock_fd) { > abort(); > rv = write(fd, buf, rv); > if (rv) >- univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Failed to write %s: %s", pidfile, strerror(errno)); >+ LOG(WARN, "Failed to write %s: %s", pidfile, strerror(errno)); > } > rv = close(fd); > if (rv) >- univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Failed to close %s: %s", pidfile, strerror(errno)); >+ LOG(WARN, "Failed to close %s: %s", pidfile, strerror(errno)); > > // Set new file permissions > umask(0); >@@ -158,10 +157,10 @@ static void daemonize(int lock_fd) { > // Change the working directory to the root directory > rv = chdir("/"); > if (rv) >- univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Failed to change directory: %s", strerror(errno)); >+ LOG(WARN, "Failed to change directory: %s", strerror(errno)); > > if ((null = open("/dev/null", O_RDWR)) == -1) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "could not open /dev/null: %s", strerror(errno)); >+ LOG(ERROR, "could not open /dev/null: %s", strerror(errno)); > exit(EXIT_FAILURE); > } > dup2(null, STDIN_FILENO); >@@ -170,13 +169,13 @@ static void daemonize(int lock_fd) { > dup2(log, STDERR_FILENO); > rv = close(log); > if (rv) >- univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Failed to close /var/log/univention/listener.log: %s", strerror(errno)); >+ LOG(WARN, "Failed to close /var/log/univention/listener.log: %s", strerror(errno)); > } else { > dup2(null, STDERR_FILENO); > } > rv = close(null); > if (rv) >- univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Failed to close /dev/null: %s", strerror(errno)); >+ LOG(WARN, "Failed to close /dev/null: %s", strerror(errno)); > > // Close all open file descriptors > for (fd = sysconf(_SC_OPEN_MAX); fd > STDERR_FILENO; fd--) >@@ -192,16 +191,16 @@ void drop_privileges(void) { > return; > > if ((listener_user = getpwnam("listener")) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "failed to get passwd entry for listener"); >+ LOG(ERROR, "failed to get passwd entry for listener"); > exit(1); > } > > if (setegid(listener_user->pw_gid) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "failed to change to listener gid"); >+ LOG(ERROR, "failed to change to listener gid"); > exit(1); > } > if (seteuid(listener_user->pw_uid) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "failed to change to listener uid"); >+ LOG(ERROR, "failed to change to listener uid"); > exit(1); > } > } >@@ -240,7 +239,7 @@ static void purge_cache(const char *cache_dir) { > char dirname[PATH_MAX]; > int rv; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "purging cache"); >+ LOG(INFO, "purging cache"); > if ((dir = opendir(cache_dir)) != NULL) { > while ((dirent = readdir(dir))) { > char path[PATH_MAX]; >@@ -316,7 +315,7 @@ static int do_connection(univention_ldap_parameters_t *lp) { > int sizelimit0 = 0; > > if (univention_ldap_open(lp) != LDAP_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "can not connect to LDAP server %s:%d", lp->host, lp->port); >+ LOG(WARN, "can not connect to LDAP server %s:%d", lp->host, lp->port); > goto fail; > } > if (notifier_client_new(NULL, lp->host, 1) != 0) >@@ -329,10 +328,12 @@ static int do_connection(univention_ldap_parameters_t *lp) { > case LDAP_SUCCESS: > return 0; > case LDAP_NO_SUCH_OBJECT: >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "Failed to find \"(objectClass=univentionBase)\" on LDAP server %s:%d", lp->host, lp->port); >+ LOG(ERROR, "Failed to find \"(objectClass=univentionBase)\" on LDAP server %s:%d", lp->host, lp->port); > break; > default: >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "Failed to search for \"(objectClass=univentionBase)\" on LDAP server %s:%d with message %s", lp->host, lp->port, ldap_err2string(rc)); >+ LOG(ERROR, "Failed to search for \"(objectClass=univentionBase)\" on LDAP " >+ "server %s:%d with message %s", >+ lp->host, lp->port, ldap_err2string(rc)); > break; > } > fail: >@@ -483,6 +484,7 @@ int main(int argc, char *argv[]) { > } > > univention_debug_set_level(UV_DEBUG_LISTENER, debugging); >+ univention_debug_set_level(UV_DEBUG_TRANSFILE, debugging); > univention_debug_set_level(UV_DEBUG_LDAP, debugging); > > { >@@ -491,7 +493,7 @@ int main(int argc, char *argv[]) { > if (rv < 0 || rv >= PATH_MAX) > abort(); > if (stat(filename, &stbuf) == 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "Corrupt cache"); >+ LOG(ERROR, "Corrupt cache"); > exit(3); > } > } >@@ -513,24 +515,24 @@ int main(int argc, char *argv[]) { > /* choose server to connect to */ > if (lp->host == NULL && lp->uri == NULL) { > select_server(lp); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "no server given, choosing one by myself (%s)", lp->host); >+ LOG(INFO, "no server given, choosing one by myself (%s)", lp->host); > } > > while (do_connection(lp) != 0) { > if (suspend_connect()) { > if (initialize_only) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "can not connect any server, exit"); >+ LOG(ERROR, "can not connect any server, exit"); > exit(1); > } >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "can not connect any server, retrying in 30 seconds"); >+ LOG(WARN, "can not connect any server, retrying in 30 seconds"); > sleep(30); > } > > select_server(lp); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "chosen server: %s:%d", lp->host, lp->port); >+ LOG(WARN, "chosen server: %s:%d", lp->host, lp->port); > } > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "connection okay to host %s:%d", lp->host, lp->port); >+ LOG(INFO, "connection okay to host %s:%d", lp->host, lp->port); > > /* connect to local LDAP server */ > server_role = univention_config_get_string("server/role"); >@@ -566,7 +568,7 @@ int main(int argc, char *argv[]) { > handlers_set_data_all("ldapserver", lp->host); > > if (notifier_get_id_s(NULL, &id) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "failed to receive current ID"); >+ LOG(ERROR, "failed to receive current ID"); > return 1; > } > >@@ -581,7 +583,7 @@ int main(int argc, char *argv[]) { > if (cache_master_entry.id == -1) { > rv = notifier_get_id_s(NULL, &cache_master_entry.id); > if (rv != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "failed to receive current ID"); >+ LOG(ERROR, "failed to receive current ID"); > return 1; > } > } >@@ -594,7 +596,7 @@ int main(int argc, char *argv[]) { > return rv; > /* Legacy file for Nagios et al. */ > if (cache_set_int("notifier_id", cache_master_entry.id)) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "failed to write notifier ID"); >+ LOG(WARN, "failed to write notifier ID"); > > /* update schema */ > if ((rv = change_update_schema(lp)) != LDAP_SUCCESS) >@@ -602,7 +604,7 @@ int main(int argc, char *argv[]) { > > /* do initial import of entries */ > if ((rv = change_new_modules(lp)) != LDAP_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "change_new_modules: %s", ldap_err2string(rv)); >+ LOG(ERROR, "change_new_modules: %s", ldap_err2string(rv)); > return rv; > } > signals_unblock(); >@@ -612,7 +614,7 @@ int main(int argc, char *argv[]) { > } > > if (rv != 0) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "listener: %d", rv); >+ LOG(ERROR, "listener: %d", rv); > > univention_ldap_close(lp); > univention_ldap_close(lp_local); >diff --git a/management/univention-directory-listener/src/network.c b/management/univention-directory-listener/src/network.c >index a5399ea..b29f623 100644 >--- a/management/univention-directory-listener/src/network.c >+++ b/management/univention-directory-listener/src/network.c >@@ -51,7 +51,6 @@ > #include <sys/stat.h> > #include <errno.h> > >-#include <univention/debug.h> > #include <univention/config.h> > > #include "common.h" >@@ -109,7 +108,7 @@ static int parse_entry(const char *line, NotifierEntry *entry) { > > /* Send buffer in blocking mode. */ > static int send_block(NotifierClient *client, const char *buf, size_t len) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, ">>>%s", buf); >+ LOG(ALL, ">>>%s", buf); > return write(client->fd, buf, len); > } > >@@ -137,19 +136,19 @@ static int recv_block(NotifierClient *client, char **back, time_t timeout) { > while (result == NULL || (pos = strstr(result, "\n\n")) == NULL) { > ssize_t r; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "RESULT: [%s]", result); >+ LOG(ALL, "RESULT: [%s]", result); > if ((rv = notifier_wait(client, timeout)) == 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "timeout when receiving data"); >+ LOG(ERROR, "timeout when receiving data"); > return 0; > } else if (rv < 0) > return 0; > > r = read(client->fd, buf, BUFSIZ); > if (r == 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "connection to notifier was closed"); >+ LOG(ERROR, "connection to notifier was closed"); > return 0; > } else if (r < 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "error %d: %s while receiving from notifier", errno, strerror(errno)); >+ LOG(ERROR, "error %d: %s while receiving from notifier", errno, strerror(errno)); > return 0; > } > >@@ -170,7 +169,7 @@ static int recv_block(NotifierClient *client, char **back, time_t timeout) { > client->buf = NULL; > } > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "<<<%s", *back); >+ LOG(ALL, "<<<%s", *back); > return strlen(*back); > } > >@@ -201,7 +200,7 @@ int notifier_recv_result(NotifierClient *client, time_t timeout) { > assert(client->fd > -1); > > if ((rv = notifier_wait(client, timeout)) == 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "no data is available (i.e. timeout elapsed)"); >+ LOG(WARN, "no data is available (i.e. timeout elapsed)"); > return 0; > } else if (rv < 0) > return 0; >@@ -319,7 +318,7 @@ int notifier_client_new(NotifierClient *client, const char *server, int starttls > client = &global_client; > > if (starttls >= 2) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "This version does not support TLS"); >+ LOG(ERROR, "This version does not support TLS"); > return 1; > } > >@@ -352,11 +351,11 @@ int notifier_client_new(NotifierClient *client, const char *server, int starttls > address6.sin6_family = AF_INET6; > address6.sin6_port = htons(NOTIFIER_PORT_PROTOCOL2); > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "connecting to notifier %s:%d", client->server, NOTIFIER_PORT_PROTOCOL2); >+ LOG(INFO, "connecting to notifier %s:%d", client->server, NOTIFIER_PORT_PROTOCOL2); > > err = getaddrinfo(client->server, NULL, &hints, &result_addrinfo); > if (err != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "address resolution of %s failed with errorcode %d: %s", client->server, err, gai_strerror(err)); >+ LOG(WARN, "address resolution of %s failed with errorcode %d: %s", client->server, err, gai_strerror(err)); > free(client->server); > client->server = NULL; > return 1; >@@ -367,7 +366,7 @@ int notifier_client_new(NotifierClient *client, const char *server, int starttls > switch (res->ai_family) { > case AF_INET: > if ((client->fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "creating IPv4 socket descriptor failed with errorcode %d: %s", errno, strerror(errno)); >+ LOG(WARN, "creating IPv4 socket descriptor failed with errorcode %d: %s", errno, strerror(errno)); > continue; > } > memcpy(&address4.sin_addr, &((struct sockaddr_in *)res->ai_addr)->sin_addr, sizeof(address4.sin_addr)); >@@ -379,7 +378,7 @@ int notifier_client_new(NotifierClient *client, const char *server, int starttls > > case AF_INET6: > if ((client->fd = socket(AF_INET6, SOCK_STREAM, 0)) == -1) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "creating IPv6 socket descriptor failed with errorcode %d: %s", errno, strerror(errno)); >+ LOG(WARN, "creating IPv6 socket descriptor failed with errorcode %d: %s", errno, strerror(errno)); > continue; > } > memcpy(&address6.sin6_addr, &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr, sizeof(address6.sin6_addr)); >@@ -401,31 +400,31 @@ int notifier_client_new(NotifierClient *client, const char *server, int starttls > int ret; > ret = setsockopt(client->fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)); > if (ret < 0) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to set SO_RCVTIMEO"); >+ LOG(WARN, "Failed to set SO_RCVTIMEO"); > ret = setsockopt(client->fd, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)); > if (ret < 0) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to set SO_SNDTIMEO"); >+ LOG(WARN, "Failed to set SO_SNDTIMEO"); > > const int enable = 1; > ret = setsockopt(client->fd, SOL_SOCKET, SO_KEEPALIVE, &enable, sizeof(enable)); > if (ret < 0) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to enable TCP KEEPALIVE"); >+ LOG(WARN, "Failed to enable TCP KEEPALIVE"); > const int idle = 60; > ret = setsockopt(client->fd, SOL_TCP, TCP_KEEPIDLE, &idle, sizeof(idle)); > if (ret < 0) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to set TCP_KEEPIDLE"); >+ LOG(WARN, "Failed to set TCP_KEEPIDLE"); > const int probes = 12; > ret = setsockopt(client->fd, SOL_TCP, TCP_KEEPCNT, &probes, sizeof(probes)); > if (ret < 0) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to set TCP_KEEPCNT"); >+ LOG(WARN, "Failed to set TCP_KEEPCNT"); > const int interval = 5; > ret = setsockopt(client->fd, SOL_TCP, TCP_KEEPINTVL, &interval, sizeof(interval)); > if (ret < 0) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to set TCP_KEEPINTVL"); >+ LOG(WARN, "Failed to set TCP_KEEPINTVL"); > } > > if (connect(client->fd, address, addrlen) == -1) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "connection to %s failed with errorcode %d: %s", addrstr, errno, strerror(errno)); >+ LOG(INFO, "connection to %s failed with errorcode %d: %s", addrstr, errno, strerror(errno)); > close(client->fd); > client->fd = -1; > continue; >@@ -435,26 +434,26 @@ int notifier_client_new(NotifierClient *client, const char *server, int starttls > freeaddrinfo(result_addrinfo); > > if (client->fd == -1) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "failed to connect to any notifier"); >+ LOG(ERROR, "failed to connect to any notifier"); > free(client->server); > client->server = NULL; > return 2; > } > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "established connection to %s port %d", addrstr, NOTIFIER_PORT_PROTOCOL2); >+ LOG(INFO, "established connection to %s port %d", addrstr, NOTIFIER_PORT_PROTOCOL2); > > const char *header = "Version: 2\nCapabilities: \n\n"; > const size_t len = strlen(header); > char *result, *tok; > > if (send_block(client, header, len) != len) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "couldn't send header"); >+ LOG(ERROR, "couldn't send header"); > free(client->server); > client->server = NULL; > return 1; > } > if (recv_block(client, &result, NOTIFIER_TIMEOUT) < 1) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "couldn't receive header"); >+ LOG(ERROR, "couldn't receive header"); > free(client->server); > client->server = NULL; > return 1; >@@ -464,7 +463,7 @@ int notifier_client_new(NotifierClient *client, const char *server, int starttls > for (tok = strtok(result, "\n"); tok != NULL; tok = strtok(NULL, "\n")) { > char *val; > if ((val = strchr(tok, ':')) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "ignoring bad header: [%s]", tok); >+ LOG(ERROR, "ignoring bad header: [%s]", tok); > continue; > } > *val++ = '\0'; >@@ -479,7 +478,7 @@ int notifier_client_new(NotifierClient *client, const char *server, int starttls > free(result); > > if (client->protocol != 2) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "Protocol version %d is not supported", client->protocol); >+ LOG(ERROR, "Protocol version %d is not supported", client->protocol); > free(client->server); > client->server = NULL; > return 1; >@@ -523,7 +522,7 @@ int notifier_wait(NotifierClient *client, time_t timeout) { > } > } while (rv == -1 && errno == EINTR); > if (rv == -1) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "select: %s", strerror(errno)); >+ LOG(ERROR, "select: %s", strerror(errno)); > } > > return rv; >diff --git a/management/univention-directory-listener/src/notifier.c b/management/univention-directory-listener/src/notifier.c >index 15b71a8..e16ca12 100644 >--- a/management/univention-directory-listener/src/notifier.c >+++ b/management/univention-directory-listener/src/notifier.c >@@ -46,7 +46,6 @@ > #include <sys/time.h> > #include <sys/statvfs.h> > >-#include <univention/debug.h> > #include <univention/config.h> > #include <univention/ldap.h> > >@@ -66,15 +65,15 @@ > > static int connect_to_ldap(univention_ldap_parameters_t *lp) { > while (univention_ldap_open(lp) != LDAP_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "can not connect to ldap server (%s)", lp->host); >+ LOG(WARN, "can not connect to ldap server (%s)", lp->host); > > if (suspend_connect()) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "can not connect to any ldap server, retrying in 30 seconds"); >+ LOG(WARN, "can not connect to any ldap server, retrying in 30 seconds"); > sleep(30); > } > > select_server(lp); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "chosen server: %s:%d", lp->host, lp->port); >+ LOG(WARN, "chosen server: %s:%d", lp->host, lp->port); > } > > return LDAP_SUCCESS; >@@ -101,7 +100,7 @@ static void check_free_space() { > if (free_mib >= min_mib) > continue; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "File system '%s' full: %" PRId64 " < %" PRId64, *dirname, free_mib, min_mib); >+ LOG(ERROR, "File system '%s' full: %" PRId64 " < %" PRId64, *dirname, free_mib, min_mib); > abort(); > } > } >@@ -120,7 +119,7 @@ int notifier_listen(univention_ldap_parameters_t *lp, bool write_transaction_fil > > check_free_space(); > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "Last Notifier ID: %lu", id); >+ LOG(INFO, "Last Notifier ID: %lu", id); > if ((msgid = notifier_get_dn(NULL, id + 1)) < 1) > break; > >@@ -132,7 +131,7 @@ int notifier_listen(univention_ldap_parameters_t *lp, bool write_transaction_fil > if ((rv = notifier_wait(NULL, timeout)) == 0) { > if (timeout == DELAY_ALIVE) { > if (notifier_alive_s(NULL) == 1) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "failed to get alive answer"); >+ LOG(ERROR, "failed to get alive answer"); > return 1; > } > notifier_resend_get_dn(NULL, msgid, id + 1); >@@ -145,13 +144,13 @@ int notifier_listen(univention_ldap_parameters_t *lp, bool write_transaction_fil > ldap_unbind_ext(trans.lp_local->ld, NULL, NULL); > trans.lp_local->ld = NULL; > } >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "running postrun handlers"); >+ LOG(INFO, "running postrun handlers"); > handlers_postrun_all(); > timeout = DELAY_ALIVE; > } > continue; > } else if (rv > 0 && notifier_recv_result(NULL, NOTIFIER_TIMEOUT) == 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "failed to recv result"); >+ LOG(ERROR, "failed to recv result"); > return 1; > } else if (rv < 0) { > return 1; >@@ -160,13 +159,13 @@ int notifier_listen(univention_ldap_parameters_t *lp, bool write_transaction_fil > > memset(&trans.cur, 0, sizeof(trans.cur)); > if (notifier_get_dn_result(NULL, msgid, &trans.cur.notify) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "failed to get dn result"); >+ LOG(ERROR, "failed to get dn result"); > return 1; > } >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "notifier returned = id: %ld\tdn: %s\tcmd: %c", trans.cur.notify.id, trans.cur.notify.dn, trans.cur.notify.command); >+ LOG(INFO, "notifier returned = id: %ld\tdn: %s\tcmd: %c", trans.cur.notify.id, trans.cur.notify.dn, trans.cur.notify.command); > > if (trans.cur.notify.id != id + 1) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "notifier returned transaction id %ld (%ld expected)", trans.cur.notify.id, id + 1); >+ LOG(ERROR, "notifier returned transaction id %ld (%ld expected)", trans.cur.notify.id, id + 1); > rv = 1; > goto out; > } >@@ -175,7 +174,7 @@ int notifier_listen(univention_ldap_parameters_t *lp, bool write_transaction_fil > /* ensure that LDAP connection is open */ > if (trans.lp->ld == NULL) { > if ((rv = connect_to_ldap(trans.lp)) != 0) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "failed to connect to LDAP"); >+ LOG(ERROR, "failed to connect to LDAP"); > goto out; > } > } >@@ -183,7 +182,7 @@ int notifier_listen(univention_ldap_parameters_t *lp, bool write_transaction_fil > /* Try to do the change. If the LDAP server is down, try > to reconnect */ > while ((rv = change_update_dn(&trans)) != LDAP_SUCCESS) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "change_update_dn failed: %d", rv); >+ LOG(ERROR, "change_update_dn failed: %d", rv); > if (rv == LDAP_SERVER_DOWN) > if ((rv = connect_to_ldap(trans.lp)) == 0) > continue; >@@ -211,7 +210,7 @@ int notifier_listen(univention_ldap_parameters_t *lp, bool write_transaction_fil > cache_master_entry.id = id; > cache_update_master_entry(&cache_master_entry); > if (cache_set_int("notifier_id", id)) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "failed to write notifier ID"); >+ LOG(WARN, "failed to write notifier ID"); > change_free_transaction_op(&trans.cur); > } > >diff --git a/management/univention-directory-listener/src/select_server.c b/management/univention-directory-listener/src/select_server.c >index 40d3d9d..68a56bc 100644 >--- a/management/univention-directory-listener/src/select_server.c >+++ b/management/univention-directory-listener/src/select_server.c >@@ -35,7 +35,7 @@ > #include <stdlib.h> > #include <time.h> > #include "select_server.h" >-#include <univention/debug.h> >+#include "common.h" > #include <univention/ldap.h> > #include <univention/config.h> > >@@ -119,10 +119,10 @@ void select_server(univention_ldap_parameters_t *lp) { > if (!name[0]) > continue; > server_list[server_list_entries++].server_name = strdup(name); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "Backup found: %s", name); >+ LOG(INFO, "Backup found: %s", name); > } > if (server_list_entries >= ARRAY_SIZE(server_list)) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "Too many (more than %zd) backup-servers found", ARRAY_SIZE(server_list)); >+ LOG(ERROR, "Too many (more than %zd) backup-servers found", ARRAY_SIZE(server_list)); > /* Append notifier on DC Master unless explicitly disabled */ > if (server_list_entries < ARRAY_SIZE(server_list) && !backup_notifier) > server_list[server_list_entries++].server_name = strdup(ldap_master); >@@ -139,10 +139,10 @@ void select_server(univention_ldap_parameters_t *lp) { > if (!seed) { > seed = getpid() * time(NULL); > srandom(seed); >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "rands with seed %ud ", seed); >+ LOG(INFO, "rands with seed %ud ", seed); > } > int randval = random() % server_list_entries; >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "randval = %d ", randval); >+ LOG(INFO, "randval = %d ", randval); > > // server_list[randval].conn_attemp++; > lp->host = strdup(server_list[randval].server_name); >@@ -155,7 +155,7 @@ void select_server(univention_ldap_parameters_t *lp) { > lp->port = backup_port; > } > } else { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "No Backup found, server is ldap/master"); >+ LOG(INFO, "No Backup found, server is ldap/master"); > lp->host = strdup(ldap_master); > if (ldap_master_port > 0) > lp->port = ldap_master_port; >@@ -166,5 +166,5 @@ result: > free(ldap_master); > free(server_role); > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "LDAP-Server is %s:%d", lp->host, lp->port); >+ LOG(INFO, "LDAP-Server is %s:%d", lp->host, lp->port); > } >diff --git a/management/univention-directory-listener/src/signals.c b/management/univention-directory-listener/src/signals.c >index 490d8b2..d42dbee 100644 >--- a/management/univention-directory-listener/src/signals.c >+++ b/management/univention-directory-listener/src/signals.c >@@ -38,8 +38,6 @@ > #include <stdio.h> > #include <unistd.h> > >-#include <univention/debug.h> >- > #include "handlers.h" > #include "cache.h" > #include "common.h" >@@ -52,7 +50,7 @@ sigset_t block_mask; > void signals_block(void) { > static int init_done = 0; > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "blocking signals (was %d)", sig_block_count); >+ LOG(ALL, "blocking signals (was %d)", sig_block_count); > if ((++sig_block_count) != 1) > return; > >@@ -72,7 +70,7 @@ void signals_block(void) { > } > > void signals_unblock(void) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "unblocking signals (was %d)", sig_block_count); >+ LOG(ALL, "unblocking signals (was %d)", sig_block_count); > if ((--sig_block_count) != 0) > return; > sigprocmask(SIG_UNBLOCK, &block_mask, NULL); >@@ -80,21 +78,21 @@ void signals_unblock(void) { > > > void sig_usr1_handler(int sig) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "received signal %d", sig); >+ LOG(WARN, "received signal %d", sig); > int loglevel = univention_debug_get_level(UV_DEBUG_LISTENER); > if (loglevel < UV_DEBUG_ALL) { > loglevel += 1; >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "increasing univention_debug_level to %d", loglevel); >+ LOG(WARN, "increasing univention_debug_level to %d", loglevel); > univention_debug_set_level(UV_DEBUG_LISTENER, loglevel); > } > } > > void sig_usr2_handler(int sig) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "received signal %d", sig); >+ LOG(WARN, "received signal %d", sig); > int loglevel = univention_debug_get_level(UV_DEBUG_LISTENER); > if (loglevel > UV_DEBUG_ERROR) { > loglevel -= 1; >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "decreasing univention_debug_level to %d", loglevel); >+ LOG(WARN, "decreasing univention_debug_level to %d", loglevel); > univention_debug_set_level(UV_DEBUG_LISTENER, loglevel); > } > } >@@ -104,13 +102,13 @@ void exit_handler(int sig) { > static bool exit_handler_running = false; > > if (exit_handler_running) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "received another signal %d, ignoring", sig); >+ LOG(WARN, "received another signal %d, ignoring", sig); > return; > } > exit_handler_running = true; > > if (sig) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "received signal %d", sig); >+ LOG(WARN, "received signal %d", sig); > > cache_close(); > unlink(pidfile); >@@ -131,7 +129,7 @@ void exit_handler(int sig) { > } > > void reload_handler(int sig) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "received signal %d", sig); >+ LOG(WARN, "received signal %d", sig); > handlers_reload_all_paths(); > } > >diff --git a/management/univention-directory-listener/src/transfile.c b/management/univention-directory-listener/src/transfile.c >index 0e58bf8..83dbf4e 100644 >--- a/management/univention-directory-listener/src/transfile.c >+++ b/management/univention-directory-listener/src/transfile.c >@@ -40,8 +40,7 @@ > #include <sys/types.h> > #include <sys/stat.h> > >-#include <univention/debug.h> >- >+#define LOG_CATEGORY UV_DEBUG_TRANSFILE > #include "common.h" > #include "transfile.h" > >@@ -60,7 +59,7 @@ static FILE *fopen_lock(const char *name, const char *type, FILE **l_file) { > snprintf(buf, sizeof(buf), "%s.lock", name); > > if ((*l_file = fopen(buf, "a")) == NULL) { >- univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Could not open lock file [%s]", buf); >+ LOG(WARN, "Could not open lock file [%s]", buf); > return NULL; > } > >@@ -69,21 +68,21 @@ static FILE *fopen_lock(const char *name, const char *type, FILE **l_file) { > int rc = lockf(l_fd, F_TLOCK, 0); > if (!rc) > break; >- univention_debug(UV_DEBUG_LDAP, UV_DEBUG_INFO, "Could not get lock for file [%s]; count=%d", buf, count); >+ LOG(INFO, "Could not get lock for file [%s]; count=%d", buf, count); > count++; > if (count > listener_lock_count) { >- univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ERROR, "Could not get lock for file [%s]; exit", buf); >+ LOG(ERROR, "Could not get lock for file [%s]; exit", buf); > exit(0); > } > usleep(1000); > } > > if ((file = fopen(name, type)) == NULL) { >- univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Could not open file [%s]", name); >+ LOG(WARN, "Could not open file [%s]", name); > > int rc = lockf(l_fd, F_ULOCK, 0); > if (rc) >- univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Failed to unlock %s: %s", buf, strerror(errno)); >+ LOG(WARN, "Failed to unlock %s: %s", buf, strerror(errno)); > fclose(*l_file); > *l_file = NULL; > } >@@ -105,7 +104,7 @@ static int fclose_lock(FILE **file, FILE **l_file) { > int l_fd = fileno(*l_file); > int rc = lockf(l_fd, F_ULOCK, 0); > if (rc) >- univention_debug(UV_DEBUG_LDAP, UV_DEBUG_ALL, "unlockf(): %d", rc); >+ LOG(ALL, "unlockf(): %d", rc); > rv |= fclose(*l_file); > *l_file = NULL; > } >@@ -119,7 +118,7 @@ bool notifier_has_failed_ldif(void) { > > if (stat(failed_ldif_file, &stat_buf) != 0) > return false; >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "'failed.ldif' exists. Check for %s", failed_ldif_file); >+ LOG(ERROR, "'failed.ldif' exists. Check for %s", failed_ldif_file); > return true; > } > >@@ -136,15 +135,15 @@ int notifier_write_transaction_file(NotifierEntry entry) { > assert(!notifier_has_failed_ldif()); > > if ((file = fopen_lock(transaction_file, "a+", &l_file)) == NULL) { >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "Could not open %s", transaction_file); >+ LOG(ERROR, "Could not open %s", transaction_file); > return res; > } > >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "write to transaction file dn=[%s], command=[%c]", entry.dn, entry.command); >+ LOG(INFO, "write to transaction file dn=[%s], command=[%c]", entry.dn, entry.command); > fprintf(file, "%ld %s %c\n", entry.id, entry.dn, entry.command); > res = fclose_lock(&file, &l_file); > if (res != 0) >- univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "failed to write to transaction file %s: %d", transaction_file, res); >+ LOG(ERROR, "failed to write to transaction file %s: %d", transaction_file, res); > > return res; > } >diff --git a/management/univention-directory-listener/src/verify.c b/management/univention-directory-listener/src/verify.c >index 33f4ac2..02dda89 100644 >--- a/management/univention-directory-listener/src/verify.c >+++ b/management/univention-directory-listener/src/verify.c >@@ -40,8 +40,6 @@ > #include <sys/types.h> > #include <ldap.h> > >-#include <univention/debug.h> >- > #include "cache.h" > #include "common.h" > #include "utils.h" >-- >2.1.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 35707
: 8495 |
9742