From 68c4ee3248d60e1156d1556917452e648ddac943 Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mareynol@redhat.com>
Date: Tue, 13 Mar 2012 10:17:16 -0400
Subject: [PATCH] TIcket #285 - compilation fixes for '--format-security'

Bug Description:  If you build the make files with -Wformat-security and
                  -Werror=format-security you will hit a few errors:

                   "format not a string literal and no format arguments"

Fix Description:  Corrected the offending functions that were the format parameter.

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

Reviewed by: nhosoi(Thanks Noriko!)
---
 ldap/servers/plugins/replication/repl5_ruv.c |    4 ++--
 ldap/servers/slapd/passwd_extop.c            |    8 ++++----
 lib/base/pool.cpp                            |   10 +++++-----
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/ldap/servers/plugins/replication/repl5_ruv.c b/ldap/servers/plugins/replication/repl5_ruv.c
index e0b10ae..9a80fcc 100644
--- a/ldap/servers/plugins/replication/repl5_ruv.c
+++ b/ldap/servers/plugins/replication/repl5_ruv.c
@@ -1364,7 +1364,7 @@ ruv_dump(const RUV *ruv, char *ruv_name, PRFileDesc *prFile)
 	}
 	else
 	{
-		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, buff);
+		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "%s", buff);
 	}
 	for (replica = dl_get_first (ruv->elements, &cookie); replica;
 		 replica = dl_get_next (ruv->elements, &cookie))
@@ -1389,7 +1389,7 @@ ruv_dump(const RUV *ruv, char *ruv_name, PRFileDesc *prFile)
 		}
 		else
 		{
-			slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, buff);
+			slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "%s", buff);
 		}
 	}
 
diff --git a/ldap/servers/slapd/passwd_extop.c b/ldap/servers/slapd/passwd_extop.c
index c77d3b7..3c050d6 100644
--- a/ldap/servers/slapd/passwd_extop.c
+++ b/ldap/servers/slapd/passwd_extop.c
@@ -485,7 +485,7 @@ passwd_modify_extop( Slapi_PBlock *pb )
 		errMesg = "Could not get OID value from request.\n";
 		rc = LDAP_OPERATIONS_ERROR;
 		slapi_log_error( SLAPI_LOG_PLUGIN, "passwd_modify_extop", 
-				 errMesg );
+				"%s", errMesg );
 		goto free_and_return;
 	} else {
 	        slapi_log_error( SLAPI_LOG_PLUGIN, "passwd_modify_extop", 
@@ -511,7 +511,7 @@ passwd_modify_extop( Slapi_PBlock *pb )
 		errMesg = "Could not get SASL SSF from connection\n";
 		rc = LDAP_OPERATIONS_ERROR;
 		slapi_log_error( SLAPI_LOG_PLUGIN, "passwd_modify_extop",
-				 errMesg );
+				"%s", errMesg );
 		goto free_and_return;
 	}
 
@@ -519,7 +519,7 @@ passwd_modify_extop( Slapi_PBlock *pb )
 		errMesg = "Could not get local SSF from connection\n";
 		rc = LDAP_OPERATIONS_ERROR;
 		slapi_log_error( SLAPI_LOG_PLUGIN, "passwd_modify_extop",
-				 errMesg );
+				"%s", errMesg );
 		goto free_and_return;
 	}
 
@@ -842,7 +842,7 @@ parse_req_done:
 	/* Free anything that we allocated above */
 free_and_return:
 	slapi_log_error( SLAPI_LOG_PLUGIN, "passwd_modify_extop",
-		errMesg ? errMesg : "success" );
+		"%s", errMesg ? errMesg : "success" );
 
 	if ((rc == LDAP_REFERRAL) && (referrals)) {
 		send_referrals_from_entry(pb, referrals);
diff --git a/lib/base/pool.cpp b/lib/base/pool.cpp
index 2299309..657e8c6 100644
--- a/lib/base/pool.cpp
+++ b/lib/base/pool.cpp
@@ -178,7 +178,7 @@ _create_block(int size)
 		crit_exit(freelist_lock);
 		if (((newblock = (block_t *)PERM_MALLOC(sizeof(block_t))) == NULL) || 
 		    ((newblock->data = (char *)PERM_MALLOC(bytes)) == NULL)) {
-			ereport(LOG_CATASTROPHE, XP_GetAdminStr(DBT_poolCreateBlockOutOfMemory_));
+			ereport(LOG_CATASTROPHE, "%s", XP_GetAdminStr(DBT_poolCreateBlockOutOfMemory_));
 			if (newblock)
 				PERM_FREE(newblock);
 			return NULL;
@@ -270,7 +270,7 @@ pool_create()
 		}
 
 		if ( (newpool->curr_block =_create_block(BLOCK_SIZE)) == NULL) {
-			ereport(LOG_CATASTROPHE, XP_GetAdminStr(DBT_poolCreateOutOfMemory_));
+			ereport(LOG_CATASTROPHE, "%s", XP_GetAdminStr(DBT_poolCreateOutOfMemory_));
 			PERM_FREE(newpool);
 			return NULL;
 		}
@@ -291,7 +291,7 @@ pool_create()
 		crit_exit(known_pools_lock);
 	}
 	else 
-		ereport(LOG_CATASTROPHE, XP_GetAdminStr(DBT_poolCreateOutOfMemory_1));
+		ereport(LOG_CATASTROPHE, "%s", XP_GetAdminStr(DBT_poolCreateOutOfMemory_1));
 
 	return (pool_handle_t *)newpool;
 }
@@ -388,7 +388,7 @@ pool_malloc(pool_handle_t *pool_handle, size_t size)
 		 */
 		blocksize = ( (size + BLOCK_SIZE-1) / BLOCK_SIZE ) * BLOCK_SIZE;
 		if ( (pool->curr_block = _create_block(blocksize)) == NULL) {
-			ereport(LOG_CATASTROPHE, XP_GetAdminStr(DBT_poolMallocOutOfMemory_));
+			ereport(LOG_CATASTROPHE, "%s", XP_GetAdminStr(DBT_poolMallocOutOfMemory_));
 #ifdef POOL_LOCKING
 			crit_exit(pool->lock);
 #endif
@@ -410,7 +410,7 @@ pool_malloc(pool_handle_t *pool_handle, size_t size)
 
 void _pool_free_error()
 {
-	ereport(LOG_WARN, XP_GetAdminStr(DBT_freeUsedWherePermFreeShouldHaveB_));
+	ereport(LOG_WARN, "%s", XP_GetAdminStr(DBT_freeUsedWherePermFreeShouldHaveB_));
 
 	return;
 }
-- 
1.7.1

