summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-rw-r--r--plugin/plugin.c49
-rw-r--r--plugin/plugin.h4
2 files changed, 8 insertions, 45 deletions
diff --git a/plugin/plugin.c b/plugin/plugin.c
index 76a493d..63158a3 100644
--- a/plugin/plugin.c
+++ b/plugin/plugin.c
@@ -148,47 +148,12 @@ lowercase (char *data)
* OPERATIONS
*/
-static char*
-dn_build_normalize (const char *dn, const char *rdn)
-{
- char *result;
- Slapi_DN *sdn;
- Slapi_DN *parent;
- Slapi_RDN *srdn;
-
- /* Get the parent of the dn */
- sdn = slapi_sdn_new_dn_byval (dn);
- return_val_if_fail (sdn, NULL);
- parent = slapi_sdn_new ();
- slapi_sdn_get_parent (sdn, parent);
-
- /* Add the rdn to the parent */
- srdn = slapi_rdn_new_dn (rdn);
- return_val_if_fail (srdn, NULL);
- slapi_sdn_add_rdn (parent, srdn);
-
- /* Get the result out */
- result = (char*)slapi_sdn_get_dn (parent);
- return_val_if_fail (result, NULL);
-
- /* Normalize the result */
- result = slapi_ch_strdup (result);
- slapi_dn_normalize_case (result);
-
- slapi_sdn_free (&sdn);
- slapi_rdn_free (&srdn);
- slapi_sdn_free (&parent);
-
- trace (result);
- return result;
-}
-
static int
pre_modify (Slapi_PBlock *pb)
{
LDAPMod **mods;
char *dn;
- int rc, code;
+ int rc;
return_val_if_fail (pb, -1);
@@ -202,7 +167,7 @@ pre_modify (Slapi_PBlock *pb)
return_val_if_fail (rc >= 0 && mods, -1);
/* Send off to components */
- rc = serial_pre_modify (dn, mods);
+ rc = suffix_pre_modify (dn, mods);
slapi_ch_free_string (&dn);
return rc;
@@ -229,7 +194,7 @@ pre_add (Slapi_PBlock *pb)
slapi_dn_normalize_case (dn);
/* Send off to components */
- rc = serial_post_add (dn);
+ rc = suffix_pre_add (dn);
slapi_ch_free_string (&dn);
return rc;
@@ -308,15 +273,13 @@ plugin_init (Slapi_PBlock *pb)
}
/* Setup the entry add/mobify functions */
- if (slapi_pblock_set (pb, SLAPI_PLUGIN_PRE_ADD_FN, (void*)post_add) != 0 ||
- slapi_pblock_set (pb, SLAPI_PLUGIN_PRE_MODIFY_FN, (void*)post_modify) != 0) {
+ if (slapi_pblock_set (pb, SLAPI_PLUGIN_PRE_ADD_FN, (void*)pre_add) != 0 ||
+ slapi_pblock_set (pb, SLAPI_PLUGIN_PRE_MODIFY_FN, (void*)pre_modify) != 0) {
log_plugin ("error registering plugin hooks");
return -1;
}
-#ifdef _DEBUG
- log_trace ("%s initialized", PLUGIN_NAME);
-#endif
+ trace (PLUGIN_NAME " initialized");
return 0;
}
diff --git a/plugin/plugin.h b/plugin/plugin.h
index cdd15ad..6ca89cf 100644
--- a/plugin/plugin.h
+++ b/plugin/plugin.h
@@ -86,7 +86,7 @@ void lowercase (char *data);
int suffix_init (void);
void suffix_destroy (void);
int suffix_config (const char *name, const char *value);
-void suffix_pre_add (const char *dn);
-void suffix_pre_modify (const char *dn, LDAPMod **mods);
+int suffix_pre_add (const char *dn);
+int suffix_pre_modify (const char *dn, LDAPMod **mods);
#endif /*PLUGIN_H_*/