summaryrefslogtreecommitdiff
path: root/plugin/autoserial.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/autoserial.c')
-rw-r--r--plugin/autoserial.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/plugin/autoserial.c b/plugin/autoserial.c
index d10f8a5..16af5d7 100644
--- a/plugin/autoserial.c
+++ b/plugin/autoserial.c
@@ -18,12 +18,12 @@
* DECLARATIONS
*/
-/* TODO: Fill these in from settings */
static const char *dnsserial_soa_attribute = "sOARecord";
static const char *dnsserial_soa_base = "";
static Slapi_Mutex *dnsserial_mutex = NULL;
static strset *dnsserial_soa_cache = NULL;
+static int dnsserial_enable = 0;
/* ---------------------------------------------------------------------------------
* MEMORY ALLOCATION
@@ -389,6 +389,9 @@ change_soa_attribute (const char *dn, const char *soa_old, const char *soa_new)
return -1;
}
+ /* Call the dns notify code, and note that we've changed a sOARecord */
+ dnsnotify_post_modify (dn, mods);
+
trace ("success");
return 0;
}
@@ -433,6 +436,9 @@ autoserial_post_delete (const char *dn)
return_if_fail (dn && dn[0]);
+ if (!dnsserial_enable)
+ return;
+
/* A DN that is an SOA? */
if (present_in_soa_cache (dn)) {
remove_from_soa_cache (dn);
@@ -455,6 +461,9 @@ autoserial_post_modify (const char *dn, LDAPMod **mods)
return_if_fail (dn && dn[0]);
+ if (!dnsserial_enable)
+ return;
+
/* Add or remove from cache as appropriate */
soa = load_soa_attribute(dn);
if (soa) {
@@ -484,6 +493,9 @@ autoserial_post_modrdn (const char *odn, const char *ndn)
return_if_fail (odn && odn[0]);
return_if_fail (ndn && ndn[0]);
+ if (!dnsserial_enable)
+ return;
+
/* A DN that is an SOA? */
if (present_in_soa_cache (odn)) {
@@ -507,6 +519,9 @@ autoserial_post_add (const char *dn)
return_if_fail (dn && dn[0]);
+ if (!dnsserial_enable)
+ return;
+
/* A DN that is an SOA? */
soa = load_soa_attribute (dn);
if (soa) {
@@ -536,6 +551,10 @@ autoserial_config (const char *name, const char *value)
} else if (strcmp ("base-dn", name) == 0 && value) {
dnsserial_soa_base = value;
return 1;
+
+ } else if (strcmp ("enable-auto-serial", name) == 0 && !value) {
+ dnsserial_enable = 1;
+ return 1;
}
return 0;