diff options
author | Mathieu Lirzin <mthl@gnu.org> | 2018-03-24 01:33:22 +0100 |
---|---|---|
committer | Mathieu Lirzin <mthl@gnu.org> | 2018-03-24 01:33:22 +0100 |
commit | a1f9e3d7a765e7a057b6c2292cb0ccebe0c697d5 (patch) | |
tree | 5af1416c63282c8686eee3088d90a50fd2ff3d47 /src/mcron/utils.scm | |
parent | 07017255a181114a9b1529aaa197e16b305910ba (diff) | |
download | mcron-a1f9e3d7a765e7a057b6c2292cb0ccebe0c697d5.tar.gz mcron-a1f9e3d7a765e7a057b6c2292cb0ccebe0c697d5.tar.bz2 mcron-a1f9e3d7a765e7a057b6c2292cb0ccebe0c697d5.zip |
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.
Diffstat (limited to 'src/mcron/utils.scm')
-rw-r--r-- | src/mcron/utils.scm | 13 |
1 files changed, 12 insertions, 1 deletions
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)))) |