summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2008-06-19 00:57:37 +0000
committerStef Walter <stef@memberwebs.com>2008-06-19 00:57:37 +0000
commit270aa3c08a296dc5f628d2180f016d2a251be5e8 (patch)
treec7dd34b721712a7230f3279d65fd440ff5ca6429
parentc00cf65b1c29b836e0c95c28b22279157585a2e7 (diff)
Update serial on SOA entries if the SOA is not being modified
-rw-r--r--plugin/autoserial.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/plugin/autoserial.c b/plugin/autoserial.c
index 7380cef..b9fdeeb 100644
--- a/plugin/autoserial.c
+++ b/plugin/autoserial.c
@@ -459,6 +459,7 @@ autoserial_post_delete (const char *dn)
void
autoserial_post_modify (const char *dn, LDAPMod **mods)
{
+ LDAPMod **m, *mod;
char *soa, *soa_dn;
int present;
@@ -478,14 +479,29 @@ autoserial_post_modify (const char *dn, LDAPMod **mods)
present = 0;
}
- /* A DN underneath an SOA? */
- if (!present) {
+ /* A DN that is or is underneath an SOA? */
+ soa_dn = NULL;
+ if (present_in_soa_cache (dn))
+ soa_dn = slapi_ch_strdup (dn);
+ else
soa_dn = ancestor_in_soa_cache (dn);
- if (soa_dn) {
- increment_soa_dn (soa_dn);
- slapi_ch_free_string (&soa_dn);
+
+ /* Make sure they're not writing to the SOA */
+ if (soa_dn) {
+ for (m = mods; *m; ++m) {
+ mod = *m;
+ if (strcasecmp (mod->mod_type, dnsserial_soa_attribute) == 0) {
+ slapi_ch_free_string (&soa_dn);
+ soa_dn = NULL;
+ break;
+ }
}
}
+
+ if (soa_dn) {
+ increment_soa_dn (soa_dn);
+ slapi_ch_free_string (&soa_dn);
+ }
}
void