|
|
dc8c34 |
From dde69b5f219cda1910bb24c7485252470e096882 Mon Sep 17 00:00:00 2001
|
|
|
dc8c34 |
From: Mark Reynolds <mreynolds@redhat.com>
|
|
|
dc8c34 |
Date: Tue, 30 Aug 2016 14:25:15 -0400
|
|
|
dc8c34 |
Subject: [PATCH 403/404] Ticket 48975- Disabling CLEAR password storage scheme
|
|
|
dc8c34 |
will crash server when setting a password
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Bug Description: If the CLEAR password storage scheme plugin is disabled, and a
|
|
|
dc8c34 |
userpassword is set, the server crashes. This is because we
|
|
|
dc8c34 |
expect this plugin to be enabled when working with the unhashed
|
|
|
dc8c34 |
password.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Fix Description: Always check if the password scheme, returned by pw_val2scheme(),
|
|
|
dc8c34 |
is NULL before dereferencing it. If it is NULL treat it as a
|
|
|
dc8c34 |
clear text password.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Valgrind: Passed
|
|
|
dc8c34 |
|
|
|
dc8c34 |
https://fedorahosted.org/389/ticket/48975
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Reviewed by: nhosoi(Thanks!)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
(cherry picked from commit 52230585a1191bf1e747780b592f291d652e26dd)
|
|
|
dc8c34 |
(cherry picked from commit 840cfbfc7d6473338cd4ef167bf4a0d8867be80b)
|
|
|
dc8c34 |
---
|
|
|
dc8c34 |
ldap/servers/slapd/modify.c | 8 ++++----
|
|
|
dc8c34 |
ldap/servers/slapd/pw.c | 4 ++--
|
|
|
dc8c34 |
2 files changed, 6 insertions(+), 6 deletions(-)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
|
|
|
dc8c34 |
index 4bcc827..ed08885 100644
|
|
|
dc8c34 |
--- a/ldap/servers/slapd/modify.c
|
|
|
dc8c34 |
+++ b/ldap/servers/slapd/modify.c
|
|
|
dc8c34 |
@@ -847,7 +847,7 @@ static void op_shared_modify (Slapi_PBlock *pb, int pw_change, char *old_pw)
|
|
|
dc8c34 |
for ( i = 0; pw_mod->mod_bvalues != NULL && pw_mod->mod_bvalues[i] != NULL; i++ ) {
|
|
|
dc8c34 |
char *password = slapi_ch_strdup(pw_mod->mod_bvalues[i]->bv_val);
|
|
|
dc8c34 |
pwsp = pw_val2scheme( password, &valpwd, 1 );
|
|
|
dc8c34 |
- if(strcmp(pwsp->pws_name, "CLEAR") == 0){
|
|
|
dc8c34 |
+ if(pwsp == NULL || strcmp(pwsp->pws_name, "CLEAR") == 0){
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* CLEAR password
|
|
|
dc8c34 |
*
|
|
|
dc8c34 |
@@ -871,7 +871,7 @@ static void op_shared_modify (Slapi_PBlock *pb, int pw_change, char *old_pw)
|
|
|
dc8c34 |
const char *userpwd = slapi_value_get_string(present_values[ii]);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
pass_scheme = pw_val2scheme( (char *)userpwd, &pval, 1 );
|
|
|
dc8c34 |
- if(strcmp(pass_scheme->pws_name,"CLEAR")){
|
|
|
dc8c34 |
+ if(pass_scheme && strcmp(pass_scheme->pws_name,"CLEAR")){
|
|
|
dc8c34 |
/* its encoded, so compare it */
|
|
|
dc8c34 |
if((*(pass_scheme->pws_cmp))( valpwd, pval ) == 0 ){
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
@@ -931,7 +931,7 @@ static void op_shared_modify (Slapi_PBlock *pb, int pw_change, char *old_pw)
|
|
|
dc8c34 |
* provided by the client.
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
unhashed_pwsp = pw_val2scheme( (char *)unhashed_pwd, NULL, 1 );
|
|
|
dc8c34 |
- if(strcmp(unhashed_pwsp->pws_name, "CLEAR") == 0){
|
|
|
dc8c34 |
+ if(unhashed_pwsp == NULL || strcmp(unhashed_pwsp->pws_name, "CLEAR") == 0){
|
|
|
dc8c34 |
if((*(pwsp->pws_cmp))((char *)unhashed_pwd , valpwd) == 0 ){
|
|
|
dc8c34 |
/* match, add the delete mod for this particular unhashed userpassword */
|
|
|
dc8c34 |
if (SLAPD_UNHASHED_PW_OFF != config_get_unhashed_pw_switch()) {
|
|
|
dc8c34 |
@@ -1457,7 +1457,7 @@ valuearray_init_bervalarray_unhashed_only(struct berval **bvals, Slapi_Value ***
|
|
|
dc8c34 |
*cvals = (Slapi_Value **) slapi_ch_malloc((n + 1) * sizeof(Slapi_Value *));
|
|
|
dc8c34 |
for(i = 0, p = 0; i < n; i++){
|
|
|
dc8c34 |
pwsp = pw_val2scheme( bvals[i]->bv_val, NULL, 1 );
|
|
|
dc8c34 |
- if(strcmp(pwsp->pws_name, "CLEAR") == 0){
|
|
|
dc8c34 |
+ if(pwsp == NULL || strcmp(pwsp->pws_name, "CLEAR") == 0){
|
|
|
dc8c34 |
(*cvals)[p++] = slapi_value_new_berval(bvals[i]);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
free_pw_scheme( pwsp );
|
|
|
dc8c34 |
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
|
|
|
dc8c34 |
index d5785ba..4c9cfac 100644
|
|
|
dc8c34 |
--- a/ldap/servers/slapd/pw.c
|
|
|
dc8c34 |
+++ b/ldap/servers/slapd/pw.c
|
|
|
dc8c34 |
@@ -265,8 +265,8 @@ void free_pw_scheme(struct pw_scheme *pwsp)
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
if ( pwsp != NULL )
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
- slapi_ch_free( (void**)&pwsp->pws_name );
|
|
|
dc8c34 |
- slapi_ch_free( (void**)&pwsp );
|
|
|
dc8c34 |
+ slapi_ch_free_string(&pwsp->pws_name);
|
|
|
dc8c34 |
+ slapi_ch_free((void**)&pwsp);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
--
|
|
|
dc8c34 |
2.4.11
|
|
|
dc8c34 |
|