From 92e7b3688d036588455097dbbc8a98b333438ea5 Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Mon, 11 Mar 2013 15:24:16 -0400
Subject: [PATCH] Ticket 606 - DSGW - format string errors

Bug Description:  When specifying [-Werror=format-security] DSGW fails to build.

Fix Description:  Several functions where not being called using the format string.

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

Reviewed by: ?
---
 csearch.c      |    2 +-
 dnedit.c       |    4 ++--
 domodify.c     |   14 +++++++-------
 entrydisplay.c |    4 ++--
 newentry.c     |    4 ++--
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/csearch.c b/csearch.c
index d7ce6f9..eb51584 100644
--- a/csearch.c
+++ b/csearch.c
@@ -176,7 +176,7 @@ emit_file (char* filename, struct ldap_searchobj* sop)
  * *after* the onSumbit handler executes, which is unfortunate.
  */
 			    "    if (sform.searchstring.value == '') {\n");
-		dsgw_emit_alert ("searchStringFrame", NULL,
+		dsgw_emit_alert ("searchStringFrame", NULL, "%s",
 				 XP_GetClientStr (DBT_youDidNotSupplyASearchString_));
 		dsgw_emits ("         return false;\n"
 			    "    }\n"
diff --git a/dnedit.c b/dnedit.c
index 599c67a..b30b72f 100644
--- a/dnedit.c
+++ b/dnedit.c
@@ -139,7 +139,7 @@ int main(int argc, char *argv[] )
 	"    var selvalue = sel.options[sel.selectedIndex].value;\n"
 	"    var lt = f.listtemplate;\n"
 	"    if ( f.searchstring.value.length == 0 ) {\n");
-    dsgw_emit_alert( "controlFrame", NULL, XP_GetClientStr( DBT_noSearchStringWasProvidedPleaseT_ ));
+    dsgw_emit_alert( "controlFrame", NULL, "%s", XP_GetClientStr( DBT_noSearchStringWasProvidedPleaseT_ ));
     dsgw_emits(
 	"	return false;\n"
 	"    }\n"
@@ -323,7 +323,7 @@ int main(int argc, char *argv[] )
 		       "CONFIRMVALUE1",
 		       NULL /* no */,
 		       XP_GetClientStr(DBT_discardChangesWindow_), 1,
-		       XP_GetClientStr(DBT_discardChanges_));
+		       "%s", XP_GetClientStr(DBT_discardChanges_));
     dsgw_emits (
 	"    }\n"
 	"}\n"
diff --git a/domodify.c b/domodify.c
index 5a37192..00306cb 100644
--- a/domodify.c
+++ b/domodify.c
@@ -114,7 +114,7 @@ post_request()
     }
 
     if ( dsgw_init_ldap( &ld, NULL, 0, 0) != DSGW_BOUND_ASUSER ) {
-	dsgw_emitf( XP_GetClientStr(DBT_warningNoAuthenticationContinuin_) );
+	dsgw_emitf( "%s", XP_GetClientStr(DBT_warningNoAuthenticationContinuin_) );
     }
 
     if ( !quiet ) {
@@ -589,7 +589,7 @@ entry_modify_or_add( LDAP *ld, char *dn, int add, int *pwdchangedp )
 	} else {	/* no changes -- just report success */
 	    lderr = LDAP_SUCCESS;
 	    if ( !quiet ) {
-		dsgw_emitf( XP_GetClientStr(DBT_PSuccessfullyEditedEntryYourChan_) );
+		dsgw_emitf("%s", XP_GetClientStr(DBT_PSuccessfullyEditedEntryYourChan_) );
 	    }
 	}
     } else { 
@@ -614,9 +614,9 @@ entry_modify_or_add( LDAP *ld, char *dn, int add, int *pwdchangedp )
 			if ( lderr == LDAP_SUCCESS ) {
 				if ( !quiet ) {
 				if ( add ) {
-					dsgw_emitf( XP_GetClientStr(DBT_PSuccessfullyAddedEntryN_) );
+					dsgw_emitf( "%s", XP_GetClientStr(DBT_PSuccessfullyAddedEntryN_) );
 				} else {
-					dsgw_emitf( XP_GetClientStr(DBT_PSuccessfullyEditedEntryYourChan_) );
+					dsgw_emitf( "%s", XP_GetClientStr(DBT_PSuccessfullyEditedEntryYourChan_) );
 				}
 				}
 			} else {
@@ -654,7 +654,7 @@ entry_delete( LDAP *ld, char *dn )
     dsgw_emitf( "<FONT SIZE=+1>\n" );
     if (( lderr = ldap_delete_ext_s( ld, dn, NULL, NULL )) == LDAP_SUCCESS ) {
 	if ( !quiet ) {
-	    dsgw_emitf( XP_GetClientStr(DBT_PSuccessfullyDeletedEntryN_) );
+	    dsgw_emitf( "%s", XP_GetClientStr(DBT_PSuccessfullyDeletedEntryN_) );
 	}
     } else {
 	(void)dsgw_ldap_get_lderrno( ld, NULL, &errmsg );
@@ -673,7 +673,7 @@ entry_modrdn( LDAP *ld, char *dn, char *newrdn, int deleteoldrdn )
     char	*errmsg = NULL;
 
     if ( verbose ) {
-	dsgw_emitf( XP_GetClientStr(DBT_PreTheNewNameForTheEntryIsSNPreH_),
+	dsgw_emitf( "%s %s", XP_GetClientStr(DBT_PreTheNewNameForTheEntryIsSNPreH_),
 		newrdn );
     }
 
@@ -681,7 +681,7 @@ entry_modrdn( LDAP *ld, char *dn, char *newrdn, int deleteoldrdn )
     if (( lderr = ldap_rename_s( ld, dn, newrdn, NULL, deleteoldrdn, NULL, NULL ))
 	    == LDAP_SUCCESS ) {
 	if ( !quiet ) {
-	    dsgw_emitf( XP_GetClientStr(DBT_PSuccessfullyRenamedEntryN_) );
+	    dsgw_emitf( "%s", XP_GetClientStr(DBT_PSuccessfullyRenamedEntryN_) );
 	}
     } else {
 	(void)dsgw_ldap_get_lderrno( ld, NULL, &errmsg );
diff --git a/entrydisplay.c b/entrydisplay.c
index 35828d1..e94427e 100644
--- a/entrydisplay.c
+++ b/entrydisplay.c
@@ -820,7 +820,7 @@ output_prelude_script( dsgwtmplinfo *tip )
 		        "    else {\n");
 	    dsgw_emit_confirm( NULL, "CONFIRMVALUE3", NULL/*no*/,
 			       XP_GetClientStr(DBT_continueWithoutSavingWindow_), 1,
-			       XP_GetClientStr(DBT_continueWithoutSaving_));
+			       "%s", XP_GetClientStr(DBT_continueWithoutSaving_));
 	    dsgw_emits( "    }\n");
 	    dsgw_emits( "}\n" );
 	}
@@ -839,7 +839,7 @@ output_prelude_script( dsgwtmplinfo *tip )
 		    "    else {\n" );
 	dsgw_emit_confirm( NULL, "CONFIRMVALUE4", NULL/*no*/,
 			   XP_GetClientStr(DBT_discardChangesWindow_), 1,
-			   XP_GetClientStr(DBT_discardChanges_));
+			   "%s", XP_GetClientStr(DBT_discardChanges_));
 	dsgw_emits( "    }\n}\n" );
 
 	/* set unload handler to catch unsaved changes */
diff --git a/newentry.c b/newentry.c
index acb488b..6110184 100644
--- a/newentry.c
+++ b/newentry.c
@@ -109,13 +109,13 @@ emit_file (char* filename, dsgwnewtype* entType)
 		deleteme =  XP_GetClientStr (DBT_enterNameForNewEntry_);
 
 		dsgw_emit_alert ("newentryNameFrame", "width=400,height=130,resizable",
-				 XP_GetClientStr (DBT_enterNameForNewEntry_));
+				 "%s", XP_GetClientStr (DBT_enterNameForNewEntry_));
 		dsgw_emits ("	return false;\n"
 			    "    } else if ( nameForm.selectLocation.options[nameForm.selectLocation.selectedIndex].value == '' &&\n"
 			    "               ( nameForm.dnsuffix == null ||\n"
 			    "                 nameForm.dnsuffix.value == '' )) {\n");
 		dsgw_emit_alert ("newentryNameFrame", "width=400,height=130,resizable",
-				 XP_GetClientStr (DBT_enterLocationForNewEntry_));
+				 "%s" ,XP_GetClientStr (DBT_enterLocationForNewEntry_));
 		dsgw_emits ("	return false;\n"
 			    "    } else {\n"
 			    "     open('', 'NewEntryWindow');\n"			    
-- 
1.7.1

