diff options
author | John Tytgat <joty@netsurf-browser.org> | 2009-08-04 23:02:23 +0000 |
---|---|---|
committer | John Tytgat <joty@netsurf-browser.org> | 2009-08-04 23:02:23 +0000 |
commit | 2261b616f61e6701b381d6e363e14431f321f843 (patch) | |
tree | f80512b595b5a9dbc84e25102270b23a724bd103 /riscos/401login.c | |
parent | 83acae8e1f41b59e32700944b996ae1e4509c07b (diff) | |
download | netsurf-2261b616f61e6701b381d6e363e14431f321f843.tar.gz netsurf-2261b616f61e6701b381d6e363e14431f321f843.tar.bz2 |
- content/urldb.c(auth_data): Removed;
(prot_space_data): Added, it lives linked in the leaf host_part
struct and together with its scheme and port (which defins canonical root
url) and realm this defines a protection space.
(path_data): Removed auth_data field and replaced by a prot_space_data
pointer.
(host_part::prot_space): Added linked list of protection space data
structs.
(urldb_get_auth_details): Given an URL fetch fetches its auth.
(urldb_set_auth_details): Creates or updates the contents of a
protection space to which given URL belongs.
(urldb_destroy_host_tree): Delete protection data space structures
using urldb_destroy_prot_space.
(urldb_destroy_prot_space): Added.
- content/urldb.h(urldb_get_auth_details): Added realm parameter.
- content/fetchers/fetch_curl.c(fetch_curl_set_options): Update
urldb_get_auth_details call (we don't know realm at this point).
- content/fetchcache.c(fetchcache_callback, fetchcache_auth): At FETCH_AUTH,
use realm to determine if we really don't know auth data and if so,
refetch content.
- content/content.h(struct content): Add content::tried_with_auth.
- content/content.c(content_create): Initialize content::tried_with_auth.
- riscos/401login.c(ro_gui_401login_open): Show known authentication
data in dialogue so user can see what was wrong with it and correct it.
Solves bug #2830829.
svn path=/trunk/netsurf/; revision=9045
Diffstat (limited to 'riscos/401login.c')
-rw-r--r-- | riscos/401login.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/riscos/401login.c b/riscos/401login.c index ac3ebe35c..e75fe022c 100644 --- a/riscos/401login.c +++ b/riscos/401login.c @@ -98,6 +98,7 @@ void ro_gui_401login_open(struct browser_window *bw, const char *host, { struct session_401 *session; wimp_w w; + const char *auth; session = calloc(1, sizeof(struct session_401)); if (!session) { @@ -111,10 +112,28 @@ void ro_gui_401login_open(struct browser_window *bw, const char *host, warn_user("NoMemory", 0); return; } - session->uname[0] = '\0'; - session->pwd[0] = '\0'; + if (realm == NULL) + realm = "Secure Area"; + auth = urldb_get_auth_details(session->url, realm); + if (auth == NULL) { + session->uname[0] = '\0'; + session->pwd[0] = '\0'; + } else { + const char *pwd; + size_t pwd_len; + + pwd = strchr(auth, ':'); + assert(pwd && pwd < auth + sizeof(session->uname)); + memcpy(session->uname, auth, pwd - auth); + session->uname[pwd - auth] = '\0'; + ++pwd; + pwd_len = strlen(pwd); + assert(pwd_len < sizeof(session->pwd)); + memcpy(session->pwd, pwd, pwd_len); + session->pwd[pwd_len] = '\0'; + } session->host = strdup(host); - session->realm = strdup(realm ? realm : "Secure Area"); + session->realm = strdup(realm); session->bwin = bw; if ((!session->host) || (!session->realm)) { free(session->host); |