From: Andreas Schneider Date: Mon, 9 Feb 2026 10:00:45 +0000 (+0100) Subject: s3:winbind: Also support %{uid} substitution for krb5_ccache_type X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b2b276041389c8abc6c0477900e8b08e3233ff6d;p=thirdparty%2Fsamba.git s3:winbind: Also support %{uid} substitution for krb5_ccache_type Pair-Programmed-With: Pavel Filipenský Signed-off-by: Pavel Filipenský Signed-off-by: Andreas Schneider Reviewed-by: Alexander Bokovoy --- diff --git a/docs-xml/manpages/pam_winbind.conf.5.xml b/docs-xml/manpages/pam_winbind.conf.5.xml index b87c210c13c..58419e89384 100644 --- a/docs-xml/manpages/pam_winbind.conf.5.xml +++ b/docs-xml/manpages/pam_winbind.conf.5.xml @@ -157,8 +157,8 @@ DIR:/path, FILE:/path, and WRFILE:/path. - You can use the %u pattern to substitute the - numeric user ID. Examples: + You can use the %u or %{uid} pattern to + substitute the numeric user ID. Examples: diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c index 050d8655845..68ffebe7e16 100644 --- a/source3/winbindd/winbindd_pam.c +++ b/source3/winbindd/winbindd_pam.c @@ -649,16 +649,25 @@ static bool generate_krb5_ccache(TALLOC_CTX *mem_ctx, } } - /* Handle types with explicit paths and %u substitution */ + /* Handle types with explicit paths and %u or %{uid} substitution */ if (has_prefix) { char *p; + const char *subst_pattern = NULL; p = strchr(type, '%'); if (p != NULL) { p++; - /* We support only one "%u" substitution */ + /* We support "%u" or "%{uid}" substitution */ if (p != NULL && *p == 'u' && strchr(p, '%') == NULL) { + subst_pattern = "%u"; + } else if (p != NULL && + strncmp(p, "{uid}", 5) == 0 && + strchr(p + 5, '%') == NULL) { + subst_pattern = "%{uid}"; + } + + if (subst_pattern != NULL) { char uid_str[sizeof("18446744073709551615")]; int rc; @@ -678,7 +687,7 @@ static bool generate_krb5_ccache(TALLOC_CTX *mem_ctx, gen_cc = talloc_string_sub2( mem_ctx, type, - "%u", + subst_pattern, uid_str, false, /* remove_unsafe_characters */ true, /* replace_once */