Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 172375 Details for
Bug 243221
rhds71 AD Directory sync fails if attribute 'initials' has too many characters in one of the entries
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
CVS Diffs
diffs.txt (text/plain), 9.04 KB, created by
Nathan Kinder
on 2007-08-23 20:31:21 UTC
(
hide
)
Description:
CVS Diffs
Filename:
MIME Type:
Creator:
Nathan Kinder
Created:
2007-08-23 20:31:21 UTC
Size:
9.04 KB
patch
obsolete
>Index: windows_protocol_util.c >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/windows_protocol_util.c,v >retrieving revision 1.27 >diff -u -5 -t -r1.27 windows_protocol_util.c >--- windows_protocol_util.c 10 Nov 2006 23:45:17 -0000 1.27 >+++ windows_protocol_util.c 23 Aug 2007 19:06:36 -0000 >@@ -1313,10 +1313,37 @@ > slapi_attr_get_type( attr, &type ); > slapi_attr_get_valueset(attr,&vs); > > if ( is_straight_mapped_attr(type,is_user,is_nt4) ) > { >+ /* The initials attribute is a special case. AD has a constraint >+ * that limits the value length. If we're sending a change to >+ * the initials attribute to AD, we trim if neccessary. >+ */ >+ if (0 == slapi_attr_type_cmp(type, "initials", SLAPI_TYPE_CMP_SUBTYPE)) { >+ int i = 0; >+ const char *initials_value = NULL; >+ Slapi_Value *value = NULL; >+ >+ i = slapi_valueset_first_value(vs,&value); >+ while (i >= 0) { >+ initials_value = slapi_value_get_string(value); >+ >+ /* If > AD_INITIALS_LENGTH, trim the value */ >+ if (strlen(initials_value) > AD_INITIALS_LENGTH) { >+ char *new_initials = PL_strndup(initials_value, AD_INITIALS_LENGTH); >+ /* the below hands off memory */ >+ slapi_value_set_string_passin(value, new_initials); >+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, >+ "%s: windows_create_remote_entry: " >+ "Trimming initials attribute to %d characters.\n", >+ agmt_get_long_name(prp->agmt), AD_INITIALS_LENGTH); >+ } >+ >+ i = slapi_valueset_next_value(vs, i, &value); >+ } >+ } > /* copy over the attr values */ > slapi_entry_add_valueset(new_entry,type,vs); > } else > { > char *new_type = NULL; >@@ -1459,11 +1486,30 @@ > char *attr_type = mod->mod_type; > int mapdn = 0; > > /* Check to see if this attribute is passed through */ > if (is_straight_mapped_attr(attr_type,is_user,is_nt4)) { >- /* If so then just copy over the mod */ >+ /* The initials attribute is a special case. AD has a constraint >+ * that limits the value length. If we're sending a change to >+ * the initials attribute to AD, we trim if neccessary. >+ */ >+ if (0 == slapi_attr_type_cmp(attr_type, "initials", SLAPI_TYPE_CMP_SUBTYPE)) { >+ int i; >+ for (i = 0; mod->mod_bvalues[i] != NULL; i++) { >+ /* If > AD_INITIALS_LENGTH, trim the value */ >+ if (mod->mod_bvalues[i]->bv_len > AD_INITIALS_LENGTH) { >+ mod->mod_bvalues[i]->bv_val[AD_INITIALS_LENGTH] = '\0'; >+ mod->mod_bvalues[i]->bv_len = AD_INITIALS_LENGTH; >+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, >+ "%s: windows_map_mods_for_replay: " >+ "Trimming initials attribute to %d characters.\n", >+ agmt_get_long_name(prp->agmt), AD_INITIALS_LENGTH); >+ } >+ } >+ } >+ >+ /* copy over the mod */ > slapi_mods_add_modbvps(&mapped_smods,mod->mod_op,attr_type,mod->mod_bvalues); > } else > { > char *mapped_type = NULL; > /* Check if this mod has its attribute type mapped */ >@@ -1519,13 +1565,16 @@ > /* Extract the mods for the caller */ > *returned_mods = slapi_mods_get_ldapmods_passout(&mapped_smods); > LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_map_mods_for_replay\n", 0, 0, 0 ); > } > >-/* Returns non-zero if the attribute value sets are identical */ >-static int >-attr_compare_equal(Slapi_Attr *a, Slapi_Attr *b) >+ >+/* Returns non-zero if the attribute value sets are identical. If you want to >+ * compare the entire attribute value, set n to 0. You can compare only the >+ * first n characters of the values by passing in the legth as n. */ >+static int >+attr_compare_equal(Slapi_Attr *a, Slapi_Attr *b, int n) > { > /* For now only handle single values */ > Slapi_Value *va = NULL; > Slapi_Value *vb = NULL; > int num_a = 0; >@@ -1533,27 +1582,29 @@ > int match = 1; > > slapi_attr_get_numvalues(a,&num_a); > slapi_attr_get_numvalues(b,&num_b); > >- if (num_a == num_b) >- { >+ if (num_a == num_b) { > slapi_attr_first_value(a, &va); > slapi_attr_first_value(b, &vb); > >- if (va->bv.bv_len == vb->bv.bv_len) >- { >- if (0 != memcmp(va->bv.bv_val,vb->bv.bv_val,va->bv.bv_len)) >- { >+ /* If either val is less than n, then check if the length, then values are >+ * equal. If both are n or greater, then only compare the first n chars. >+ * If n is 0, then just compare the entire attribute. */ >+ if ((va->bv.bv_len < n) || (vb->bv.bv_len < n) || (n == 0)) { >+ if (va->bv.bv_len == vb->bv.bv_len) { >+ if (0 != memcmp(va->bv.bv_val, vb->bv.bv_val, va->bv.bv_len)) { >+ match = 0; >+ } >+ } else { > match = 0; > } >- } else >- { >+ } else if (0 != memcmp(va->bv.bv_val, vb->bv.bv_val, n)) { > match = 0; > } >- } else >- { >+ } else { > match = 0; > } > return match; > } > >@@ -2552,11 +2603,21 @@ > /* Is the attribute present on the local entry ? */ > if (is_present_local && !is_guid) > { > if (!mapdn) > { >- int values_equal = attr_compare_equal(attr,local_attr); >+ int values_equal = 0; >+ >+ /* AD has a legth contraint on the initials attribute, >+ * so treat is as a special case. */ >+ if (0 == slapi_attr_type_cmp(type,"initials",SLAPI_TYPE_CMP_SUBTYPE) && !to_windows) { >+ values_equal = attr_compare_equal(attr, local_attr, AD_INITIALS_LENGTH); >+ } else { >+ /* Compare the entire attribute values */ >+ values_equal = attr_compare_equal(attr, local_attr, 0); >+ } >+ > /* If it is then we need to replace the local values with the remote values if they are different */ > if (!values_equal) > { > slapi_log_error(SLAPI_LOG_REPL, windows_repl_plugin_name, > "windows_generate_update_mods: %s, %s : values are different\n", slapi_sdn_get_dn(slapi_entry_get_sdn_const(local_entry)), local_type); >Index: windowsrepl.h >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/windowsrepl.h,v >retrieving revision 1.9 >diff -u -5 -t -r1.9 windowsrepl.h >--- windowsrepl.h 10 Nov 2006 23:45:17 -0000 1.9 >+++ windowsrepl.h 23 Aug 2007 19:06:36 -0000 >@@ -95,6 +95,8 @@ > 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" >+/* Used to work around contrained attribute legth for initials on AD */ >+#define AD_INITIALS_LENGTH 6 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 243221
: 172375