[packages/jggtrans] - fix errors caused by -Wformat-security - rel 5

baggins baggins at pld-linux.org
Mon Nov 19 09:35:50 CET 2012


commit 008f5b2f0f25d09b63df03fb87e6ae268278a5e9
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Mon Nov 19 09:35:31 2012 +0100

    - fix errors caused by -Wformat-security
    - rel 5

 jggtrans-format-security.patch | 341 +++++++++++++++++++++++++++++++++++++++++
 jggtrans.spec                  |   4 +-
 2 files changed, 344 insertions(+), 1 deletion(-)
---
diff --git a/jggtrans.spec b/jggtrans.spec
index da4837d..f42a1e9 100644
--- a/jggtrans.spec
+++ b/jggtrans.spec
@@ -4,7 +4,7 @@ Summary:	GaduGadu transport module for Jabber
 Summary(pl.UTF-8):	Moduł transportowy GaduGadu dla systemu Jabber
 Name:		jggtrans
 Version:	2.2.4
-Release:	4
+Release:	5
 License:	GPL
 Group:		Applications/Communications
 Source0:	http://jggtrans.jajcus.net/downloads/jggtrans-%{version}.tar.gz
@@ -14,6 +14,7 @@ Source2:	jggtrans.sysconfig
 Patch0:		%{name}-pidfile.patch
 Patch1:		%{name}-spooldir.patch
 Patch2:		diff-trunk_src-from-r714-to-r716.diff
+Patch3:		%{name}-format-security.patch
 URL:		http://jggtrans.jajcus.net/
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -44,6 +45,7 @@ użytkownikami GaduGadu.
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 %build
 %{__gettextize}
diff --git a/jggtrans-format-security.patch b/jggtrans-format-security.patch
new file mode 100644
index 0000000..879301d
--- /dev/null
+++ b/jggtrans-format-security.patch
@@ -0,0 +1,341 @@
+--- jggtrans-2.2.4/src/acl.c.orig	2010-04-10 16:23:06.000000000 +0200
++++ jggtrans-2.2.4/src/acl.c	2012-11-19 09:26:59.451913266 +0100
+@@ -83,7 +83,7 @@
+ 	if (from){
+ 		jid=jid_normalized(from,0);
+ 		if (jid==NULL){
+-			debug(L_("Not Allowed - bad 'from'"));
++			debug("%s", L_("Not Allowed - bad 'from'"));
+ 			return 0;
+ 		}
+ 	}
+@@ -102,7 +102,7 @@
+ 	if (it==NULL) result=1;
+ 	xmlnode_free(x);
+ 	g_free(jid);
+-	if (result) debug(L_("Allowed"));
+-	else debug(L_("Denied"));
++	if (result) debug("%s", L_("Allowed"));
++	else debug("%s", L_("Denied"));
+ 	return result;
+ }
+--- jggtrans-2.2.4/src/browse.c.orig	2010-04-10 16:23:06.000000000 +0200
++++ jggtrans-2.2.4/src/browse.c	2012-11-19 09:27:41.835245105 +0100
+@@ -48,7 +48,7 @@
+ 
+ 	jid=jid_normalized(from,0);
+ 	if (jid==NULL){
+-		debug(L_("Bad 'from' address"));
++		debug("%s", L_("Bad 'from' address"));
+ 		return;
+ 	}
+ 	if (g_list_find_custom(admins,jid,(GCompareFunc)strcmp)==NULL){
+@@ -77,7 +77,7 @@
+ 
+ 	jid=jid_normalized(from,0);
+ 	if (jid==NULL){
+-		debug(L_("Bad 'from' address"));
++		debug("%s", L_("Bad 'from' address"));
+ 		return;
+ 	}
+ 	resource=strchr(to,'/');
+--- jggtrans-2.2.4/src/jabber.c.orig	2010-04-10 16:23:06.000000000 +0200
++++ jggtrans-2.2.4/src/jabber.c	2012-11-19 09:28:49.191909396 +0100
+@@ -64,7 +64,7 @@
+ 		return;
+ 	}
+ 
+-	g_message(L_("handshake OK"));
++	g_message("%s", L_("handshake OK"));
+ 	jabber_state=JS_CONNECTED;
+ 	users_probe_all();
+ }
+@@ -219,43 +219,43 @@
+ 	stream_add_destroy_handler(jabber_stream_destroyed);
+ 	node=xmlnode_get_tag(config,"service");
+ 	if (!node)
+-		g_error(L_("No <service/> found in config file"));
++		g_error("%s", L_("No <service/> found in config file"));
+ 
+ 	my_name=xmlnode_get_attrib(node,"jid");
+ 	if (!my_name)
+-		g_error(L_("<service/> without \"jid\" in config file"));
++		g_error("%s", L_("<service/> without \"jid\" in config file"));
+ 
+ 	node=xmlnode_get_tag(config, "bare_domain");
+ 	if (node) bare_domain=1;
+ 
+ 	server=config_load_string("connect/ip");
+ 	if (!server)
+-		g_error(L_("Jabberd server not found in config file"));
++		g_error("%s", L_("Jabberd server not found in config file"));
+ 
+ 	port=config_load_int("connect/port",0);
+ 	if (port<=0)
+-		g_error(L_("Connect port not found in config file"));
++		g_error("%s", L_("Connect port not found in config file"));
+ 
+ 	node=xmlnode_get_tag(config,"connect/secret");
+ 	if (node) secret=xmlnode_get_data(node);
+ 	if (!node || !secret)
+-		g_error(L_("Connect secret not found in config file"));
++		g_error("%s", L_("Connect secret not found in config file"));
+ 
+ 	register_instructions=config_load_formatted_string("register/instructions");
+ 	if (!register_instructions)
+-		g_error(L_("Registration instructions not not found in config file"));
++		g_error("%s", L_("Registration instructions not not found in config file"));
+ 
+ 	search_instructions=config_load_formatted_string("search/instructions");
+ 	if (!search_instructions)
+-		g_error(L_("Search instructions not found in config file"));
++		g_error("%s", L_("Search instructions not found in config file"));
+ 
+ 	gateway_desc=config_load_formatted_string("gateway/desc");
+ 	if (!gateway_desc)
+-		g_error(L_("Gateway instructions not found in config file"));
++		g_error("%s", L_("Gateway instructions not found in config file"));
+ 
+ 	gateway_prompt=config_load_formatted_string("gateway/prompt");
+ 	if (!gateway_prompt)
+-		g_error(L_("Gateway prompt not found in config file"));
++		g_error("%s", L_("Gateway prompt not found in config file"));
+ 
+ 	jabber_state=JS_NONE;
+ 	return 0;
+--- jggtrans-2.2.4/src/main.c.orig	2010-04-10 16:23:06.000000000 +0200
++++ jggtrans-2.2.4/src/main.c	2012-11-19 09:31:03.988571309 +0100
+@@ -318,7 +318,7 @@
+ pid_t sid;
+ int fd;
+ 
+-	debug(L_("Daemonizing..."));
++	debug("%s", L_("Daemonizing..."));
+ 	pid=fork();
+ 	if (pid==-1) g_error(L_("Failed to fork(): %s"),g_strerror(errno));
+ 	if (pid){
+@@ -348,7 +348,7 @@
+ 	sid=setsid();
+ 	if (sid==-1) abort();
+ 	foreground=FALSE;
+-	debug(L_("I am a daemon, I think."));
++	debug("%s", L_("I am a daemon, I think."));
+ 	return;
+ }
+ 
+@@ -475,7 +475,7 @@
+ 
+ 	config=xmlnode_file(config_file);
+ 	if (!config){
+-		g_error(L_("Couldn't load config!"));
++		g_error("%s", L_("Couldn't load config!"));
+ 		return 1;
+ 	}
+ 	str=xmlnode_get_name(config);
+@@ -535,13 +535,13 @@
+ 			fclose(pidfile);
+ 			if (r==1 && pid>0){
+ 				r=kill(pid,0);
+-				if (!r || (r && errno!=ESRCH)) g_error(L_("jggtrans already running"));
++				if (!r || (r && errno!=ESRCH)) g_error("%s", L_("jggtrans already running"));
+ 				if (r){
+ 					g_warning(N_("Stale pid file. Removing."));
+ 					unlink(pid_filename);
+ 				}
+ 			}
+-			else if (r!=EOF) g_error(L_("Invalid pid file."));
++			else if (r!=EOF) g_error("%s", L_("Invalid pid file."));
+ 		}
+ 		if (pid_filename) pidfile=fopen(pid_filename,"w");
+ 		if (pidfile==NULL)
+@@ -564,7 +564,7 @@
+ 		if (initgroups(user,newgid)) g_error(L_("Couldn't init groups: %s"),g_strerror(errno));
+ 		if (setuid(pwd->pw_uid)) g_error(L_("Couldn't change user: %s"),g_strerror(errno));
+ 	}
+-	else if (uid==0 && !restarting) g_error(L_("Refusing to run with uid=0"));
++	else if (uid==0 && !restarting) g_error("%s", L_("Refusing to run with uid=0"));
+ 
+ 	main_loop=g_main_new(0);
+ 
+@@ -656,7 +656,7 @@
+ 		}
+ 	}
+ 
+-	g_message(L_("Exiting normally.\n"));
++	g_message("%s", L_("Exiting normally.\n"));
+ 
+ 	g_log_remove_handler(NULL,lh);
+ 
+--- jggtrans-2.2.4/src/presence.c.orig	2012-11-19 09:24:56.000000000 +0100
++++ jggtrans-2.2.4/src/presence.c	2012-11-19 09:32:16.008568768 +0100
+@@ -232,7 +232,7 @@
+ 
+ 	u=user_get_by_jid(from);
+ 	if (jid_is_me(to)){
+-		debug(L_("Presence subscribe request sent to me"));
++		debug("%s", L_("Presence subscribe request sent to me"));
+ 		if (!u) {
+ 			presence_send_unsubscribed(stream,to,from);
+ 			return 0;
+@@ -268,7 +268,7 @@
+ 	user_save(u);
+ 
+ 	if (s) session_update_contact(s,c);	
+-	debug(L_("Subscribed."));
++	debug("%s", L_("Subscribed."));
+ 	presence_send_subscribed(stream,to,from);
+ 	bare=jid_normalized(from,FALSE);
+ 	if (c->subscribe!=SUB_FROM && c->subscribe!=SUB_BOTH) {
+@@ -294,7 +294,7 @@
+ 		if (u->subscribe==SUB_NONE) u->subscribe=SUB_FROM;
+ 		else if (u->subscribe==SUB_UNDEFINED || u->subscribe==SUB_TO) u->subscribe=SUB_BOTH;
+ 		user_save(u);
+-		debug(L_("Presence 'subscribed' sent to me"));
++		debug("%s", L_("Presence 'subscribed' sent to me"));
+ 		return 0;
+ 	}
+ 	if (!jid_has_uin(to) || !jid_is_my(to)){
+@@ -332,7 +332,7 @@
+ 		if (u->subscribe==SUB_FROM) u->subscribe=SUB_NONE;
+ 		else if (u->subscribe==SUB_BOTH || u->subscribe==SUB_UNDEFINED) u->subscribe=SUB_TO;
+ 		user_save(u);
+-		debug(L_("Presence 'unsubscribed' sent to me"));
++		debug("%s", L_("Presence 'unsubscribed' sent to me"));
+ 		return 0;
+ 	}
+ 	if (!jid_has_uin(to) || !jid_is_my(to)){
+@@ -367,7 +367,7 @@
+ 		return -1;
+ 	}
+ 	if (jid_is_me(to)){
+-		debug(L_("Presence unsubscribe request sent to me"));
++		debug("%s", L_("Presence unsubscribe request sent to me"));
+ 		if (u->subscribe==SUB_TO || u->subscribe==SUB_UNDEFINED) u->subscribe=SUB_NONE;
+ 		else if (u->subscribe==SUB_BOTH) u->subscribe=SUB_FROM;
+ 		user_save(u);
+@@ -392,7 +392,7 @@
+ 
+ 	if (s) session_update_contact(s,c);
+ 	
+-	debug(L_("Unsubscribed."));
++	debug("%s", L_("Unsubscribed."));
+ 	presence_send_unsubscribed(stream,to,from);
+ 	if (!GG_S_NA(c->status) && c->status!=-1){
+ 		char *ujid;
+--- jggtrans-2.2.4/src/sessions.c.orig	2010-04-10 16:23:06.000000000 +0200
++++ jggtrans-2.2.4/src/sessions.c	2012-11-19 09:33:16.305233307 +0100
+@@ -443,7 +443,7 @@
+ time_t timestamp;
+ 
+ 	user_load_locale(s->user);
+-	debug(L_("Checking error conditions..."));
++	debug("%s", L_("Checking error conditions..."));
+ 	if (condition&(G_IO_ERR|G_IO_NVAL)){
+ 		if (condition&G_IO_ERR) g_warning(N_("Error on connection for %s ,[GGnumber: %i]"),s->jid,s->ggs->uin);
+ 		if (condition&G_IO_HUP){
+@@ -579,7 +579,7 @@
+ 						event->event.msg.sender,0);
+ 				if ((!c && s->user->ignore_unknown) 
+ 						|| (c && c->ignored)) {
+-					debug(L_("Ignoring the message."));
++					debug("%s", L_("Ignoring the message."));
+ 				       	break;
+ 				}
+ 				jid=jid_build_full(event->event.msg.sender);
+@@ -630,7 +630,7 @@
+ 	session_setup_g_source(s);
+ 
+ 	gg_event_free(event);
+-	debug(L_("io handler done..."));
++	debug("%s", L_("io handler done..."));
+ 
+ 	return FALSE;
+ }
+@@ -855,12 +855,12 @@
+ 	s=(Session *)g_hash_table_lookup(sessions_jid,(gpointer)njid);
+ 	g_free(njid);
+ 	if (s) return s;
+-	debug(L_("Session not found"));
++	debug("%s", L_("Session not found"));
+ 	if (!stream) return NULL;
+ 	u=user_get_by_jid(jid);
+ 	if (!u) return NULL;
+ 
+-	debug(L_("User loaded, processing his subscriptions."));
++	debug("%s", L_("User loaded, processing his subscriptions."));
+ 	for(it=u->contacts;it;it=it->next){
+ 		Contact *c;
+ 		char *c_jid;
+@@ -876,7 +876,7 @@
+ 			g_free(c_jid);
+ 		}
+ 	}
+-	debug(L_("Creating new session"));
++	debug("%s", L_("Creating new session"));
+ 	return session_create(u,jid,NULL,NULL,stream,delay_login);
+ }
+ 
+--- jggtrans-2.2.4/src/stream.c.orig	2010-04-10 16:23:06.000000000 +0200
++++ jggtrans-2.2.4/src/stream.c	2012-11-19 09:33:53.661898655 +0100
+@@ -166,9 +166,9 @@
+ 	s->err_watch=0;
+ 	s->xs->f(XSTREAM_CLOSE,NULL,s);
+ 	if (!s->connected)
+-		g_critical(L_("Couldn't connect to jabber server"));
++		g_critical("%s", L_("Couldn't connect to jabber server"));
+ 	else
+-		g_critical(L_("Connection to jabber server broken"));
++		g_critical("%s", L_("Connection to jabber server broken"));
+ 	do_restart=TRUE;
+ 	return FALSE;
+ }
+@@ -202,7 +202,7 @@
+ 	s=(Stream *)data;
+ 	g_assert(s);
+ 
+-	if (!s->connected) g_error(L_("Unconnected stream"));
++	if (!s->connected) g_error("%s", L_("Unconnected stream"));
+ 
+ 	if (!s->read_buf){
+ 		s->read_buf=g_new(char,1025);
+@@ -224,7 +224,7 @@
+ 	s->read_buf[br]=0;
+ 	debug("IN: %s",s->read_buf);
+ 	if(xstream_eat(s->xs,s->read_buf,br) > XSTREAM_NODE){
+-		g_warning(L_("Error reading from stream"));
++		g_warning("%s", L_("Error reading from stream"));
+ 		s->read_watch=0;
+ 		s->xs->f(XSTREAM_CLOSE,NULL,s);
+ 		return FALSE;
+--- jggtrans-2.2.4/src/users.c.orig	2010-04-10 16:23:06.000000000 +0200
++++ jggtrans-2.2.4/src/users.c	2012-11-19 09:34:27.835230786 +0100
+@@ -67,7 +67,7 @@
+ 
+ 	spool_dir=config_load_string("spool");
+ 	if (!spool_dir)
+-		g_error(L_("No <spool/> defined in config file"));
++		g_error("%s", L_("No <spool/> defined in config file"));
+ 
+ 	r=chdir(spool_dir);
+ 	if (r) g_error(L_("Couldn't enter %s: %s"),spool_dir,g_strerror(errno));
+@@ -499,17 +499,17 @@
+ 	}
+ 
+ 	if (uin<1){
+-		g_warning(L_("Bad UIN"));
++		g_warning("%s", L_("Bad UIN"));
+ 		g_free(njid);
+ 		return NULL;
+ 	}
+ 	if (!password){
+-		g_warning(L_("Password not given"));
++		g_warning("%s", L_("Password not given"));
+ 		g_free(njid);
+ 		return NULL;
+ 	}
+ 	if (!jid){
+-		g_warning(L_("JID not given"));
++		g_warning("%s", L_("JID not given"));
+ 		g_free(njid);
+ 		return NULL;
+ 	}
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/jggtrans.git/commitdiff/008f5b2f0f25d09b63df03fb87e6ae268278a5e9



More information about the pld-cvs-commit mailing list