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 201401 Details for
Bug 299361
Sync total update doesn't handle initials and streetAddress properly
[?]
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), 13.93 KB, created by
Nathan Kinder
on 2007-09-20 22:21:25 UTC
(
hide
)
Description:
CVS Diffs
Filename:
MIME Type:
Creator:
Nathan Kinder
Created:
2007-09-20 22:21:25 UTC
Size:
13.93 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.33 >diff -u -5 -t -r1.33 windows_protocol_util.c >--- windows_protocol_util.c 17 Sep 2007 19:18:30 -0000 1.33 >+++ windows_protocol_util.c 20 Sep 2007 22:18:30 -0000 >@@ -2969,10 +2969,11 @@ > i = slapi_valueset_next_value(local_values,i,&lv); > } > return ret; > } > >+/* Generate the mods for an update in either direction. Be careful... the "remote" entry is the DS entry in the to_windows case, but the AD entry in the other case. */ > static int > windows_generate_update_mods(Private_Repl_Protocol *prp,Slapi_Entry *remote_entry,Slapi_Entry *local_entry, int to_windows, Slapi_Mods *smods, int *do_modify) > { > int retval = 0; > Slapi_Attr *attr = NULL; >@@ -3031,37 +3032,100 @@ > slapi_valueset_free(vs); > vs = NULL; > } > continue; > } >- slapi_entry_attr_find(local_entry,local_type,&local_attr); >+ >+ if (to_windows && (0 == slapi_attr_type_cmp(local_type, "streetAddress", SLAPI_TYPE_CMP_SUBTYPE))) { >+ slapi_entry_attr_find(local_entry,FAKE_STREET_ATTR_NAME,&local_attr); >+ } else { >+ slapi_entry_attr_find(local_entry,local_type,&local_attr); >+ } >+ > is_present_local = (NULL == local_attr) ? 0 : 1; > /* Is the attribute present on the local entry ? */ > if (is_present_local && !is_guid) > { > if (!mapdn) > { > 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) { >+ if (0 == slapi_attr_type_cmp(type, "initials", SLAPI_TYPE_CMP_SUBTYPE)) { > values_equal = attr_compare_equal(attr, local_attr, AD_INITIALS_LENGTH); >+ /* If we're getting a streetAddress (a fake attr name is used) from AD, then >+ * we just check if the value in AD is present in our entry in DS. In this >+ * case, attr is from the AD entry, and local_attr is from the DS entry. */ > } else if (0 == slapi_attr_type_cmp(type, FAKE_STREET_ATTR_NAME, SLAPI_TYPE_CMP_SUBTYPE) && !to_windows) { >- /* Need to check if attr is present in local_attr */ > values_equal = attr_compare_present(attr, local_attr); >+ /* If we are checking if we should send a street attribute to AD, then >+ * we want to first see if the AD entry already contains any street value >+ * that is present in the DS entry. In this case, attr is from the DS >+ * entry, and local_attr is from the AD entry. */ >+ } else if ((0 == slapi_attr_type_cmp(type, "street", SLAPI_TYPE_CMP_SUBTYPE) && to_windows)) { >+ values_equal = attr_compare_present(local_attr, attr); > } 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); >- slapi_mods_add_mod_values(smods,LDAP_MOD_REPLACE,local_type,valueset_get_valuearray(vs)); >+ "windows_generate_update_mods: %s, %s : values are different\n", >+ slapi_sdn_get_dn(slapi_entry_get_sdn_const(local_entry)), local_type); >+ >+ if ((0 == slapi_attr_type_cmp(local_type, "streetAddress", >+ SLAPI_TYPE_CMP_SUBTYPE) && to_windows)) { >+ /* streetAddress is single-valued in AD, so make >+ * sure we don't try to send more than one value. */ >+ if (slapi_valueset_count(vs) > 1) { >+ int i = 0; >+ const char *street_value = NULL; >+ Slapi_Value *value = NULL; >+ Slapi_Value *new_value = NULL; >+ >+ i = slapi_valueset_first_value(vs,&value); >+ if (i >= 0) { >+ /* Dup the first value, trash the valueset, then copy >+ * in the dup'd value. */ >+ new_value = slapi_value_dup(value); >+ slapi_valueset_done(vs); >+ /* The below hands off the memory to the valueset */ >+ slapi_valueset_add_value_ext(vs, new_value, SLAPI_VALUE_FLAG_PASSIN); >+ } >+ } >+ } else if ((0 == slapi_attr_type_cmp(local_type, "initials", >+ SLAPI_TYPE_CMP_SUBTYPE) && to_windows)) { >+ /* initials is constratined to a max length of >+ * 6 characters in AD, so trim the value if >+ * needed before sending. */ >+ 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_generate_update_mods: " >+ "Trimming initials attribute to %d characters.\n", >+ agmt_get_long_name(prp->agmt), AD_INITIALS_LENGTH); >+ } >+ >+ i = slapi_valueset_next_value(vs, i, &value); >+ } >+ } >+ slapi_mods_add_mod_values(smods,LDAP_MOD_REPLACE, >+ local_type,valueset_get_valuearray(vs)); > *do_modify = 1; > } else > { > slapi_log_error(SLAPI_LOG_REPL, windows_repl_plugin_name, > "windows_generate_update_mods: %s, %s : values are equal\n", slapi_sdn_get_dn(slapi_entry_get_sdn_const(local_entry)), local_type); >@@ -3123,10 +3187,57 @@ > slapi_valueset_free(mapped_values); > mapped_values = NULL; > } > } else > { >+ if ((0 == slapi_attr_type_cmp(local_type, "streetAddress", >+ SLAPI_TYPE_CMP_SUBTYPE) && to_windows)) { >+ /* streetAddress is single-valued in AD, so make >+ * sure we don't try to send more than one value. */ >+ if (slapi_valueset_count(vs) > 1) { >+ int i = 0; >+ const char *street_value = NULL; >+ Slapi_Value *value = NULL; >+ Slapi_Value *new_value = NULL; >+ >+ i = slapi_valueset_first_value(vs,&value); >+ if (i >= 0) { >+ /* Dup the first value, trash the valueset, then copy >+ * in the dup'd value. */ >+ new_value = slapi_value_dup(value); >+ slapi_valueset_done(vs); >+ /* The below hands off the memory to the valueset */ >+ slapi_valueset_add_value_ext(vs, new_value, SLAPI_VALUE_FLAG_PASSIN); >+ } >+ } >+ } else if ((0 == slapi_attr_type_cmp(local_type, "initials", >+ SLAPI_TYPE_CMP_SUBTYPE) && to_windows)) { >+ /* initials is constratined to a max length of >+ * 6 characters in AD, so trim the value if >+ * needed before sending. */ >+ 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_generate_update_mods: " >+ "Trimming initials attribute to %d characters.\n", >+ agmt_get_long_name(prp->agmt), AD_INITIALS_LENGTH); >+ } >+ >+ i = slapi_valueset_next_value(vs, i, &value); >+ } >+ } > slapi_mods_add_mod_values(smods,LDAP_MOD_ADD,local_type,valueset_get_valuearray(vs)); > } > } > *do_modify = 1; > }
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 299361
: 201401