1
0
mirror of https://github.com/kakwa/uts-server synced 2024-06-03 09:38:07 +02:00

change ts app code to read query from memory

This commit is contained in:
kakwa 2016-08-23 20:12:09 +02:00
parent 7c45a71f22
commit fb068a341e

View File

@ -26,13 +26,13 @@ static CONF *load_config_file(const char *configfile);
/* Reply related functions. */ /* Reply related functions. */
static int reply_command(CONF *conf, char *section, char *engine, static int reply_command(CONF *conf, char *section, char *engine,
char *queryfile, char *passin, char *inkey, char *query, char *passin, char *inkey,
const EVP_MD *md, char *signer, char *chain, const EVP_MD *md, char *signer, char *chain,
const char *policy, char *in, int token_in, char *out, const char *policy, char *in, int token_in, char *out,
int token_out, int text); int token_out, int text);
static TS_RESP *read_PKCS7(BIO *in_bio); static TS_RESP *read_PKCS7(BIO *in_bio);
static TS_RESP *create_response(CONF *conf, const char *section, char *engine, static TS_RESP *create_response(CONF *conf, const char *section, char *engine,
char *queryfile, char *passin, char *inkey, char *query, char *passin, char *inkey,
const EVP_MD *md, char *signer, char *chain, const EVP_MD *md, char *signer, char *chain,
const char *policy); const char *policy);
static ASN1_INTEGER *serial_cb(TS_RESP_CTX *ctx, void *data); static ASN1_INTEGER *serial_cb(TS_RESP_CTX *ctx, void *data);
@ -159,7 +159,7 @@ static ASN1_OBJECT *txt2obj(const char *oid) {
*/ */
static int reply_command(CONF *conf, char *section, char *engine, static int reply_command(CONF *conf, char *section, char *engine,
char *queryfile, char *passin, char *inkey, char *query, char *passin, char *inkey,
const EVP_MD *md, char *signer, char *chain, const EVP_MD *md, char *signer, char *chain,
const char *policy, char *in, int token_in, char *out, const char *policy, char *in, int token_in, char *out,
int token_out, int text) { int token_out, int text) {
@ -181,7 +181,7 @@ static int reply_command(CONF *conf, char *section, char *engine,
response = d2i_TS_RESP_bio(in_bio, NULL); response = d2i_TS_RESP_bio(in_bio, NULL);
} }
} else { } else {
response = create_response(conf, section, engine, queryfile, passin, response = create_response(conf, section, engine, query, passin,
inkey, md, signer, chain, policy); inkey, md, signer, chain, policy);
// if (response) // if (response)
// BIO_printf(bio_err, "Response has been // BIO_printf(bio_err, "Response has been
@ -270,7 +270,7 @@ end:
} }
static TS_RESP *create_response(CONF *conf, const char *section, char *engine, static TS_RESP *create_response(CONF *conf, const char *section, char *engine,
char *queryfile, char *passin, char *inkey, char *query, char *passin, char *inkey,
const EVP_MD *md, char *signer, char *chain, const EVP_MD *md, char *signer, char *chain,
const char *policy) { const char *policy) {
int ret = 0; int ret = 0;
@ -278,7 +278,7 @@ static TS_RESP *create_response(CONF *conf, const char *section, char *engine,
BIO *query_bio = NULL; BIO *query_bio = NULL;
TS_RESP_CTX *resp_ctx = NULL; TS_RESP_CTX *resp_ctx = NULL;
if ((query_bio = BIO_new_file(queryfile, "rb")) == NULL) if ((query_bio = BIO_new_mem_buf(query, -1)) == NULL)
goto end; goto end;
if ((section = TS_CONF_get_tsa_section(conf, section)) == NULL) if ((section = TS_CONF_get_tsa_section(conf, section)) == NULL)
goto end; goto end;