packages: pcsc-lite/pcsc-lite.spec, pcsc-lite/noautostart.patch (NEW) - dis...

glen glen at pld-linux.org
Mon Jan 10 21:59:22 CET 2011


Author: glen                         Date: Mon Jan 10 20:59:22 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- disable pcscd autostart, we have it as daemon and never had it suid-installed (fc patch)

---- Files affected:
packages/pcsc-lite:
   pcsc-lite.spec (1.48 -> 1.49) , noautostart.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/pcsc-lite/pcsc-lite.spec
diff -u packages/pcsc-lite/pcsc-lite.spec:1.48 packages/pcsc-lite/pcsc-lite.spec:1.49
--- packages/pcsc-lite/pcsc-lite.spec:1.48	Wed Jan  5 22:46:49 2011
+++ packages/pcsc-lite/pcsc-lite.spec	Mon Jan 10 21:59:17 2011
@@ -7,7 +7,7 @@
 Summary(pl.UTF-8):	Środowisko PCSC dla Linuksa
 Name:		pcsc-lite
 Version:	1.6.4
-Release:	2
+Release:	3
 License:	BSD
 Group:		Daemons
 #Source0Download: http://alioth.debian.org/project/showfiles.php?group_id=30105
@@ -17,6 +17,7 @@
 Source2:	%{name}-pcscd.sysconfig
 Patch0:		%{name}-fhs.patch
 Patch1:		%{name}-any.patch
+Patch2:		noautostart.patch
 URL:		http://www.linuxnet.com/middle.html
 BuildRequires:	autoconf >= 2.58
 BuildRequires:	automake >= 1:1.8
@@ -92,6 +93,7 @@
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %build
 %{__libtoolize}
@@ -119,10 +121,10 @@
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
-install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/pcscd
-install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/pcscd
+install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/pcscd
+cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/pcscd
 
-install doc/example/*.c $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+cp -a doc/example/*.c $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
 
 rm -rf $RPM_BUILD_ROOT%{_prefix}/doc
 
@@ -185,6 +187,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.49  2011/01/10 20:59:17  glen
+- disable pcscd autostart, we have it as daemon and never had it suid-installed (fc patch)
+
 Revision 1.48  2011/01/05 21:46:49  glen
 - release 2
 

================================================================
Index: packages/pcsc-lite/noautostart.patch
diff -u /dev/null packages/pcsc-lite/noautostart.patch:1.1
--- /dev/null	Mon Jan 10 21:59:22 2011
+++ packages/pcsc-lite/noautostart.patch	Mon Jan 10 21:59:17 2011
@@ -0,0 +1,102 @@
+# Disable pcscd on-demand startup (#653903)
+https://bugzilla.redhat.com/show_bug.cgi?id=653903
+
+diff -up pcsc-lite-1.6.4/src/winscard_clnt.c.noautostart pcsc-lite-1.6.4/src/winscard_clnt.c
+--- pcsc-lite-1.6.4/src/winscard_clnt.c.noautostart	2010-12-12 23:46:43.228293593 +0200
++++ pcsc-lite-1.6.4/src/winscard_clnt.c	2010-12-12 23:52:44.388532774 +0200
+@@ -387,79 +387,15 @@ LONG SCardEstablishContext(DWORD dwScope
+ 	LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
+ {
+ 	LONG rv;
+-	int daemon_launched = FALSE;
+-	int retries = 0;
+ 
+ 	PROFILE_START
+ 
+-again:
+ 	/* Check if the server is running */
+ 	rv = SCardCheckDaemonAvailability();
+ 	if (SCARD_E_INVALID_HANDLE == rv)
+ 		/* we reconnected to a daemon or we got called from a forked child */
+ 		rv = SCardCheckDaemonAvailability();
+ 
+-	if (SCARD_E_NO_SERVICE == rv)
+-	{
+-launch:
+-		if (daemon_launched)
+-		{
+-			retries++;
+-			if (retries < 50)	/* 50 x 100ms = 5 seconds */
+-			{
+-				/* give some more time to the server to start */
+-				SYS_USleep(100*1000);	/* 100 ms */
+-				goto again;
+-			}
+-
+-			/* the server failed to start (in time) */
+-			goto end;
+-		}
+-		else
+-		{
+-			int pid;
+-
+-			pid = fork();
+-
+-			if (pid < 0)
+-			{
+-				Log2(PCSC_LOG_CRITICAL, "fork failed: %s", strerror(errno));
+-				rv = SCARD_F_INTERNAL_ERROR;
+-				goto end;
+-			}
+-
+-			if (0 == pid)
+-			{
+-				int ret, i, max;
+-				char *param = getenv("PCSCLITE_PCSCD_ARGS");
+-
+-				/* close all file handles except stdin, stdout and
+-				 * stderr so that pcscd does not confiscate ressources
+-				 * allocated by the application */
+-				max = sysconf(_SC_OPEN_MAX);
+-				if (-1 == max)
+-					max = 1024;
+-				for (i=3; i<max; i++)
+-					(void)close(i);
+-
+-				/* son process */
+-				ret = execl(PCSCD_BINARY, "pcscd", "--auto-exit", param,
+-					(char *)NULL);
+-				Log2(PCSC_LOG_CRITICAL, "exec " PCSCD_BINARY " failed: %s",
+-					strerror(errno));
+-				exit(1);
+-			}
+-
+-			/* father process */
+-			daemon_launched = TRUE;
+-
+-			if (waitpid(pid, NULL, 0) < 0)
+-				Log2(PCSC_LOG_CRITICAL, "waitpid failed: %s", strerror(errno));
+-
+-			goto again;
+-		}
+-	}
+-
+ 	if (rv != SCARD_S_SUCCESS)
+ 		goto end;
+ 
+@@ -468,15 +404,6 @@ launch:
+ 		pvReserved2, phContext);
+ 	(void)SCardUnlockThread();
+ 
+-	/* SCardEstablishContextTH may fail if the previous pcscd crashed
+-	 * without cleaning /var/run/pcscd/pcscd.comm */
+-	if (SCARD_E_NO_SERVICE == rv)
+-	{
+-		retries++;
+-		if (retries <= 1)
+-			goto launch;
+-	}
+-
+ end:
+ 	PROFILE_END(rv)
+ 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/pcsc-lite/pcsc-lite.spec?r1=1.48&r2=1.49&f=u



More information about the pld-cvs-commit mailing list