From 57bb4f20c1cf737b49eac2a8be108a9ffbde60ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Tue, 24 Sep 2019 23:07:24 +0800 Subject: Initialisation takes CA certificates file path --- client.c | 4 +++- icclient/client.h | 2 +- main.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client.c b/client.c index 2d315ab..608b7e5 100644 --- a/client.c +++ b/client.c @@ -6,13 +6,15 @@ CURL *curl = NULL; char *server_url = NULL; -bool icclient_init(const char *url) +bool icclient_init(const char *url, const char *certificate) { curl_global_init(CURL_GLOBAL_SSL); curl = curl_easy_init(); if (curl) { curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl, CURLOPT_COOKIEFILE, ""); + if (certificate) + curl_easy_setopt(curl, CURLOPT_CAINFO, certificate); #ifdef DEBUG curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); #endif diff --git a/icclient/client.h b/icclient/client.h index bea8b51..53d5d77 100644 --- a/icclient/client.h +++ b/icclient/client.h @@ -5,7 +5,7 @@ extern "C" { #endif - bool icclient_init(const char *url); + bool icclient_init(const char *url, const char *certificate); void icclient_login(const char *username, const char *password , const char *successpage, const char *nextpage , const char *failpage); diff --git a/main.c b/main.c index 1a26c95..2cad4f3 100644 --- a/main.c +++ b/main.c @@ -24,7 +24,7 @@ int main(void) strncpy(pass, pass_line, pass_nread); free(pass_line); - icclient_init(url); + icclient_init(url, NULL); free(url); icclient_admin_login(name, pass, NULL, NULL, NULL); -- cgit v1.2.3