ldap/servers/plugins/uiduniq/7bit.c | 37 +++++++++---------------------------
1 file changed, 10 insertions(+), 27 deletions(-)
New commits:
commit fc67fb8a40a340b8f02e746f1446496d23a3b572
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Jun 23 14:59:04 2014 -0700
Revert "Ticket #47423 - 7-bit check plugin does not work for userpassword attribute"
This reverts commit 7e7a85f6fb74547f7d2af191db3b4608b39995ab.
This patch should not be in 389-ds-base-1.2.11 branch.
diff --git a/ldap/servers/plugins/uiduniq/7bit.c b/ldap/servers/plugins/uiduniq/7bit.c
index c98d660..f690b4e 100644
--- a/ldap/servers/plugins/uiduniq/7bit.c
+++ b/ldap/servers/plugins/uiduniq/7bit.c
@@ -218,8 +218,7 @@ preop_add(Slapi_PBlock *pb)
{
int result;
char *violated = NULL;
- char *pwd = NULL;
- char *origpwd = NULL;
+
#ifdef DEBUG
slapi_log_error(SLAPI_LOG_PLUGIN, plugin_name, "ADD begin\n");
#endif
@@ -237,14 +236,12 @@ preop_add(Slapi_PBlock *pb)
const char *dn;
Slapi_DN *sdn = NULL;
Slapi_Entry *e;
+ Slapi_Attr *attr;
char **firstSubtree;
char **subtreeDN;
int subtreeCnt;
int is_replicated_operation;
- struct berval *vals[2];
- struct berval val;
- vals[0] = &val;
- vals[1] = NULL;
+
/*
* Get the arguments
*/
@@ -291,26 +288,19 @@ preop_add(Slapi_PBlock *pb)
for (attrName = argv; strcmp(*attrName, ",") != 0; attrName++ )
{
/*
- * if the attribute is userpassword, check unhashed user password
+ * if the attribute is userpassword, check unhashed#user#password
* instead. "userpassword" is encoded; it will always pass the 7bit
* check.
*/
- char *attr_name = NULL;
- Slapi_Attr *attr = NULL;
+ char *attr_name;
if ( strcasecmp(*attrName, "userpassword") == 0 )
{
- origpwd = pwd = slapi_get_first_clear_text_pw(e);
- if (pwd == NULL)
- {
- continue;
- }
- val.bv_val = pwd;
- val.bv_len = strlen(val.bv_val);
+ attr_name = "unhashed#user#password";
} else {
attr_name = *attrName;
- err = slapi_entry_attr_find(e, attr_name, &attr);
- if (err) continue; /* break;*/ /* no 7-bit attribute */
}
+ err = slapi_entry_attr_find(e, attr_name, &attr);
+ if (err) continue; /* break;*/ /* no 7-bit attribute */
/*
* For each DN in the managed list, do 7-bit checking if
@@ -333,14 +323,7 @@ preop_add(Slapi_PBlock *pb)
/*
* Check if the value is 7-bit clean
*/
- if(pwd)
- {
- result = bit_check(attr, vals, &violated);
- if(!result)
- pwd = NULL;
- }
- else
- result = bit_check(attr, NULL, &violated);
+ result = bit_check(attr, NULL, &violated);
if (result) break;
}
}
@@ -352,7 +335,7 @@ preop_add(Slapi_PBlock *pb)
if (result) {
issue_error(pb, result, "ADD", violated);
}
- slapi_ch_free_string(&origpwd);
+
return (result==LDAP_SUCCESS)?0:-1;
}