Browse Source

Fix for #156449 : mangle 'street' attribute to defeat our schema aliasing it with 'streetaddress'

David Boreham 20 years ago
parent
commit
d723996cfb

+ 10 - 1
ldap/servers/plugins/replication/windows_connection.c

@@ -523,7 +523,16 @@ windows_LDAPMessage2Entry(LDAP * ld, LDAPMessage * msg, int attrsonly) {
 			} else 
 			{
 				struct  berval ** aVal = ldap_get_values_len( ld, msg, a);
-				slapi_entry_add_values( e, a, aVal);
+				char *type_to_use = NULL;
+				/* Work around the fact that we alias street and streetaddress, while Microsoft do not */
+				if (0 == strcasecmp(a,"streetaddress")) 
+				{
+					type_to_use = FAKE_STREET_ATTR_NAME;
+				} else
+				{
+					type_to_use = a;
+				}
+				slapi_entry_add_values( e, type_to_use, aVal);
                 
 				ldap_memfree(a);
 				ldap_value_free_len(aVal);

+ 2 - 2
ldap/servers/plugins/replication/windows_protocol_util.c

@@ -193,8 +193,8 @@ static windows_attribute_map user_attribute_map[] =
 	{ "maxStorage", "ntUserMaxStorage", bidirectional, always, normal},
 	{ "profilePath", "ntUserProfile", bidirectional, always, normal},
 	/* IETF schema has 'street' and 'streetaddress' as aliases, but Microsoft does not */
-	{ "street", "street", fromwindowsonly, always, normal},
 	{ "streetAddress", "street", towindowsonly, always, normal},
+	{ FAKE_STREET_ATTR_NAME, "street", fromwindowsonly, always, normal},
 	{ "userParameters", "ntUserParms", bidirectional, always, normal},
 	{ "userWorkstations", "ntUserWorkstations", bidirectional, always, normal},
     { "sAMAccountName", "ntUserDomainId", bidirectional, always, normal},
@@ -212,8 +212,8 @@ static windows_attribute_map group_attribute_map[] =
 	{ "groupType", "ntGroupType",  bidirectional, createonly, normal},
 	{ "sAMAccountName", "ntUserDomainId", bidirectional, always, normal},
 	/* IETF schema has 'street' and 'streetaddress' as aliases, but Microsoft does not */
-	{ "street", "street", fromwindowsonly, always, normal},
 	{ "streetAddress", "street", towindowsonly, always, normal},
+	{ FAKE_STREET_ATTR_NAME, "street", fromwindowsonly, always, normal},
     { "member", "uniquemember", bidirectional, always, dnmap},
 	{NULL, NULL, -1}
 };

+ 3 - 0
ldap/servers/plugins/replication/windowsrepl.h

@@ -90,3 +90,6 @@ ConnResult windows_conn_push_schema(Repl_Connection *conn, CSN **remotecsn);
 void windows_conn_set_timeout(Repl_Connection *conn, long timeout);
 void windows_conn_set_agmt_changed(Repl_Connection *conn);
 
+/* Used to work around a schema incompatibility between Microsoft and the IETF */
+#define FAKE_STREET_ATTR_NAME "in#place#of#streetaddress"
+