Skip to content

Commit 032204e

Browse files
Update dependency curl/curl to v8_15_0 (#111)
* Update dependency curl/curl to v8_15_0 * 修正(stns.c, stns.h): curlオプションの型をintからlongに変更 理由: curl_easy_setoptの引数としてlong型が必要なため、型を修正して 警告を防止し、コードの安定性を向上させるため。 * 修正(stns.c): long型フィールドの読み込みを一時的なint変数を使用して修正 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Kazuhiko Yamashita <[email protected]>
1 parent 298f199 commit 032204e

File tree

3 files changed

+36
-12
lines changed

3 files changed

+36
-12
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ BINSYMDIR=$(PREFIX)/local/bin/
1717

1818
CRITERION_VERSION=2.4.2
1919
SHUNIT_VERSION=2.1.8
20-
CURL_VERSION_TAG=8_12_1
20+
CURL_VERSION_TAG=8_15_0
2121
CURL_VERSION=$(shell echo $(CURL_VERSION_TAG) | sed -e 's/_/./g')
2222
OPENSSL_VERSION=3.6.0
2323
ZLIB_VERSION=1.3.1

stns.c

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,36 @@ int stns_load_config(char *filename, stns_conf_t *c)
9999
GET_TOML_BYKEY(gid_shift, toml_rtoi, 0, TOML_NULL_OR_INT);
100100
GET_TOML_BYKEY(cache_ttl, toml_rtoi, 600, TOML_NULL_OR_INT);
101101
GET_TOML_BYKEY(negative_cache_ttl, toml_rtoi, 10, TOML_NULL_OR_INT);
102-
GET_TOML_BYKEY(ssl_verify, toml_rtob, 1, TOML_NULL_OR_INT);
102+
103+
// Load long type fields via temporary int variables
104+
int tmp_ssl_verify = 1;
105+
int tmp_request_timeout = 10;
106+
int tmp_http_location = 0;
107+
108+
if (0 != (raw = toml_raw_in(tab, "ssl_verify"))) {
109+
if (0 != toml_rtob(raw, &tmp_ssl_verify)) {
110+
syslog(LOG_ERR, "%s(stns)[L%d] cannot parse toml file:%s key:ssl_verify", __func__, __LINE__, filename);
111+
}
112+
}
113+
c->ssl_verify = (long)tmp_ssl_verify;
114+
115+
if (0 != (raw = toml_raw_in(tab, "request_timeout"))) {
116+
if (0 != toml_rtoi(raw, &tmp_request_timeout)) {
117+
syslog(LOG_ERR, "%s(stns)[L%d] cannot parse toml file:%s key:request_timeout", __func__, __LINE__, filename);
118+
}
119+
}
120+
c->request_timeout = (long)tmp_request_timeout;
121+
122+
if (0 != (raw = toml_raw_in(tab, "http_location"))) {
123+
if (0 != toml_rtob(raw, &tmp_http_location)) {
124+
syslog(LOG_ERR, "%s(stns)[L%d] cannot parse toml file:%s key:http_location", __func__, __LINE__, filename);
125+
}
126+
}
127+
c->http_location = (long)tmp_http_location;
128+
103129
GET_TOML_BYKEY(cache, toml_rtob, 1, TOML_NULL_OR_INT);
104-
GET_TOML_BYKEY(request_timeout, toml_rtoi, 10, TOML_NULL_OR_INT);
105130
GET_TOML_BYKEY(request_retry, toml_rtoi, 3, TOML_NULL_OR_INT);
106131
GET_TOML_BYKEY(request_locktime, toml_rtoi, 60, TOML_NULL_OR_INT);
107-
GET_TOML_BYKEY(http_location, toml_rtob, 0, TOML_NULL_OR_INT);
108132

109133
TRIM_SLASH(api_endpoint)
110134
TRIM_SLASH(cache_dir)
@@ -314,8 +338,8 @@ static CURLcode inner_http_request(stns_conf_t *c, char *path, stns_response_t *
314338
}
315339
}
316340
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
317-
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, c->ssl_verify);
318-
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, c->ssl_verify);
341+
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, (long)c->ssl_verify);
342+
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, (long)c->ssl_verify);
319343
curl_easy_setopt(curl, CURLOPT_USERAGENT, STNS_VERSION_WITH_NAME);
320344
if (c->http_location == 1) {
321345
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
@@ -347,13 +371,13 @@ static CURLcode inner_http_request(stns_conf_t *c, char *path, stns_response_t *
347371
"http://unix", path);
348372
}
349373
curl_easy_setopt(curl, CURLOPT_URL, url);
350-
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1);
351-
curl_easy_setopt(curl, CURLOPT_TIMEOUT, c->request_timeout);
374+
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);
375+
curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)c->request_timeout);
352376
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, response_callback);
353377
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, header_callback);
354378
curl_easy_setopt(curl, CURLOPT_WRITEDATA, res);
355379
curl_easy_setopt(curl, CURLOPT_HEADERDATA, c);
356-
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
380+
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L);
357381

358382
#ifdef DEBUG
359383
syslog(LOG_ERR, "%s(stns)[L%d] before request http request: %s", __func__, __LINE__, url);

stns.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ struct stns_conf_t {
5858
char *query_wrapper;
5959
char *chain_ssh_wrapper;
6060
char *http_proxy;
61-
int http_location;
61+
long http_location;
6262
char *cache_dir;
6363
char *tls_cert;
6464
char *tls_key;
@@ -68,9 +68,9 @@ struct stns_conf_t {
6868
stns_user_httpheaders_t *http_headers;
6969
int uid_shift;
7070
int gid_shift;
71-
int ssl_verify;
71+
long ssl_verify;
7272
int use_cached;
73-
int request_timeout;
73+
long request_timeout;
7474
int request_retry;
7575
int request_locktime;
7676
int cache;

0 commit comments

Comments
 (0)