Fix bug with permission failed.

This commit is contained in:
Marcela Mašláňová 2006-11-14 11:36:00 +00:00
parent 8fef59e173
commit a381a9c6bb
3 changed files with 99 additions and 7 deletions

View File

@ -1,11 +1,14 @@
--- at-3.1.10/at.c.daylight 2006-10-25 13:45:30.000000000 +0200
+++ at-3.1.10/at.c 2006-10-30 14:14:52.000000000 +0100
@@ -854,7 +854,7 @@
--- at-3.1.10/at.c.daylight 2007-03-31 00:03:47.000000000 +0200
+++ at-3.1.10/at.c 2007-03-31 00:06:23.000000000 +0200
@@ -840,8 +840,9 @@
if( tm.tm_mday )
{
- tm.tm_isdst = tm_now.tm_isdst;
+ //tm.tm_isdst = tm_now.tm_isdst;
return mktime(&tm);
- return mktime(&tm);
+ tm.tm_isdst = -1;
+ t = mktime(&tm);
+ return t;
} else
return 0L;
}

83
at-3.1.10-perm.patch Normal file
View File

@ -0,0 +1,83 @@
--- at-3.1.10/at.c.perm 2006-11-14 12:26:27.000000000 +0100
+++ at-3.1.10/at.c 2006-11-14 12:28:15.000000000 +0100
@@ -144,17 +144,12 @@
*/
if (fcreated) {
/*
- PRIV_START
-
We need the unprivileged uid here since the file is owned by the real
(not effective) uid.
*/
setregid(real_gid, effective_gid);
unlink(atfile);
setregid(effective_gid, real_gid);
- /*
- PRIV_END
- */
}
exit(EXIT_FAILURE);
}
@@ -314,18 +309,18 @@
* bit. Yes, this is a kluge.
*/
cmask = umask(S_IRUSR | S_IWUSR | S_IXUSR);
- seteuid(real_uid);
+ seteuid(effective_uid);
if ((fd = open(atfile, O_CREAT | O_EXCL | O_TRUNC | O_WRONLY, S_IRUSR)) == -1)
perr("Cannot create atjob file %.500s", atfile);
- seteuid(effective_uid);
+ //seteuid(effective_uid);
if ((fd2 = dup(fd)) < 0)
perr("Error in dup() of job file");
- /*
+
if (fchown(fd2, real_uid, real_gid) != 0)
perr("Cannot give away file");
- */
+
PRIV_END
@@ -656,6 +651,7 @@
We need the unprivileged uid here since the file is owned by the real
(not effective) uid.
*/
+// PRIV_START
setregid(real_gid, effective_gid);
if (queue == '=') {
@@ -668,17 +664,17 @@
setregid(effective_gid, real_gid);
done = 1;
-
+// PRIV_END
break;
case CAT:
{
FILE *fp;
int ch;
-
+ // PRIV_START
setregid(real_gid, effective_gid);
fp = fopen(dirent->d_name, "r");
-
+ // PRIV_END
if (fp) {
while ((ch = getc(fp)) != EOF) {
putchar(ch);
--- at-3.1.10/Makefile.in.perm 2006-11-14 12:26:27.000000000 +0100
+++ at-3.1.10/Makefile.in 2006-11-14 12:26:27.000000000 +0100
@@ -97,7 +97,7 @@
$(INSTALL) -m 755 -d $(IROOT)$(atdocdir)
$(INSTALL) -m 755 -d $(IROOT)$(ATJOB_DIR)
$(INSTALL) -m 755 -d $(IROOT)$(etcdir)/pam.d
- $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 755 -d $(IROOT) $(ATSPOOL_DIR)
+ $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 755 -d $(IROOT)$(ATSPOOL_DIR)
chmod 700 $(IROOT)$(ATSPOOL_DIR) $(IROOT)$(ATJOB_DIR)
touch $(IROOT)$(LFILE)
chmod 600 $(IROOT)$(LFILE)

10
at.spec
View File

@ -6,7 +6,7 @@
Summary: Job spooling tools.
Name: at
Version: 3.1.10
Release: 5%{?dist}
Release: 6%{?dist}
License: GPL
Group: System Environment/Daemons
Source: http://ftp.debian.org/debian/pool/main/a/at/at-%{major_ver}.tar.gz
@ -46,6 +46,7 @@ Patch35: at-3.1.10-dont_fork.patch
Patch36: at-3.1.10-pam.patch
Patch37: at-3.1.10-makefile.patch
Patch38: at-3.1.10-daylight.patch
Patch39: at-3.1.10-perm.patch
Prereq: fileutils chkconfig /etc/init.d
BuildPrereq: flex bison autoconf
@ -102,7 +103,7 @@ cp %{SOURCE1} .
#%patch22 -p1 -b .selinux
#replace PAMLIB with SELINUXLIB in Makefile.in -> replaced by #36
%patch23 -p1 -b .pie
%patch24 -p1 -b -t_option
%patch24 -p1 -b .t_option
%patch25 -p1 -b .usage
%patch26 -p1 -b .fix_no_export
#%patch27 -p1 -b .pam -> pam.patch
@ -117,6 +118,7 @@ cp %{SOURCE1} .
%patch36 -p1 -b .pam
%patch37 -p1 -b .makefile
%patch38 -p1 -b .daylight
%patch39 -p1 -b .perm
%build
# patch10 touches configure.in
@ -203,6 +205,10 @@ fi
%attr(4755,root,root) %{_bindir}/at
%changelog
* Tue Oct 27 2006 Marcela Maslanova <mmaslano@redhat.com> - 3.1.10-6
- fix daylight-saving again
- fix #214759 - problem with seteuid
* Wed Oct 25 2006 Marcela Maslanova <mmaslano@redhat.com> - 3.1.10-5
- daylight-saving