From a1f9e3d7a765e7a057b6c2292cb0ccebe0c697d5 Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Sat, 24 Mar 2018 01:33:22 +0100 Subject: utils: Add 'get-user' * src/mcron/utils.scm (get-user): New procedure. * src/mcron/job-specifier.scm (job): Use it. * src/mcron/base.scm (remove-user-jobs): Likewise. --- src/mcron/utils.scm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/mcron/utils.scm') diff --git a/src/mcron/utils.scm b/src/mcron/utils.scm index bb23f4a..98afaf0 100644 --- a/src/mcron/utils.scm +++ b/src/mcron/utils.scm @@ -29,7 +29,8 @@ parse-args show-version show-package-information - process-update-request) + process-update-request + get-user) #:re-export (option-ref read-string)) @@ -101,3 +102,13 @@ comes in on the above socket." (remove-user-jobs user) (set-configuration-user user) (read-vixie-file (string-append config-spool-dir "/" user-name))))))) + +(define (get-user spec) + "Return the passwd entry corresponding to SPEC. If SPEC is passwd entry +then return it. If SPEC is not a valid specification throw an exception." + (cond ((or (string? spec) (integer? spec)) + (getpw spec)) + ((vector? spec) ;assume a user passwd entry + spec) + (else + (throw 'invalid-user-specification spec)))) -- cgit v1.2.3