[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fedora-directory-commits
Subject:    [389-commits] ldap/servers
From:       Mark Reynolds <mreynolds () fedoraproject ! org>
Date:       2012-10-19 18:57:49
Message-ID: 20121019185749.17BBCA1046 () fedorahosted ! org
[Download RAW message or body]

 ldap/servers/plugins/dna/dna.c     |    4 --
 ldap/servers/slapd/add.c           |   56 +++----------------------------------
 ldap/servers/slapd/opshared.c      |    8 +----
 ldap/servers/slapd/proto-slap.h    |    1 
 ldap/servers/slapd/slapi-private.h |    6 ---
 5 files changed, 8 insertions(+), 67 deletions(-)

New commits:
commit 680cd143107be34fadd55cd0c08097b7cae7afff
Author: Mark Reynolds <mreynolds@redhat.com>
Date:   Fri Oct 19 14:56:08 2012 -0400

    Revert "Ticket 495 - internalModifiersname not updated by DNA plugin"
    
    -> need to free plugin_dn
    
    This reverts commit 2bef7e7dad076549faa6af3f0d7e70294fe48a00.

diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index 2b56967..34d67ab 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -2853,8 +2853,6 @@ _dna_pre_op_add(Slapi_PBlock *pb, Slapi_Entry *e)
                                                  /* no need to dup */
                                                  DNA_NEEDS_UPDATE);
                 }
-                /* Update the internalModifiersname for this add op */
-                add_internal_modifiersname(pb, e);
 
                 /* Make sure we don't generate for this
                  * type again by keeping a list of types
@@ -3108,8 +3106,6 @@ _dna_pre_op_modify(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Mods *smods)
                                           /* no need to dup */
                                           DNA_NEEDS_UPDATE); 
                 }
-                /* Update the internalModifersname for this mod op */
-                modify_update_last_modified_attr(pb, smods);
 
                 /* Make sure we don't generate for this
                  * type again by keeping a list of types
diff --git a/ldap/servers/slapd/add.c b/ldap/servers/slapd/add.c
index c41c09f..d1d23b3 100644
--- a/ldap/servers/slapd/add.c
+++ b/ldap/servers/slapd/add.c
@@ -73,7 +73,7 @@
 /* Forward declarations */
 static int add_internal_pb (Slapi_PBlock *pb);
 static void op_shared_add (Slapi_PBlock *pb);
-static int add_created_attrs(Slapi_PBlock *pb, Slapi_Entry *e);
+static int add_created_attrs(Operation *op, Slapi_Entry *e);
 static int check_rdn_for_created_attrs(Slapi_Entry *e);
 static void handle_fast_add(Slapi_PBlock *pb, Slapi_Entry *entry);
 static int add_uniqueid (Slapi_Entry *e);
@@ -684,7 +684,7 @@ static void op_shared_add (Slapi_PBlock *pb)
 		/* can get lastmod only after backend is selected */
 		slapi_pblock_get(pb, SLAPI_BE_LASTMOD, &lastmod);
 
-		if (lastmod && add_created_attrs(pb, e) != 0)
+		if (lastmod && add_created_attrs(operation, e) != 0)
 		{
 			send_ldap_result(pb, LDAP_UNWILLING_TO_PERFORM, NULL,
 				"cannot insert computed attributes", 0, NULL);
@@ -797,25 +797,20 @@ done:
 }
 
 static int 
-add_created_attrs(Slapi_PBlock *pb, Slapi_Entry *e)
+add_created_attrs(Operation *op, Slapi_Entry *e)
 {
 	char   buf[20];
 	char   *binddn = NULL;
-	char   *plugin_dn = NULL;
 	struct berval	bv;
 	struct berval	*bvals[2];
 	time_t		curtime;
 	struct tm	ltm;
-	Operation *op;
-	struct slapdplugin *plugin = NULL;
-	struct slapi_componentid *cid = NULL;
 	slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
 
 	LDAPDebug(LDAP_DEBUG_TRACE, "add_created_attrs\n", 0, 0, 0);
 
 	bvals[0] = &bv;
 	bvals[1] = NULL;
-	slapi_pblock_get(pb, SLAPI_OPERATION, &op);
 	
 	if(slapdFrontendConfig->plugin_track){
 		/* plugin bindDN tracking is enabled, grab the dn from thread local storage */
@@ -823,21 +818,8 @@ add_created_attrs(Slapi_PBlock *pb, Slapi_Entry *e)
 			bv.bv_val = "";
 			bv.bv_len = strlen(bv.bv_val);
 		} else {
-			slapi_pblock_get (pb, SLAPI_PLUGIN_IDENTITY, &cid);
-			if (cid){
-				plugin=(struct slapdplugin *) cid->sci_plugin;
-			} else {
-				slapi_pblock_get (pb, SLAPI_PLUGIN, &plugin);
-			}
-			if(plugin)
-				plugin_dn = plugin_get_dn (plugin);
-			if(plugin_dn){
-				bv.bv_val = plugin_dn;
-				bv.bv_len = strlen(bv.bv_val);
-			} else {
-				bv.bv_val = (char*)slapi_sdn_get_dn(&op->o_sdn);
-				bv.bv_len = strlen(bv.bv_val);
-			}
+			bv.bv_val = (char*)slapi_sdn_get_dn(&op->o_sdn);
+			bv.bv_len = strlen(bv.bv_val);
 		}
 		slapi_entry_attr_replace(e, "internalCreatorsName", bvals);
 		slapi_entry_attr_replace(e, "internalModifiersName", bvals);
@@ -1041,31 +1023,3 @@ check_oc_subentry(Slapi_Entry *e, struct berval	**vals, char *normtype) {
   }
   return subentry;
 }
-
-/*
- *  Used by plugins that modify entries on add operations, otherwise the internalModifiersname
- *  would be incorrect.
- */
-void
-add_internal_modifiersname(Slapi_PBlock *pb, Slapi_Entry *e)
-{
-    slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-    struct slapi_componentid *cid = NULL;
-    struct slapdplugin *plugin = NULL;
-    char *plugin_dn = NULL;
-
-    if(slapdFrontendConfig->plugin_track){
-        /* plugin bindDN tracking is enabled, grab the bind dn from thread local storage */
-        slapi_pblock_get (pb, SLAPI_PLUGIN_IDENTITY, &cid);
-        if (cid){
-           plugin=(struct slapdplugin *) cid->sci_plugin;
-        } else {
-           slapi_pblock_get (pb, SLAPI_PLUGIN, &plugin);
-        }
-        if(plugin)
-            plugin_dn = plugin_get_dn (plugin);
-        if(plugin_dn){
-            slapi_entry_attr_set_charptr(e, "internalModifiersname", plugin_dn);
-        }
-    }
-}
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 4a6ca44..019fe20 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -135,8 +135,7 @@ do_ps_service(Slapi_Entry *e, Slapi_Entry *eprev, ber_int_t chgtype, ber_int_t c
     (ps_service_fn)(e, eprev, chgtype, chgnum);
 }
 
-void
-modify_update_last_modified_attr(Slapi_PBlock *pb, Slapi_Mods *smods)
+void modify_update_last_modified_attr(Slapi_PBlock *pb, Slapi_Mods *smods)
 {
     char        buf[20];
     char        *plugin_dn = NULL;
@@ -163,11 +162,8 @@ modify_update_last_modified_attr(Slapi_PBlock *pb, Slapi_Mods *smods)
             bv.bv_len = strlen(bv.bv_val);
         } else {
             slapi_pblock_get (pb, SLAPI_PLUGIN_IDENTITY, &cid);
-            if (cid){
+            if (cid)
                 plugin=(struct slapdplugin *) cid->sci_plugin;
-            } else {
-                slapi_pblock_get (pb, SLAPI_PLUGIN, &plugin);
-            }
             if(plugin)
                 plugin_dn = plugin_get_dn (plugin);
             if(plugin_dn){
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 19c06a2..905b0f4 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -1290,6 +1290,7 @@ void set_config_params (Slapi_PBlock *pb);
 /* set parameters common for all internal operations */
 void set_common_params (Slapi_PBlock *pb);
 void do_ps_service(Slapi_Entry *e, Slapi_Entry *eprev, ber_int_t chgtype, ber_int_t chgnum);
+void modify_update_last_modified_attr(Slapi_PBlock *pb, Slapi_Mods *smods);
 
 /*
  * debugdump.cpp
diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h
index 3ee1755..6c2781c 100644
--- a/ldap/servers/slapd/slapi-private.h
+++ b/ldap/servers/slapd/slapi-private.h
@@ -1252,12 +1252,6 @@ int slapi_add_internal_attr_syntax( const char *name, const char *oid, const cha
 void pw_exp_init ( void );
 int pw_copy_entry_ext(Slapi_Entry *src_e, Slapi_Entry *dest_e);
 
-/* op_shared.c */
-void modify_update_last_modified_attr(Slapi_PBlock *pb, Slapi_Mods *smods);
-
-/* add.c */
-void add_internal_modifiersname(Slapi_PBlock *pb, Slapi_Entry *e);
-
 #ifdef __cplusplus
 }
 #endif


--
389 commits mailing list
389-commits@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/389-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic