Univention Bugzilla – Attachment 4398 Details for
Bug 27314
cache_dir bei bad_cache berücksichtigen
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Honor cache_dir
0002-Ticket-2012050221003422-Honor-cache_dir.patch (text/plain), 4.29 KB, created by
Philipp Hahn
on 2012-05-29 14:30 CEST
(
hide
)
Description:
Honor cache_dir
Filename:
MIME Type:
Creator:
Philipp Hahn
Created:
2012-05-29 14:30 CEST
Size:
4.29 KB
patch
obsolete
>From 434a393edd3a36ba3ff9d51ed4f4a0f08a5b461f Mon Sep 17 00:00:00 2001 >Message-Id: <434a393edd3a36ba3ff9d51ed4f4a0f08a5b461f.1338294098.git.hahn@univention.de> >In-Reply-To: <ccdba1cd10f4c19ed93a761f31af2c71ef47d86d.1338294098.git.hahn@univention.de> >References: <ccdba1cd10f4c19ed93a761f31af2c71ef47d86d.1338294098.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Tue, 29 May 2012 12:14:42 +0200 >Subject: [PATCH 2/4] Ticket #2012050221003422: Honor cache_dir >Organization: Univention GmbH, Bremen, Germany > >cache_dir can be changed using the command line options, but the check >for a bad_cache is done before that. > >Move the check for a bad cache after parsing the command line options. >--- > .../src/cache_lowlevel.c | 5 ++++- > .../src/cache_lowlevel.h | 2 ++ > .../univention-directory-listener/src/handlers.c | 1 - > .../univention-directory-listener/src/main.c | 11 +++++++---- > 4 files changed, 13 insertions(+), 6 deletions(-) > >diff --git a/branches/ucs-3.0/ucs/management/univention-directory-listener/src/cache_lowlevel.c b/branches/ucs-3.0/ucs/management/univention-directory-listener/src/cache_lowlevel.c >index 4df9e5a..c48cc2d 100644 >--- a/branches/ucs-3.0/ucs/management/univention-directory-listener/src/cache_lowlevel.c >+++ b/branches/ucs-3.0/ucs/management/univention-directory-listener/src/cache_lowlevel.c >@@ -199,6 +199,7 @@ int parse_entry(void *data, u_int32_t size, CacheEntry *entry) > void *key_data, *data_data; > u_int32_t key_size, data_size; > u_int32_t pos=0; >+ char *f; > > entry->attributes=NULL; > entry->attribute_count=0; >@@ -260,10 +261,12 @@ int parse_entry(void *data, u_int32_t size, CacheEntry *entry) > univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "first 100 bytes of current entry:"); > hex_dump(UV_DEBUG_ERROR, data, pos, pos+1000 > size ? size-pos : 1000); > >- if ((file=fopen("/var/lib/univention-directory-listener/bad_cache", "w")) != NULL) { >+ if (asprintf(&f, "%s/bad_cache", cache_dir) < 0) abort(); >+ if ((file = fopen(f, "w")) != NULL) { > fprintf(file, "Check log file"); > fclose(file); > } >+ free(f); > > return -1; > } >diff --git a/branches/ucs-3.0/ucs/management/univention-directory-listener/src/cache_lowlevel.h b/branches/ucs-3.0/ucs/management/univention-directory-listener/src/cache_lowlevel.h >index bd41856..b1fd210 100644 >--- a/branches/ucs-3.0/ucs/management/univention-directory-listener/src/cache_lowlevel.h >+++ b/branches/ucs-3.0/ucs/management/univention-directory-listener/src/cache_lowlevel.h >@@ -35,6 +35,8 @@ > > #include "cache.h" > >+extern char *cache_dir; >+ > int unparse_entry (void **data, > u_int32_t *size, > CacheEntry *entry); >diff --git a/branches/ucs-3.0/ucs/management/univention-directory-listener/src/handlers.c b/branches/ucs-3.0/ucs/management/univention-directory-listener/src/handlers.c >index 3157c52..3ddeea0 100644 >--- a/branches/ucs-3.0/ucs/management/univention-directory-listener/src/handlers.c >+++ b/branches/ucs-3.0/ucs/management/univention-directory-listener/src/handlers.c >@@ -57,7 +57,6 @@ PyObject* handlers_argtuple(char *dn, CacheEntry *new, CacheEntry *old); > PyObject* handlers_argtuple_command(char *dn, CacheEntry *new, CacheEntry *old, char *command); > > extern int INIT_ONLY; >-extern char *cache_dir; > extern char **module_dirs; > extern int module_dir_count; > >diff --git a/branches/ucs-3.0/ucs/management/univention-directory-listener/src/main.c b/branches/ucs-3.0/ucs/management/univention-directory-listener/src/main.c >index 0ad06bc..baa7905 100644 >--- a/branches/ucs-3.0/ucs/management/univention-directory-listener/src/main.c >+++ b/branches/ucs-3.0/ucs/management/univention-directory-listener/src/main.c >@@ -335,10 +335,7 @@ int main(int argc, char* argv[]) > CacheMasterEntry master_entry; > #endif > struct stat stbuf; >- >- if (stat("/var/lib/univention-directory-listener/bad_cache", &stbuf) == 0) { >- exit(3); >- } >+ char *f = NULL; > > univention_debug_init("stderr", 1, 1); > >@@ -451,6 +448,12 @@ int main(int argc, char* argv[]) > } > } > >+ if (asprintf(&f, "%s/bad_cache", cache_dir) < 0) abort(); >+ if (stat(f, &stbuf) == 0) { >+ exit(3); >+ } >+ free(f); >+ > univention_debug_set_level(UV_DEBUG_LISTENER, debugging); > univention_debug_set_level(UV_DEBUG_LDAP, debugging); > univention_debug_set_level(UV_DEBUG_KERBEROS, debugging); >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 27314
: 4398