rpms/vixie-cron/devel vixie-cron-4.1-bz220376.patch, NONE, 1.1 vixie-cron.spec, 1.94, 1.95
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Thu Apr 5 08:01:33 UTC 2007
Author: mmaslano
Update of /cvs/dist/rpms/vixie-cron/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv16809
Modified Files:
vixie-cron.spec
Added Files:
vixie-cron-4.1-bz220376.patch
Log Message:
Add patch.
vixie-cron-4.1-bz220376.patch:
crontab.c | 23 ++++++++++++++++++++
database.c | 24 +++++++++++++++++++++
misc.c | 69 +++++++++++++++++++++++++++++++------------------------------
3 files changed, 83 insertions(+), 33 deletions(-)
--- NEW FILE vixie-cron-4.1-bz220376.patch ---
--- vixie-cron-4.1/misc.c.old 2007-04-05 09:04:51.000000000 +0200
+++ vixie-cron-4.1/misc.c 2007-04-05 09:08:39.000000000 +0200
@@ -206,6 +206,41 @@
#endif
}
+void check_dirs(char* dirs,struct stat sb, struct group *grp) {
+ /* CRONDIR okay (now==CWD), now look at SPOOL_DIR ("tabs" or some such)
+ */
+ if (stat(dirs, &sb) < OK && errno == ENOENT) {
+ perror(dirs);
+ if (OK == mkdir(dirs, 0700)) {
+ fprintf(stderr, "%s: created\n", dirs);
+ stat(dirs, &sb);
+ } else {
+ fprintf(stderr, "%s: ", dirs);
+ perror("mkdir");
+ exit(ERROR_EXIT);
+ }
+ }
+ if (!S_ISDIR(sb.st_mode)) {
+ fprintf(stderr, "'%s' is not a directory, bailing out.\n",
+ dirs);
+ exit(ERROR_EXIT);
+ }
+ if (grp != NULL) {
+ if (sb.st_gid != grp->gr_gid)
+ if( chown(dirs, -1, grp->gr_gid) == -1 )
+ {
+ fprintf(stderr,"chdir %s failed: %s\n", dirs, strerror(errno));
+ exit(ERROR_EXIT);
+ }
+ if (sb.st_mode != 01730)
+ if( chmod(dirs, 01730) == -1 )
+ {
+ fprintf(stderr,"chmod 01730 %s failed: %s\n", dirs, strerror(errno));
+ exit(ERROR_EXIT);
+ }
+ }
+}
+
void
set_cron_cwd(void) {
struct stat sb;
@@ -237,39 +272,7 @@
perror(CRONDIR);
exit(ERROR_EXIT);
}
-
- /* CRONDIR okay (now==CWD), now look at SPOOL_DIR ("tabs" or some such)
- */
- if (stat(SPOOL_DIR, &sb) < OK && errno == ENOENT) {
- perror(SPOOL_DIR);
- if (OK == mkdir(SPOOL_DIR, 0700)) {
- fprintf(stderr, "%s: created\n", SPOOL_DIR);
- stat(SPOOL_DIR, &sb);
- } else {
- fprintf(stderr, "%s: ", SPOOL_DIR);
- perror("mkdir");
- exit(ERROR_EXIT);
- }
- }
- if (!S_ISDIR(sb.st_mode)) {
- fprintf(stderr, "'%s' is not a directory, bailing out.\n",
- SPOOL_DIR);
- exit(ERROR_EXIT);
- }
- if (grp != NULL) {
- if (sb.st_gid != grp->gr_gid)
- if( chown(SPOOL_DIR, -1, grp->gr_gid) == -1 )
- {
- fprintf(stderr,"chdir %s failed: %s\n", SPOOL_DIR, strerror(errno));
- exit(ERROR_EXIT);
- }
- if (sb.st_mode != 01730)
- if( chmod(SPOOL_DIR, 01730) == -1 )
- {
- fprintf(stderr,"chmod 01730 %s failed: %s\n", SPOOL_DIR, strerror(errno));
- exit(ERROR_EXIT);
- }
- }
+ check_dirs(SPOOL_DIR,sb,grp); check_dirs(RH_CROND_DIR,sb,grp);
}
/* acquire_daemonlock() - write our PID into /etc/cron.pid, unless
--- vixie-cron-4.1/database.c.old 2007-04-05 09:12:02.000000000 +0200
+++ vixie-cron-4.1/database.c 2007-04-05 09:16:11.000000000 +0200
@@ -150,6 +150,27 @@
}
closedir(dir);
+ if (!(dir = opendir(RH_CROND_DIR))) {
+ log_it("CRON", getpid(), "OPENDIR FAILED", RH_CROND_DIR);
+ (void) exit(ERROR_EXIT);
+ }
+
+ while (NULL != (dp = readdir(dir))) {
+ char fname[MAXNAMLEN+1], tabname[MAXNAMLEN+1];
+
+ if ( not_a_crontab( dp ) )
+ continue;
+
+ strncpy(fname, dp->d_name, MAXNAMLEN);
+
+ if (!glue_strings(tabname, sizeof tabname, RH_CROND_DIR, fname, '/'))
+ continue; /* XXX log? */
+
+ process_crontab(fname, fname, tabname,
+ &statbuf, &new_db, old_db);
+ }
+ closedir(dir);
+
/* if we don't do this, then when our children eventually call
* getpwnam() in do_command.c's child_process to verify MAILTO=,
* they will screw us up (and v-v).
@@ -357,6 +378,9 @@
if (!glue_strings(tabname, sizeof tabname, SPOOL_DIR, dp->d_name, '/'))
continue; /* XXX log? */
+ if (!glue_strings(tabname, sizeof tabname, RH_CROND_DIR, dp->d_name, '/'))
+ continue; /* XXX log? */
+
if ( stat( tabname, &st ) < OK )
continue; /* XXX log? */
--- vixie-cron-4.1/crontab.c.old 2007-04-05 09:16:33.000000000 +0200
+++ vixie-cron-4.1/crontab.c 2007-04-05 09:32:04.000000000 +0200
@@ -287,6 +287,10 @@
fprintf(stderr, "path too long\n");
exit(ERROR_EXIT);
}
+ if (!glue_strings(n, sizeof n, RH_CROND_DIR, User, '/')) {
+ fprintf(stderr, "path too long\n");
+ exit(ERROR_EXIT);
+ }
if (!(f = fopen(n, "r"))) {
if (errno == ENOENT)
fprintf(stderr, "no crontab for %s\n", User);
@@ -320,6 +324,10 @@
fprintf(stderr, "path too long\n");
exit(ERROR_EXIT);
}
+ if (!glue_strings(n, sizeof n, RH_CROND_DIR, User, '/')) {
+ fprintf(stderr, "path too long\n");
+ exit(ERROR_EXIT);
+ }
if (unlink(n) != 0) {
if (errno == ENOENT)
fprintf(stderr, "no crontab for %s\n", User);
@@ -351,6 +359,10 @@
fprintf(stderr, "path too long\n");
exit(ERROR_EXIT);
}
+ if (!glue_strings(n, sizeof n, RH_CROND_DIR, User, '/')) {
+ fprintf(stderr, "path too long\n");
+ exit(ERROR_EXIT);
+ }
if (!(f = fopen(n, "r"))) {
if (errno != ENOENT) {
perror(n);
@@ -627,6 +639,12 @@
fprintf(stderr, "path too long\n");
return (-2);
}
+ if (!glue_strings(TempFilename, sizeof TempFilename, RH_CROND_DIR,
+ "tmp.XXXXXXXXXX", '/')) {
+ TempFilename[0] = '\0';
+ fprintf(stderr, "path too long\n");
+ return (-2);
+ }
if ((fd = mkstemp(TempFilename)) == -1 || !(tmp = fdopen(fd, "w+"))) {
perror(TempFilename);
if (fd != -1) {
@@ -742,6 +760,11 @@
error = -2;
goto done;
}
+ if (!glue_strings(n, sizeof n, RH_CROND_DIR, User, '/')) {
+ fprintf(stderr, "path too long\n");
+ error = -2;
+ goto done;
+ }
if (rename(TempFilename, n)) {
fprintf(stderr, "%s: error renaming %s to %s\n",
ProgramName, TempFilename, n);
Index: vixie-cron.spec
===================================================================
RCS file: /cvs/dist/rpms/vixie-cron/devel/vixie-cron.spec,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- vixie-cron.spec 8 Mar 2007 14:39:42 -0000 1.94
+++ vixie-cron.spec 5 Apr 2007 08:01:31 -0000 1.95
@@ -10,7 +10,7 @@
Summary: The Vixie cron daemon for executing specified programs at set times
Name: vixie-cron
Version: 4.1
-Release: 79%{?dist}
+Release: 80%{?dist}
Epoch: 4
License: BSD
Group: System Environment/Base
@@ -83,6 +83,7 @@
Patch63: vixie-cron-4.1-manual.patch
Patch64: vixie-cron-4.1-_62newyear.patch
Patch65: vixie-cron-4.1-_63newavc.patch
+Patch66: vixie-cron-4.1-bz220376.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: syslog, bash >= 2.0
@@ -189,6 +190,8 @@
%patch63 -p1 -b .manual
%patch64 -p1 -b ._62newyear
%patch65 -p1 -b ._63newavc
+%patch66 -p1 -b .patch
+%patch67 -p1 -b .bz220376
%build
# RPM_OPT_FLAGS are better here, because we don't have configure for set up variables ;-)
@@ -209,16 +212,16 @@
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
mkdir -p $RPM_BUILD_ROOT/%{_sbindir}
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man{1,5,8}
-mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/init.d
-mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/pam.d
+mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
+mkdir -p $RPM_BUILD_ROOT/etc/pam.d
make install DESTDIR=$RPM_BUILD_ROOT DESTMAN=$RPM_BUILD_ROOT%{_mandir}
-mkdir -pm700 $RPM_BUILD_ROOT/%{_localstatedir}/spool/cron
-mkdir -pm755 $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d
+mkdir -pm700 $RPM_BUILD_ROOT/var/spool/cron
+mkdir -pm755 $RPM_BUILD_ROOT/etc/cron.d
install -pm755 %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/crond
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/
-cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/crond
+mkdir -p $RPM_BUILD_ROOT/etc/sysconfig/
+cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/crond
%if ! %{WITH_PAM}
- rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/pam.d
+ rm -rf $RPM_BUILD_ROOT/etc/pam.d
%endif
%clean
@@ -255,11 +258,15 @@
%attr(700,root,root) %dir /etc/cron.d
%attr(755,root,root) /etc/rc.d/init.d/crond
%if %{WITH_PAM}
- %config(noreplace) /etc/pam.d/crond
+ %attr(0644,root,root) %config(noreplace) /etc/pam.d/crond
%endif
%config(noreplace) /etc/sysconfig/crond
%changelog
+* Thu Apr 5 2007 Marcela Maslanova <mmaslano at redhat.com> - 4:4.1-80
+- jobs from RH_CROND_DIR wasn't "sometimes" run
+- rhbz#220376
+
* Thu Mar 07 2007 Marcela Maslanova <mmaslano at redhat.com> - 4:4.1-79
- merge review
More information about the fedora-cvs-commits
mailing list