diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-06-03 17:14:17 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-06-05 23:10:36 +0200 |
commit | d497b6ab397273cd250003b6266f22ad74f4c20d (patch) | |
tree | b70dda99dd7f9558d0c2ee40ac0369f2c5248a64 /gnu/build/accounts.scm | |
parent | 5f0cf1df710cca3eeff6b41ce8e665fb911cfb41 (diff) | |
download | guix-d497b6ab397273cd250003b6266f22ad74f4c20d.tar.gz |
activation: Lock /etc/.pwd.lock before accessing databases.
Suggested by Florian Pelz <pelzflorian@pelzflorian.de> in <http://bugs.gnu.org/35996>. * gnu/build/accounts.scm (%password-lock-file): New variable. * gnu/build/activation.scm (activate-users+groups): Wrap calls to 'user+group-databases', 'write-group', etc. into 'with-file-lock'.
Diffstat (limited to 'gnu/build/accounts.scm')
-rw-r--r-- | gnu/build/accounts.scm | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gnu/build/accounts.scm b/gnu/build/accounts.scm index c43ce85b60..8687446aa6 100644 --- a/gnu/build/accounts.scm +++ b/gnu/build/accounts.scm @@ -51,6 +51,7 @@ group-entry-gid group-entry-members + %password-lock-file write-group write-passwd write-shadow @@ -224,6 +225,11 @@ each field." (serialization list->comma-separated comma-separated->list) (default '()))) +(define %password-lock-file + ;; The password database lock file used by libc's 'lckpwdf'. Users should + ;; grab this lock with 'with-file-lock' when they access the databases. + "/etc/.pwd.lock") + (define (database-writer file mode entry->string) (lambda* (entries #:optional (file-or-port file)) "Write ENTRIES to FILE-OR-PORT. When FILE-OR-PORT is a file name, write |