Sure... but no more than any web browser that do exactly the same afaik.Wouldn't it be a security risk?
Code: Select all
// .........................................................
// In the function that pops the http auth dialog box
String httpUsername = HttpCredential.getLastUsedUsername();
String httpPassword = HttpCredential.getLastUsedPassword();
if(httpUsername == null && httpPassword == null){
// ... whatever you do now
}
// ...............................................
// in HttpCredential.cpp
class httpCredential{
private static String username = null;
private static String password = null;
public static HttpCredential::getLastUsedName(){
return this.username;
}
public static HttpCredential::getLastUsedPassword(){
return this.password;
}
}
Code: Select all
index 9817bca..a8414b7 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -192,6 +192,13 @@ struct access_sys_t
vlc_array_t * cookies;
};
+
+char *psz_cached_http_user = NULL;
+char *psz_cached_http_password = NULL;
+
+
+
+
/* */
static int OpenWithCookies( vlc_object_t *p_this, const char *psz_access,
unsigned i_redirect, vlc_array_t *cookies );
@@ -534,6 +541,20 @@ connect:
Disconnect( p_access );
goto connect;
}
+
+
+ if (psz_cached_http_user && psz_cached_http_password) {
+
+ p_sys->url.psz_username = strdup(psz_cached_http_user);
+ free(psz_cached_http_user);
+ psz_cached_http_user = NULL;
+ p_sys->url.psz_password = strdup(psz_cached_http_password);
+ free(psz_cached_http_password);
+ psz_cached_http_password = NULL;
+ Disconnect(p_access);
+ goto connect;
+ }
+
msg_Dbg( p_access, "authentication failed for realm %s",
p_sys->auth.psz_realm );
dialog_Login( p_access, &psz_login, &psz_password,
@@ -556,6 +577,18 @@ connect:
}
}
+
+ /* Succesful authentication => remember user/password if any */
+ if (p_sys->url.psz_username) {
+
+ psz_cached_http_user = strdup(p_sys->url.psz_username);
+ }
+
+ if (p_sys->url.psz_password) {
+
+ psz_cached_http_password = strdup(p_sys->url.psz_password);
+ }
+
if( ( p_sys->i_code == 301 || p_sys->i_code == 302 ||
p_sys->i_code == 303 || p_sys->i_code == 307 ) &&
p_sys->psz_location && *p_sys->psz_location )
why would it be ? could you explain why this might be a securityWouldn't it be a security risk?
Return to “VLC media player Feature Requests”
Users browsing this forum: No registered users and 11 guests