mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 04:26:50 +03:00
Fix issues with authentication storage/lookup in database
svn path=/trunk/netsurf/; revision=2527
This commit is contained in:
parent
d453fa3206
commit
1b48febd2f
@ -838,7 +838,7 @@ const struct url_data *urldb_get_url_data(const char *url)
|
||||
*/
|
||||
const char *urldb_get_auth_details(const char *url)
|
||||
{
|
||||
struct path_data *p, *q;
|
||||
struct path_data *p, *q = NULL;
|
||||
|
||||
assert(url);
|
||||
|
||||
@ -849,6 +849,11 @@ const char *urldb_get_auth_details(const char *url)
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
/* Check for any auth details attached to this node */
|
||||
if (p && p->auth.realm && p->auth.auth)
|
||||
return p->auth.auth;
|
||||
|
||||
/* Now consider ancestors */
|
||||
for (; p; p = p->parent) {
|
||||
/* The parent path entry is stored hung off the
|
||||
* parent entry with an empty (not NULL) segment string.
|
||||
@ -906,14 +911,27 @@ void urldb_set_auth_details(const char *url, const char *realm,
|
||||
const char *auth)
|
||||
{
|
||||
struct path_data *p;
|
||||
char *t1, *t2;
|
||||
char *urlt, *t1, *t2;
|
||||
|
||||
assert(url && realm && auth);
|
||||
|
||||
/* add url, in case it's missing */
|
||||
urldb_add_url(url);
|
||||
urlt = strdup(url);
|
||||
if (!urlt)
|
||||
return;
|
||||
|
||||
/* strip leafname from URL */
|
||||
t1 = strrchr(urlt, '/');
|
||||
if (t1) {
|
||||
*(t1 + 1) = '\0';
|
||||
}
|
||||
|
||||
/* add url, in case it's missing */
|
||||
urldb_add_url(urlt);
|
||||
|
||||
p = urldb_find_url(urlt);
|
||||
|
||||
free(urlt);
|
||||
|
||||
p = urldb_find_url(url);
|
||||
if (!p)
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user