summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2017-02-24 16:22:33 +0000
committerjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2017-02-24 16:22:33 +0000
commit917d6e4981d1f7c1bfa241268a7dc8c15bee259b (patch)
tree74a28cce249fb6a2a654e262f3e4be68961c9228
parent7934be2602145f8112e46bf45d510fa6f7eeef01 (diff)
downloadneon-917d6e4981d1f7c1bfa241268a7dc8c15bee259b.tar.gz
* test/auth.c (struct digest_parms, make_digest): Prepare for non-MD5
algorithms. git-svn-id: http://svn.webdav.org/repos/projects/neon/trunk@1993 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845
-rw-r--r--test/auth.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/test/auth.c b/test/auth.c
index 050b046..23c53a5 100644
--- a/test/auth.c
+++ b/test/auth.c
@@ -376,7 +376,7 @@ struct digest_parms {
const char *realm, *nonce, *opaque, *domain;
int rfc2617;
int send_ainfo;
- int md5_sess;
+ enum { ALG_MD5 = 0, ALG_MD5_SESS = 1, ALG_SHA256 = 2 } alg;
int proxy;
int send_nextnonce;
int num_requests;
@@ -426,7 +426,7 @@ static void make_digest(struct digest_state *state, struct digest_parms *parms,
ne_md5_process_bytes(state->password, strlen(state->password), ctx);
ne_md5_finish_ascii(ctx, h_a1);
- if (parms->md5_sess) {
+ if (parms->alg == ALG_MD5_SESS) {
ne_md5_reset_ctx(ctx);
ne_md5_process_bytes(h_a1, 32, ctx);
ne_md5_process_bytes(":", 1, ctx);
@@ -692,7 +692,12 @@ static int serve_digest(ne_socket *sock, void *userdata)
state.username = username;
state.password = password;
state.nc = 1;
- state.algorithm = parms->md5_sess ? "MD5-sess" : "MD5";
+ switch (parms->alg) {
+ case ALG_SHA256: state.algorithm = "SHA-256"; break;
+ case ALG_MD5_SESS: state.algorithm = "MD5-sess"; break;
+ default:
+ case ALG_MD5: state.algorithm = "MD5"; break;
+ }
state.qop = "auth";
state.cnonce = state.digest = state.ncval = NULL;
@@ -838,6 +843,11 @@ static int digest(void)
/* Proxy + A-I */
{ "WallyWorld", "this-is-also-a-nonce", "opaque-string", NULL, 1, 1, 0, 1, 0, 1, 0, fail_not },
+#if 0
+ /* RFC 6717. */
+ { "WallyWorld", "nonce-sha-nonce", "opaque-string", NULL, 1, 1, ALG_SHA256, 0, 0, 1, 0, fail_not },
+#endif
+
{ NULL }
};
size_t n;