diff options
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/autoserial.c | 26 |
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 |