49086: Target spec and target address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

While looking into the failure of test 48272 (addn), I realised that we
were using both target_address and target_spec in the operation struct.
The pblock is a bit inconsistent about their usage also.

I've attached a list of the places we use them. 

I think that this is a mistake, we really only need "one" target value
(probably target_spec). 

I want to propose that we drop target_address for target_spec, update
the pblock to use operation_set_target_spec as needed. 

However, I don't know the full history of these values, so I would like
your input to this design. Is there a difference between target_spec and
target_address?

Thanks,


-- 
Sincerely,

William Brown
Software Engineer
Red Hat, Brisbane
[william@rei 13:15] ~/development/389ds/ds I0> grep -r -n -e 'target_address' 
ldap/servers/plugins/replication/replutil.c:440:    if (op->target_address.uniqueid == NULL)
ldap/servers/plugins/replication/replutil.c:447:    if (op->target_address.sdn == NULL)
ldap/servers/plugins/replication/windows_inc_protocol.c:1099:    return (strcmp (op->target_address.uniqueid, START_ITERATION_ENTRY_UNIQUEID) == 0);
ldap/servers/plugins/replication/windows_inc_protocol.c:1341:							entry.op->target_address.uniqueid, csn_str,
ldap/servers/plugins/replication/windows_inc_protocol.c:1355:							entry.op->target_address.uniqueid, csn_str,
ldap/servers/plugins/replication/windows_inc_protocol.c:1366:							entry.op->target_address.uniqueid, csn_str,
ldap/servers/plugins/replication/windows_inc_protocol.c:1381:							entry.op->target_address.uniqueid, csn_str);
ldap/servers/plugins/replication/repl5_plugins.c:1136:			op_params->target_address.uniqueid = slapi_ch_strdup (uniqueid);
ldap/servers/plugins/replication/repl5_plugins.c:1167:					REPL_GET_DN(&op_params->target_address),
ldap/servers/plugins/replication/repl5_plugins.c:1168:					op_params->target_address.uniqueid,
ldap/servers/plugins/replication/repl5_plugins.c:1177:			slapi_ch_free((void**)&op_params->target_address.uniqueid);
ldap/servers/plugins/replication/repl5_plugins.c:1193:		const char *dn = op_params ? REPL_GET_DN(&op_params->target_address) : "unknown";
ldap/servers/plugins/replication/repl5_plugins.c:1194:		Slapi_DN *sdn = op_params ? (&op_params->target_address)->sdn : NULL;
ldap/servers/plugins/replication/repl5_plugins.c:1195:		char *uniqueid = op_params ? op_params->target_address.uniqueid : "unknown";
ldap/servers/plugins/replication/windows_protocol_util.c:1550:	local_dn = slapi_sdn_dup( op->target_address.sdn );
ldap/servers/plugins/replication/windows_protocol_util.c:1559:		rc = windows_get_local_entry_by_uniqueid(prp, op->target_address.uniqueid, &local_entry, 0);
ldap/servers/plugins/replication/windows_protocol_util.c:1561:		rc = windows_get_local_tombstone_by_uniqueid(prp, op->target_address.uniqueid, &local_entry);
ldap/servers/plugins/replication/windows_protocol_util.c:1570:				  op->target_address.uniqueid, &local_entry, 1 /* is_global */);
ldap/servers/plugins/replication/windows_protocol_util.c:1577:					REPL_GET_DN(&op->target_address));
ldap/servers/plugins/replication/windows_protocol_util.c:1590:					REPL_GET_DN(&op->target_address));
ldap/servers/plugins/replication/windows_protocol_util.c:1596:					REPL_GET_DN(&op->target_address), "ours");
ldap/servers/plugins/replication/windows_protocol_util.c:1615:		REPL_GET_DN(&op->target_address), is_ours ? "ours" : "not ours", 
ldap/servers/plugins/replication/windows_protocol_util.c:1629:				REPL_GET_DN(&op->target_address),
ldap/servers/plugins/replication/windows_protocol_util.c:1637:			REPL_GET_DN(&op->target_address), slapi_sdn_get_dn(remote_dn));
ldap/servers/plugins/replication/repl5_inc_protocol.c:1339:	if (create_NSDS50ReplUpdateInfoControl(op->target_address.uniqueid,
ldap/servers/plugins/replication/repl5_inc_protocol.c:1353:							op2string(op->operation_type), REPL_GET_DN(&op->target_address),
ldap/servers/plugins/replication/repl5_inc_protocol.c:1387:										REPL_GET_DN(&op->target_address),
ldap/servers/plugins/replication/repl5_inc_protocol.c:1392:					return_value = conn_send_add(prp->conn, REPL_GET_DN(&op->target_address),
ldap/servers/plugins/replication/repl5_inc_protocol.c:1412:									REPL_GET_DN(&op->target_address),
ldap/servers/plugins/replication/repl5_inc_protocol.c:1417:				return_value = conn_send_modify(prp->conn, REPL_GET_DN(&op->target_address),
ldap/servers/plugins/replication/repl5_inc_protocol.c:1422:			return_value = conn_send_delete(prp->conn, REPL_GET_DN(&op->target_address),
ldap/servers/plugins/replication/repl5_inc_protocol.c:1427:			return_value = conn_send_rename(prp->conn, REPL_GET_DN(&op->target_address),
ldap/servers/plugins/replication/repl5_inc_protocol.c:1464:    return (strcmp (op->target_address.uniqueid, START_ITERATION_ENTRY_UNIQUEID) == 0);
ldap/servers/plugins/replication/repl5_inc_protocol.c:1810:							entry.op->target_address.uniqueid, csn_str,
ldap/servers/plugins/replication/repl5_inc_protocol.c:1824:							entry.op->target_address.uniqueid, csn_str,
ldap/servers/plugins/replication/repl5_inc_protocol.c:1835:							entry.op->target_address.uniqueid, csn_str,
ldap/servers/plugins/replication/repl5_inc_protocol.c:1850:							entry.op->target_address.uniqueid, csn_str);
ldap/servers/plugins/replication/repl5_inc_protocol.c:1861:					uniqueid = entry.op->target_address.uniqueid;
ldap/servers/plugins/replication/repl5_inc_protocol.c:1899:							entry.op->target_address.uniqueid, csn_str);
ldap/servers/plugins/replication/cl5_api.c:1057:                        op.operation_type, REPL_GET_DN(&op.target_address));
ldap/servers/plugins/replication/cl5_api.c:1077:                        op.operation_type, REPL_GET_DN(&op.target_address));
ldap/servers/plugins/replication/cl5_api.c:2158:	PR_ASSERT (op->target_address.uniqueid);
ldap/servers/plugins/replication/cl5_api.c:2162:	size += strlen (op->target_address.uniqueid) + 1;
ldap/servers/plugins/replication/cl5_api.c:2182:			size += REPL_GET_DN_LEN(&op->target_address) + 1;
ldap/servers/plugins/replication/cl5_api.c:2192:			size += REPL_GET_DN_LEN(&op->target_address) + 1;
ldap/servers/plugins/replication/cl5_api.c:2212:			size += REPL_GET_DN_LEN(&op->target_address) + 1;
ldap/servers/plugins/replication/cl5_api.c:2240:	_cl5WriteString (op->target_address.uniqueid, &pos);
ldap/servers/plugins/replication/cl5_api.c:2252:		case SLAPI_OPERATION_MODIFY:	_cl5WriteString (REPL_GET_DN(&op->target_address), &pos);
ldap/servers/plugins/replication/cl5_api.c:2256:		case SLAPI_OPERATION_MODRDN:	_cl5WriteString (REPL_GET_DN(&op->target_address), &pos);
ldap/servers/plugins/replication/cl5_api.c:2265:		case SLAPI_OPERATION_DELETE:	_cl5WriteString (REPL_GET_DN(&op->target_address), &pos);
ldap/servers/plugins/replication/cl5_api.c:2345:	_cl5ReadString (&op->target_address.uniqueid, &pos);	
ldap/servers/plugins/replication/cl5_api.c:2354:			op->target_address.sdn = slapi_sdn_new_dn_passin(rawDN);
ldap/servers/plugins/replication/cl5_api.c:2363:			op->target_address.sdn = slapi_sdn_new_dn_passin(rawDN);
ldap/servers/plugins/replication/cl5_api.c:2369:			op->target_address.sdn = slapi_sdn_new_dn_passin(rawDN);
ldap/servers/plugins/replication/cl5_api.c:2381:			op->target_address.sdn = slapi_sdn_new_dn_passin(rawDN);
ldap/servers/plugins/replication/cl5_api.c:4749:	len += LDIF_SIZE_NEEDED(strlen (T_UNIQUEIDSTR), strlen (op->target_address.uniqueid));
ldap/servers/plugins/replication/cl5_api.c:4774:			len += LDIF_SIZE_NEEDED(strlen (T_DNSTR), REPL_GET_DN_LEN(&op->target_address));
ldap/servers/plugins/replication/cl5_api.c:4785:			len += LDIF_SIZE_NEEDED(strlen (T_DNSTR), REPL_GET_DN_LEN(&op->target_address));
ldap/servers/plugins/replication/cl5_api.c:4801:			if (NULL == REPL_GET_DN(&op->target_address)) {
ldap/servers/plugins/replication/cl5_api.c:4806:			len += LDIF_SIZE_NEEDED(strlen (T_DNSTR), REPL_GET_DN_LEN(&op->target_address));
ldap/servers/plugins/replication/cl5_api.c:4829:	slapi_ldif_put_type_and_value_with_options(&buff, T_UNIQUEIDSTR, op->target_address.uniqueid, 
ldap/servers/plugins/replication/cl5_api.c:4830:							strlen (op->target_address.uniqueid), 0);
ldap/servers/plugins/replication/cl5_api.c:4844:			slapi_ldif_put_type_and_value_with_options(&buff, T_DNSTR, REPL_GET_DN(&op->target_address), 
ldap/servers/plugins/replication/cl5_api.c:4845:									REPL_GET_DN_LEN(&op->target_address), 0);
ldap/servers/plugins/replication/cl5_api.c:4850:			slapi_ldif_put_type_and_value_with_options(&buff, T_DNSTR, REPL_GET_DN(&op->target_address), 
ldap/servers/plugins/replication/cl5_api.c:4851:									REPL_GET_DN_LEN(&op->target_address), 0);
ldap/servers/plugins/replication/cl5_api.c:4868:			slapi_ldif_put_type_and_value_with_options(&buff, T_DNSTR, REPL_GET_DN(&op->target_address), 
ldap/servers/plugins/replication/cl5_api.c:4869:				REPL_GET_DN_LEN(&op->target_address), 0);
ldap/servers/plugins/replication/cl5_api.c:4937:			op->target_address.uniqueid = slapi_ch_strdup (value.bv_val);
ldap/servers/plugins/replication/cl5_api.c:4946:				op->target_address.sdn = slapi_sdn_new_dn_byval(rawDN);
ldap/servers/plugins/replication/cl5_api.c:4949:				op->target_address.sdn = slapi_sdn_new_dn_byval(value.bv_val);
ldap/servers/plugins/replication/cl5_api.c:5080:						REPL_GET_DN(&op->target_address));
ldap/servers/plugins/replication/cl5_api.c:5489:				csnStr, REPL_GET_DN(&op->target_address));
ldap/servers/plugins/replication/cl5_api.c:6690:    sdn = op->target_address.sdn;
ldap/servers/plugins/replication/repl5_replica.c:3805:    op_params.target_address.sdn = slapi_sdn_new_ndn_byval(START_ITERATION_ENTRY_DN);
ldap/servers/plugins/replication/repl5_replica.c:3806:    op_params.target_address.uniqueid = START_ITERATION_ENTRY_UNIQUEID;
ldap/servers/plugins/replication/repl5_replica.c:3814:    slapi_sdn_free(&op_params.target_address.sdn);
ldap/servers/plugins/replication/cl4_api.c:244:	    csn_as_string(op->csn,PR_FALSE,s), op->target_address.dn);
ldap/servers/plugins/replication/cl4_api.c:290:		slapi_entry_attr_set_charptr (e, attr_targetdn, op->target_address.dn);
ldap/servers/plugins/replication/cl4_api.c:348:			"Logging of changes is disabled.\n", csn_as_string(op->csn,PR_FALSE,s), op->target_address.dn, 
ldap/servers/plugins/replication/cl5_test.c:488:		op.target_address.uniqueid = uniqueid;
ldap/servers/plugins/replication/cl5_test.c:489:		op.target_address.dn = slapi_ch_strdup ("cn=entry,dc=example,dc=com");
ldap/servers/plugins/replication/cl5_test.c:508:			slapi_entry_set_dn (op.p.p_add.target_entry, slapi_ch_strdup(op.target_address.dn));
ldap/servers/plugins/replication/cl5_test.c:509:			slapi_entry_set_uniqueid (op.p.p_add.target_entry, slapi_ch_strdup(op.target_address.uniqueid));
ldap/servers/slapd/operation.c:467:	if(sop->target_address.uniqueid!=NULL)
ldap/servers/slapd/operation.c:469:		sop_new->target_address.uniqueid= slapi_ch_strdup(sop->target_address.uniqueid); 
ldap/servers/slapd/operation.c:471:	if(sop->target_address.sdn != NULL)
ldap/servers/slapd/operation.c:473:		sop_new->target_address.sdn = slapi_sdn_dup(sop->target_address.sdn);
ldap/servers/slapd/operation.c:528:		slapi_ch_free((void **)&sop->target_address.uniqueid);
ldap/servers/slapd/operation.c:529:		slapi_sdn_free(&sop->target_address.sdn);
ldap/servers/slapd/pblock.c:1145:			(*(entry_address **)value) = &(pblock->pb_op->o_params.target_address);
ldap/servers/slapd/pblock.c:1153:			Slapi_DN *sdn = pblock->pb_op->o_params.target_address.sdn;
ldap/servers/slapd/pblock.c:1168:			(*(Slapi_DN **)value) = pblock->pb_op->o_params.target_address.sdn;
ldap/servers/slapd/pblock.c:1178:			(*(char **)value) = pblock->pb_op->o_params.target_address.udn;
ldap/servers/slapd/pblock.c:1184:			(*(char **)value) = pblock->pb_op->o_params.target_address.uniqueid;
ldap/servers/slapd/pblock.c:2893:			Slapi_DN *sdn = pblock->pb_op->o_params.target_address.sdn;
ldap/servers/slapd/pblock.c:2895:			pblock->pb_op->o_params.target_address.sdn =
ldap/servers/slapd/pblock.c:2906:			pblock->pb_op->o_params.target_address.sdn = (Slapi_DN *)value;
ldap/servers/slapd/pblock.c:2916:			pblock->pb_op->o_params.target_address.udn = (char *)value;
ldap/servers/slapd/pblock.c:2922:			pblock->pb_op->o_params.target_address.uniqueid = (char *) value;
ldap/servers/slapd/slapi-private.h:541:	entry_address target_address;	/* address of target entry */
[william@rei 13:15] ~/development/389ds/ds I0> grep -r -n -e 'target_spec'   
ldap/servers/plugins/retrocl/retrocl.c:202:    operation_set_target_spec_str(op,RETROCL_CHANGELOG_DN);
ldap/servers/slapd/abandon.c:95:		ts = operation_get_target_spec (o);
ldap/servers/slapd/abandon.c:97:		  	operation_set_target_spec (pb->pb_op, ts);
ldap/servers/slapd/operation.c:222:		slapi_sdn_free(&(*op)->o_target_spec);
ldap/servers/slapd/operation.c:373:operation_get_target_spec (Slapi_Operation *op)
ldap/servers/slapd/operation.c:375:	return op->o_target_spec;
ldap/servers/slapd/operation.c:379:operation_set_target_spec (Slapi_Operation *op, const Slapi_DN *target_spec)
ldap/servers/slapd/operation.c:382:	PR_ASSERT (target_spec);
ldap/servers/slapd/operation.c:384:	op->o_target_spec = slapi_sdn_dup(target_spec);
ldap/servers/slapd/operation.c:388:operation_set_target_spec_str (Slapi_Operation *op, const char *target_spec)
ldap/servers/slapd/operation.c:392:	op->o_target_spec = slapi_sdn_new_dn_byval (target_spec);
ldap/servers/slapd/add.c:443:	operation_set_target_spec (operation, slapi_entry_get_sdn (e));
ldap/servers/slapd/add.c:509:		slapi_pblock_set(pb, SLAPI_TARGET_SDN, (void*)operation_get_target_spec (operation));
ldap/servers/slapd/opshared.c:371:  operation_set_target_spec (pb->pb_op, basesdn);
ldap/servers/slapd/opshared.c:592:              basesdn = operation_get_target_spec(pb->pb_op);
ldap/servers/slapd/opshared.c:595:              operation_set_target_spec (pb->pb_op, basesdn);
ldap/servers/slapd/proto-slap.h:897:Slapi_DN* operation_get_target_spec (Slapi_Operation *op);
ldap/servers/slapd/proto-slap.h:898:void operation_set_target_spec (Slapi_Operation *op, const Slapi_DN *target_spec);
ldap/servers/slapd/proto-slap.h:899:void operation_set_target_spec_str (Slapi_Operation *op, const char *target_spec);
ldap/servers/slapd/proto-slap.h:922:                                 Slapi_PBlock *pb, Slapi_DN *target_spec);
ldap/servers/slapd/saslbind.c:564:        operation_set_target_spec(op, sdn);
ldap/servers/slapd/bind.c:138:    operation_set_target_spec (pb->pb_op, sdn);
ldap/servers/slapd/compare.c:108:	operation_set_target_spec (pb->pb_op, &sdn);
ldap/servers/slapd/passwd_extop.c:723:	operation_set_target_spec (pb->pb_op, slapi_entry_get_sdn(targetEntry));
ldap/servers/slapd/plugin_internal_op.c:391:	operation_set_target_spec (op, sdn);
ldap/servers/slapd/delete.c:249:	operation_set_target_spec (operation, sdn);
ldap/servers/slapd/modify.c:667:	operation_set_target_spec (pb->pb_op, sdn);
ldap/servers/slapd/unbind.c:77:	operation_set_target_spec_str (operation, pb->pb_conn->c_dn);
ldap/servers/slapd/defbackend.c:239:            sdn = operation_get_target_spec(pb->pb_op);
ldap/servers/slapd/modrdn.c:556:	operation_set_target_spec (pb->pb_op, sdn);
ldap/servers/slapd/plugin.c:50:static PRBool plugin_matches_operation (Slapi_DN *target_spec, PluginTargetData *ptd, 
ldap/servers/slapd/plugin.c:3715:	Slapi_DN *target_spec;
ldap/servers/slapd/plugin.c:3734:	target_spec = operation_get_target_spec (pb->pb_op);
ldap/servers/slapd/plugin.c:3736:	rc = plugin_invoke_plugin_sdn (plugin, operation, pb, target_spec);
ldap/servers/slapd/plugin.c:3742:plugin_invoke_plugin_sdn (struct slapdplugin *plugin, int operation, Slapi_PBlock *pb, Slapi_DN *target_spec)
ldap/servers/slapd/plugin.c:3816:	if (plugin_matches_operation (target_spec, excludedPtd, bindop, isroot, islocal, method) == PR_TRUE) {
ldap/servers/slapd/plugin.c:3820:	return plugin_matches_operation (target_spec, ptd, bindop, isroot, islocal, method);
ldap/servers/slapd/plugin.c:3881:PRBool plugin_allow_internal_op (Slapi_DN *target_spec, struct slapdplugin *plugin)
ldap/servers/slapd/plugin.c:3897:	be = slapi_be_select(target_spec);
ldap/servers/slapd/plugin.c:3910:	if (plugin_matches_operation (target_spec, &config->plgc_excluded_target_subtrees,
ldap/servers/slapd/plugin.c:3915:	return plugin_matches_operation (target_spec, &config->plgc_target_subtrees,
ldap/servers/slapd/plugin.c:3919:static PRBool plugin_matches_operation (Slapi_DN *target_spec, PluginTargetData *ptd, 
ldap/servers/slapd/plugin.c:3932:        if (bindop && target_spec && (slapi_sdn_get_dn (target_spec) == NULL || 
ldap/servers/slapd/plugin.c:3933:            slapi_sdn_get_dn (target_spec)[0] == '\0'))
ldap/servers/slapd/plugin.c:3960:		if (slapi_sdn_issuffix (target_spec, subtree))
ldap/servers/slapd/plugin.c:4060:static void trace_plugin_invocation (Slapi_DN *target_spec, PluginTargetData *ptd, 
ldap/servers/slapd/plugin.c:4068:					 "Invocation parameters: target_spec = %s, bindop = %d, isroot=%d, islocal=%d\n"
ldap/servers/slapd/plugin.c:4070:					 slapi_sdn_get_ndn (target_spec), bindop, isroot, islocal, ptd->special_data[0],
ldap/servers/slapd/slap.h:1518:	Slapi_DN *o_target_spec; /* used to decide which plugins should be called for the operation */
ldap/servers/slapd/mapping_tree.c:2045:    operation_set_target_spec(op, sdn);
ldap/servers/slapd/mapping_tree.c:2175:    target_sdn = operation_get_target_spec (op);
ldap/servers/slapd/mapping_tree.c:2286:    target_sdn = operation_get_target_spec (op);
ldap/servers/slapd/mapping_tree.c:2458:    target_sdn = operation_get_target_spec (op);
ldap/servers/slapd/mapping_tree.c:2645:    target_sdn = operation_get_target_spec (op);
ldap/servers/slapd/mapping_tree.c:3168:    target_sdn = operation_get_target_spec (op);

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
389-devel mailing list -- 389-devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to 389-devel-leave@xxxxxxxxxxxxxxxxxxxxxxx

[Index of Archives]     [Fedora Directory Announce]     [Fedora Users]     [Older Fedora Users Mail]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Review]     [Fedora Art]     [Fedora Music]     [Fedora Packaging]     [CentOS]     [Fedora SELinux]     [Big List of Linux Books]     [KDE Users]     [Fedora Art]     [Fedora Docs]

  Powered by Linux