[csw-devel] SF.net SVN: gar:[10205] csw/mgar/pkg/vixiecron/trunk

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sat Jun 12 12:49:12 CEST 2010


Revision: 10205
          http://gar.svn.sourceforge.net/gar/?rev=10205&view=rev
Author:   wahwah
Date:     2010-06-12 10:49:12 +0000 (Sat, 12 Jun 2010)

Log Message:
-----------
vixiecron: Compiles on Solaris 9

Modified Paths:
--------------
    csw/mgar/pkg/vixiecron/trunk/Makefile
    csw/mgar/pkg/vixiecron/trunk/checksums

Added Paths:
-----------
    csw/mgar/pkg/vixiecron/trunk/files/0001-Use-bash-for-putman.sh.patch
    csw/mgar/pkg/vixiecron/trunk/files/0002-Makefile-adjustments.patch
    csw/mgar/pkg/vixiecron/trunk/files/0003-mkdtemp-support.patch
    csw/mgar/pkg/vixiecron/trunk/files/0004-Sun-Studio-detection.patch
    csw/mgar/pkg/vixiecron/trunk/files/0005-bitstring.h-a-local-header-file.patch
    csw/mgar/pkg/vixiecron/trunk/files/0006-signal-handlers-and-setenv.patch
    csw/mgar/pkg/vixiecron/trunk/files/0007-Solaris-9-doesn-t-have-O_NOFOLLOW.patch
    csw/mgar/pkg/vixiecron/trunk/files/0008-consts-needed-in-externs.h.patch
    csw/mgar/pkg/vixiecron/trunk/files/0009-lockf-instead-of-flock.patch
    csw/mgar/pkg/vixiecron/trunk/files/0010-A-workaround-for-O_NOFOLLOW.patch

Removed Paths:
-------------
    csw/mgar/pkg/vixiecron/trunk/files/gar-vixiecron_3.0pl1.patch

Property Changed:
----------------
    csw/mgar/pkg/vixiecron/trunk/Makefile

Modified: csw/mgar/pkg/vixiecron/trunk/Makefile
===================================================================
--- csw/mgar/pkg/vixiecron/trunk/Makefile	2010-06-12 02:29:06 UTC (rev 10204)
+++ csw/mgar/pkg/vixiecron/trunk/Makefile	2010-06-12 10:49:12 UTC (rev 10205)
@@ -1,6 +1,6 @@
 # Copyright 2009 Google Inc.
 # Distributed under the terms of the GNU General Public License v2
-# $Header: $
+# $Id$
 
 GARNAME = vixiecron
 GARVERSION = 3.0pl1
@@ -12,7 +12,7 @@
 
   This build includes patches from Debian.  It supports /etc/cron.d directory,
   which can be used to conveniently set up cron jobs by placing files. It also
-  supports a slash notation: */5 denotes "Every five minutes".
+  supports slash notation: */5 denotes "Every five minutes".
 endef
 
 # TODO:
@@ -21,7 +21,7 @@
 
 MASTER_SITES  = http://ftp.de.debian.org/debian/pool/main/c/cron/
 DISTFILES  = cron_$(GARVERSION).orig.tar.gz
-DISTFILES += cron_$(GARVERSION)-105.diff.gz
+DISTFILES += cron_$(GARVERSION)-111.diff.gz
 DISTFILES += CSWvixiecron.preinstall
 DISTFILES += CSWvixiecron.postinstall
 DISTFILES += CSWvixiecron.postremove
@@ -29,24 +29,38 @@
 DISTFILES += crontab.CSW
 DISTFILES += run-crons-0.3.2
 
-WORKSRC = $(WORKDIR)/cron-$(GARVERSION).orig
+DISTNAME = cron-$(GARVERSION).orig
+# WORKSRC = $(WORKDIR)/cron-$(GARVERSION).orig
 
-SPKG_CLASSES = none cswcpsampleconf cswinitsmf
-RUNTIME_DEP_PKGS = CSWcswclassutils
+LICENSE = README
 
+#    $$$$3 ~ /\/init.d\/cswvixiecron$$$$/ { $$$$2 = "cswinitsmf" }
+#    $$$$3 ~ /\/crontab\.CSW$$$$/ { $$$$2 = "cswcpsampleconf" }
 PROTOTYPE_FILTER  = awk ' \
-    $$$$3 ~ /\/init.d\/cswvixiecron$$$$/ { $$$$2 = "cswinitsmf" } \
-    $$$$3 ~ /\/crontab\.CSW$$$$/ { $$$$2 = "cswcpsampleconf" } \
     $$$$3 ~ /\/opt\/csw\/bin\/crontab$$$$/ { $$$$4 = "1755" } \
     { print }'
 
-PATCHFILES = cron_$(GARVERSION)-105.diff.gz \
-             gar-$(GARNAME)_$(GARVERSION).patch
+INITSMF = /etc/opt/csw/init.d/cswvixiecron
+PRESERVECONF = /etc/crontab
 
+PATCHFILES += cron_$(GARVERSION)-111.diff.gz
+PATCHFILES += 0001-Use-bash-for-putman.sh.patch
+PATCHFILES += 0002-Makefile-adjustments.patch
+PATCHFILES += 0003-mkdtemp-support.patch
+PATCHFILES += 0004-Sun-Studio-detection.patch
+PATCHFILES += 0005-bitstring.h-a-local-header-file.patch
+PATCHFILES += 0006-signal-handlers-and-setenv.patch
+PATCHFILES += 0007-Solaris-9-doesn-t-have-O_NOFOLLOW.patch
+PATCHFILES += 0008-consts-needed-in-externs.h.patch
+PATCHFILES += 0009-lockf-instead-of-flock.patch
+PATCHFILES += 0010-A-workaround-for-O_NOFOLLOW.patch
+
 TEST_SCRIPTS =
 CONFIGURE_SCRIPTS =
 EXTRA_CFLAGS = -DDEBUGGING=0 -DPOSIX -DDEBIAN
 
+include gar/category.mk
+
 pre-install-modulated:
 	ginstall -d $(DESTDIR)/opt/csw
 	ginstall -d $(DESTDIR)/opt/csw/bin
@@ -68,5 +82,3 @@
 		ginstall -d $(DESTDIR)/etc/cron.$$base; \
 	done
 	@$(MAKECOOKIE)
-
-include gar/category.mk


Property changes on: csw/mgar/pkg/vixiecron/trunk/Makefile
___________________________________________________________________
Added: svn:keywords
   + Id

Modified: csw/mgar/pkg/vixiecron/trunk/checksums
===================================================================
--- csw/mgar/pkg/vixiecron/trunk/checksums	2010-06-12 02:29:06 UTC (rev 10204)
+++ csw/mgar/pkg/vixiecron/trunk/checksums	2010-06-12 10:49:12 UTC (rev 10205)
@@ -1,9 +1,18 @@
-aedcd26b85ba600a67414a489f78c1cf  download/CSWvixiecron.postinstall
-98917c3e13cefc8d910937056ab3b27f  download/CSWvixiecron.postremove
-852d67b49b724c633ff32115dab57b77  download/CSWvixiecron.preinstall
-6235d305843da483b69671cde7d1d8ea  download/cron_3.0pl1-105.diff.gz
-4c64aece846f8483daf440f8e3dd210f  download/cron_3.0pl1.orig.tar.gz
-d1c17a3cf4f1ff253c36897d94b0b834  download/crontab.CSW
-b5cdad15f8d66a84b807cd9cf5a04171  download/cswvixiecron
-cf0aa68ad98415650daad595fbc415cf  download/gar-vixiecron_3.0pl1.patch
-d0dd7b19670e9a40060977b0b8779cad  download/run-crons-0.3.2
+33a94c5a97fbdf7b0a4be491050953c0  0001-Use-bash-for-putman.sh.patch
+ea18cbf226406edbb1ff6e8bc44658c1  0002-Makefile-adjustments.patch
+dbfdeb2e9a578984c24f2de2e9a45477  0003-mkdtemp-support.patch
+18022c47f5dca6650aeb2a49288e707a  0004-Sun-Studio-detection.patch
+a3706fe3ef80641e4c989e1173f9a273  0005-bitstring.h-a-local-header-file.patch
+0a0f863cf020638b8e752f9c462fdeeb  0006-signal-handlers-and-setenv.patch
+c3839bbc5ee06fad9784b1cb9a688409  0007-Solaris-9-doesn-t-have-O_NOFOLLOW.patch
+8fd2ecef73a84fa9cd5affe408020e55  0008-consts-needed-in-externs.h.patch
+0f7b35b4bf2d8bcbb5e527918371bdb6  0009-lockf-instead-of-flock.patch
+f1e1e92190fb401e6cd07f3521aa0827  0010-A-workaround-for-O_NOFOLLOW.patch
+aedcd26b85ba600a67414a489f78c1cf  CSWvixiecron.postinstall
+98917c3e13cefc8d910937056ab3b27f  CSWvixiecron.postremove
+852d67b49b724c633ff32115dab57b77  CSWvixiecron.preinstall
+aad89fc8c63f76fe60d39a9f62f33fb1  cron_3.0pl1-111.diff.gz
+4c64aece846f8483daf440f8e3dd210f  cron_3.0pl1.orig.tar.gz
+d1c17a3cf4f1ff253c36897d94b0b834  crontab.CSW
+b5cdad15f8d66a84b807cd9cf5a04171  cswvixiecron
+d0dd7b19670e9a40060977b0b8779cad  run-crons-0.3.2

Added: csw/mgar/pkg/vixiecron/trunk/files/0001-Use-bash-for-putman.sh.patch
===================================================================
--- csw/mgar/pkg/vixiecron/trunk/files/0001-Use-bash-for-putman.sh.patch	                        (rev 0)
+++ csw/mgar/pkg/vixiecron/trunk/files/0001-Use-bash-for-putman.sh.patch	2010-06-12 10:49:12 UTC (rev 10205)
@@ -0,0 +1,22 @@
+From 90552d070008320ed0527da02c0b430469fa6865 Mon Sep 17 00:00:00 2001
+From: Maciej Blizinski <maciej at opencsw.org>
+Date: Sat, 12 Jun 2010 10:59:17 +0200
+Subject: [PATCH 01/10] Use bash for putman.sh
+
+---
+ putman.sh |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/putman.sh b/putman.sh
+index 4aef625..f3fd249 100644
+--- a/putman.sh
++++ b/putman.sh
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/bin/bash
+ 
+ # putman.sh - install a man page according to local custom
+ # vixie 27dec93 [original]
+-- 
+1.7.1
+

Added: csw/mgar/pkg/vixiecron/trunk/files/0002-Makefile-adjustments.patch
===================================================================
--- csw/mgar/pkg/vixiecron/trunk/files/0002-Makefile-adjustments.patch	                        (rev 0)
+++ csw/mgar/pkg/vixiecron/trunk/files/0002-Makefile-adjustments.patch	2010-06-12 10:49:12 UTC (rev 10205)
@@ -0,0 +1,69 @@
+From 559fab561ce5b7367982b4bde57e919af5c2a0bb Mon Sep 17 00:00:00 2001
+From: Maciej Blizinski <maciej at opencsw.org>
+Date: Sat, 12 Jun 2010 10:59:47 +0200
+Subject: [PATCH 02/10] Makefile adjustments
+
+---
+ Makefile |   14 +++++++-------
+ 1 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 024b458..578b546 100644
+--- a/Makefile
++++ b/Makefile
+@@ -47,7 +47,7 @@
+ 
+ #################################### begin configurable stuff
+ #<<DESTROOT is assumed to have ./etc, ./bin, and ./man subdirectories>>
+-DESTROOT	=	$(DESTDIR)/usr
++DESTROOT	=	$(DESTDIR)/opt/csw
+ DESTSBIN	=	$(DESTROOT)/sbin
+ DESTBIN		=	$(DESTROOT)/bin
+ DESTMAN		=	$(DESTROOT)/share/man
+@@ -57,7 +57,7 @@ INCLUDE		=	-I.
+ #<<need getopt()>>
+ LIBS		= $(PAM_LIBS) $(SELINUX_LIBS) $(AUDIT_LIBS)
+ #<<optimize or debug?>>
+-OPTIM		=	-O2
++#OPTIM		=	-O2
+ #OPTIM		=	-g
+ #<<ATT or BSD or POSIX?>>
+ # (ATT untested)
+@@ -74,12 +74,12 @@ LINTFLAGS	=	-hbxa $(INCLUDE) $(COMPAT) $(DEBUGGING)
+ # Allow override from command line
+ DEBUG_DEFS = -DDEBUGGING=0   
+ # The -DUSE_SIGCHLD is needed for the Alpha port
+-DEFS = -DDEBIAN -DUSE_SIGCHLD $(DEBUG_DEFS) $(PAM_DEFS) $(SELINUX_DEFS)
++#DEFS = -DDEBIAN -DUSE_SIGCHLD $(DEBUG_DEFS) $(PAM_DEFS) $(SELINUX_DEFS)
+ #(SGI IRIX systems need this)
+ #DEFS		=	-D_BSD_SIGNALS -Dconst=
+ #<<the name of the BSD-like install program>>
+ #INSTALL = installbsd
+-INSTALL = install -s
++INSTALL = ginstall -s
+ #<<any special load flags>>
+ # LDFLAGS		=	-s
+ # Let install do the strip
+@@ -87,7 +87,7 @@ INSTALL = install -s
+ #################################### end configurable stuff
+ 
+ SHELL		=	/bin/sh
+-CFLAGS		=	$(OPTIM) $(INCLUDE) $(COMPAT) $(DEFS)
++# CFLAGS		=	$(OPTIM) $(INCLUDE) $(COMPAT) $(DEFS)
+ 
+ INFOS		=	README CHANGES FEATURES INSTALL CONVERSION THANKS MAIL
+ MANPAGES	=	bitstring.3 crontab.5 crontab.1 cron.8 putman.sh
+@@ -118,8 +118,8 @@ crontab		:	$(CRONTAB_OBJ)
+ 			$(CC) $(LDFLAGS) -o crontab $(CRONTAB_OBJ) $(LIBS)
+ 
+ install		:	all
+-			$(INSTALL) -c -m  755 -o root cron    $(DESTSBIN)/
+-			$(INSTALL) -c -m 4755 -o root crontab $(DESTBIN)/
++			$(INSTALL) -c -m  755 cron    $(DESTSBIN)/
++			$(INSTALL) -c -m 4755 crontab $(DESTBIN)/
+ 			sh putman.sh crontab.1 $(DESTMAN)
+ 			sh putman.sh cron.8    $(DESTMAN)
+ 			sh putman.sh crontab.5 $(DESTMAN)
+-- 
+1.7.1
+

Added: csw/mgar/pkg/vixiecron/trunk/files/0003-mkdtemp-support.patch
===================================================================
--- csw/mgar/pkg/vixiecron/trunk/files/0003-mkdtemp-support.patch	                        (rev 0)
+++ csw/mgar/pkg/vixiecron/trunk/files/0003-mkdtemp-support.patch	2010-06-12 10:49:12 UTC (rev 10205)
@@ -0,0 +1,51 @@
+From d15a39dac7ea2c43ca664555f207eff82e7b4181 Mon Sep 17 00:00:00 2001
+From: Maciej Blizinski <maciej at opencsw.org>
+Date: Sat, 12 Jun 2010 11:00:43 +0200
+Subject: [PATCH 03/10] mkdtemp support
+
+---
+ compat.c |   14 ++++++++++++--
+ 1 files changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/compat.c b/compat.c
+index 4fd78f6..aa1aa81 100644
+--- a/compat.c
++++ b/compat.c
+@@ -33,6 +33,8 @@ static char rcsid[] = "$Id: compat.c,v 1.6 1994/01/15 20:43:43 vixie Exp $";
+ #endif
+ #include <errno.h>
+ 
++#include <sys/types.h>
++#include <sys/stat.h>
+ 
+ /* the code does not depend on any of vfork's
+  * side-effects; it just uses it as a quick
+@@ -85,8 +87,8 @@ strerror(error)
+ #ifdef NEED_STRCASECMP
+ int
+ strcasecmp(left, right)
+-	char	*left;
+-	char	*right;
++	const char	*left;
++	const char	*right;
+ {
+ 	while (*left && (MkLower(*left) == MkLower(*right))) {
+ 		left++;
+@@ -214,6 +216,14 @@ flock(fd, operation)
+ #endif /*NEED_FLOCK*/
+ 
+ 
++/* Solaris 10 is missing mkdtemp */
++char *mkdtemp(char *template)
++{
++  if (!mktemp(template) || mkdir(template, 0700))
++    return NULL;
++  return template;
++}
++
+ #ifdef NEED_SETENV
+ int
+ setenv(name, value, overwrite)
+-- 
+1.7.1
+

Added: csw/mgar/pkg/vixiecron/trunk/files/0004-Sun-Studio-detection.patch
===================================================================
--- csw/mgar/pkg/vixiecron/trunk/files/0004-Sun-Studio-detection.patch	                        (rev 0)
+++ csw/mgar/pkg/vixiecron/trunk/files/0004-Sun-Studio-detection.patch	2010-06-12 10:49:12 UTC (rev 10205)
@@ -0,0 +1,43 @@
+From e37182638e43cdab37021cd1ef6b41ea290c799d Mon Sep 17 00:00:00 2001
+From: Maciej Blizinski <maciej at opencsw.org>
+Date: Sat, 12 Jun 2010 11:01:33 +0200
+Subject: [PATCH 04/10] Sun Studio detection
+
+---
+ compat.h |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/compat.h b/compat.h
+index 7990cce..14852f6 100644
+--- a/compat.h
++++ b/compat.h
+@@ -63,7 +63,7 @@
+ 
+ #ifndef POSIX
+ # if (BSD >= 199103) || defined(__linux__) || defined(__GNU__) || defined(ultrix) ||\
+-        defined(AIX) ||\ defined(HPUX) || defined(CONVEX) || defined(IRIX) || defined(__GLIBC__)
++        defined(AIX) || defined(HPUX) || defined(CONVEX) || defined(IRIX) || defined(__GLIBC__)
+ #  define POSIX
+ # endif
+ #endif
+@@ -81,7 +81,7 @@
+ #endif
+ 
+ #if (!defined(BSD) || (BSD < 198902)) && !defined(__linux__) && \
+-	!defined(IRIX) && !defined(NeXT) && !defined(HPUX) && !defined(__GNU__) && !defined(__GLIBC__)
++ 	!defined(IRIX) && !defined(UNICOS) && !defined(HPUX) && !defined(__GNU__) && !defined(__GLIBC__) && !defined(__SUNPRO_C)
+ # define NEED_STRCASECMP
+ #endif
+ 
+@@ -110,7 +110,7 @@
+ # define HAVE_SAVED_UIDS
+ #endif
+ 
+-#if !defined(ATT) && !defined(__linux__) && !defined(__GNU__) && !defined(IRIX) && !defined(UNICOS) && !defined(__GLIBC__)
++#if !defined(ATT) && !defined(__linux__) && !defined(__GNU__) && !defined(IRIX) && !defined(UNICOS) && !defined(__GLIBC__) && !defined(__SUNPRO_C)
+ # define USE_SIGCHLD
+ #endif
+ 
+-- 
+1.7.1
+

Added: csw/mgar/pkg/vixiecron/trunk/files/0005-bitstring.h-a-local-header-file.patch
===================================================================
--- csw/mgar/pkg/vixiecron/trunk/files/0005-bitstring.h-a-local-header-file.patch	                        (rev 0)
+++ csw/mgar/pkg/vixiecron/trunk/files/0005-bitstring.h-a-local-header-file.patch	2010-06-12 10:49:12 UTC (rev 10205)
@@ -0,0 +1,25 @@
+From 62aec186248945918bfedbff9549689badbc66fc Mon Sep 17 00:00:00 2001
+From: Maciej Blizinski <maciej at opencsw.org>
+Date: Sat, 12 Jun 2010 11:02:15 +0200
+Subject: [PATCH 05/10] bitstring.h a local header file
+
+---
+ cron.h |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/cron.h b/cron.h
+index 2ed89cc..dbd569a 100644
+--- a/cron.h
++++ b/cron.h
+@@ -32,7 +32,7 @@
+ 
+ #include <stdio.h>
+ #include <ctype.h>
+-#include <bitstring.h>
++#include "bitstring.h"
+ #include <pwd.h>
+ #include <sys/wait.h>
+ 
+-- 
+1.7.1
+

Added: csw/mgar/pkg/vixiecron/trunk/files/0006-signal-handlers-and-setenv.patch
===================================================================
--- csw/mgar/pkg/vixiecron/trunk/files/0006-signal-handlers-and-setenv.patch	                        (rev 0)
+++ csw/mgar/pkg/vixiecron/trunk/files/0006-signal-handlers-and-setenv.patch	2010-06-12 10:49:12 UTC (rev 10205)
@@ -0,0 +1,63 @@
+From 26ff2aff82bb10f93561fd6b6db601e566d5e560 Mon Sep 17 00:00:00 2001
+From: Maciej Blizinski <maciej at opencsw.org>
+Date: Sat, 12 Jun 2010 11:03:03 +0200
+Subject: [PATCH 06/10] signal handlers and setenv
+
+---
+ cron.c |   26 ++++++++++++++++++++++++--
+ 1 files changed, 24 insertions(+), 2 deletions(-)
+
+diff --git a/cron.c b/cron.c
+index 5567dae..9d6f1af 100644
+--- a/cron.c
++++ b/cron.c
+@@ -29,6 +29,28 @@ static char rcsid[] = "$Id: cron.c,v 2.11 1994/01/15 20:43:43 vixie Exp $";
+ #include <sys/types.h>
+ #include <fcntl.h>
+ 
++/* Solaris 9 doens't have setenv.
++ * http://wiki.opencsw.org/porting-faq
++ */
++
++#ifdef __sun
++void setenv(char *n, char *v, int x) {
++  char buf[256];
++  snprintf(buf,sizeof(buf),"%s=%s",n,v);
++  putenv(buf);
++}
++
++void unsetenv(char *env_name) {
++  extern char **environ;
++  char **cc;
++  int l;
++  l=strlen(env_name);
++  for (cc=environ;*cc!=NULL;cc++) {
++    if (strncmp(env_name,*cc,l)==0 && ((*cc)[l]=='='||(*cc)[l]=='\0')) break;
++  } for (; *cc != NULL; cc++) *cc=cc[1];
++}
++#endif
++
+ static	void	usage __P((void)),
+ 		run_reboot_jobs __P((cron_db *)),
+ 		find_jobs __P((time_min, cron_db *, int, int)),
+@@ -414,7 +436,7 @@ cron_sleep(target)
+ 
+ #ifdef USE_SIGCHLD
+ static void
+-sigchld_handler(x) {
++sigchld_handler(int x) {
+ 	int save_errno = errno;
+ 	WAIT_T		waiter;
+ 	PID_T		pid;
+@@ -448,7 +470,7 @@ sigchld_handler(x) {
+ 
+ 
+ static void
+-sighup_handler(x) {
++sighup_handler(int x) {
+ 	log_close();
+ 
+ 	/* we should use sigaction for proper signal blocking as this 
+-- 
+1.7.1
+

Added: csw/mgar/pkg/vixiecron/trunk/files/0007-Solaris-9-doesn-t-have-O_NOFOLLOW.patch
===================================================================
--- csw/mgar/pkg/vixiecron/trunk/files/0007-Solaris-9-doesn-t-have-O_NOFOLLOW.patch	                        (rev 0)
+++ csw/mgar/pkg/vixiecron/trunk/files/0007-Solaris-9-doesn-t-have-O_NOFOLLOW.patch	2010-06-12 10:49:12 UTC (rev 10205)
@@ -0,0 +1,25 @@
+From f60f021c2e1cb1c0acf63298e4c6c8be1732a10f Mon Sep 17 00:00:00 2001
+From: Maciej Blizinski <maciej at opencsw.org>
+Date: Sat, 12 Jun 2010 11:03:28 +0200
+Subject: [PATCH 07/10] Solaris 9 doesn't have O_NOFOLLOW
+
+---
+ database.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/database.c b/database.c
+index 11bcc72..5aef938 100644
+--- a/database.c
++++ b/database.c
+@@ -344,7 +344,7 @@ process_crontab(uname, fname, tabname, statbuf, new_db, old_db)
+ 
+         if (pw) {
+             /* Path for user crontabs (including root's!) */
+-            if ((crontab_fd = open(tabname, O_RDONLY|O_NOFOLLOW, 0)) < OK) {
++            if ((crontab_fd = open(tabname, O_RDONLY, 0)) < OK) {
+ 		/* crontab not accessible?
+ 		 */
+ 		log_it(fname, getpid(), "CAN'T OPEN", tabname);
+-- 
+1.7.1
+

Added: csw/mgar/pkg/vixiecron/trunk/files/0008-consts-needed-in-externs.h.patch
===================================================================
--- csw/mgar/pkg/vixiecron/trunk/files/0008-consts-needed-in-externs.h.patch	                        (rev 0)
+++ csw/mgar/pkg/vixiecron/trunk/files/0008-consts-needed-in-externs.h.patch	2010-06-12 10:49:12 UTC (rev 10205)
@@ -0,0 +1,30 @@
+From 0e050a2a22f934b9c2382de7c8dbb7a68f23e771 Mon Sep 17 00:00:00 2001
+From: Maciej Blizinski <maciej at opencsw.org>
+Date: Sat, 12 Jun 2010 11:04:00 +0200
+Subject: [PATCH 08/10] consts needed in externs.h
+
+---
+ externs.h |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/externs.h b/externs.h
+index b658235..89a868e 100644
+--- a/externs.h
++++ b/externs.h
+@@ -116,11 +116,11 @@ extern	int optind, opterr, optopt;
+ #endif
+ 
+ #ifdef NEED_STRCASECMP
+-extern	int		strcasecmp __P((char *, char *));
++extern	int		strcasecmp __P((const char *, const char *));
+ #endif
+ 
+ #ifdef NEED_STRDUP
+-extern	char		*strdup __P((char *));
++extern	char		*strdup __P((const char *));
+ #endif
+ 
+ #ifdef NEED_STRERROR
+-- 
+1.7.1
+

Added: csw/mgar/pkg/vixiecron/trunk/files/0009-lockf-instead-of-flock.patch
===================================================================
--- csw/mgar/pkg/vixiecron/trunk/files/0009-lockf-instead-of-flock.patch	                        (rev 0)
+++ csw/mgar/pkg/vixiecron/trunk/files/0009-lockf-instead-of-flock.patch	2010-06-12 10:49:12 UTC (rev 10205)
@@ -0,0 +1,35 @@
+From 6b17727747523731d64399166f1182bf24988b41 Mon Sep 17 00:00:00 2001
+From: Maciej Blizinski <maciej at opencsw.org>
+Date: Sat, 12 Jun 2010 11:04:27 +0200
+Subject: [PATCH 09/10] lockf instead of flock
+
+---
+ misc.c |    5 +++--
+ 1 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/misc.c b/misc.c
+index 933552f..13def32 100644
+--- a/misc.c
++++ b/misc.c
+@@ -42,7 +42,7 @@ static char rcsid[] = "$Id: misc.c,v 2.9 1994/01/15 20:43:43 vixie Exp $";
+ #if defined(SYSLOG)
+ # include <syslog.h>
+ #endif
+-
++#include <sys/file.h>
+ 
+ #if defined(LOG_DAEMON) && !defined(LOG_CRON)
+ #define LOG_CRON LOG_DAEMON
+@@ -308,7 +308,8 @@ acquire_daemonlock(closeflag)
+ 			exit(ERROR_EXIT);
+ 		}
+ 
+-		if (flock(fd, LOCK_EX|LOCK_NB) < OK) {
++    /* This bit originally used flock(), switched to lockf() */
++    if (lockf(fd, F_TLOCK, 0) < OK) {
+ 			int save_errno = errno;
+ 
+ 			fscanf(fp, "%d", &otherpid);
+-- 
+1.7.1
+

Added: csw/mgar/pkg/vixiecron/trunk/files/0010-A-workaround-for-O_NOFOLLOW.patch
===================================================================
--- csw/mgar/pkg/vixiecron/trunk/files/0010-A-workaround-for-O_NOFOLLOW.patch	                        (rev 0)
+++ csw/mgar/pkg/vixiecron/trunk/files/0010-A-workaround-for-O_NOFOLLOW.patch	2010-06-12 10:49:12 UTC (rev 10205)
@@ -0,0 +1,63 @@
+From 3c362e317acc2fa1227bb9d80a893f7b56dcce78 Mon Sep 17 00:00:00 2001
+From: Maciej Blizinski <maciej at opencsw.org>
+Date: Sat, 12 Jun 2010 12:29:09 +0200
+Subject: [PATCH 10/10] A workaround for O_NOFOLLOW
+
+---
+ database.c |   26 ++++++++++++++++++++++++++
+ 1 files changed, 26 insertions(+), 0 deletions(-)
+
+diff --git a/database.c b/database.c
+index 5aef938..6b7cfcf 100644
+--- a/database.c
++++ b/database.c
+@@ -322,6 +322,7 @@ process_crontab(uname, fname, tabname, statbuf, new_db, old_db)
+ 	cron_db		*new_db;
+ 	cron_db		*old_db;
+ {
++        struct stat orig_st;
+ 	struct passwd	*pw = NULL;
+ 	int		crontab_fd = OK - 1;
+ 	user		*u;
+@@ -344,6 +345,21 @@ process_crontab(uname, fname, tabname, statbuf, new_db, old_db)
+ 
+         if (pw) {
+             /* Path for user crontabs (including root's!) */
++
++            /* Solaris 9 doesn't have O_NOFOLLOW.
++             *
++             * https://www.securecoding.cert.org/confluence/display/seccode/POS01-C.+Check+for+the+existence+of+links+when+dealing+with+files
++             */
++            if (lstat( tabname, &orig_st) != 0) {
++		log_it(fname, getpid(), "CAN'T LSTAT", tabname);
++		goto next_crontab;
++            }
++            if (!S_ISREG( orig_st.st_mode)) {
++                /* file is irregular or symlink */
++		log_it(fname, getpid(), "SYMLINK OR IRREGULAR FILE", tabname);
++		goto next_crontab;
++            }
++
+             if ((crontab_fd = open(tabname, O_RDONLY, 0)) < OK) {
+ 		/* crontab not accessible?
+ 		 */
+@@ -355,6 +371,16 @@ process_crontab(uname, fname, tabname, statbuf, new_db, old_db)
+ 		log_it(fname, getpid(), "FSTAT FAILED", tabname);
+ 		goto next_crontab;
+             }
++
++            /* Check that the device and inode numbers didn't change since the
++             * previous lstat() */
++            if (orig_st.st_dev != statbuf->st_dev ||
++                    orig_st.st_ino != statbuf->st_ino) {
++                /* file was tampered with during race window */
++		log_it(fname, getpid(), "FILE TAMPERED", tabname);
++		goto next_crontab;
++            }
++
+             /* Check to make sure that the crontab is owned by the correct user
+                (or root) */
+ 
+-- 
+1.7.1
+

Deleted: csw/mgar/pkg/vixiecron/trunk/files/gar-vixiecron_3.0pl1.patch
===================================================================
--- csw/mgar/pkg/vixiecron/trunk/files/gar-vixiecron_3.0pl1.patch	2010-06-12 02:29:06 UTC (rev 10204)
+++ csw/mgar/pkg/vixiecron/trunk/files/gar-vixiecron_3.0pl1.patch	2010-06-12 10:49:12 UTC (rev 10205)
@@ -1,268 +0,0 @@
-diff -ur cron-3.0pl1.orig-solaris/compat.c cron-3.0pl1.orig/compat.c
---- cron-3.0pl1.orig-solaris/compat.c	2009-03-12 13:30:53.000000000 +0000
-+++ cron-3.0pl1.orig/compat.c	2009-03-12 15:10:44.820233050 +0000
-@@ -33,6 +33,8 @@
- #endif
- #include <errno.h>
- 
-+#include <sys/types.h>
-+#include <sys/stat.h>
- 
- /* the code does not depend on any of vfork's
-  * side-effects; it just uses it as a quick
-@@ -85,8 +87,8 @@
- #ifdef NEED_STRCASECMP
- int
- strcasecmp(left, right)
--	char	*left;
--	char	*right;
-+	const char	*left;
-+	const char	*right;
- {
- 	while (*left && (MkLower(*left) == MkLower(*right))) {
- 		left++;
-@@ -236,3 +238,13 @@
- 	return putenv(tmp);	/* intentionally orphan 'tmp' storage */
- }
- #endif
-+
-+/* Solaris 10 is missing mkdtemp */
-+char *mkdtemp(char *template)
-+{
-+        if (!mktemp(template) || mkdir(template, 0700))
-+                return NULL;
-+        return template;
-+}
-+
-+
-diff -ur cron-3.0pl1.orig-solaris/compat.h cron-3.0pl1.orig/compat.h
---- cron-3.0pl1.orig-solaris/compat.h	2009-03-12 13:30:53.000000000 +0000
-+++ cron-3.0pl1.orig/compat.h	2009-03-12 15:20:37.912499900 +0000
-@@ -63,7 +63,8 @@
- 
- #ifndef POSIX
- # if (BSD >= 199103) || defined(__linux__) || defined(__GNU__) || defined(ultrix) ||\
--        defined(AIX) ||\ defined(HPUX) || defined(CONVEX) || defined(IRIX) || defined(__GLIBC__)
-+        defined(AIX) ||\
-+defined(HPUX) || defined(CONVEX) || defined(IRIX) || defined(__GLIBC__)
- #  define POSIX
- # endif
- #endif
-@@ -86,7 +87,7 @@
- #endif
- 
- #if (!defined(BSD) || (BSD < 198911)) && !defined(__linux__) &&\
--	!defined(IRIX) && !defined(UNICOS) && !defined(HPUX) && !defined(__GNU__) && !defined(__GLIBC__)
-+	!defined(IRIX) && !defined(UNICOS) && !defined(HPUX) && !defined(__GNU__) && !defined(__GLIBC__) && !defined(__SUNPRO_C)
- # define NEED_STRDUP
- #endif
- 
-@@ -110,7 +111,7 @@
- # define HAVE_SAVED_UIDS
- #endif
- 
--#if !defined(ATT) && !defined(__linux__) && !defined(__GNU__) && !defined(IRIX) && !defined(UNICOS) && !defined(__GLIBC__)
-+        #if !defined(ATT) && !defined(__linux__) && !defined(__GNU__) && !defined(IRIX) && !defined(UNICOS) && !defined(__GLIBC__) && !defined(__SUNPRO_C)
- # define USE_SIGCHLD
- #endif
- 
-Only in cron-3.0pl1.orig: compat.o
-Only in cron-3.0pl1.orig: cron
-diff -ur cron-3.0pl1.orig-solaris/cron.c cron-3.0pl1.orig/cron.c
---- cron-3.0pl1.orig-solaris/cron.c	2009-03-12 13:30:53.000000000 +0000
-+++ cron-3.0pl1.orig/cron.c	2009-03-12 15:09:25.251653050 +0000
-@@ -401,7 +401,7 @@
- 
- #ifdef USE_SIGCHLD
- static void
--sigchld_handler(x) {
-+sigchld_handler(int x) {
- 	int save_errno = errno;
- 	WAIT_T		waiter;
- 	PID_T		pid;
-@@ -435,7 +435,7 @@
- 
- 
- static void
--sighup_handler(x) {
-+sighup_handler(int x) {
- 	log_close();
- 
- 	/* we should use sigaction for proper signal blocking as this 
-diff -ur cron-3.0pl1.orig-solaris/cron.h cron-3.0pl1.orig/cron.h
---- cron-3.0pl1.orig-solaris/cron.h	2009-03-12 13:30:53.000000000 +0000
-+++ cron-3.0pl1.orig/cron.h	2009-03-12 15:19:14.122628700 +0000
-@@ -32,7 +32,7 @@
- 
- #include <stdio.h>
- #include <ctype.h>
--#include <bitstring.h>
-+#include "bitstring.h"
- #include <pwd.h>
- #include <sys/wait.h>
- 
-Only in cron-3.0pl1.orig: cron.o
-Only in cron-3.0pl1.orig: crontab
-Only in cron-3.0pl1.orig: crontab.o
-Only in cron-3.0pl1.orig: database.o
-Only in cron-3.0pl1.orig: do_command.o
-Only in cron-3.0pl1.orig: entry.o
-Only in cron-3.0pl1.orig: env.o
-diff -ur cron-3.0pl1.orig-solaris/externs.h cron-3.0pl1.orig/externs.h
---- cron-3.0pl1.orig-solaris/externs.h	2009-03-12 13:30:53.000000000 +0000
-+++ cron-3.0pl1.orig/externs.h	2009-03-12 13:35:46.000000000 +0000
-@@ -116,11 +116,11 @@
- #endif
- 
- #ifdef NEED_STRCASECMP
--extern	int		strcasecmp __P((char *, char *));
-+extern	int		strcasecmp __P((const char *, const char *));
- #endif
- 
- #ifdef NEED_STRDUP
--extern	char		*strdup __P((char *));
-+extern	char		*strdup __P((const char *));
- #endif
- 
- #ifdef NEED_STRERROR
-Only in cron-3.0pl1.orig: job.o
-diff -ur cron-3.0pl1.orig-solaris/Makefile cron-3.0pl1.orig/Makefile
---- cron-3.0pl1.orig-solaris/Makefile	2009-03-12 13:30:53.000000000 +0000
-+++ cron-3.0pl1.orig/Makefile	2009-03-12 17:39:22.971233150 +0000
-@@ -47,7 +47,7 @@
- 
- #################################### begin configurable stuff
- #<<DESTROOT is assumed to have ./etc, ./bin, and ./man subdirectories>>
--DESTROOT	=	$(DESTDIR)/usr
-+DESTROOT	=	$(DESTDIR)/opt/csw
- DESTSBIN	=	$(DESTROOT)/sbin
- DESTBIN		=	$(DESTROOT)/bin
- DESTMAN		=	$(DESTROOT)/share/man
-@@ -57,7 +57,7 @@
- #<<need getopt()>>
- LIBS		= $(PAM_LIBS) $(SELINUX_LIBS) $(AUDIT_LIBS)
- #<<optimize or debug?>>
--OPTIM		=	-O2
-+#OPTIM		=	-O2
- #OPTIM		=	-g
- #<<ATT or BSD or POSIX?>>
- # (ATT untested)
-@@ -74,12 +74,12 @@
- # Allow override from command line
- DEBUG_DEFS = -DDEBUGGING=0   
- # The -DUSE_SIGCHLD is needed for the Alpha port
--DEFS = -DDEBIAN -DUSE_SIGCHLD $(DEBUG_DEFS) $(PAM_DEFS) $(SELINUX_DEFS)
-+#DEFS = -DDEBIAN -DUSE_SIGCHLD $(DEBUG_DEFS) $(PAM_DEFS) $(SELINUX_DEFS)
- #(SGI IRIX systems need this)
- #DEFS		=	-D_BSD_SIGNALS -Dconst=
- #<<the name of the BSD-like install program>>
- #INSTALL = installbsd
--INSTALL = install -s
-+INSTALL = ginstall -s
- #<<any special load flags>>
- # LDFLAGS		=	-s
- # Let install do the strip
-@@ -87,7 +87,7 @@
- #################################### end configurable stuff
- 
- SHELL		=	/bin/sh
--CFLAGS		=	$(OPTIM) $(INCLUDE) $(COMPAT) $(DEFS)
-+# CFLAGS		=	$(OPTIM) $(INCLUDE) $(COMPAT) $(DEFS)
- 
- INFOS		=	README CHANGES FEATURES INSTALL CONVERSION THANKS MAIL
- MANPAGES	=	bitstring.3 crontab.5 crontab.1 cron.8 putman.sh
-@@ -118,8 +118,8 @@
- 			$(CC) $(LDFLAGS) -o crontab $(CRONTAB_OBJ) $(LIBS)
- 
- install		:	all
--			$(INSTALL) -c -m  755 -o root cron    $(DESTSBIN)/
--			$(INSTALL) -c -m 4755 -o root crontab $(DESTBIN)/
-+			$(INSTALL) -c -m  755 cron    $(DESTSBIN)/
-+			$(INSTALL) -c -m 2755 crontab $(DESTBIN)/
- 			sh putman.sh crontab.1 $(DESTMAN)
- 			sh putman.sh cron.8    $(DESTMAN)
- 			sh putman.sh crontab.5 $(DESTMAN)
-diff -ur cron-3.0pl1.orig-solaris/misc.c cron-3.0pl1.orig/misc.c
---- cron-3.0pl1.orig-solaris/misc.c	2009-03-12 13:30:53.000000000 +0000
-+++ cron-3.0pl1.orig/misc.c	2009-03-12 13:38:43.000000000 +0000
-@@ -42,6 +42,7 @@
- # include <syslog.h>
- #endif
- 
-+#include <sys/file.h>
- 
- #if defined(LOG_DAEMON) && !defined(LOG_CRON)
- #define LOG_CRON LOG_DAEMON
-@@ -277,7 +278,8 @@
- 			exit(ERROR_EXIT);
- 		}
- 
--		if (flock(fd, LOCK_EX|LOCK_NB) < OK) {
-+                /* This bit originally used flock(), switched to lockf() */
-+		if (lockf(fd, F_TLOCK, 0) < OK) {
- 			int save_errno = errno;
- 
- 			fscanf(fp, "%d", &otherpid);
-Only in cron-3.0pl1.orig: misc.o
-diff -ur cron-3.0pl1.orig-solaris/popen.c cron-3.0pl1.orig/popen.c
---- cron-3.0pl1.orig-solaris/popen.c	2009-03-12 13:30:53.000000000 +0000
-+++ cron-3.0pl1.orig/popen.c	2009-03-12 16:04:25.829649200 +0000
-@@ -35,6 +35,10 @@
- #  include <grp.h>
- #endif
- 
-+#include<string.h>
-+#include<strings.h>
-+#include<sys/types.h>
-+#include<sys/stat.h>
- 
- #define MAX_ARGS 100
- #define WANT_GLOBBING 0
-@@ -167,9 +171,12 @@
- 	FILE *iop;
- {
- 	register int fdes;
--	int omask;
- 	WAIT_T stat_loc;
- 	PID_T pid;
-+        /*
-+         * http://www.phys.ufl.edu/docs/porting-faq.html
-+         */
-+        sigset_t block, oblock;
- 
- 	/*
- 	 * pclose returns -1 if stream is not associated with a
-@@ -178,10 +185,20 @@
- 	if (pids == 0 || pids[fdes = fileno(iop)] == 0)
- 		return(-1);
- 	(void)fclose(iop);
--	omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP));
-+        /*
-+         * omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP));
-+         */
-+        (void)sigemptyset(&block);
-+        (void)sigaddset(&block, SIGINT | SIGQUIT | SIGHUP);
-+        if (sigprocmask(SIG_BLOCK, &block, &oblock) < 0)
-+                log_it("CRON", getpid(), "error", "sigprocmask")
-+                ;
- 	while ((pid = wait(&stat_loc)) != pids[fdes] && pid != -1)
- 		;
--	(void)sigsetmask(omask);
-+        /*
-+         * (void)sigsetmask(omask);
-+         */
-+        (void)sigprocmask(SIG_SETMASK, &oblock, (sigset_t *)NULL);
- 	pids[fdes] = 0;
- 	return (pid == -1 ? -1 : WEXITSTATUS(stat_loc));
- }
-Only in cron-3.0pl1.orig: popen.o
-diff -ur cron-3.0pl1.orig-solaris/putman.sh cron-3.0pl1.orig/putman.sh
---- cron-3.0pl1.orig-solaris/putman.sh	1994-09-01 20:17:17.000000000 +0000
-+++ cron-3.0pl1.orig/putman.sh	2009-03-12 20:04:07.194853350 +0000
-@@ -1,4 +1,4 @@
--#!/bin/sh
-+#!/bin/bash
- 
- # putman.sh - install a man page according to local custom
- # vixie 27dec93 [original]
-Only in cron-3.0pl1.orig: user.o


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list