Univention Bugzilla – Bug 29964
UCR C lib does not support different UCR layers
Last modified: 2013-11-19 06:41:18 CET
Initially watched with UCS 2.4 at Ticket #2013010421000598 - but seems to be also the case in UCS 3.0 and 3.1: The listener uses the method "univention_config_get_string()" from config.c lib of univention-config-registry. This method only looks in "/etc/univention/base.conf". The listener should use the effective variable values (i.e. scope ldap if existing).
The listener uses the C lib of UCR. The C lib doesn't support the different layers.
The C library has been adjusted to consider the force, schedule and ldap layers before consulting the normal layer. I only changed the "get" function(s). Since frontend.py does not consider the "custom" layer (environment variable "UNIVENTION_BASECONFIG") the C-library also doesn't, to keep results comparable.
> Modified: branches/ucs-3.2/ucs-3.2-0/base/univention-config-registry/lib/config.c (42903 => 42904) ... > +const char *SCOPES[] = { ... > +const char *BASES[] = { Please prefix with "static" to limit the availability of those two declaration to the scope of this file. Otherwise they are exported and pollute the name space of all programs using this lib (not many). The names are way too generic for that. otherwise prefix them with "univention_config_". Otherwise this in an ABI change, which requires configure.ac and debian/libunivention-config0.symbols to be updated: > --- debian/libunivention-config0.symbols > (libunivention-config0_9.0.3-3_amd64) +++ dpkg-gensymbolsTRoxCZ > 2013-08-05 07:24:27.607999997 +0200 @@ -1,4 +1,6 @@ > > libuniventionconfig.so.0 libunivention-config0 #MINVER# > > + BASES@Base 9.0.3-3 > + SCOPES@Base 9.0.3-3 > > univention_config_get_int@Base 5.0.0 > univention_config_get_long@Base 5.0.0 > univention_config_get_string@Base 5.0.0 LIB_CURRENT=0 → 1 LIB_REVISION=1 → 0 LIB_AGE=0 → 1 (The API was changed in a forward-compatible way:: programs linked with the old version still work (LIB_CURRENT-LIB_DELTA=const), but programs linked to the new version might not work with the old version (LIB_CURRENT++)) While updating test/clib.c I also noticed that the code was and is broken: The last entry in /etc/univention/base*.conf is NOT terminated by a new-line, so the code in lib/config.c:90 > ret = strndup(line + len, strlen(line) - len - 1 ); /* no newline */ strips the last character: > should=--ldap-policy is=--ldap-polic Notice the missing 'y'. A hex-dump of /etc/univention/base-ldap.conf shows this: # xxd /etc/univention/base-ldap.conf 0000000: 2320 756e 6976 656e 7469 6f6e 5f20 6261 # univention_ ba 0000010: 7365 2e63 6f6e 660a 0a74 6573 742f 636c se.conf..test/cl 0000020: 6962 3a20 2d2d 6c64 6170 2d70 6f6c 6963 ib: --ldap-polic 0000030: 79 y Also no '0a' = '\n' at the end. The equivalent of Pythons string.rstrip() is needed instead of the unconditional -1.
Created attachment 5354 [details] Test case and rstip() implementation
Patch applied and rebuilt.
OK: univention_config_get_string() now honors the layers OK: UCS-3.1-1 → UCS-3.2~ OK: svn42904,42905,42907,42984 OK: ./test/clib OK: ucs-test 09_ucr/50layer-priority OK: UCS 3.2 Autotest MultiEnv OK: ChangeLog
UCS 3.2 has been released: http://docs.univention.de/release-notes-3.2-en.html http://docs.univention.de/release-notes-3.2-de.html If this error occurs again, please use "Clone This Bug".