|
|
dc8c34 |
From 33828482372ad5b77370b17c04c6bc804f926ed4 Mon Sep 17 00:00:00 2001
|
|
|
dc8c34 |
From: Mark Reynolds <mreynolds@redhat.com>
|
|
|
dc8c34 |
Date: Mon, 24 Nov 2014 12:22:34 -0500
|
|
|
dc8c34 |
Subject: [PATCH 282/305] Ticket 47965 - Fix coverity issues (2014/11/24)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
12864 - nesting level adjustment - sync_presist.c
|
|
|
dc8c34 |
12867 - Uninitialized pointer read - repl5_replica.c
|
|
|
dc8c34 |
12870 - Unused value - repl5_ruv.c
|
|
|
dc8c34 |
12880, 12881, 12893 - Unused value - dblayer.c
|
|
|
dc8c34 |
12887 - nesting level adjustment - acl.c
|
|
|
dc8c34 |
12894 - nesting level adjustment - acl_ext.c
|
|
|
dc8c34 |
12898 - Logically dead code - acllas.c
|
|
|
dc8c34 |
12891 - Unused value - windows_inc_protocol.c
|
|
|
dc8c34 |
12902 - Unused value - repl5_inc_protocol.c
|
|
|
dc8c34 |
|
|
|
dc8c34 |
https://fedorahosted.org/389/ticket/47965
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Reviewed by: rmeggins(Thanks!)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
(cherry picked from commit da90d57c30bf93265f06499b8ea2102378a0ed12)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Conflicts:
|
|
|
dc8c34 |
ldap/servers/plugins/sync/sync_persist.c
|
|
|
dc8c34 |
|
|
|
dc8c34 |
(cherry picked from commit 0f210a7db73836899c9eefb5e45a36e7a98c696a)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Conflicts:
|
|
|
dc8c34 |
ldap/servers/plugins/sync/sync_persist.c
|
|
|
dc8c34 |
ldap/servers/slapd/back-ldbm/dblayer.c
|
|
|
dc8c34 |
|
|
|
dc8c34 |
(cherry picked from commit 53df6b2eb8a969b379f027d4aa155bace94a1868)
|
|
|
dc8c34 |
(cherry picked from commit c724541f1b443aa3e104b4d3314cd79c678514f8)
|
|
|
dc8c34 |
---
|
|
|
dc8c34 |
ldap/servers/plugins/acl/acl.c | 3 +-
|
|
|
dc8c34 |
ldap/servers/plugins/acl/acl_ext.c | 52 +++++++------
|
|
|
dc8c34 |
ldap/servers/plugins/acl/acllas.c | 4 -
|
|
|
dc8c34 |
.../plugins/replication/repl5_inc_protocol.c | 1 -
|
|
|
dc8c34 |
ldap/servers/plugins/replication/repl5_replica.c | 2 +-
|
|
|
dc8c34 |
ldap/servers/plugins/replication/repl5_ruv.c | 1 -
|
|
|
dc8c34 |
.../plugins/replication/windows_inc_protocol.c | 89 +++++++++++-----------
|
|
|
dc8c34 |
ldap/servers/slapd/pw.c | 47 +++++++-----
|
|
|
dc8c34 |
8 files changed, 101 insertions(+), 98 deletions(-)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
|
|
|
dc8c34 |
index ad929c5..6edc367 100644
|
|
|
dc8c34 |
--- a/ldap/servers/plugins/acl/acl.c
|
|
|
dc8c34 |
+++ b/ldap/servers/plugins/acl/acl.c
|
|
|
dc8c34 |
@@ -2040,9 +2040,10 @@ acl__resource_match_aci( Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int *
|
|
|
dc8c34 |
** acl in the entry cache list.
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
if (!((res_right & (SLAPI_ACL_SEARCH | SLAPI_ACL_READ)) &&
|
|
|
dc8c34 |
- (aci_right & (SLAPI_ACL_SEARCH | SLAPI_ACL_READ))))
|
|
|
dc8c34 |
+ (aci_right & (SLAPI_ACL_SEARCH | SLAPI_ACL_READ)))){
|
|
|
dc8c34 |
matches = ACL_FALSE;
|
|
|
dc8c34 |
goto acl__resource_match_aci_EXIT;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
|
|
|
dc8c34 |
diff --git a/ldap/servers/plugins/acl/acl_ext.c b/ldap/servers/plugins/acl/acl_ext.c
|
|
|
dc8c34 |
index 7c50308..014890c 100644
|
|
|
dc8c34 |
--- a/ldap/servers/plugins/acl/acl_ext.c
|
|
|
dc8c34 |
+++ b/ldap/servers/plugins/acl/acl_ext.c
|
|
|
dc8c34 |
@@ -300,12 +300,14 @@ acl_operation_ext_destructor ( void *ext, void *object, void *parent )
|
|
|
dc8c34 |
int attr_only = 0;
|
|
|
dc8c34 |
PRLock *shared_lock = aclcb->aclcb_lock;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- if (aclcb->aclcb_lock ) PR_Lock ( shared_lock );
|
|
|
dc8c34 |
+ if (aclcb->aclcb_lock )
|
|
|
dc8c34 |
+ PR_Lock ( shared_lock );
|
|
|
dc8c34 |
else {
|
|
|
dc8c34 |
goto clean_aclpb;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ( !aclcb->aclcb_lock ) {
|
|
|
dc8c34 |
- slapi_log_error (SLAPI_LOG_FATAL, plugin_name, "aclcb lock released! aclcb cache can't be refreshed\n");
|
|
|
dc8c34 |
+ slapi_log_error (SLAPI_LOG_FATAL, plugin_name,
|
|
|
dc8c34 |
+ "aclcb lock released! aclcb cache can't be refreshed\n");
|
|
|
dc8c34 |
PR_Unlock ( shared_lock );
|
|
|
dc8c34 |
goto clean_aclpb;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -313,29 +315,29 @@ acl_operation_ext_destructor ( void *ext, void *object, void *parent )
|
|
|
dc8c34 |
/* We need to refresh the aclcb cache */
|
|
|
dc8c34 |
if ( aclpb->aclpb_state & ACLPB_UPD_ACLCB_CACHE )
|
|
|
dc8c34 |
acl_clean_aclEval_context ( &aclcb->aclcb_eval_context, 0 /* clean*/ );
|
|
|
dc8c34 |
- if ( aclpb->aclpb_prev_entryEval_context.acle_numof_attrs ) {
|
|
|
dc8c34 |
- c_evalContext = &aclpb->aclpb_prev_entryEval_context;
|
|
|
dc8c34 |
- } else {
|
|
|
dc8c34 |
- c_evalContext = &aclpb->aclpb_curr_entryEval_context;
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- if (( aclpb->aclpb_state & ACLPB_INCR_ACLCB_CACHE ) &&
|
|
|
dc8c34 |
- ! ( aclpb->aclpb_state & ACLPB_UPD_ACLCB_CACHE ))
|
|
|
dc8c34 |
- attr_only = 1;
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- acl_copyEval_context ( NULL, c_evalContext, &aclcb->aclcb_eval_context, attr_only );
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- aclcb->aclcb_aclsignature = aclpb->aclpb_signature;
|
|
|
dc8c34 |
- if ( aclcb->aclcb_sdn &&
|
|
|
dc8c34 |
- (0 != slapi_sdn_compare ( aclcb->aclcb_sdn,
|
|
|
dc8c34 |
- aclpb->aclpb_authorization_sdn ) ) ) {
|
|
|
dc8c34 |
- slapi_sdn_set_ndn_byval( aclcb->aclcb_sdn,
|
|
|
dc8c34 |
- slapi_sdn_get_ndn ( aclpb->aclpb_authorization_sdn ) );
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- aclcb->aclcb_state = 0;
|
|
|
dc8c34 |
- aclcb->aclcb_state |= ACLCB_HAS_CACHED_EVALCONTEXT;
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- PR_Unlock ( shared_lock );
|
|
|
dc8c34 |
+ if ( aclpb->aclpb_prev_entryEval_context.acle_numof_attrs ) {
|
|
|
dc8c34 |
+ c_evalContext = &aclpb->aclpb_prev_entryEval_context;
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ c_evalContext = &aclpb->aclpb_curr_entryEval_context;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ if (( aclpb->aclpb_state & ACLPB_INCR_ACLCB_CACHE ) &&
|
|
|
dc8c34 |
+ ! ( aclpb->aclpb_state & ACLPB_UPD_ACLCB_CACHE ))
|
|
|
dc8c34 |
+ attr_only = 1;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ acl_copyEval_context ( NULL, c_evalContext, &aclcb->aclcb_eval_context, attr_only );
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ aclcb->aclcb_aclsignature = aclpb->aclpb_signature;
|
|
|
dc8c34 |
+ if ( aclcb->aclcb_sdn &&
|
|
|
dc8c34 |
+ (0 != slapi_sdn_compare( aclcb->aclcb_sdn, aclpb->aclpb_authorization_sdn )))
|
|
|
dc8c34 |
+ {
|
|
|
dc8c34 |
+ slapi_sdn_set_ndn_byval( aclcb->aclcb_sdn,
|
|
|
dc8c34 |
+ slapi_sdn_get_ndn ( aclpb->aclpb_authorization_sdn ) );
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ aclcb->aclcb_state = 0;
|
|
|
dc8c34 |
+ aclcb->aclcb_state |= ACLCB_HAS_CACHED_EVALCONTEXT;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ PR_Unlock ( shared_lock );
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
clean_aclpb:
|
|
|
dc8c34 |
diff --git a/ldap/servers/plugins/acl/acllas.c b/ldap/servers/plugins/acl/acllas.c
|
|
|
dc8c34 |
index 81e486f..3fb5d79 100644
|
|
|
dc8c34 |
--- a/ldap/servers/plugins/acl/acllas.c
|
|
|
dc8c34 |
+++ b/ldap/servers/plugins/acl/acllas.c
|
|
|
dc8c34 |
@@ -1693,10 +1693,6 @@ DS_LASAuthMethodEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
rc = (matched == ACL_TRUE ? LAS_EVAL_FALSE : LAS_EVAL_TRUE);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- } else {
|
|
|
dc8c34 |
- rc = LAS_EVAL_FAIL;
|
|
|
dc8c34 |
- slapi_log_error( SLAPI_LOG_ACL, plugin_name,
|
|
|
dc8c34 |
- "Returning UNDEFINED for authmethod evaluation.\n");
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
return rc;
|
|
|
dc8c34 |
diff --git a/ldap/servers/plugins/replication/repl5_inc_protocol.c b/ldap/servers/plugins/replication/repl5_inc_protocol.c
|
|
|
dc8c34 |
index 5d3e143..ae26380 100644
|
|
|
dc8c34 |
--- a/ldap/servers/plugins/replication/repl5_inc_protocol.c
|
|
|
dc8c34 |
+++ b/ldap/servers/plugins/replication/repl5_inc_protocol.c
|
|
|
dc8c34 |
@@ -924,7 +924,6 @@ repl5_inc_run(Private_Repl_Protocol *prp)
|
|
|
dc8c34 |
/* Destroy the backoff timer, since we won't need it anymore */
|
|
|
dc8c34 |
backoff_delete(&prp_priv->backoff);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- use_busy_backoff_timer = PR_FALSE;
|
|
|
dc8c34 |
} else if (event_occurred(prp, EVENT_TRIGGERING_CRITERIA_MET)){
|
|
|
dc8c34 |
/* changes are available */
|
|
|
dc8c34 |
if ( prp_priv->backoff == NULL || backoff_expired (prp_priv->backoff, 60)){
|
|
|
dc8c34 |
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
|
|
|
dc8c34 |
index 1cec805..3cc5cbb 100644
|
|
|
dc8c34 |
--- a/ldap/servers/plugins/replication/repl5_replica.c
|
|
|
dc8c34 |
+++ b/ldap/servers/plugins/replication/repl5_replica.c
|
|
|
dc8c34 |
@@ -1931,7 +1931,7 @@ done:
|
|
|
dc8c34 |
char *ridstr = NULL;
|
|
|
dc8c34 |
char *token = NULL;
|
|
|
dc8c34 |
char *repl_root;
|
|
|
dc8c34 |
- char *iter;
|
|
|
dc8c34 |
+ char *iter = NULL;
|
|
|
dc8c34 |
int i;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
for(i = 0; clean_vals[i]; i++){
|
|
|
dc8c34 |
diff --git a/ldap/servers/plugins/replication/repl5_ruv.c b/ldap/servers/plugins/replication/repl5_ruv.c
|
|
|
dc8c34 |
index d9a3b26..2dcf7f0 100644
|
|
|
dc8c34 |
--- a/ldap/servers/plugins/replication/repl5_ruv.c
|
|
|
dc8c34 |
+++ b/ldap/servers/plugins/replication/repl5_ruv.c
|
|
|
dc8c34 |
@@ -693,7 +693,6 @@ set_max_csn_nolock_ext(RUV *ruv, const CSN *max_csn, const char *replica_purl, P
|
|
|
dc8c34 |
csn_as_string(replica->csn, PR_FALSE, csn2));
|
|
|
dc8c34 |
return_value = RUV_COVERS_CSN;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- return_value = RUV_SUCCESS;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
return return_value;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
diff --git a/ldap/servers/plugins/replication/windows_inc_protocol.c b/ldap/servers/plugins/replication/windows_inc_protocol.c
|
|
|
dc8c34 |
index 321d1a2..fa053d3 100644
|
|
|
dc8c34 |
--- a/ldap/servers/plugins/replication/windows_inc_protocol.c
|
|
|
dc8c34 |
+++ b/ldap/servers/plugins/replication/windows_inc_protocol.c
|
|
|
dc8c34 |
@@ -679,63 +679,64 @@ windows_inc_run(Private_Repl_Protocol *prp)
|
|
|
dc8c34 |
backoff_delete(&prp_priv->backoff);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
else if (event_occurred(prp, EVENT_BACKOFF_EXPIRED))
|
|
|
dc8c34 |
- {
|
|
|
dc8c34 |
+ {
|
|
|
dc8c34 |
rc = windows_acquire_replica(prp, &ruv, 1 /* check RUV for incremental */);
|
|
|
dc8c34 |
use_busy_backoff_timer = PR_FALSE;
|
|
|
dc8c34 |
if (rc == ACQUIRE_SUCCESS)
|
|
|
dc8c34 |
- {
|
|
|
dc8c34 |
- next_state = STATE_SENDING_UPDATES;
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ {
|
|
|
dc8c34 |
+ next_state = STATE_SENDING_UPDATES;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
else if (rc == ACQUIRE_REPLICA_BUSY)
|
|
|
dc8c34 |
- {
|
|
|
dc8c34 |
- next_state = STATE_BACKOFF;
|
|
|
dc8c34 |
- use_busy_backoff_timer = PR_TRUE;
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ {
|
|
|
dc8c34 |
+ next_state = STATE_BACKOFF;
|
|
|
dc8c34 |
+ use_busy_backoff_timer = PR_TRUE;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
else if (rc == ACQUIRE_CONSUMER_WAS_UPTODATE)
|
|
|
dc8c34 |
- {
|
|
|
dc8c34 |
+ {
|
|
|
dc8c34 |
next_state = STATE_WAIT_CHANGES;
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
else if (rc == ACQUIRE_TRANSIENT_ERROR)
|
|
|
dc8c34 |
- {
|
|
|
dc8c34 |
- next_state = STATE_BACKOFF;
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ {
|
|
|
dc8c34 |
+ next_state = STATE_BACKOFF;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
else if (rc == ACQUIRE_FATAL_ERROR)
|
|
|
dc8c34 |
- {
|
|
|
dc8c34 |
- next_state = STATE_STOP_FATAL_ERROR;
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ {
|
|
|
dc8c34 |
+ next_state = STATE_STOP_FATAL_ERROR;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
if (rc != ACQUIRE_SUCCESS)
|
|
|
dc8c34 |
- {
|
|
|
dc8c34 |
- int optype, ldaprc;
|
|
|
dc8c34 |
- windows_conn_get_error(prp->conn, &optype, &ldaprc);
|
|
|
dc8c34 |
- agmt_set_last_update_status(prp->agmt, ldaprc,
|
|
|
dc8c34 |
+ {
|
|
|
dc8c34 |
+ int optype, ldaprc;
|
|
|
dc8c34 |
+ windows_conn_get_error(prp->conn, &optype, &ldaprc);
|
|
|
dc8c34 |
+ agmt_set_last_update_status(prp->agmt, ldaprc,
|
|
|
dc8c34 |
prp->last_acquire_response_code, NULL);
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- /*
|
|
|
dc8c34 |
- * We either need to step the backoff timer, or
|
|
|
dc8c34 |
- * destroy it if we don't need it anymore.
|
|
|
dc8c34 |
- */
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ /*
|
|
|
dc8c34 |
+ * We either need to step the backoff timer, or
|
|
|
dc8c34 |
+ * destroy it if we don't need it anymore.
|
|
|
dc8c34 |
+ */
|
|
|
dc8c34 |
if (STATE_BACKOFF == next_state)
|
|
|
dc8c34 |
- {
|
|
|
dc8c34 |
- time_t next_fire_time;
|
|
|
dc8c34 |
- time_t now;
|
|
|
dc8c34 |
- /* Step the backoff timer */
|
|
|
dc8c34 |
- time(&now;;
|
|
|
dc8c34 |
- next_fire_time = backoff_step(prp_priv->backoff);
|
|
|
dc8c34 |
- /* And go back to sleep */
|
|
|
dc8c34 |
- slapi_log_error(SLAPI_LOG_REPL, windows_repl_plugin_name,
|
|
|
dc8c34 |
- "%s: Replication session backing off for %ld seconds\n",
|
|
|
dc8c34 |
- agmt_get_long_name(prp->agmt),
|
|
|
dc8c34 |
- next_fire_time - now);
|
|
|
dc8c34 |
+ {
|
|
|
dc8c34 |
+ time_t next_fire_time;
|
|
|
dc8c34 |
+ time_t now;
|
|
|
dc8c34 |
+ /* Step the backoff timer */
|
|
|
dc8c34 |
+ time(&now;;
|
|
|
dc8c34 |
+ next_fire_time = backoff_step(prp_priv->backoff);
|
|
|
dc8c34 |
+ /* And go back to sleep */
|
|
|
dc8c34 |
+ slapi_log_error(SLAPI_LOG_REPL, windows_repl_plugin_name,
|
|
|
dc8c34 |
+ "%s: Replication session backing off for %ld seconds\n",
|
|
|
dc8c34 |
+ agmt_get_long_name(prp->agmt),
|
|
|
dc8c34 |
+ next_fire_time - now);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- protocol_sleep(prp, PR_INTERVAL_NO_TIMEOUT);
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ protocol_sleep(prp, PR_INTERVAL_NO_TIMEOUT);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
else
|
|
|
dc8c34 |
- {
|
|
|
dc8c34 |
- /* Destroy the backoff timer, since we won't need it anymore */
|
|
|
dc8c34 |
- backoff_delete(&prp_priv->backoff);
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- use_busy_backoff_timer = PR_FALSE;
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ {
|
|
|
dc8c34 |
+ /* Destroy the backoff timer, since we won't need it anymore */
|
|
|
dc8c34 |
+ backoff_delete(&prp_priv->backoff);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
else if (event_occurred(prp, EVENT_TRIGGERING_CRITERIA_MET))
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
/* changes are available */
|
|
|
dc8c34 |
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
|
|
|
dc8c34 |
index e0d0080..0349c5a 100644
|
|
|
dc8c34 |
--- a/ldap/servers/slapd/pw.c
|
|
|
dc8c34 |
+++ b/ldap/servers/slapd/pw.c
|
|
|
dc8c34 |
@@ -2034,28 +2034,33 @@ slapi_pwpolicy_make_response_control (Slapi_PBlock *pb, int seconds, int logins,
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
rc = ber_printf( ber, "{" );
|
|
|
dc8c34 |
- if ( seconds >= 0 || logins >= 0 ) {
|
|
|
dc8c34 |
- if ( seconds >= 0 ) {
|
|
|
dc8c34 |
- rc = ber_printf( ber, "t{ti}", LDAP_TAG_PWP_WARNING,
|
|
|
dc8c34 |
- LDAP_TAG_PWP_SECSLEFT,
|
|
|
dc8c34 |
- seconds );
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- else {
|
|
|
dc8c34 |
- rc = ber_printf( ber, "t{ti}", LDAP_TAG_PWP_WARNING,
|
|
|
dc8c34 |
- LDAP_TAG_PWP_GRCLOGINS,
|
|
|
dc8c34 |
- logins );
|
|
|
dc8c34 |
+ if ( rc != -1){
|
|
|
dc8c34 |
+ if(seconds >= 0 || logins >= 0 ) {
|
|
|
dc8c34 |
+ if ( seconds >= 0 ) {
|
|
|
dc8c34 |
+ rc = ber_printf( ber, "t{ti}", LDAP_TAG_PWP_WARNING,
|
|
|
dc8c34 |
+ LDAP_TAG_PWP_SECSLEFT,
|
|
|
dc8c34 |
+ seconds );
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ else {
|
|
|
dc8c34 |
+ rc = ber_printf( ber, "t{ti}", LDAP_TAG_PWP_WARNING,
|
|
|
dc8c34 |
+ LDAP_TAG_PWP_GRCLOGINS,
|
|
|
dc8c34 |
+ logins );
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (rc != -1){
|
|
|
dc8c34 |
+ if ( error >= 0 ) {
|
|
|
dc8c34 |
+ rc = ber_printf( ber, "te", LDAP_TAG_PWP_ERROR, error );
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (rc != -1){
|
|
|
dc8c34 |
+ rc = ber_printf( ber, "}" );
|
|
|
dc8c34 |
+ if ( rc != -1 )
|
|
|
dc8c34 |
+ {
|
|
|
dc8c34 |
+ rc = ber_flatten( ber, &bvp );
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- if ( error >= 0 ) {
|
|
|
dc8c34 |
- rc = ber_printf( ber, "te", LDAP_TAG_PWP_ERROR, error );
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- rc = ber_printf( ber, "}" );
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- if ( rc != -1 )
|
|
|
dc8c34 |
- {
|
|
|
dc8c34 |
- rc = ber_flatten( ber, &bvp );
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
ber_free( ber, 1 );
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ( rc != -1 )
|
|
|
dc8c34 |
@@ -2064,11 +2069,11 @@ slapi_pwpolicy_make_response_control (Slapi_PBlock *pb, int seconds, int logins,
|
|
|
dc8c34 |
new_ctrl.ldctl_oid = LDAP_X_CONTROL_PWPOLICY_RESPONSE;
|
|
|
dc8c34 |
new_ctrl.ldctl_value = *bvp;
|
|
|
dc8c34 |
new_ctrl.ldctl_iscritical = 0;
|
|
|
dc8c34 |
- rc= slapi_pblock_set( pb, SLAPI_ADD_RESCONTROL, &new_ctrl );
|
|
|
dc8c34 |
+ rc = slapi_pblock_set( pb, SLAPI_ADD_RESCONTROL, &new_ctrl );
|
|
|
dc8c34 |
ber_bvfree(bvp);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- LDAPDebug( LDAP_DEBUG_TRACE, "<= slapi_pwpolicy_make_response_control", 0, 0, 0 );
|
|
|
dc8c34 |
+ LDAPDebug( LDAP_DEBUG_TRACE, "<= slapi_pwpolicy_make_response_control (%d)", rc, 0, 0 );
|
|
|
dc8c34 |
|
|
|
dc8c34 |
return (rc==-1?LDAP_OPERATIONS_ERROR:LDAP_SUCCESS);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
--
|
|
|
dc8c34 |
1.9.3
|
|
|
dc8c34 |
|