Subject: [PATCH v2 3/8] services: krb5-realm: Add default-principal-flags field.

From: Tomas Volf <[email-masked]>
Date: Wed, 19 Mar 2025 17:24:29 +0100

* gnu/services/kerberos.scm (krb5-realm): Add default-principal-flags field.
(serialize-comma-separated-string-list/unset, comma-separated-string-list?)
(comma-separated-string-list/unset?): New procedures.

Change-Id: Ie5f787ca0745dd6234ea4577b39a58d71e4fa6d2
---
 gnu/services/kerberos.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index ee0deec2e4..1a7cc5774a 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -107,6 +107,19 @@ (define (space-separated-string-list? val)
 (define space-separated-string-list/unset?
   (predicate/unset space-separated-string-list?))
 
+(define (serialize-comma-separated-string-list/unset field-name val)
+  (unless (eq? val unset-field)
+      (serialize-field* field-name (string-join val ","))))
+
+(define (comma-separated-string-list? val)
+  (and (list? val)
+       (and-map (lambda (x)
+                  (and (string? x) (not (string-index x #\,))))
+                val)))
+
+(define comma-separated-string-list/unset?
+  (predicate/unset comma-separated-string-list?))
+
 (define comma-separated-integer-list/unset?
   (predicate/unset (lambda (val)
                      (and (list? val)
@@ -199,6 +212,13 @@ (define-configuration krb5-realm
    (string/unset unset-field)
    "The server where password changes are performed.")
 
+  (default-principal-flags
+   (comma-separated-string-list/unset unset-field)
+   "Specifies the default attributes of principals created in this realm.  The
+format for this string is a list of strings, with '+' before each flag that
+should be enabled and '-' before each flag that should be disabled.  See the
+manual page for details on available flags.")
+
   (auth-to-local
    (free-form-fields '())
    "Rules to map between principals and local users.")
-- 
2.48.1