Friday, August 26, 2016

[389-commits] Branch '389-ds-base-1.3.3' - ldap/servers

ldap/servers/slapd/add.c | 15 -------
ldap/servers/slapd/libglobs.c | 14 ------
ldap/servers/slapd/proto-slap.h | 3 -
ldap/servers/slapd/pw.c | 81 ----------------------------------------
ldap/servers/slapd/pw_mgmt.c | 9 ----
5 files changed, 1 insertion(+), 121 deletions(-)

New commits:
commit 4108fbd10b85d1672ec25d14eb635ef68a51b337
Author: Mark Reynolds <mreynolds@redhat.com>
Date: Fri Aug 26 18:51:42 2016 -0400

Ticket 48972 - remove old pwp code that adds/removes ACIs

Bug Description: Old legacy code is still present in the DS that used
to enforce the password policy "user may change password"
using ACIs. This old code would re-add the ACI for
selfwrite on userpassword at server startup.

Fix Description: The current password policy does not depend on these access
access control rules to enforce if a user can change their
password or not.

https://fedorahosted.org/389/ticket/48972

Reviewed by: nhosoi(Thanks!)

(cherry picked from commit 32881be120f14b952de67a0d533ad94ba0956093)

diff --git a/ldap/servers/slapd/add.c b/ldap/servers/slapd/add.c
index 8f72e28..ba9bbd5 100644
--- a/ldap/servers/slapd/add.c
+++ b/ldap/servers/slapd/add.c
@@ -675,21 +675,6 @@ static void op_shared_add (Slapi_PBlock *pb)
}

slapi_pblock_set(pb, SLAPI_BACKEND, be);
- /* we set local password policy ACI for non-replicated operations only */
- if (!repl_op &&
- !operation_is_flag_set(operation, OP_FLAG_REPL_FIXUP) &&
- !operation_is_flag_set(operation, OP_FLAG_LEGACY_REPLICATION_DN) &&
- !slapi_be_is_flag_set(be,SLAPI_BE_FLAG_REMOTE_DATA) &&
- !slapi_be_private(be) &&
- slapi_be_issuffix (be, slapi_entry_get_sdn_const(e)))
- {
- /* this is a suffix. update the pw aci */
- slapdFrontendConfig_t *slapdFrontendConfig;
- slapdFrontendConfig = getFrontendConfig();
- pw_add_allowchange_aci(e, !slapdFrontendConfig->pw_policy.pw_change &&
- !slapdFrontendConfig->pw_policy.pw_must_change);
- }
-

if (!repl_op)
{
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index d03d39b..bb1ec7d 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -2487,13 +2487,6 @@ config_set_pw_change( const char *attrname, char *value, char *errorbuf, int app
errorbuf,
apply);

- if (retVal == LDAP_SUCCESS) {
- /* LP: Update ACI to reflect the value ! */
- if (apply)
- pw_mod_allowchange_aci(!slapdFrontendConfig->pw_policy.pw_change &&
- !slapdFrontendConfig->pw_policy.pw_must_change);
- }
-
return retVal;
}

@@ -2525,13 +2518,6 @@ config_set_pw_must_change( const char *attrname, char *value, char *errorbuf, in
errorbuf,
apply);

- if (retVal == LDAP_SUCCESS) {
- /* LP: Update ACI to reflect the value ! */
- if (apply)
- pw_mod_allowchange_aci(!slapdFrontendConfig->pw_policy.pw_change &&
- !slapdFrontendConfig->pw_policy.pw_must_change);
- }
-
return retVal;
}

diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 3d0b3c1..1f5b288 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -950,9 +950,6 @@ void get_old_pw( Slapi_PBlock *pb, const Slapi_DN *sdn, char **old_pw);
int check_account_lock( Slapi_PBlock *pb, Slapi_Entry * bind_target_entry, int pwresponse_req, int account_inactivation_only /*no wire/no pw policy*/);
int check_pw_minage( Slapi_PBlock *pb, const Slapi_DN *sdn, struct berval **vals) ;
void add_password_attrs( Slapi_PBlock *pb, Operation *op, Slapi_Entry *e );
-void mod_allowchange_aci(char *val);
-void pw_mod_allowchange_aci(int pw_prohibit_change);
-void pw_add_allowchange_aci(Slapi_Entry *e, int pw_prohibit_change);

/*
* pw_retry.c
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index f16ac98..8232c60 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -1372,69 +1372,6 @@ slapi_add_pwd_control ( Slapi_PBlock *pb, char *arg, long time) {
}

void
-pw_mod_allowchange_aci(int pw_prohibit_change)
-{
- const Slapi_DN *base;
- char *values_mod[2];
- LDAPMod mod;
- LDAPMod *mods[2];
- Slapi_Backend *be;
- char *cookie = NULL;
-
- mods[0] = &mod;
- mods[1] = NULL;
- mod.mod_type = "aci";
- mod.mod_values = values_mod;
-
- if (pw_prohibit_change) {
- mod.mod_op = LDAP_MOD_ADD;
- }
- else
- {
- /* Allow change password by default */
- /* remove the aci if it is there. it is ok to fail */
- mod.mod_op = LDAP_MOD_DELETE;
- }
-
- be = slapi_get_first_backend (&cookie);
- /* Foreach backend... */
- while (be)
- {
- /* Don't add aci on a chaining backend holding remote entries */
- if((!be->be_private) && (!slapi_be_is_flag_set(be,SLAPI_BE_FLAG_REMOTE_DATA)))
- {
- /* There's only One suffix per DB now. No need to loop */
- base = slapi_be_getsuffix(be, 0);
- if (base != NULL)
- {
- Slapi_PBlock pb;
- int rc;
-
- pblock_init (&pb);
- values_mod[0] = DENY_PW_CHANGE_ACI;
- values_mod[1] = NULL;
- slapi_modify_internal_set_pb_ext(&pb, base, mods, NULL, NULL,
- pw_get_componentID(), 0);
- slapi_modify_internal_pb(&pb);
- slapi_pblock_get(&pb, SLAPI_PLUGIN_INTOP_RESULT, &rc);
- if (rc == LDAP_SUCCESS){
- /*
- ** Since we modified the acl
- ** successfully, let's update the
- ** in-memory acl list
- */
- slapi_pblock_set(&pb, SLAPI_TARGET_SDN, (void *)base);
- plugin_call_acl_mods_update (&pb, LDAP_REQ_MODIFY );
- }
- pblock_done(&pb);
- }
- }
- be = slapi_get_next_backend (cookie);
- }
- slapi_ch_free((void **) &cookie);
-}
-
-void
add_password_attrs( Slapi_PBlock *pb, Operation *op, Slapi_Entry *e )
{
struct berval bv;
@@ -1601,24 +1538,6 @@ check_trivial_words (Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Value **vals, char
return ( 0 );
}

-
-void
-pw_add_allowchange_aci(Slapi_Entry *e, int pw_prohibit_change) {
- char *aci_pw = NULL;
- const char *aciattr = "aci";
-
- aci_pw = slapi_ch_strdup(DENY_PW_CHANGE_ACI);
-
- if (pw_prohibit_change) {
- /* Add ACI */
- slapi_entry_add_string(e, aciattr, aci_pw);
- } else {
- /* Remove ACI */
- slapi_entry_delete_string(e, aciattr, aci_pw);
- }
- slapi_ch_free((void **) &aci_pw);
-}
-
int
pw_is_pwp_admin(Slapi_PBlock *pb, passwdPolicy *pwp){
Slapi_DN *bind_sdn = NULL;
diff --git a/ldap/servers/slapd/pw_mgmt.c b/ldap/servers/slapd/pw_mgmt.c
index 5a0ecb2..3072cc0 100644
--- a/ldap/servers/slapd/pw_mgmt.c
+++ b/ldap/servers/slapd/pw_mgmt.c
@@ -295,13 +295,8 @@ skip:
void
pw_init ( void )
{
- slapdFrontendConfig_t *slapdFrontendConfig;
-
pw_set_componentID(generate_componentid(NULL, COMPONENT_PWPOLICY));
-
- slapdFrontendConfig = getFrontendConfig();
- pw_mod_allowchange_aci (!slapdFrontendConfig->pw_policy.pw_change &&
- !slapdFrontendConfig->pw_policy.pw_must_change);
+
#if defined(USE_OLD_UNHASHED)
slapi_add_internal_attr_syntax( PSEUDO_ATTR_UNHASHEDUSERPASSWORD,
PSEUDO_ATTR_UNHASHEDUSERPASSWORD_OID,
@@ -312,5 +307,3 @@ pw_init ( void )
SLAPI_ATTR_FLAG_NOEXPOSE);

No comments:

Post a Comment