[vlc-devel] [PATCH v3 09/11] smb2: send the logged username

Thomas Guillem thomas at gllm.fr
Mon Dec 21 17:54:34 UTC 2020


---
 modules/access/smb2.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/modules/access/smb2.c b/modules/access/smb2.c
index 65c34a2bd3a..a90064fc2c5 100644
--- a/modules/access/smb2.c
+++ b/modules/access/smb2.c
@@ -87,6 +87,7 @@ struct access_sys
     bool                    eof;
     bool                    smb2_connected;
     int                     error_status;
+    char                    *username;
 
     bool res_done;
     union {
@@ -380,6 +381,8 @@ DirRead(stream_t *access, input_item_node_t *p_node)
     int ret = VLC_SUCCESS;
     assert(sys->smb2dir);
 
+    input_item_node_SetLoggedUser(p_node, sys->username);
+
     struct vlc_readdir_helper rdh;
     vlc_readdir_helper_init(&rdh, access, p_node);
 
@@ -716,7 +719,11 @@ Open(vlc_object_t *p_obj)
     free(resolved_host);
     free(url);
     if (ret == 0)
+    {
+        sys->username = strdup(credential.psz_username != NULL ?
+                               credential.psz_username : N_("Guest"));
         vlc_credential_store(&credential, access);
+    }
     vlc_credential_clean(&credential);
 
     if (ret != 0)
@@ -790,5 +797,6 @@ Close(vlc_object_t *p_obj)
     vlc_smb2_disconnect_share(access);
     smb2_destroy_context(sys->smb2);
 
+    free(sys->username);
     vlc_UrlClean(&sys->encoded_url);
 }
-- 
2.29.2



More information about the vlc-devel mailing list