aboutsummaryrefslogtreecommitdiff
path: root/sysutils/fcron
diff options
context:
space:
mode:
authorSergey Matveychuk <sem@FreeBSD.org>2006-06-04 20:09:42 +0000
committerSergey Matveychuk <sem@FreeBSD.org>2006-06-04 20:09:42 +0000
commitc616f818655de93ca1967279eadea3f48d758248 (patch)
treee65d6cff206f7e1fbb70f313197f918bda3e1235 /sysutils/fcron
parent2b17f205b05f43139ddc02ab3aa57648dea69fcb (diff)
downloadports-c616f818655de93ca1967279eadea3f48d758248.tar.gz
ports-c616f818655de93ca1967279eadea3f48d758248.zip
- Install pam files directly (in /etc/pam.d, unless they already exist)
rather than just leaving them in the examples directory. There seems to be no real security advantage to not installing the pam files since they are required for fcron and fcrontab to operate, and root privs are required to install fcron to begin with. - The sockaddr.sa_len was not set prior to calls to bind() and connect(). The upshot begin that fcrondyn was unable to open the socket to communicate with fcron. PR: ports/97066 Submitted by: maintainer
Notes
Notes: svn path=/head/; revision=164357
Diffstat (limited to 'sysutils/fcron')
-rw-r--r--sysutils/fcron/Makefile8
-rw-r--r--sysutils/fcron/files/patch-config.h.in8
-rw-r--r--sysutils/fcron/files/patch-configure.in20
-rw-r--r--sysutils/fcron/files/patch-fcrondyn.c29
-rw-r--r--sysutils/fcron/files/patch-socket.c34
-rw-r--r--sysutils/fcron/files/pkg-message.in6
-rw-r--r--sysutils/fcron/pkg-plist6
7 files changed, 104 insertions, 7 deletions
diff --git a/sysutils/fcron/Makefile b/sysutils/fcron/Makefile
index d96cff2a39de..df752be727df 100644
--- a/sysutils/fcron/Makefile
+++ b/sysutils/fcron/Makefile
@@ -8,6 +8,7 @@
PORTNAME= fcron
PORTVERSION= 3.0.1
+PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_SUNSITE} \
http://fcron.free.fr/archives/ \
@@ -20,6 +21,7 @@ COMMENT= A periodic command scheduler
GNU_CONFIGURE= yes
USE_GMAKE= yes
+USE_AUTOTOOLS= autoconf:259
USE_PERL5_BUILD=yes
CONFIGURE_ARGS= --with-etcdir=${PREFIX}/etc --with-cflags="${CFLAGS}" \
--with-rootname=root --with-rootgroup=wheel \
@@ -34,6 +36,9 @@ MAN1= fcrontab.1
MAN5= fcron.conf.5 fcrontab.5
MAN8= fcron.8
+PAMDIR?= /etc/pam.d
+PLIST_SUB+= PAMDIR=${PAMDIR}
+
PORTDOCS= *
.if defined(MANLANG) && exists(${WRKSRC}/doc/${MANLANG})
@@ -55,6 +60,9 @@ do-install:
.endfor
${MKDIR} ${EXAMPLESDIR}
${INSTALL_DATA} ${FILESDIR}/fcrontab-* ${WRKSRC}/files/*.pam ${EXAMPLESDIR}
+ ${MKDIR} ${PAMDIR}
+ [ -f ${PAMDIR}/fcron ] || ${INSTALL_DATA} ${WRKSRC}/files/fcron.pam ${PAMDIR}/fcron
+ [ -f ${PAMDIR}/fcrontab ] || ${INSTALL_DATA} ${WRKSRC}/files/fcrontab.pam ${PAMDIR}/fcrontab
.for n in 1 5 8
${INSTALL_MAN} ${MAN${n}:S|^|${DOCSRC}/man/|} ${PREFIX}/man/man${n}
.endfor
diff --git a/sysutils/fcron/files/patch-config.h.in b/sysutils/fcron/files/patch-config.h.in
new file mode 100644
index 000000000000..1a396012d854
--- /dev/null
+++ b/sysutils/fcron/files/patch-config.h.in
@@ -0,0 +1,8 @@
+--- config.h.in.orig Mon Feb 6 14:44:52 2006
++++ config.h.in Tue May 9 17:15:19 2006
+@@ -424,3 +424,5 @@
+ #define O_SYNC O_FSYNC
+ #endif
+
++/* Define if (struct sockaddr) has an sa_len field. */
++#undef HAVE_SA_LEN
diff --git a/sysutils/fcron/files/patch-configure.in b/sysutils/fcron/files/patch-configure.in
new file mode 100644
index 000000000000..63378ef5f5cf
--- /dev/null
+++ b/sysutils/fcron/files/patch-configure.in
@@ -0,0 +1,20 @@
+--- configure.in.orig Mon Jan 9 17:21:24 2006
++++ configure.in Tue May 9 17:04:30 2006
+@@ -57,6 +57,17 @@
+ AC_STRUCT_TM
+ AC_TYPE_UID_T
+
++dnl Check for post-Reno style struct sockaddr
++AC_CACHE_CHECK([for sa_len],
++ ac_cv_sa_len,
++[AC_TRY_COMPILE([#include <sys/types.h>
++#include <sys/socket.h>], [int main(void) {
++ struct sockaddr t;t.sa_len = 0;}],
++ ac_cv_sa_len=yes,ac_cv_sa_len=no)])
++if test $ac_cv_sa_len = yes; then
++ AC_DEFINE(HAVE_SA_LEN)
++fi
++
+ dnl Checks for library functions.
+ AC_PROG_GCC_TRADITIONAL
+ AC_FUNC_MEMCMP
diff --git a/sysutils/fcron/files/patch-fcrondyn.c b/sysutils/fcron/files/patch-fcrondyn.c
new file mode 100644
index 000000000000..b6d374d74c78
--- /dev/null
+++ b/sysutils/fcron/files/patch-fcrondyn.c
@@ -0,0 +1,29 @@
+--- fcrondyn.c.orig Mon Feb 6 14:44:52 2006
++++ fcrondyn.c Tue May 9 15:24:22 2006
+@@ -399,17 +399,21 @@
+ int fd = -1;
+ struct sockaddr_un addr;
+ int len = 0;
++ int sa_len;
+
+ if ( (fd = socket(PF_UNIX, SOCK_STREAM, 0)) == -1 )
+ die_e("could not create socket");
+
+ addr.sun_family = AF_UNIX;
+- if ( (len = strlen(fifofile)) > sizeof(addr.sun_path) )
+- die("Error : fifo file path too long (max is %d)", sizeof(addr.sun_path));
+- strncpy(addr.sun_path, fifofile, sizeof(addr.sun_path) - 1);
+- addr.sun_path[sizeof(addr.sun_path)-1] = '\0';
++ if ( (len = strlen(fifofile)) > sizeof(addr.sun_path) - 1 )
++ die("Error : fifo file path too long (max is %d)", sizeof(addr.sun_path) - 1);
++ strncpy(addr.sun_path, fifofile, sizeof(addr.sun_path));
++ sa_len = (addr.sun_path - (char *)&addr) + len;
++#if HAVE_SA_LEN
++ addr.sun_len = sa_len;
++#endif
+
+- if ( connect(fd, (struct sockaddr *) &addr, sizeof(addr.sun_family) + len) < 0 )
++ if ( connect(fd, (struct sockaddr *) &addr, sa_len) < 0 )
+ die_e("Cannot connect() to fcron (check if fcron is running)");
+
+ if ( authenticate_user(fd) == ERR ) {
diff --git a/sysutils/fcron/files/patch-socket.c b/sysutils/fcron/files/patch-socket.c
new file mode 100644
index 000000000000..8dabb2aa077b
--- /dev/null
+++ b/sysutils/fcron/files/patch-socket.c
@@ -0,0 +1,34 @@
+--- socket.c.orig Mon Feb 6 14:44:52 2006
++++ socket.c Tue May 9 16:33:19 2006
+@@ -134,6 +134,7 @@
+ {
+ struct sockaddr_un addr;
+ int len = 0;
++ int sa_len;
+
+ /* used in fcron.c:main_loop():select() */
+ FD_ZERO(&read_set);
+@@ -145,15 +146,19 @@
+ }
+
+ addr.sun_family = AF_UNIX;
+- if ( (len = strlen(fifofile)) > sizeof(addr.sun_path) ) {
+- error("Error : fifo file path too long (max is %d)", sizeof(addr.sun_path));
++ if ( (len = strlen(fifofile)) > sizeof(addr.sun_path) - 1) {
++ error("Error : fifo file path too long (max is %d)", sizeof(addr.sun_path) - 1);
+ goto err;
+ }
+- strncpy(addr.sun_path, fifofile, sizeof(addr.sun_path) - 1);
++ strncpy(addr.sun_path, fifofile, sizeof(addr.sun_path));
+ addr.sun_path[sizeof(addr.sun_path) -1 ] = '\0';
++ sa_len = (addr.sun_path - (char *)&addr) + len;
++#if HAVE_SA_LEN
++ addr.sun_len = sa_len;
++#endif
+
+ unlink(fifofile);
+- if (bind(listen_fd, (struct sockaddr*) &addr, sizeof(addr.sun_family)+len+1) != 0){
++ if (bind(listen_fd, (struct sockaddr*) &addr, sa_len) != 0){
+ error_e("Cannot bind socket to '%s'", fifofile);
+ goto err;
+ }
diff --git a/sysutils/fcron/files/pkg-message.in b/sysutils/fcron/files/pkg-message.in
index f3409e1be538..04257be00f2b 100644
--- a/sysutils/fcron/files/pkg-message.in
+++ b/sysutils/fcron/files/pkg-message.in
@@ -5,12 +5,6 @@ to your /etc/rc.conf:
fcron_enable="YES"
cron_enable="NO"
-install the pam config files
-
- mkdir -p %%PREFIX%%/etc/pam.d
- cp %%EXAMPLESDIR%%/fcron.pam %%PREFIX%%/etc/pam.d/fcron
- cp %%EXAMPLESDIR%%/fcrontab.pam %%PREFIX%%/etc/pam.d/fcrontab
-
and move any jobs in /etc/crontab to the root fcrontab(5) file. See:
%%EXAMPLESDIR%%
diff --git a/sysutils/fcron/pkg-plist b/sysutils/fcron/pkg-plist
index 2fccda00cef4..61a28fe049cb 100644
--- a/sysutils/fcron/pkg-plist
+++ b/sysutils/fcron/pkg-plist
@@ -5,8 +5,12 @@ etc/fcron.allow.dist
etc/fcron.conf.dist
etc/fcron.deny.dist
sbin/fcron
-%%EXAMPLESDIR%%/fcron.pam
%%EXAMPLESDIR%%/fcrontab-operator
%%EXAMPLESDIR%%/fcrontab-root
+%%EXAMPLESDIR%%/fcron.pam
%%EXAMPLESDIR%%/fcrontab.pam
@dirrm %%EXAMPLESDIR%%
+@cwd /
+%%PAMDIR%%/fcron
+%%PAMDIR%%/fcrontab
+@dirrmtry %%PAMDIR%%