diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2019-08-06 11:25:11 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2019-08-06 11:26:47 +0100 |
commit | 8469f4cc8e62e80a3165a1d4f13b62b5b4a04720 (patch) | |
tree | 707b46c3cf0b373b53adf8c54d290e4c546ebb2c /frontends/monkey | |
parent | 9c9c26a308995c22210c90e3772e86f49a1948b9 (diff) | |
download | netsurf-8469f4cc8e62e80a3165a1d4f13b62b5b4a04720.tar.gz netsurf-8469f4cc8e62e80a3165a1d4f13b62b5b4a04720.tar.bz2 |
Reimplement handling of BAD_AUTH inside browser_window
We now handle authentication requests via an `about:` page
which presents a nice form built into the browser window.
In order to do this, we add internal navigation as a concept
to the browser window and we strip the 401login support from all
frontends except monkey.
The 401login callback is now intended for password safe type support
rather than an immediately interactive prompt.
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'frontends/monkey')
-rw-r--r-- | frontends/monkey/401login.c | 20 | ||||
-rw-r--r-- | frontends/monkey/401login.h | 4 |
2 files changed, 18 insertions, 6 deletions
diff --git a/frontends/monkey/401login.c b/frontends/monkey/401login.c index b9e75bf8f..1629425f6 100644 --- a/frontends/monkey/401login.c +++ b/frontends/monkey/401login.c @@ -30,10 +30,12 @@ struct monkey401 { struct monkey401 *r_next, *r_prev; uint32_t num; - nserror (*cb)(const char *, const char *, void *); + nserror (*cb)(struct nsurl*, const char *, const char *, const char *, void *); void *cbpw; char *username; char *password; + char *realm; + struct nsurl *url; }; static struct monkey401 *m401_ring = NULL; @@ -45,7 +47,9 @@ gui_401login_open(struct nsurl *url, const char *realm, const char *username, const char *password, - nserror (*cb)(const char *username, + nserror (*cb)(struct nsurl *url, + const char *realm, + const char *username, const char *password, void *pw), void *cbpw) @@ -56,6 +60,12 @@ gui_401login_open(struct nsurl *url, if (m401_ctx == NULL) { return NSERROR_NOMEM; } + m401_ctx->realm = strdup(realm); + if (m401_ctx->realm == NULL) { + free(m401_ctx); + return NSERROR_NOMEM; + } + m401_ctx->url = nsurl_ref(url); m401_ctx->cb = cb; m401_ctx->cbpw = cbpw; m401_ctx->num = m401_ctr++; @@ -102,6 +112,8 @@ static void free_login_context(struct monkey401 *m401_ctx) { if (m401_ctx->password != NULL) { free(m401_ctx->password); } + free(m401_ctx->realm); + nsurl_unref(m401_ctx->url); free(m401_ctx); } @@ -121,7 +133,7 @@ monkey_login_handle_go(int argc, char **argv) return; } - m401_ctx->cb(m401_ctx->username, m401_ctx->password, m401_ctx->cbpw); + m401_ctx->cb(m401_ctx->url, m401_ctx->realm, m401_ctx->username, m401_ctx->password, m401_ctx->cbpw); free_login_context(m401_ctx); } @@ -142,8 +154,6 @@ monkey_login_handle_destroy(int argc, char **argv) return; } - m401_ctx->cb(NULL, NULL, m401_ctx->cbpw); - free_login_context(m401_ctx); } diff --git a/frontends/monkey/401login.h b/frontends/monkey/401login.h index 9ebe46a62..45a2a1b52 100644 --- a/frontends/monkey/401login.h +++ b/frontends/monkey/401login.h @@ -27,7 +27,9 @@ nserror gui_401login_open(struct nsurl *url, const char *realm, const char *username, const char *password, - nserror (*cb)(const char *username, + nserror (*cb)(struct nsurl *url, + const char *realm, + const char *username, const char *password, void *pw), void *cbpw); |