Re: [Freeipa-devel] [PATCH 0220] Move temporary files to /var/named/dyndb-ldap directory
On 18.2.2014 17:38, Nathaniel McCallum wrote: On Tue, 2014-02-18 at 09:58 +0100, Petr Spacek wrote: On 28.1.2014 16:45, Petr Spacek wrote: Hello, Move temporary files to /var/named/dyndb-ldap directory. This should make RPM packaging easier. This patch should go to master branch before 4.0 release. This version fixes packaging problems found by Tomas Hozza. ACK Pushed to master branch: 88d89bb9c6941321b57dadb59403c4cf975a2165 -- Petr^2 Spacek ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH 0220] Move temporary files to /var/named/dyndb-ldap directory
On 28.1.2014 16:45, Petr Spacek wrote: Hello, Move temporary files to /var/named/dyndb-ldap directory. This should make RPM packaging easier. This patch should go to master branch before 4.0 release. This version fixes packaging problems found by Tomas Hozza. -- Petr^2 Spacek From a52962e15968ff5cee893d6a9ba1987b0994071c Mon Sep 17 00:00:00 2001 From: Petr Spacek pspa...@redhat.com Date: Tue, 28 Jan 2014 16:30:09 +0100 Subject: [PATCH] Move temporary files to /var/named/dyndb-ldap directory. This should make RPM packaging easier. --- README | 7 --- contrib/bind-dyndb-ldap.spec | 6 ++ src/fs.c | 27 +++ src/fs.h | 2 +- src/ldap_helper.c| 7 --- src/zone_register.c | 2 +- 6 files changed, 43 insertions(+), 8 deletions(-) diff --git a/README b/README index 25f516c9bed9aeea0c547666e75aec3afa5112c4..b2c3653ef3ae653e4454ec43e341a220a4968e8f 100644 --- a/README +++ b/README @@ -259,7 +259,8 @@ verbose_checks (default no) debugging purposes. It could produce huge amount of log messages on a loaded system! -directory (default is current instance name from dynamic-db directive) +directory (default is + dyndb-ldap/current instance name from dynamic-db directive) Specifies working directory for plug-in. The path has to be writeable by named because plug-in will create sub-directory for each zone. These sub-directories will contain temporary files like zone dump, zone @@ -288,9 +289,9 @@ base for entries with object class idnsZone, for which the idnsZoneActive attribute is set to True. For each entry it will find, it will register a new zone with BIND. The LDAP back-end will keep each record it gets from LDAP in its memory. -Working directory for the plug-in will be /var/named/my_db_name/, +Working directory for the plug-in will be /var/named/dyndb-ldap/my_db_name/, so hypothetical zone example.com will use sub-directory -/var/named/my_db_name/example.com/. +/var/named/dyndb-ldap/my_db_name/example.com/. 5.3 Configuration in LDAP - diff --git a/contrib/bind-dyndb-ldap.spec b/contrib/bind-dyndb-ldap.spec index e28bf5195cd6bb3bed24d71d7c834c93cdf2df41..65a64120e8637ce2eda9c091231cbf5a19391da0 100644 --- a/contrib/bind-dyndb-ldap.spec +++ b/contrib/bind-dyndb-ldap.spec @@ -35,6 +35,7 @@ make %{?_smp_mflags} %install rm -rf %{buildroot} make install DESTDIR=%{buildroot} +mkdir -m 770 -p %{buildroot}/%{_localstatedir}/named/dyndb-ldap # Remove unwanted files rm %{buildroot}%{_libdir}/bind/ldap.la @@ -48,9 +49,14 @@ rm -rf %{buildroot} %files %defattr(-,root,root,-) %doc NEWS README COPYING doc/{example.ldif,schema} +%dir %{_localstatedir}/named/dyndb-ldap +%attr(770, root, named) %{_localstatedir}/named/dyndb-ldap %{_libdir}/bind/ldap.so %changelog +* Tue Jan 28 2014 Petr Spacek pspacek redhat com +- package /var/named/dyndb-ldap directory + * Mon Nov 14 2011 Adam Tkac atkac redhat com - specfile to build bind-dyndb-ldap diff --git a/src/fs.c b/src/fs.c index ba7003ced895e26b134421c055049e8b9f049fb3..44eebc141bb2a881c95c0f729271e6e1450c9cbe 100644 --- a/src/fs.c +++ b/src/fs.c @@ -28,6 +28,7 @@ #include isc/file.h #include isc/errno2result.h #include isc/result.h +#include isc/string.h #include isc/util.h #include log.h @@ -70,6 +71,32 @@ fs_dir_create(const char *dir_name) return result; } +/** + * Create directories specified by path (including all parents). + */ +isc_result_t +fs_dirs_create(const char *path) { + isc_result_t result = ISC_R_SUCCESS; + char curr_path[PATH_MAX + 1]; + char *end = NULL; + + CHECK(isc_string_copy(curr_path, PATH_MAX, path)); + + for (end = strchr(curr_path, '/'); + end != NULL; + end = strchr(end + 1, '/')) { + *end = '\0'; + if (strcmp(curr_path, ) != 0) + /* Absolute paths would have first component empty. */ + CHECK(fs_dir_create(curr_path)); + *end = '/'; + } + + +cleanup: + return result; +} + isc_result_t fs_file_remove(const char *file_name) { isc_result_t result; diff --git a/src/fs.h b/src/fs.h index b583d3be57b7e1582b61b2bf3554c5d5be805e18..341222dac1ce08e4d37bd10edb9a3838632a8c58 100644 --- a/src/fs.h +++ b/src/fs.h @@ -24,7 +24,7 @@ #include util.h isc_result_t ATTR_NONNULLS -fs_dir_create(const char *dir_name); +fs_dirs_create(const char *path); isc_result_t ATTR_NONNULLS fs_file_remove(const char *file_name); diff --git a/src/ldap_helper.c b/src/ldap_helper.c index 8e8bf4bdb4072e414f5212c6b5df429203e582de..b0dd3391f4dca88992ac7869b34d943a381d51be 100644 --- a/src/ldap_helper.c +++ b/src/ldap_helper.c @@ -372,9 +372,10 @@ validate_local_instance_settings(ldap_instance_t *inst, settings_set_t *set) { CHECK(str_new(inst-mctx, buff)); CHECK(setting_get_str(directory, inst-local_settings, dir_name)); dir_default = (strcmp(dir_name, ) == 0); - if (dir_default == ISC_TRUE) + if (dir_default == ISC_TRUE) { +
Re: [Freeipa-devel] [PATCH 0220] Move temporary files to /var/named/dyndb-ldap directory
On Tue, 2014-02-18 at 09:58 +0100, Petr Spacek wrote: On 28.1.2014 16:45, Petr Spacek wrote: Hello, Move temporary files to /var/named/dyndb-ldap directory. This should make RPM packaging easier. This patch should go to master branch before 4.0 release. This version fixes packaging problems found by Tomas Hozza. ACK ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
[Freeipa-devel] [PATCH 0220] Move temporary files to /var/named/dyndb-ldap directory
Hello, Move temporary files to /var/named/dyndb-ldap directory. This should make RPM packaging easier. This patch should go to master branch before 4.0 release. -- Petr^2 Spacek From 1811facb8c736ed4d6176c3524c0d56ce0c2b2f5 Mon Sep 17 00:00:00 2001 From: Petr Spacek pspa...@redhat.com Date: Tue, 28 Jan 2014 16:30:09 +0100 Subject: [PATCH] Move temporary files to /var/named/dyndb-ldap directory. This should make RPM packaging easier. --- README | 7 --- contrib/bind-dyndb-ldap.spec | 5 + src/fs.c | 27 +++ src/fs.h | 2 +- src/ldap_helper.c| 7 --- src/zone_register.c | 2 +- 6 files changed, 42 insertions(+), 8 deletions(-) diff --git a/README b/README index 25f516c9bed9aeea0c547666e75aec3afa5112c4..b2c3653ef3ae653e4454ec43e341a220a4968e8f 100644 --- a/README +++ b/README @@ -259,7 +259,8 @@ verbose_checks (default no) debugging purposes. It could produce huge amount of log messages on a loaded system! -directory (default is current instance name from dynamic-db directive) +directory (default is + dyndb-ldap/current instance name from dynamic-db directive) Specifies working directory for plug-in. The path has to be writeable by named because plug-in will create sub-directory for each zone. These sub-directories will contain temporary files like zone dump, zone @@ -288,9 +289,9 @@ base for entries with object class idnsZone, for which the idnsZoneActive attribute is set to True. For each entry it will find, it will register a new zone with BIND. The LDAP back-end will keep each record it gets from LDAP in its memory. -Working directory for the plug-in will be /var/named/my_db_name/, +Working directory for the plug-in will be /var/named/dyndb-ldap/my_db_name/, so hypothetical zone example.com will use sub-directory -/var/named/my_db_name/example.com/. +/var/named/dyndb-ldap/my_db_name/example.com/. 5.3 Configuration in LDAP - diff --git a/contrib/bind-dyndb-ldap.spec b/contrib/bind-dyndb-ldap.spec index e28bf5195cd6bb3bed24d71d7c834c93cdf2df41..4463c193027680c4a88eefd6b776cf44538ce3b4 100644 --- a/contrib/bind-dyndb-ldap.spec +++ b/contrib/bind-dyndb-ldap.spec @@ -48,9 +48,14 @@ rm -rf %{buildroot} %files %defattr(-,root,root,-) %doc NEWS README COPYING doc/{example.ldif,schema} +%dir /var/named/dyndb-ldap +%attr(770, root, named) /var/named/dyndb-ldap %{_libdir}/bind/ldap.so %changelog +* Tue Jan 28 2014 Petr Spacek pspacek redhat com +- package /var/named/dyndb-ldap directory + * Mon Nov 14 2011 Adam Tkac atkac redhat com - specfile to build bind-dyndb-ldap diff --git a/src/fs.c b/src/fs.c index ba7003ced895e26b134421c055049e8b9f049fb3..44eebc141bb2a881c95c0f729271e6e1450c9cbe 100644 --- a/src/fs.c +++ b/src/fs.c @@ -28,6 +28,7 @@ #include isc/file.h #include isc/errno2result.h #include isc/result.h +#include isc/string.h #include isc/util.h #include log.h @@ -70,6 +71,32 @@ fs_dir_create(const char *dir_name) return result; } +/** + * Create directories specified by path (including all parents). + */ +isc_result_t +fs_dirs_create(const char *path) { + isc_result_t result = ISC_R_SUCCESS; + char curr_path[PATH_MAX + 1]; + char *end = NULL; + + CHECK(isc_string_copy(curr_path, PATH_MAX, path)); + + for (end = strchr(curr_path, '/'); + end != NULL; + end = strchr(end + 1, '/')) { + *end = '\0'; + if (strcmp(curr_path, ) != 0) + /* Absolute paths would have first component empty. */ + CHECK(fs_dir_create(curr_path)); + *end = '/'; + } + + +cleanup: + return result; +} + isc_result_t fs_file_remove(const char *file_name) { isc_result_t result; diff --git a/src/fs.h b/src/fs.h index b583d3be57b7e1582b61b2bf3554c5d5be805e18..341222dac1ce08e4d37bd10edb9a3838632a8c58 100644 --- a/src/fs.h +++ b/src/fs.h @@ -24,7 +24,7 @@ #include util.h isc_result_t ATTR_NONNULLS -fs_dir_create(const char *dir_name); +fs_dirs_create(const char *path); isc_result_t ATTR_NONNULLS fs_file_remove(const char *file_name); diff --git a/src/ldap_helper.c b/src/ldap_helper.c index 8e8bf4bdb4072e414f5212c6b5df429203e582de..b0dd3391f4dca88992ac7869b34d943a381d51be 100644 --- a/src/ldap_helper.c +++ b/src/ldap_helper.c @@ -372,9 +372,10 @@ validate_local_instance_settings(ldap_instance_t *inst, settings_set_t *set) { CHECK(str_new(inst-mctx, buff)); CHECK(setting_get_str(directory, inst-local_settings, dir_name)); dir_default = (strcmp(dir_name, ) == 0); - if (dir_default == ISC_TRUE) + if (dir_default == ISC_TRUE) { + CHECK(str_cat_char(buff, dyndb-ldap/)); CHECK(str_cat_char(buff, inst-db_name)); - else + } else CHECK(str_cat_char(buff, dir_name)); if (str_buf(buff)[str_len(buff) - 1] != '/') @@ -388,7 +389,7 @@ validate_local_instance_settings(ldap_instance_t *inst, settings_set_t *set) { CHECK(setting_get_str(directory, inst-local_settings, dir_name)); /* Make sure that working