Blame SOURCES/0054-Ticket-47965-Fix-coverity-issues-2014-11-24.patch

f92ce9
From 86cb4a8568160e5f5f1051506b8f24bb1312ff60 Mon Sep 17 00:00:00 2001
f92ce9
From: Mark Reynolds <mreynolds@redhat.com>
f92ce9
Date: Mon, 24 Nov 2014 12:22:34 -0500
f92ce9
Subject: [PATCH 54/55] Ticket 47965 - Fix coverity issues (2014/11/24)
f92ce9
f92ce9
12864 - nesting level adjustment - sync_presist.c
f92ce9
12867 - Uninitialized pointer read - repl5_replica.c
f92ce9
12870 - Unused value - repl5_ruv.c
f92ce9
12880, 12881, 12893 - Unused value - dblayer.c
f92ce9
12887 - nesting level adjustment - acl.c
f92ce9
12894 - nesting level adjustment - acl_ext.c
f92ce9
12898 - Logically dead code - acllas.c
f92ce9
12891 - Unused value - windows_inc_protocol.c
f92ce9
12902 - Unused value - repl5_inc_protocol.c
f92ce9
f92ce9
https://fedorahosted.org/389/ticket/47965
f92ce9
f92ce9
Reviewed by: rmeggins(Thanks!)
f92ce9
f92ce9
(cherry picked from commit da90d57c30bf93265f06499b8ea2102378a0ed12)
f92ce9
(cherry picked from commit 61d1211f1721355d571d570a67f36ef6baeb4866)
f92ce9
---
f92ce9
 ldap/servers/plugins/acl/acl.c                     |  3 +-
f92ce9
 ldap/servers/plugins/acl/acl_ext.c                 | 52 +++++++------
f92ce9
 ldap/servers/plugins/acl/acllas.c                  |  4 -
f92ce9
 .../plugins/replication/repl5_inc_protocol.c       |  1 -
f92ce9
 ldap/servers/plugins/replication/repl5_replica.c   |  2 +-
f92ce9
 ldap/servers/plugins/replication/repl5_ruv.c       |  1 -
f92ce9
 .../plugins/replication/windows_inc_protocol.c     | 89 +++++++++++-----------
f92ce9
 ldap/servers/plugins/sync/sync_persist.c           |  8 +-
f92ce9
 ldap/servers/slapd/back-ldbm/dblayer.c             | 21 +++--
f92ce9
 ldap/servers/slapd/pw.c                            | 47 +++++++-----
f92ce9
 10 files changed, 119 insertions(+), 109 deletions(-)
f92ce9
f92ce9
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
f92ce9
index 403c5b3..f04e258 100644
f92ce9
--- a/ldap/servers/plugins/acl/acl.c
f92ce9
+++ b/ldap/servers/plugins/acl/acl.c
f92ce9
@@ -2106,9 +2106,10 @@ acl__resource_match_aci( Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int *
f92ce9
 		** acl in  the entry cache list.
f92ce9
 		*/
f92ce9
 		if (!((res_right & (SLAPI_ACL_SEARCH | SLAPI_ACL_READ)) &&
f92ce9
-			(aci_right & (SLAPI_ACL_SEARCH | SLAPI_ACL_READ))))
f92ce9
+			(aci_right & (SLAPI_ACL_SEARCH | SLAPI_ACL_READ)))){
f92ce9
 			matches = ACL_FALSE;
f92ce9
 			goto acl__resource_match_aci_EXIT;			
f92ce9
+		}
f92ce9
 	}
f92ce9
 
f92ce9
 	
f92ce9
diff --git a/ldap/servers/plugins/acl/acl_ext.c b/ldap/servers/plugins/acl/acl_ext.c
f92ce9
index 126a234..0863de0 100644
f92ce9
--- a/ldap/servers/plugins/acl/acl_ext.c
f92ce9
+++ b/ldap/servers/plugins/acl/acl_ext.c
f92ce9
@@ -334,12 +334,14 @@ acl_operation_ext_destructor ( void *ext, void *object, void *parent )
f92ce9
 		int					attr_only = 0;
f92ce9
 		PRLock			*shared_lock = aclcb->aclcb_lock;
f92ce9
 
f92ce9
-		if (aclcb->aclcb_lock ) PR_Lock ( shared_lock );
f92ce9
+		if (aclcb->aclcb_lock )
f92ce9
+			PR_Lock ( shared_lock );
f92ce9
 		else {
f92ce9
 			goto clean_aclpb;
f92ce9
 		}
f92ce9
 		if ( !aclcb->aclcb_lock ) {
f92ce9
-			slapi_log_error (SLAPI_LOG_FATAL, plugin_name, "aclcb lock released! aclcb cache can't be refreshed\n");
f92ce9
+			slapi_log_error (SLAPI_LOG_FATAL, plugin_name,
f92ce9
+			        "aclcb lock released! aclcb cache can't be refreshed\n");
f92ce9
 			PR_Unlock ( shared_lock );
f92ce9
 			goto clean_aclpb;
f92ce9
 		}
f92ce9
@@ -347,29 +349,29 @@ acl_operation_ext_destructor ( void *ext, void *object, void *parent )
f92ce9
 		/* We need to refresh the aclcb cache */
f92ce9
 		if ( aclpb->aclpb_state & ACLPB_UPD_ACLCB_CACHE )
f92ce9
 			acl_clean_aclEval_context ( &aclcb->aclcb_eval_context, 0 /* clean*/ );
f92ce9
-			if ( aclpb->aclpb_prev_entryEval_context.acle_numof_attrs ) {
f92ce9
-				c_evalContext = &aclpb->aclpb_prev_entryEval_context;
f92ce9
-			} else {
f92ce9
-				c_evalContext = &aclpb->aclpb_curr_entryEval_context;
f92ce9
-			}
f92ce9
-
f92ce9
-			if (( aclpb->aclpb_state & ACLPB_INCR_ACLCB_CACHE ) &&
f92ce9
-				! ( aclpb->aclpb_state & ACLPB_UPD_ACLCB_CACHE ))
f92ce9
-				attr_only = 1;
f92ce9
-
f92ce9
-			acl_copyEval_context ( NULL, c_evalContext, &aclcb->aclcb_eval_context, attr_only );
f92ce9
-
f92ce9
-			aclcb->aclcb_aclsignature = aclpb->aclpb_signature;
f92ce9
-			if ( aclcb->aclcb_sdn &&
f92ce9
-					(0 != slapi_sdn_compare ( aclcb->aclcb_sdn,
f92ce9
-										aclpb->aclpb_authorization_sdn ) ) ) {
f92ce9
-				slapi_sdn_set_ndn_byval( aclcb->aclcb_sdn,
f92ce9
-					slapi_sdn_get_ndn ( aclpb->aclpb_authorization_sdn ) );
f92ce9
-			}
f92ce9
-			aclcb->aclcb_state = 0;
f92ce9
-			aclcb->aclcb_state |= ACLCB_HAS_CACHED_EVALCONTEXT;
f92ce9
-		
f92ce9
-			PR_Unlock ( shared_lock );
f92ce9
+		if ( aclpb->aclpb_prev_entryEval_context.acle_numof_attrs ) {
f92ce9
+			c_evalContext = &aclpb->aclpb_prev_entryEval_context;
f92ce9
+		} else {
f92ce9
+			c_evalContext = &aclpb->aclpb_curr_entryEval_context;
f92ce9
+		}
f92ce9
+
f92ce9
+		if (( aclpb->aclpb_state & ACLPB_INCR_ACLCB_CACHE ) &&
f92ce9
+			! ( aclpb->aclpb_state & ACLPB_UPD_ACLCB_CACHE ))
f92ce9
+			attr_only = 1;
f92ce9
+
f92ce9
+		acl_copyEval_context ( NULL, c_evalContext, &aclcb->aclcb_eval_context, attr_only );
f92ce9
+
f92ce9
+		aclcb->aclcb_aclsignature = aclpb->aclpb_signature;
f92ce9
+		if ( aclcb->aclcb_sdn &&
f92ce9
+		     (0 != slapi_sdn_compare( aclcb->aclcb_sdn, aclpb->aclpb_authorization_sdn )))
f92ce9
+		{
f92ce9
+			slapi_sdn_set_ndn_byval( aclcb->aclcb_sdn,
f92ce9
+			        slapi_sdn_get_ndn ( aclpb->aclpb_authorization_sdn ) );
f92ce9
+		}
f92ce9
+		aclcb->aclcb_state = 0;
f92ce9
+		aclcb->aclcb_state |= ACLCB_HAS_CACHED_EVALCONTEXT;
f92ce9
+
f92ce9
+		PR_Unlock ( shared_lock );
f92ce9
 	}
f92ce9
 
f92ce9
 clean_aclpb:
f92ce9
diff --git a/ldap/servers/plugins/acl/acllas.c b/ldap/servers/plugins/acl/acllas.c
f92ce9
index 2d0dae9..439c8f1 100644
f92ce9
--- a/ldap/servers/plugins/acl/acllas.c
f92ce9
+++ b/ldap/servers/plugins/acl/acllas.c
f92ce9
@@ -1726,10 +1726,6 @@ DS_LASAuthMethodEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
f92ce9
 		} else {
f92ce9
 			rc = (matched == ACL_TRUE ? LAS_EVAL_FALSE : LAS_EVAL_TRUE);
f92ce9
 		}
f92ce9
-	} else {
f92ce9
-		rc = LAS_EVAL_FAIL;
f92ce9
-		slapi_log_error( SLAPI_LOG_ACL, plugin_name, 
f92ce9
-			"Returning UNDEFINED for authmethod evaluation.\n");
f92ce9
 	}
f92ce9
 
f92ce9
 	return rc;
f92ce9
diff --git a/ldap/servers/plugins/replication/repl5_inc_protocol.c b/ldap/servers/plugins/replication/repl5_inc_protocol.c
f92ce9
index b867fc4..5cf170c 100644
f92ce9
--- a/ldap/servers/plugins/replication/repl5_inc_protocol.c
f92ce9
+++ b/ldap/servers/plugins/replication/repl5_inc_protocol.c
f92ce9
@@ -940,7 +940,6 @@ repl5_inc_run(Private_Repl_Protocol *prp)
f92ce9
                   /* Destroy the backoff timer, since we won't need it anymore */
f92ce9
                   backoff_delete(&prp_priv->backoff);
f92ce9
               }
f92ce9
-              use_busy_backoff_timer = PR_FALSE;
f92ce9
          } else if (event_occurred(prp, EVENT_TRIGGERING_CRITERIA_MET)){
f92ce9
              /* changes are available */
f92ce9
              if ( prp_priv->backoff == NULL || backoff_expired (prp_priv->backoff, 60)){
f92ce9
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
f92ce9
index dab1c4e..77663f6 100644
f92ce9
--- a/ldap/servers/plugins/replication/repl5_replica.c
f92ce9
+++ b/ldap/servers/plugins/replication/repl5_replica.c
f92ce9
@@ -2140,7 +2140,7 @@ done:
f92ce9
         char *ridstr = NULL;
f92ce9
         char *token = NULL;
f92ce9
         char *repl_root;
f92ce9
-        char *iter;
f92ce9
+        char *iter = NULL;
f92ce9
         int i;
f92ce9
 
f92ce9
         for(i = 0; clean_vals[i]; i++){
f92ce9
diff --git a/ldap/servers/plugins/replication/repl5_ruv.c b/ldap/servers/plugins/replication/repl5_ruv.c
f92ce9
index 500fd7a..132c641 100644
f92ce9
--- a/ldap/servers/plugins/replication/repl5_ruv.c
f92ce9
+++ b/ldap/servers/plugins/replication/repl5_ruv.c
f92ce9
@@ -705,7 +705,6 @@ set_max_csn_nolock_ext(RUV *ruv, const CSN *max_csn, const char *replica_purl, P
f92ce9
 			                csn_as_string(replica->csn, PR_FALSE, csn2));
f92ce9
 			return_value = RUV_COVERS_CSN;
f92ce9
 		}
f92ce9
-		return_value = RUV_SUCCESS;
f92ce9
 	}
f92ce9
 	return return_value;
f92ce9
 }
f92ce9
diff --git a/ldap/servers/plugins/replication/windows_inc_protocol.c b/ldap/servers/plugins/replication/windows_inc_protocol.c
f92ce9
index d62deec..ec6ca55 100644
f92ce9
--- a/ldap/servers/plugins/replication/windows_inc_protocol.c
f92ce9
+++ b/ldap/servers/plugins/replication/windows_inc_protocol.c
f92ce9
@@ -675,63 +675,64 @@ windows_inc_run(Private_Repl_Protocol *prp)
f92ce9
 						  backoff_delete(&prp_priv->backoff);
f92ce9
 					  }
f92ce9
 					else if (event_occurred(prp, EVENT_BACKOFF_EXPIRED))
f92ce9
-					  {
f92ce9
+					{
f92ce9
 						rc = windows_acquire_replica(prp, &ruv, 1 /* check RUV for incremental */);
f92ce9
 						use_busy_backoff_timer = PR_FALSE;
f92ce9
 						if (rc == ACQUIRE_SUCCESS)
f92ce9
-						  {
f92ce9
-						next_state = STATE_SENDING_UPDATES;
f92ce9
-						  }
f92ce9
+						{
f92ce9
+							next_state = STATE_SENDING_UPDATES;
f92ce9
+						}
f92ce9
 						else if (rc == ACQUIRE_REPLICA_BUSY)
f92ce9
-						  {
f92ce9
-						next_state = STATE_BACKOFF;
f92ce9
-						use_busy_backoff_timer = PR_TRUE;
f92ce9
-						  }
f92ce9
+						{
f92ce9
+							next_state = STATE_BACKOFF;
f92ce9
+							use_busy_backoff_timer = PR_TRUE;
f92ce9
+						}
f92ce9
 						else if (rc == ACQUIRE_CONSUMER_WAS_UPTODATE)
f92ce9
-						  {
f92ce9
+						{
f92ce9
 							next_state = STATE_WAIT_CHANGES;
f92ce9
-						  }
f92ce9
+						}
f92ce9
 						else if (rc == ACQUIRE_TRANSIENT_ERROR)
f92ce9
-						  {
f92ce9
-						next_state = STATE_BACKOFF;
f92ce9
-						  }
f92ce9
+						{
f92ce9
+							next_state = STATE_BACKOFF;
f92ce9
+						}
f92ce9
 						else if (rc == ACQUIRE_FATAL_ERROR)
f92ce9
-						  {
f92ce9
-						next_state = STATE_STOP_FATAL_ERROR;
f92ce9
-						  }
f92ce9
+						{
f92ce9
+							next_state = STATE_STOP_FATAL_ERROR;
f92ce9
+						}
f92ce9
+
f92ce9
 						if (rc != ACQUIRE_SUCCESS)
f92ce9
-						  {
f92ce9
-						int optype, ldaprc;
f92ce9
-						windows_conn_get_error(prp->conn, &optype, &ldaprc);
f92ce9
-						agmt_set_last_update_status(prp->agmt, ldaprc,
f92ce9
+						{
f92ce9
+							int optype, ldaprc;
f92ce9
+							windows_conn_get_error(prp->conn, &optype, &ldaprc);
f92ce9
+							agmt_set_last_update_status(prp->agmt, ldaprc,
f92ce9
 										prp->last_acquire_response_code, NULL);
f92ce9
-						  }
f92ce9
-								/*
f92ce9
-								 * We either need to step the backoff timer, or
f92ce9
-								 * destroy it if we don't need it anymore.
f92ce9
-								 */
f92ce9
+						}
f92ce9
+
f92ce9
+						/*
f92ce9
+						 * We either need to step the backoff timer, or
f92ce9
+						 * destroy it if we don't need it anymore.
f92ce9
+						 */
f92ce9
 						if (STATE_BACKOFF == next_state)
f92ce9
-						  {
f92ce9
-						time_t next_fire_time;
f92ce9
-						time_t now;
f92ce9
-						/* Step the backoff timer */
f92ce9
-						time(&now;;
f92ce9
-						next_fire_time = backoff_step(prp_priv->backoff);
f92ce9
-						/* And go back to sleep */
f92ce9
-						slapi_log_error(SLAPI_LOG_REPL, windows_repl_plugin_name,
f92ce9
-								"%s: Replication session backing off for %ld seconds\n",
f92ce9
-								agmt_get_long_name(prp->agmt),
f92ce9
-								next_fire_time - now);
f92ce9
+						{
f92ce9
+							time_t next_fire_time;
f92ce9
+							time_t now;
f92ce9
+							/* Step the backoff timer */
f92ce9
+							time(&now;;
f92ce9
+							next_fire_time = backoff_step(prp_priv->backoff);
f92ce9
+							/* And go back to sleep */
f92ce9
+							slapi_log_error(SLAPI_LOG_REPL, windows_repl_plugin_name,
f92ce9
+									"%s: Replication session backing off for %ld seconds\n",
f92ce9
+									agmt_get_long_name(prp->agmt),
f92ce9
+									next_fire_time - now);
f92ce9
 
f92ce9
-						protocol_sleep(prp, PR_INTERVAL_NO_TIMEOUT);
f92ce9
-						  }
f92ce9
+							protocol_sleep(prp, PR_INTERVAL_NO_TIMEOUT);
f92ce9
+						}
f92ce9
 						else
f92ce9
-						  {
f92ce9
-						/* Destroy the backoff timer, since we won't need it anymore */
f92ce9
-						backoff_delete(&prp_priv->backoff);
f92ce9
-						  }            
f92ce9
-						use_busy_backoff_timer = PR_FALSE;
f92ce9
-					  }
f92ce9
+						{
f92ce9
+							/* Destroy the backoff timer, since we won't need it anymore */
f92ce9
+							backoff_delete(&prp_priv->backoff);
f92ce9
+						}
f92ce9
+					}
f92ce9
 					else if (event_occurred(prp, EVENT_TRIGGERING_CRITERIA_MET))
f92ce9
 					  {
f92ce9
 						/* changes are available */
f92ce9
diff --git a/ldap/servers/plugins/sync/sync_persist.c b/ldap/servers/plugins/sync/sync_persist.c
f92ce9
index 8d46102..f41a10c 100644
f92ce9
--- a/ldap/servers/plugins/sync/sync_persist.c
f92ce9
+++ b/ldap/servers/plugins/sync/sync_persist.c
f92ce9
@@ -661,10 +661,10 @@ sync_send_results( void *arg )
f92ce9
 				ectrls = (LDAPControl **)slapi_ch_calloc(2, sizeof (LDAPControl *));
f92ce9
 				if (req->req_cookie)
f92ce9
 					sync_cookie_update(req->req_cookie, ec);
f92ce9
-					sync_create_state_control(ec, &ectrls[0], chg_type, req->req_cookie);
f92ce9
-	    			rc = slapi_send_ldap_search_entry( req->req_pblock,
f92ce9
-								ec, ectrls,
f92ce9
-								noattrs?noattrs:attrs, attrsonly );
f92ce9
+				sync_create_state_control(ec, &ectrls[0], chg_type, req->req_cookie);
f92ce9
+				rc = slapi_send_ldap_search_entry( req->req_pblock,
f92ce9
+							ec, ectrls,
f92ce9
+							noattrs?noattrs:attrs, attrsonly );
f92ce9
 				if (rc) {
f92ce9
 					slapi_log_error(SLAPI_LOG_CONNS, SYNC_PLUGIN_SUBSYSTEM,
f92ce9
 							"Error %d sending entry %s\n",
f92ce9
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
f92ce9
index f3159a9..2524355 100644
f92ce9
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
f92ce9
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
f92ce9
@@ -4805,19 +4805,18 @@ static int checkpoint_threadmain(void *param)
f92ce9
 
f92ce9
             for (inst_obj = objset_first_obj(li->li_instance_set);
f92ce9
                  inst_obj;
f92ce9
-                 inst_obj = objset_next_obj(li->li_instance_set, inst_obj)) {
f92ce9
+                 inst_obj = objset_next_obj(li->li_instance_set, inst_obj))
f92ce9
+            {
f92ce9
                 inst = (ldbm_instance *)object_get_data(inst_obj);
f92ce9
                 rc = dblayer_get_id2entry(inst->inst_be, &db);
f92ce9
-                if (!db) {
f92ce9
+                if (!db || rc ) {
f92ce9
                     continue;
f92ce9
                 }
f92ce9
                 LDAPDebug1Arg(LDAP_DEBUG_BACKLDBM, "compactdb: Compacting DB start: %s\n",
f92ce9
                               inst->inst_name);
f92ce9
                 rc = dblayer_txn_begin(inst->inst_be, NULL, &txn);
f92ce9
                 if (rc) {
f92ce9
-                    LDAPDebug1Arg(LDAP_DEBUG_ANY,
f92ce9
-                                  "compactdb: transaction begin failed: %d\n",
f92ce9
-                                  rc);
f92ce9
+                    LDAPDebug1Arg(LDAP_DEBUG_ANY, "compactdb: transaction begin failed: %d\n", rc);
f92ce9
                     break;
f92ce9
                 }
f92ce9
                 rc = db->compact(db, txn.back_txn_txn, NULL/*start*/, NULL/*stop*/, 
f92ce9
@@ -4826,12 +4825,20 @@ static int checkpoint_threadmain(void *param)
f92ce9
                     LDAPDebug(LDAP_DEBUG_ANY,
f92ce9
                               "compactdb: failed to compact %s; db error - %d %s\n",
f92ce9
                               inst->inst_name, rc, db_strerror(rc));
f92ce9
-                    rc = dblayer_txn_abort(inst->inst_be, &txn);
f92ce9
+                    if((rc = dblayer_txn_abort(inst->inst_be, &txn))){
f92ce9
+                        LDAPDebug(LDAP_DEBUG_ANY, "compactdb: failed to abort txn (%s) db error - %d %s\n",
f92ce9
+                                  inst->inst_name, rc, db_strerror(rc));
f92ce9
+                        break;
f92ce9
+                    }
f92ce9
                 } else {
f92ce9
                     LDAPDebug2Args(LDAP_DEBUG_BACKLDBM,
f92ce9
                                    "compactdb: compact %s - %d pages freed\n",
f92ce9
                                    inst->inst_name, c_data.compact_pages_free);
f92ce9
-                    rc = dblayer_txn_commit(inst->inst_be, &txn);
f92ce9
+                    if((rc = dblayer_txn_commit(inst->inst_be, &txn))){
f92ce9
+                        LDAPDebug(LDAP_DEBUG_ANY, "compactdb: failed to commit txn (%s) db error - %d %s\n",
f92ce9
+                                  inst->inst_name, rc, db_strerror(rc));
f92ce9
+                        break;
f92ce9
+                    }
f92ce9
                 }
f92ce9
             }
f92ce9
             time_of_last_comapctdb_completion = current_time();    /* seconds since epoch */
f92ce9
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
f92ce9
index a4d2dc6..7930be9 100644
f92ce9
--- a/ldap/servers/slapd/pw.c
f92ce9
+++ b/ldap/servers/slapd/pw.c
f92ce9
@@ -2011,28 +2011,33 @@ slapi_pwpolicy_make_response_control (Slapi_PBlock *pb, int seconds, int logins,
f92ce9
 	}
f92ce9
 
f92ce9
 	rc = ber_printf( ber, "{" );
f92ce9
-	if ( seconds >= 0 || logins >= 0 ) {
f92ce9
-		if ( seconds >= 0 ) {
f92ce9
-			rc = ber_printf( ber, "t{ti}", LDAP_TAG_PWP_WARNING,
f92ce9
-							LDAP_TAG_PWP_SECSLEFT,
f92ce9
-							seconds );
f92ce9
-		} 
f92ce9
-		else {
f92ce9
-			rc = ber_printf( ber, "t{ti}", LDAP_TAG_PWP_WARNING,
f92ce9
-							LDAP_TAG_PWP_GRCLOGINS,
f92ce9
-							logins );
f92ce9
+	if ( rc != -1){
f92ce9
+		if(seconds >= 0 || logins >= 0 ) {
f92ce9
+			if ( seconds >= 0 ) {
f92ce9
+				rc = ber_printf( ber, "t{ti}", LDAP_TAG_PWP_WARNING,
f92ce9
+								LDAP_TAG_PWP_SECSLEFT,
f92ce9
+								seconds );
f92ce9
+			}
f92ce9
+			else {
f92ce9
+				rc = ber_printf( ber, "t{ti}", LDAP_TAG_PWP_WARNING,
f92ce9
+								LDAP_TAG_PWP_GRCLOGINS,
f92ce9
+								logins );
f92ce9
+			}
f92ce9
+		}
f92ce9
+		if (rc != -1){
f92ce9
+			if ( error >= 0 ) {
f92ce9
+				rc = ber_printf( ber, "te", LDAP_TAG_PWP_ERROR, error );
f92ce9
+			}
f92ce9
+			if (rc != -1){
f92ce9
+				rc = ber_printf( ber, "}" );
f92ce9
+				if ( rc != -1 )
f92ce9
+				{
f92ce9
+					rc = ber_flatten( ber, &bvp );
f92ce9
+				}
f92ce9
+			}
f92ce9
 		}
f92ce9
 	}
f92ce9
-	if ( error >= 0 ) {
f92ce9
-		rc = ber_printf( ber, "te", LDAP_TAG_PWP_ERROR, error );
f92ce9
-	}
f92ce9
-	rc = ber_printf( ber, "}" );
f92ce9
 
f92ce9
-	if ( rc != -1 )
f92ce9
-	{
f92ce9
-		rc = ber_flatten( ber, &bvp );
f92ce9
-	}
f92ce9
-    
f92ce9
 	ber_free( ber, 1 );
f92ce9
 
f92ce9
 	if ( rc != -1 )
f92ce9
@@ -2041,11 +2046,11 @@ slapi_pwpolicy_make_response_control (Slapi_PBlock *pb, int seconds, int logins,
f92ce9
 		new_ctrl.ldctl_oid = LDAP_X_CONTROL_PWPOLICY_RESPONSE;
f92ce9
 		new_ctrl.ldctl_value = *bvp;
f92ce9
 		new_ctrl.ldctl_iscritical = 0;         
f92ce9
-		rc= slapi_pblock_set( pb, SLAPI_ADD_RESCONTROL, &new_ctrl );
f92ce9
+		rc = slapi_pblock_set( pb, SLAPI_ADD_RESCONTROL, &new_ctrl );
f92ce9
 		ber_bvfree(bvp);
f92ce9
 	}
f92ce9
 
f92ce9
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= slapi_pwpolicy_make_response_control", 0, 0, 0 );
f92ce9
+	LDAPDebug( LDAP_DEBUG_TRACE, "<= slapi_pwpolicy_make_response_control (%d)", rc, 0, 0 );
f92ce9
 
f92ce9
 	return (rc==-1?LDAP_OPERATIONS_ERROR:LDAP_SUCCESS);
f92ce9
 }
f92ce9
-- 
f92ce9
1.9.3
f92ce9