/* XXX: Something blew up, assume no such ID */
status = "NO_SUCH_CLIENT";
send_response(conn, NULL, status, NULL, timestamp);
- /* XXX free memory */
- return MHD_YES;
+ goto free_mem;
}
if (otp == NULL) {
signature = sign_request(shared_secret, shared_secret_len,
info, status, timestamp);
send_response(conn, signature, status, NULL, timestamp);
- /* XXX free memory */
- return MHD_YES;
+ goto free_mem;
}
if (! yubikey_modhex_p(otp)) {
signature = sign_request(shared_secret, shared_secret_len,
NULL, status, timestamp);
send_response(conn, signature, status, NULL, timestamp);
- /* XXX free memory */
- return MHD_YES;
+ goto free_mem;
}
/* XXX: If h exists, verify. FIXME */
NULL, status, timestamp);
send_response(conn, signature, status, NULL, timestamp);
- /* XXX FIXME free memory */
- fprintf(stderr, "BAD TOKEN\n");
+ goto free_mem;
return MHD_YES;
}
if (yubikey_counter(token.ctr) < stats.session_counter ||
signature = sign_request(shared_secret, shared_secret_len,
NULL, status, timestamp);
send_response(conn, signature, status, NULL, timestamp);
- /* XXX FIXME free memory */
fprintf(stderr, "replay\n");
- return MHD_YES;
+ goto free_mem;
}
/* Update status, if appropriate */
+ free(stats.public_id);
+ free(stats.secret_uid);
+ free(stats.secret_key);
memset(&stats, 0, sizeof(struct ykc_stats));
stats.session_counter = yubikey_counter(token.ctr);
stats.session_use = token.use;
signature = sign_request(shared_secret, shared_secret_len,
NULL, status, timestamp);
send_response(conn, signature, status, NULL, timestamp);
+free_mem:
+ free(timestamp);
+ free(shared_secret);
+ free(signature);
+ free(stats.public_id);
+ free(stats.secret_uid);
+ free(stats.secret_key);
+ free(uid);
+ free(otp_token);
return MHD_YES;
}