From d83c8bf0b1c7728009eed921029065629b131ad2 Mon Sep 17 00:00:00 2001 From: Robert Relyea Date: Wed, 17 Jun 2009 17:57:10 +0000 Subject: [PATCH] Update directory permissions bug: 503211 --- pcsc-lite-1.5-permissions.patch | 49 +++++++++++++++++++++++++++++++++ pcsc-lite.spec | 7 ++++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 pcsc-lite-1.5-permissions.patch diff --git a/pcsc-lite-1.5-permissions.patch b/pcsc-lite-1.5-permissions.patch new file mode 100644 index 0000000..cdf3dd7 --- /dev/null +++ b/pcsc-lite-1.5-permissions.patch @@ -0,0 +1,49 @@ +diff -up ./src/pcscdaemon.c.permissions ./src/pcscdaemon.c +--- ./src/pcscdaemon.c.permissions 2009-02-06 00:46:20.000000000 -0800 ++++ ./src/pcscdaemon.c 2009-06-17 10:06:49.419656000 -0700 +@@ -438,7 +438,8 @@ int main(int argc, char **argv) + rv = SYS_Stat(PCSCLITE_EVENTS_DIR, &fStatBuf); + if (rv < 0) + { +- int mode = S_IRWXU | S_IWGRP | S_IXGRP | S_IWOTH | S_IXOTH; /* 0755 */ ++ /* 1733 : world writable + sticky bit */ ++ int mode = S_IRWXU | S_IWGRP | S_IXGRP | S_IWOTH | S_IXOTH | S_ISVTX; + + rv = SYS_Mkdir(PCSCLITE_EVENTS_DIR, mode); + if (rv != 0) +diff -up ./src/winscard_clnt.c.permissions ./src/winscard_clnt.c +--- ./src/winscard_clnt.c.permissions 2009-02-06 00:46:20.000000000 -0800 ++++ ./src/winscard_clnt.c 2009-06-17 10:07:32.392742000 -0700 +@@ -1717,7 +1717,7 @@ static long WaitForPcscdEvent(SCARDCONTE + { + char filename[FILENAME_MAX]; + char buf[1]; +- int fd; ++ int fd, r; + struct timeval tv, *ptv = NULL; + struct timeval before, after; + fd_set read_fd; +@@ -1734,7 +1734,14 @@ static long WaitForPcscdEvent(SCARDCONTE + + (void)snprintf(filename, sizeof(filename), "%s/event.%d.%ld", + PCSCLITE_EVENTS_DIR, SYS_GetPID(), hContext); +- (void)mkfifo(filename, 0644); ++ r = mkfifo(filename, 0644); ++ if (-1 == r) ++ { ++ Log2(PCSC_LOG_CRITICAL, "Can't create event fifo: %s", strerror(errno)); ++ goto exit; ++ } ++ ++ + fd = SYS_OpenFile(filename, O_RDONLY | O_NONBLOCK, 0); + + FD_ZERO(&read_fd); +@@ -1755,6 +1762,7 @@ static long WaitForPcscdEvent(SCARDCONTE + dwTime -= diff/1000; + } + ++exit: + return dwTime; + } + diff --git a/pcsc-lite.spec b/pcsc-lite.spec index 3dcc159..d48eb20 100644 --- a/pcsc-lite.spec +++ b/pcsc-lite.spec @@ -1,6 +1,6 @@ Name: pcsc-lite Version: 1.5.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: PC/SC Lite smart card framework and applications %define upstream_build 2795 @@ -11,6 +11,7 @@ Source0: http://alioth.debian.org/download.php/%{upstream_build}/%{name}- Patch0: %{name}-1.4-docinst.patch Patch1: %{name}-1.4.100-rpath64.patch Patch2: %{name}-close_on_exec.patch +Patch3: %{name}-1.5-permissions.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -64,6 +65,7 @@ Group: Documentation %patch0 -p0 -b .docinst %patch1 -p1 -b .rpath64 %patch2 -p1 -b .close_on_exec +%patch3 -p0 -b .permissions %build %configure \ @@ -150,6 +152,9 @@ fi %changelog +* Wed Jun 17 2009 Bob Relyea - 1.5.2-2 +- Pick up security fixes from upstream + * Fri Feb 27 2009 Bob Relyea - 1.5.2-1 - Pick up 1.5.2 - Add FD_CLOEXEC flag