[Midnightbsd-cvs] CVS Commit: usr.sbin/cron: $MidnightBSD$ Add PAM supoprt to cron.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Aug 18 03:37:13 EDT 2007


Log Message:
-----------
$MidnightBSD$

Add PAM supoprt to cron.  This will allow cron to skip commands by unavailable accounts depending on pam.conf for cron. This only effects personal crontabs and not /etc/crontab.  

Also fix an issue with $HOME

Obtained from FreeBSD.

Modified Files:
--------------
    src/usr.sbin/cron:
        Makefile (r1.1.1.1 -> r1.2)
        Makefile.inc (r1.1.1.1 -> r1.2)
    src/usr.sbin/cron/cron:
        Makefile (r1.1.1.1 -> r1.2)
        compat.h (r1.1.1.1 -> r1.2)
        config.h (r1.1.1.1 -> r1.2)
        cron.8 (r1.1.1.1 -> r1.2)
        cron.h (r1.1.1.2 -> r1.2)
        database.c (r1.1.1.1 -> r1.2)
        do_command.c (r1.1.1.2 -> r1.2)
        externs.h (r1.1.1.1 -> r1.2)
        job.c (r1.1.1.1 -> r1.2)
        pathnames.h (r1.1.1.1 -> r1.2)
        popen.c (r1.1.1.1 -> r1.2)
        user.c (r1.1.1.1 -> r1.2)
    src/usr.sbin/cron/doc:
        CONVERSION (r1.1.1.1 -> r1.2)
        FEATURES (r1.1.1.1 -> r1.2)
        INSTALL (r1.1.1.1 -> r1.2)
        MAIL (r1.1.1.1 -> r1.2)
        Makefile.vixie (r1.1.1.1 -> r1.2)
        README (r1.1.1.1 -> r1.2)
    src/usr.sbin/cron/lib:
        Makefile (r1.1.1.1 -> r1.2)
        compat.c (r1.1.1.1 -> r1.2)
        entry.c (r1.1.1.1 -> r1.2)
        env.c (r1.1.1.1 -> r1.2)
        misc.c (r1.1.1.2 -> r1.2)

-------------- next part --------------
Index: Makefile.inc
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/Makefile.inc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/Makefile.inc -Lusr.sbin/cron/Makefile.inc -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/Makefile.inc
+++ usr.sbin/cron/Makefile.inc
@@ -1,3 +1,4 @@
+# $MidnightBSD$
 # $FreeBSD: src/usr.sbin/cron/Makefile.inc,v 1.4 2005/06/10 06:12:52 des Exp $
 
 LIBCRON= ${.OBJDIR}/../lib/libcron.a
Index: Makefile
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/Makefile -Lusr.sbin/cron/Makefile -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/Makefile
+++ usr.sbin/cron/Makefile
@@ -1,3 +1,4 @@
+# $MidnightBSD$
 # $FreeBSD: src/usr.sbin/cron/Makefile,v 1.2 2001/07/20 06:19:42 obrien Exp $
 
 SUBDIR=	lib cron crontab
Index: popen.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/cron/popen.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/cron/popen.c -Lusr.sbin/cron/cron/popen.c -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/cron/popen.c
+++ usr.sbin/cron/cron/popen.c
@@ -22,13 +22,14 @@
 /* this came out of the ftpd sources; it's been modified to avoid the
  * globbing stuff since we don't need it.  also execvp instead of execv.
  */
+/* $FreeBSD: src/usr.sbin/cron/cron/popen.c,v 1.12 2002/02/06 02:00:07 bbraun Exp $ */
 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)popen.c	5.7 (Berkeley) 2/14/89";
 #endif
 static const char rcsid[] =
-  "$FreeBSD: src/usr.sbin/cron/cron/popen.c,v 1.12 2002/02/06 02:00:07 bbraun Exp $";
+  "$MidnightBSD$";
 #endif /* not lint */
 
 #include "cron.h"
@@ -173,14 +174,19 @@
 				(void) endpwent();
 # endif
 				/* set our directory, uid and gid.  Set gid first,
-				 * since once we set uid, we've lost root privledges.
+				 * since once we set uid, we've lost root privileges.
 				 */
-				setgid(e->gid);
+				if (setgid(e->gid) != 0)
+					_exit(ERROR_EXIT);
 # if defined(BSD)
-				initgroups(usernm, e->gid);
+				if (initgroups(usernm, e->gid) != 0)
+					_exit(ERROR_EXIT);
 # endif
-				setlogin(usernm);
-				setuid(e->uid);         /* we aren't root after this..*/
+				if (setlogin(usernm) != 0)
+					_exit(ERROR_EXIT);
+				if (setuid(e->uid) != 0)
+					_exit(ERROR_EXIT);
+				/* we aren't root after this..*/
 #if defined(LOGIN_CAP)
 			}
 			if (lc != NULL)
Index: do_command.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/cron/do_command.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -Lusr.sbin/cron/cron/do_command.c -Lusr.sbin/cron/cron/do_command.c -u -r1.1.1.2 -r1.2
--- usr.sbin/cron/cron/do_command.c
+++ usr.sbin/cron/cron/do_command.c
@@ -14,10 +14,10 @@
  * I'll try to keep a version up to date.  I can be reached as follows:
  * Paul Vixie          <paul at vix.com>          uunet!decwrl!vixie!paul
  */
-
+/* $FreeBSD: src/usr.sbin/cron/cron/do_command.c,v 1.22.8.1 2006/01/15 17:50:36 delphij Exp $ */
 #if !defined(lint) && !defined(LINT)
 static const char rcsid[] =
-  "$FreeBSD: src/usr.sbin/cron/cron/do_command.c,v 1.22.8.1 2006/01/15 17:50:36 delphij Exp $";
+  "$MidnightBSD$";
 #endif
 
 
@@ -32,6 +32,10 @@
 #if defined(LOGIN_CAP)
 # include <login_cap.h>
 #endif
+#ifdef PAM
+# include <security/pam_appl.h>
+# include <security/openpam.h>
+#endif
 
 
 static void		child_process __P((entry *, user *)),
@@ -98,6 +102,48 @@
 	usernm = env_get("LOGNAME", e->envp);
 	mailto = env_get("MAILTO", e->envp);
 
+#ifdef PAM
+	/* use PAM to see if the user's account is available,
+	 * i.e., not locked or expired or whatever.  skip this
+	 * for system tasks from /etc/crontab -- they can run
+	 * as any user.
+	 */
+	if (strcmp(u->name, SYS_NAME)) {	/* not equal */
+		pam_handle_t *pamh = NULL;
+		int pam_err;
+		struct pam_conv pamc = {
+			.conv = openpam_nullconv,
+			.appdata_ptr = NULL
+		};
+
+		Debug(DPROC, ("[%d] checking account with PAM\n", getpid()))
+
+		/* u->name keeps crontab owner name while LOGNAME is the name
+		 * of user to run command on behalf of.  they should be the
+		 * same for a task from a per-user crontab.
+		 */
+		if (strcmp(u->name, usernm)) {
+			log_it(usernm, getpid(), "username ambiguity", u->name);
+			exit(ERROR_EXIT);
+		}
+
+		pam_err = pam_start("cron", usernm, &pamc, &pamh);
+		if (pam_err != PAM_SUCCESS) {
+			log_it("CRON", getpid(), "error", "can't start PAM");
+			exit(ERROR_EXIT);
+		}
+
+		pam_err = pam_acct_mgmt(pamh, PAM_SILENT);
+		/* Expired password shouldn't prevent the job from running. */
+		if (pam_err != PAM_SUCCESS && pam_err != PAM_NEW_AUTHTOK_REQD) {
+			log_it(usernm, getpid(), "USER", "account unavailable");
+			exit(ERROR_EXIT);
+		}
+
+		pam_end(pamh, pam_err);
+	}
+#endif
+
 #ifdef USE_SIGCHLD
 	/* our parent is watching for our death by catching SIGCHLD.  we
 	 * do not care to watch for our children's deaths this way -- we
@@ -243,14 +289,31 @@
 			(void) endpwent();
 # endif
 			/* set our directory, uid and gid.  Set gid first,
-			 * since once we set uid, we've lost root privledges.
+			 * since once we set uid, we've lost root privileges.
 			 */
-			setgid(e->gid);
+			if (setgid(e->gid) != 0) {
+				log_it(usernm, getpid(),
+				    "error", "setgid failed");
+				exit(ERROR_EXIT);
+			}
 # if defined(BSD)
-			initgroups(usernm, e->gid);
+			if (initgroups(usernm, e->gid) != 0) {
+				log_it(usernm, getpid(),
+				    "error", "initgroups failed");
+				exit(ERROR_EXIT);
+			}
 # endif
-			setlogin(usernm);
-			setuid(e->uid);		/* we aren't root after this..*/
+			if (setlogin(usernm) != 0) {
+				log_it(usernm, getpid(),
+				    "error", "setlogin failed");
+				exit(ERROR_EXIT);
+			}
+			if (setuid(e->uid) != 0) {
+				log_it(usernm, getpid(),
+				    "error", "setuid failed");
+				exit(ERROR_EXIT);
+			}
+			/* we aren't root after this..*/
 #if defined(LOGIN_CAP)
 		}
 		if (lc != NULL)
Index: user.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/cron/user.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/cron/user.c -Lusr.sbin/cron/cron/user.c -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/cron/user.c
+++ usr.sbin/cron/cron/user.c
@@ -1,3 +1,5 @@
+/* $MidnightBSD$ */
+/* $FreeBSD: src/usr.sbin/cron/cron/user.c,v 1.8 1999/08/28 01:15:50 peter Exp $ */
 /* Copyright 1988,1990,1993,1994 by Paul Vixie
  * All rights reserved
  *
@@ -15,11 +17,6 @@
  * Paul Vixie          <paul at vix.com>          uunet!decwrl!vixie!paul
  */
 
-#if !defined(lint) && !defined(LINT)
-static const char rcsid[] =
-  "$FreeBSD: src/usr.sbin/cron/cron/user.c,v 1.8 1999/08/28 01:15:50 peter Exp $";
-#endif
-
 /* vix 26jan87 [log is in RCS file]
  */
 
Index: externs.h
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/cron/externs.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/cron/externs.h -Lusr.sbin/cron/cron/externs.h -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/cron/externs.h
+++ usr.sbin/cron/cron/externs.h
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /* Copyright 1993,1994 by Paul Vixie
  * All rights reserved
  *
Index: config.h
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/cron/config.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/cron/config.h -Lusr.sbin/cron/cron/config.h -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/cron/config.h
+++ usr.sbin/cron/cron/config.h
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /* Copyright 1988,1990,1993,1994 by Paul Vixie
  * All rights reserved
  *
Index: cron.h
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/cron/cron.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -Lusr.sbin/cron/cron/cron.h -Lusr.sbin/cron/cron/cron.h -u -r1.1.1.2 -r1.2
--- usr.sbin/cron/cron/cron.h
+++ usr.sbin/cron/cron/cron.h
@@ -17,6 +17,7 @@
 
 /* cron.h - header for vixie's cron
  *
+ * $MidnightBSD$
  * $FreeBSD: src/usr.sbin/cron/cron/cron.h,v 1.15.8.1 2006/01/15 17:50:36 delphij Exp $
  *
  * vix 14nov88 [rest of log is in RCS]
@@ -76,6 +77,7 @@
 #define	MAX_UNAME	20	/* max length of username, should be overkill */
 #define	ROOT_UID	0	/* don't change this, it really must be root */
 #define	ROOT_USER	"root"	/* ditto */
+#define	SYS_NAME	"*system*" /* magic owner name for system crontab */
 
 				/* NOTE: these correspond to DebugFlagNames,
 				 *	defined below.
Index: job.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/cron/job.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/cron/job.c -Lusr.sbin/cron/cron/job.c -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/cron/job.c
+++ usr.sbin/cron/cron/job.c
@@ -1,3 +1,5 @@
+/* $MidnightBSD$ */
+/* $FreeBSD: src/usr.sbin/cron/cron/job.c,v 1.6 1999/08/28 01:15:50 peter Exp $ */
 /* Copyright 1988,1990,1993,1994 by Paul Vixie
  * All rights reserved
  *
@@ -15,12 +17,6 @@
  * Paul Vixie          <paul at vix.com>          uunet!decwrl!vixie!paul
  */
 
-#if !defined(lint) && !defined(LINT)
-static const char rcsid[] =
-  "$FreeBSD: src/usr.sbin/cron/cron/job.c,v 1.6 1999/08/28 01:15:50 peter Exp $";
-#endif
-
-
 #include "cron.h"
 
 
Index: compat.h
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/cron/compat.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/cron/compat.h -Lusr.sbin/cron/cron/compat.h -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/cron/compat.h
+++ usr.sbin/cron/cron/compat.h
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /* Copyright 1993,1994 by Paul Vixie
  * All rights reserved
  *
Index: Makefile
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/cron/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/cron/Makefile -Lusr.sbin/cron/cron/Makefile -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/cron/Makefile
+++ usr.sbin/cron/cron/Makefile
@@ -1,12 +1,13 @@
+# $MidnightBSD$
 # $FreeBSD: src/usr.sbin/cron/cron/Makefile,v 1.15 2001/07/20 06:19:40 obrien Exp $
 
 PROG=	cron
 MAN=	cron.8
 SRCS=	cron.c database.c do_command.c job.c user.c popen.c
 
-CFLAGS+= -DLOGIN_CAP
+CFLAGS+= -DLOGIN_CAP -DPAM
 
-DPADD=	${LIBCRON} ${LIBUTIL}
-LDADD=	${LIBCRON} -lutil
+DPADD=	${LIBCRON} ${LIBPAM} ${LIBUTIL}
+LDADD=	${LIBCRON} -lpam -lutil
 
 .include <bsd.prog.mk>
Index: database.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/cron/database.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/cron/database.c -Lusr.sbin/cron/cron/database.c -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/cron/database.c
+++ usr.sbin/cron/cron/database.c
@@ -14,10 +14,11 @@
  * I'll try to keep a version up to date.  I can be reached as follows:
  * Paul Vixie          <paul at vix.com>          uunet!decwrl!vixie!paul
  */
+/* $FreeBSD: src/usr.sbin/cron/cron/database.c,v 1.8 1999/08/28 01:15:50 peter Exp $ */
 
 #if !defined(lint) && !defined(LINT)
 static const char rcsid[] =
-  "$FreeBSD: src/usr.sbin/cron/cron/database.c,v 1.8 1999/08/28 01:15:50 peter Exp $";
+  "$MidnightBSD$";
 #endif
 
 /* vix 26jan87 [RCS has the log]
@@ -87,7 +88,7 @@
 	new_db.head = new_db.tail = NULL;
 
 	if (syscron_stat.st_mtime) {
-		process_crontab("root", "*system*",
+		process_crontab("root", SYS_NAME,
 				SYSCRONTAB, &syscron_stat,
 				&new_db, old_db);
 	}
@@ -205,7 +206,7 @@
 	int		crontab_fd = OK - 1;
 	user		*u;
 
-	if (strcmp(fname, "*system*") && !(pw = getpwnam(uname))) {
+	if (strcmp(fname, SYS_NAME) && !(pw = getpwnam(uname))) {
 		/* file doesn't have a user in passwd file.
 		 */
 		log_it(fname, getpid(), "ORPHAN", "no passwd entry");
Index: cron.8
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/cron/cron.8,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/cron/cron.8 -Lusr.sbin/cron/cron/cron.8 -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/cron/cron.8
+++ usr.sbin/cron/cron/cron.8
@@ -15,9 +15,10 @@
 .\" * Paul Vixie          <paul at vix.com>          uunet!decwrl!vixie!paul
 .\" */
 .\"
+.\" $MidnightBSD$
 .\" $FreeBSD: src/usr.sbin/cron/cron/cron.8,v 1.24 2005/02/13 23:45:51 ru Exp $
 .\"
-.Dd December 20, 1993
+.Dd August 18, 2007
 .Dt CRON 8
 .Os
 .Sh NAME
@@ -53,11 +54,21 @@
 .Pa /etc/crontab
 which is in a different format (see
 .Xr crontab 5 ) .
+.Pp
 The
 .Nm
 utility
 then wakes up every minute, examining all stored crontabs, checking each
 command to see if it should be run in the current minute.
+Before running a command from a per-account crontab file,
+.Nm
+checks the status of the account with
+.Xr pam 3
+and skips the command if the account is unavailable,
+e.g., locked out or expired.
+Commands from
+.Pa /etc/crontab
+bypass this check.
 When executing
 commands, any output is mailed to the owner of the crontab (or to the user
 named in the
@@ -173,8 +184,21 @@
 trace through the execution, but do not perform any actions
 .El
 .El
+.Sh FILES
+.Bl -tag -width /etc/pam.d/cron -compact
+.It Pa /etc/crontab
+System crontab file
+.It Pa /etc/pam.d/cron
+.Xr pam.conf 5
+configuration file for
+.Nm
+.It Pa /var/cron/tabs
+Directory for personal crontab files
+.El
 .Sh SEE ALSO
 .Xr crontab 1 ,
-.Xr crontab 5
+.Xr pam 3 ,
+.Xr crontab 5 ,
+.Xr pam.conf 5
 .Sh AUTHORS
 .An Paul Vixie Aq paul at vix.com
Index: pathnames.h
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/cron/pathnames.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/cron/pathnames.h -Lusr.sbin/cron/cron/pathnames.h -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/cron/pathnames.h
+++ usr.sbin/cron/cron/pathnames.h
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /* Copyright 1993,1994 by Paul Vixie
  * All rights reserved
  *
Index: CONVERSION
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/doc/CONVERSION,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/doc/CONVERSION -Lusr.sbin/cron/doc/CONVERSION -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/doc/CONVERSION
+++ usr.sbin/cron/doc/CONVERSION
@@ -1,3 +1,4 @@
+$MidnightBSD$
 $FreeBSD: src/usr.sbin/cron/doc/CONVERSION,v 1.5 2001/02/06 11:21:45 asmodai Exp $
 
 Conversion of BSD 4.[23] crontab files:
Index: MAIL
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/doc/MAIL,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/doc/MAIL -Lusr.sbin/cron/doc/MAIL -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/doc/MAIL
+++ usr.sbin/cron/doc/MAIL
@@ -3,6 +3,7 @@
   version of cron.  it is presented here for its entertainment value.
   --vix ]
 
+$MidnightBSD$
 $FreeBSD: src/usr.sbin/cron/doc/MAIL,v 1.4 1999/08/28 01:15:53 peter Exp $
 
 From ptsfa!lll-crg!ames!acornrc!bob Wed Dec 31 10:07:08 1986
Index: FEATURES
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/doc/FEATURES,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/doc/FEATURES -Lusr.sbin/cron/doc/FEATURES -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/doc/FEATURES
+++ usr.sbin/cron/doc/FEATURES
@@ -1,3 +1,4 @@
+$MidnightBSD$
 $FreeBSD: src/usr.sbin/cron/doc/FEATURES,v 1.4 1999/08/28 01:15:53 peter Exp $
 
 Features of Vixie's cron relative to BSD 4.[23] and SysV crons:
Index: Makefile.vixie
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/doc/Makefile.vixie,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/doc/Makefile.vixie -Lusr.sbin/cron/doc/Makefile.vixie -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/doc/Makefile.vixie
+++ usr.sbin/cron/doc/Makefile.vixie
@@ -17,6 +17,7 @@
 
 # Makefile for vixie's cron
 #
+# $MidnightBSD$
 # $FreeBSD: src/usr.sbin/cron/doc/Makefile.vixie,v 1.5 1999/08/28 01:15:53 peter Exp $
 #
 # vix 03mar88 [moved to RCS, rest of log is in there]
Index: INSTALL
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/doc/INSTALL,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/doc/INSTALL -Lusr.sbin/cron/doc/INSTALL -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/doc/INSTALL
+++ usr.sbin/cron/doc/INSTALL
@@ -15,6 +15,7 @@
  * Paul Vixie          <paul at vix.com>          uunet!decwrl!vixie!paul
  */
 
+$MidnightBSD$
 $FreeBSD: src/usr.sbin/cron/doc/INSTALL,v 1.4 1999/08/28 01:15:53 peter Exp $
 
 Read the comments at the top of the Makefile, then edit the area marked
Index: README
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/doc/README,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/doc/README -Lusr.sbin/cron/doc/README -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/doc/README
+++ usr.sbin/cron/doc/README
@@ -69,4 +69,5 @@
 	if you like it, change your /etc/{rc,rc.local} to use it instead of
 		the old one.
 
+$MidnightBSD$
 $FreeBSD: src/usr.sbin/cron/doc/README,v 1.4 1999/08/28 01:15:53 peter Exp $
Index: compat.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/lib/compat.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/lib/compat.c -Lusr.sbin/cron/lib/compat.c -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/lib/compat.c
+++ usr.sbin/cron/lib/compat.c
@@ -1,3 +1,5 @@
+/* $MidnightBSD$ */
+/* $FreeBSD: src/usr.sbin/cron/lib/compat.c,v 1.7 2000/12/09 09:35:44 obrien Exp $ */
 /* Copyright 1988,1990,1993,1994 by Paul Vixie
  * All rights reserved
  *
@@ -15,10 +17,6 @@
  * Paul Vixie          <paul at vix.com>          uunet!decwrl!vixie!paul
  */
 
-#if !defined(lint) && !defined(LINT)
-static char rcsid[] = "$FreeBSD: src/usr.sbin/cron/lib/compat.c,v 1.7 2000/12/09 09:35:44 obrien Exp $";
-#endif
-
 /* vix 30dec93 [broke this out of misc.c - see RCS log for history]
  * vix 15jan87 [added TIOCNOTTY, thanks csg at pyramid]
  */
Index: entry.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/lib/entry.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/lib/entry.c -Lusr.sbin/cron/lib/entry.c -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/lib/entry.c
+++ usr.sbin/cron/lib/entry.c
@@ -14,10 +14,10 @@
  * I'll try to keep a version up to date.  I can be reached as follows:
  * Paul Vixie          <paul at vix.com>          uunet!decwrl!vixie!paul
  */
-
+/* $FreeBSD: src/usr.sbin/cron/lib/entry.c,v 1.16 2005/02/14 14:09:21 delphij Exp $ */
 #if !defined(lint) && !defined(LINT)
 static const char rcsid[] =
-  "$FreeBSD: src/usr.sbin/cron/lib/entry.c,v 1.16 2005/02/14 14:09:21 delphij Exp $";
+  "$MidnightBSD$";
 #endif
 
 /* vix 26jan87 [RCS'd; rest of log is in RCS file]
@@ -323,10 +323,12 @@
 #endif
 	}
 
+#ifndef PAM	/* PAM takes care of account expiration by itself */
 	if (pw->pw_expire && time(NULL) >= pw->pw_expire) {
 		ecode = e_username;
 		goto eof;
 	}
+#endif /* !PAM */
 
 	e->uid = pw->pw_uid;
 	e->gid = pw->pw_gid;
@@ -351,14 +353,16 @@
 			goto eof;
 		}
 	}
-	prev_env = e->envp;
-	sprintf(envstr, "HOME=%s", pw->pw_dir);
-	e->envp = env_set(e->envp, envstr);
-	if (e->envp == NULL) {
-		warn("env_set(%s)", envstr);
-		env_free(prev_env);
-		ecode = e_mem;
-		goto eof;
+	if (!env_get("HOME", e->envp)) {
+		prev_env = e->envp;
+		sprintf(envstr, "HOME=%s", pw->pw_dir);
+		e->envp = env_set(e->envp, envstr);
+		if (e->envp == NULL) {
+			warn("env_set(%s)", envstr);
+			env_free(prev_env);
+			ecode = e_mem;
+			goto eof;
+		}
 	}
 	if (!env_get("PATH", e->envp)) {
 		prev_env = e->envp;
@@ -507,7 +511,9 @@
 		if (EOF == (ch = get_number(&num1, low, names, ch, file)))
 			return EOF;
 
-		if (ch != '-') {
+		if (ch == '/')
+			num2 = high;
+		else if (ch != '-') {
 			/* not a range, it's a single number.
 			 */
 			if (EOF == set_element(bits, low, high, num1))
Index: env.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/lib/env.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/lib/env.c -Lusr.sbin/cron/lib/env.c -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/lib/env.c
+++ usr.sbin/cron/lib/env.c
@@ -1,3 +1,5 @@
+/* $MidnightBSD$ */
+/* $FreeBSD: src/usr.sbin/cron/lib/env.c,v 1.12 2003/02/10 11:20:58 thomas Exp $ */
 /* Copyright 1988,1990,1993,1994 by Paul Vixie
  * All rights reserved
  *
@@ -15,12 +17,6 @@
  * Paul Vixie          <paul at vix.com>          uunet!decwrl!vixie!paul
  */
 
-#if !defined(lint) && !defined(LINT)
-static const char rcsid[] =
-  "$FreeBSD: src/usr.sbin/cron/lib/env.c,v 1.12 2003/02/10 11:20:58 thomas Exp $";
-#endif
-
-
 #include "cron.h"
 
 
Index: Makefile
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/lib/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.sbin/cron/lib/Makefile -Lusr.sbin/cron/lib/Makefile -u -r1.1.1.1 -r1.2
--- usr.sbin/cron/lib/Makefile
+++ usr.sbin/cron/lib/Makefile
@@ -1,3 +1,4 @@
+# $MidnightBSD$
 # $FreeBSD: src/usr.sbin/cron/lib/Makefile,v 1.7 2004/10/24 15:33:02 ru Exp $
 
 LIB=	cron
@@ -5,6 +6,6 @@
 SRCS= entry.c env.c misc.c
 
 CFLAGS+= -I${.CURDIR}/../cron
-CFLAGS+= -DLOGIN_CAP
+CFLAGS+= -DLOGIN_CAP -DPAM
 
 .include <bsd.lib.mk>
Index: misc.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/cron/lib/misc.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -Lusr.sbin/cron/lib/misc.c -Lusr.sbin/cron/lib/misc.c -u -r1.1.1.2 -r1.2
--- usr.sbin/cron/lib/misc.c
+++ usr.sbin/cron/lib/misc.c
@@ -1,3 +1,5 @@
+/* $MidnightBSD$ */
+/* $FreeBSD: src/usr.sbin/cron/lib/misc.c,v 1.12.2.1 2006/01/15 17:50:36 delphij Exp $ */
 /* Copyright 1988,1990,1993,1994 by Paul Vixie
  * All rights reserved
  *
@@ -15,11 +17,6 @@
  * Paul Vixie          <paul at vix.com>          uunet!decwrl!vixie!paul
  */
 
-#if !defined(lint) && !defined(LINT)
-static const char rcsid[] =
-  "$FreeBSD: src/usr.sbin/cron/lib/misc.c,v 1.12.2.1 2006/01/15 17:50:36 delphij Exp $";
-#endif
-
 /* vix 26jan87 [RCS has the rest of the log]
  * vix 30dec86 [written]
  */


More information about the Midnightbsd-cvs mailing list