Subject: [PATCH v2 2/2] gnu: services: nscd: Sanitize nscd-configuration's implementation.

From: Nicolas Graves <[email-masked]>
Date: Sun, 29 Jun 2025 13:52:41 +0200

* gnu/services/base.scm (<nscd-configuration>): Sanitize
nscd-configuration's implementation field with ...
(warn-unexpected-nscd-implementation): New procedure.
---
 gnu/services/base.scm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index a81bdf809c..0c5b26ccb1 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1363,11 +1363,20 @@ (define-deprecated (mingetty-service config)
 the tty to run, among other things."
   (service mingetty-service-type config))
 
+(define-with-syntax-properties (warn-unexpected-nscd-implementation
+                                (value properties))
+  (unless (member value '(glibc nsncd))
+    (leave (source-properties->location properties)
+           (G_ "The nscd-configuration object's implementation field supports \
+only 'glibc and 'nsncd values.")))
+  value)
+
 (define-record-type* <nscd-configuration> nscd-configuration
   make-nscd-configuration
   nscd-configuration?
   (implementation nscd-implementation
-                  (default 'glibc))               ;'glibc or 'nsncd
+                  (default 'glibc)                ;'glibc or 'nsncd
+                  (sanitize warn-unexpected-nscd-implementation))
   (log-file    nscd-configuration-log-file        ;string
                (default #f))
   (debug-level nscd-debug-level                   ;integer
-- 
2.49.0