From 3283d3ea13b72ff25ecf67972916ef82b83ab791 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 28 Jul 2009 23:01:13 +0000 Subject: Basic build working git-svn-id: http://internal-svn-server/svn/network/slapi-suffix@1509 96c7dce7-e4ff-0310-afa0-05b99c2e9643 --- Makefile.am | 2 +- configure.in | 3 --- plugin/plugin.c | 49 ++++++------------------------------------------- plugin/plugin.h | 4 ++-- 4 files changed, 9 insertions(+), 49 deletions(-) diff --git a/Makefile.am b/Makefile.am index 55b753d..4c3ee57 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ EXTRA_DIST = include -SUBDIRS = plugin doc +SUBDIRS = plugin dist-hook: rm -rf `find $(distdir)/ -name .svn` diff --git a/configure.in b/configure.in index 3d5c644..77eb121 100644 --- a/configure.in +++ b/configure.in @@ -94,10 +94,7 @@ fi AC_CONFIG_FILES([ Makefile - doc/Makefile plugin/Makefile - tests/Makefile - tools/Makefile ]) AC_OUTPUT 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_*/ -- cgit v1.2.3