]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
auth:creds: Also uppercase realm set via a callback
authorAndreas Schneider <asn@samba.org>
Thu, 7 Aug 2025 11:32:47 +0000 (13:32 +0200)
committerJule Anger <janger@samba.org>
Thu, 28 Aug 2025 09:38:21 +0000 (09:38 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15893

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
(cherry picked from commit 4f8ff3a567d6318c71b0960345592224721c9594)

auth/credentials/credentials.c

index 5588a355c744630449aed3049f9051fa9002055d..a558aada67c18c0f67c7f50931e0bb4f1cc584eb 100644 (file)
@@ -912,9 +912,20 @@ _PUBLIC_ const char *cli_credentials_get_realm(struct cli_credentials *cred)
 
        if (cred->realm_obtained == CRED_CALLBACK &&
            !cred->callback_running) {
+               const char *realm = NULL;
+
                cred->callback_running = true;
-               cred->realm = cred->realm_cb(cred);
+               realm = cred->realm_cb(cred);
                cred->callback_running = false;
+
+               cred->realm = NULL;
+               if (realm != NULL) {
+                       cred->realm = strupper_talloc(cred, realm);
+                       if (cred->realm == NULL) {
+                               return NULL;
+                       }
+               }
+
                if (cred->realm_obtained == CRED_CALLBACK) {
                        cred->realm_obtained = CRED_CALLBACK_RESULT;
                        cli_credentials_invalidate_ccache(cred, cred->realm_obtained);