[vlc-commits] keychain: store the realm

Thomas Guillem git at videolan.org
Thu Nov 14 15:24:05 CET 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Oct 31 15:31:54 2019 +0100| [0a2a6496704e0d5efe0f3b9b501106d931ea4c75] | committer: Thomas Guillem

keychain: store the realm

Used for SMB domains.

Needed for the test_modules_keystore success.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0a2a6496704e0d5efe0f3b9b501106d931ea4c75
---

 modules/keystore/keychain.m | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/modules/keystore/keychain.m b/modules/keystore/keychain.m
index dde0723745..e788755b0c 100644
--- a/modules/keystore/keychain.m
+++ b/modules/keystore/keychain.m
@@ -229,6 +229,7 @@ static int SetAttributesForQuery(const char *const ppsz_values[KEY_MAX], NSMutab
     const char *psz_server = ppsz_values[KEY_SERVER];
     const char *psz_path = ppsz_values[KEY_PATH];
     const char *psz_port = ppsz_values[KEY_PORT];
+    const char *psz_realm = ppsz_values[KEY_REALM];
 
     if (psz_label) {
         [query setObject:[NSString stringWithUTF8String:psz_label] forKey:(__bridge id)kSecAttrLabel];
@@ -264,6 +265,9 @@ static int SetAttributesForQuery(const char *const ppsz_values[KEY_MAX], NSMutab
     if (psz_port) {
         [query setObject:[NSNumber numberWithInt:atoi(psz_port)] forKey:(__bridge id)kSecAttrPort];
     }
+    if (psz_realm) {
+        [query setObject:[NSString stringWithUTF8String:psz_realm] forKey:(__bridge id)kSecAttrSecurityDomain];
+    }
 
     return VLC_SUCCESS;
 }
@@ -310,6 +314,14 @@ static int FillEntryValues(const NSDictionary *item, char *ppsz_values[KEY_MAX])
             return VLC_ENOMEM;
     }
 
+    NSString *realm = [item objectForKey:(__bridge id)kSecAttrSecurityDomain];
+    if (realm)
+    {
+        ppsz_values[KEY_REALM] = strdup([realm UTF8String]);
+        if (!ppsz_values[KEY_REALM])
+            return VLC_ENOMEM;
+    }
+
     return VLC_SUCCESS;
 }
 



More information about the vlc-commits mailing list