AboutSummaryRefsLogTreeCommitDiffStats
path: root/scm/mcron/main.scm
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2015-09-07 00:54:45 +0200
committerMathieu Lirzin <mthl@gnu.org>2016-05-07 16:17:52 +0200
commitfdbaa674a73c04681d574a4eabf5a723dc716d38 (patch)
tree2a0877128b93f6fddd5053f790bf0b17406c9d92 /scm/mcron/main.scm
parent4da7aec83b6f8f854568ac150ed129502486bf14 (diff)
downloadmcron-fdbaa674a73c04681d574a4eabf5a723dc716d38.tar.gz
mcron-fdbaa674a73c04681d574a4eabf5a723dc716d38.tar.bz2
mcron-fdbaa674a73c04681d574a4eabf5a723dc716d38.zip
main: Remove 'valid-user' procedure.
* scm/mcron/main.scm (valid-user): Delete procedure. (process-files-in-system-directory): Adjust accordingly by using a local definition.
Diffstat (limited to 'scm/mcron/main.scm')
-rw-r--r--scm/mcron/main.scm20
1 files changed, 7 insertions, 13 deletions
diff --git a/scm/mcron/main.scm b/scm/mcron/main.scm
index a84f82f..1f2b068 100644
--- a/scm/mcron/main.scm
+++ b/scm/mcron/main.scm
@@ -226,28 +226,22 @@ $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 (user-entry name)
+ ;; Return the user database entry if NAME is valid, otherwise #f.
+ (false-if-exception (getpwnam name)))
+
(catch #t
(lambda ()
(for-each-file
(lambda (user)
- (and-let* ((user* (valid-user user))) ;crontab without user?
- (set-configuration-user user*)
+ (and-let* ((entry (user-entry user))) ;crontab without user?
+ (set-configuration-user entry)
(catch-mcron-error
(read-vixie-file (string-append config-spool-dir "/" user)))))
config-spool-dir))