-struct _auth_obj verify_authobj(const char *userid, const char *password,
- const char *oldnonce, const char *newnonce,
- const unsigned char *authobj, const int authsize)
-{
- struct _auth_obj old_ao;
- struct _auth_obj new_ao = {0};
- struct _hash_obj ho_chal, ho_key;
-
- ho_chal = make_challenge(userid, password, oldnonce);
- if (ho_chal.err) {
- new_ao.err = ho_chal.err;
- return new_ao;
- }
- ho_key = fetch_key(ho_chal.hash, sizeof(ho_chal.hash));
- memset(&ho_chal, 0, sizeof(ho_chal));
- if (ho_key.err) {
- new_ao.err = ho_key.err;
- return new_ao;
- }
- old_ao = parse_authobj(ho_key.hash, sizeof(ho_key.hash),
- authobj, authsize);
- memset(&ho_key, 0, sizeof(ho_key));
- if (old_ao.err) {
- new_ao.err = old_ao.err;
- if (old_ao.buffer) free(old_ao.buffer);
- return new_ao;
- }