[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-mcron] [PATCH 32/33] main: Remove 'valid-user'.
From: |
Mathieu Lirzin |
Subject: |
[Bug-mcron] [PATCH 32/33] main: Remove 'valid-user'. |
Date: |
Sun, 27 Sep 2015 23:20:13 +0200 |
* scm/mcron/main.scm (valid-user): Delete variable.
(process-files-in-system-directory): Adjust accordingly by using a
local definition.
---
scm/mcron/main.scm | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/scm/mcron/main.scm b/scm/mcron/main.scm
index ca0d051..3bf2342 100644
--- a/scm/mcron/main.scm
+++ b/scm/mcron/main.scm
@@ -225,26 +225,20 @@ $XDG_CONFIG_HOME is not defined uses ~/.config/cron
instead)."
(mcron-error 13
"Cannot read files in your ~/.config/cron (or ~/.cron) directory."))))
-(define (valid-user user-name)
- "Check that USER-NAME is in the passwd database (it may happen that a user
-is removed after creating a crontab). If the USER-NAME is valid, Return the
-full passwd entry for that user."
- (setpwent)
- (do ((entry (getpw) (getpw)))
- ((or (not entry)
- (string=? (passwd:name entry) user-name))
- (endpwent)
- entry)))
-
(define (process-files-in-system-directory)
"Process all the files in the crontab directory. When the job procedure is
run on behalf of the configuration files, the jobs are registered on the
system with the appropriate user. Only root should be able to perform this
operation. The permissions on the /var/cron/tabs directory enforce this."
+
+ (define (valid-user? user-name)
+ "Return the full user database entry if USER-NAME is in it, otherwise #f."
+ (false-if-exception (getpwnam user-name)))
+
(catch #t
(proc-in-directory config-spool-dir
(lambda (user-name)
- (and-let* ((user (valid-user user-name))) ;crontab without user?
+ (and-let* ((user (valid-user? user-name))) ;crontab without user?
(set-configuration-user user)
(catch-mcron-error
(read-vixie-file
- [Bug-mcron] [PATCH 23/33] mcron: Add forward declarations., (continued)
- [Bug-mcron] [PATCH 23/33] mcron: Add forward declarations., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 28/33] main: Remove unused 'regular-file?' procedure., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 24/33] mcron: Use symbolic constants., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 25/33] mcron: Rework comments., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 20/33] build: Enable silent rules by default., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 13/33] main: Turn 'command-name' into a thunk., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 19/33] build: Compile and install '.go' files., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 18/33] main: Add (mcron main) module., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 30/33] Define directory-local variables for Emacs., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 31/33] main: Add 'proc-in-directory'., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 32/33] main: Remove 'valid-user'.,
Mathieu Lirzin <=
- [Bug-mcron] [PATCH 33/33] core: Use SRFI-9 records for the job data structure., Mathieu Lirzin, 2015/09/27