diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2013-08-25 15:37:26 +0200 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2013-08-25 15:37:26 +0200 |
commit | 6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349 (patch) | |
tree | 009fc492961e13860d2a4bc2de8caf2bbe2975e7 /src/scepclient/scep.c | |
parent | c83921a2b566aa9d55d8ccc7258f04fca6292ee6 (diff) | |
download | vyos-strongswan-6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349.tar.gz vyos-strongswan-6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349.zip |
Imported Upstream version 5.1.0
Diffstat (limited to 'src/scepclient/scep.c')
-rw-r--r-- | src/scepclient/scep.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/scepclient/scep.c b/src/scepclient/scep.c index 3fdcd6c28..5bb29bbd8 100644 --- a/src/scepclient/scep.c +++ b/src/scepclient/scep.c @@ -339,15 +339,22 @@ static char* escape_http_request(chunk_t req) * Send a SCEP request via HTTP and wait for a response */ bool scep_http_request(const char *url, chunk_t msg, scep_op_t op, - bool http_get_request, u_int timeout, chunk_t *response) + bool http_get_request, u_int timeout, char *src, + chunk_t *response) { int len; status_t status; char *complete_url = NULL; + host_t *srcip = NULL; /* initialize response */ *response = chunk_empty; + if (src) + { + srcip = host_create_from_string(src, 0); + } + DBG2(DBG_APP, "sending scep request to '%s'", url); if (op == SCEP_PKI_OPERATION) @@ -371,6 +378,7 @@ bool scep_http_request(const char *url, chunk_t msg, scep_op_t op, FETCH_REQUEST_HEADER, "Pragma:", FETCH_REQUEST_HEADER, "Host:", FETCH_REQUEST_HEADER, "Accept:", + FETCH_SOURCEIP, srcip, FETCH_END); } else /* HTTP_POST */ @@ -386,6 +394,7 @@ bool scep_http_request(const char *url, chunk_t msg, scep_op_t op, FETCH_REQUEST_DATA, msg, FETCH_REQUEST_TYPE, "", FETCH_REQUEST_HEADER, "Expect:", + FETCH_SOURCEIP, srcip, FETCH_END); } } @@ -412,9 +421,11 @@ bool scep_http_request(const char *url, chunk_t msg, scep_op_t op, status = lib->fetcher->fetch(lib->fetcher, complete_url, response, FETCH_HTTP_VERSION_1_0, FETCH_TIMEOUT, timeout, + FETCH_SOURCEIP, srcip, FETCH_END); } + DESTROY_IF(srcip); free(complete_url); return (status == SUCCESS); } |