mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-08-08 09:21:48 +08:00
Merge branch 'tmp-seclog-trailing-newline' into 'master'
Avoid trailing `\n` in messages passed to logging See merge request openconnect/ocserv!544
This commit is contained in:
+2
-2
@@ -67,7 +67,7 @@ static void print_gss_err(const char *where, gss_OID mech, OM_uint32 err_maj,
|
||||
mech, &msg_ctx, &status);
|
||||
if (GSS_ERROR(major))
|
||||
break;
|
||||
oc_syslog(LOG_ERR, "gssapi: %s[maj]: %s\n", where,
|
||||
oc_syslog(LOG_ERR, "gssapi: %s[maj]: %s", where,
|
||||
(char *)status.value);
|
||||
gss_release_buffer(&minor, &status);
|
||||
} while (msg_ctx);
|
||||
@@ -78,7 +78,7 @@ static void print_gss_err(const char *where, gss_OID mech, OM_uint32 err_maj,
|
||||
mech, &msg_ctx, &status);
|
||||
if (GSS_ERROR(major))
|
||||
break;
|
||||
oc_syslog(LOG_ERR, "gssapi: %s[min]: %s\n", where,
|
||||
oc_syslog(LOG_ERR, "gssapi: %s[min]: %s", where,
|
||||
(char *)status.value);
|
||||
gss_release_buffer(&minor, &status);
|
||||
} while (msg_ctx);
|
||||
|
||||
+44
-52
@@ -62,7 +62,7 @@ static void oidc_vhost_init(void **vctx, void *pool, void *additional)
|
||||
|
||||
vc = talloc(pool, struct oidc_vctx_st);
|
||||
if (vc == NULL) {
|
||||
oc_syslog(LOG_ERR, "ocserv-oidc allocation failure!\n");
|
||||
oc_syslog(LOG_ERR, "ocserv-oidc allocation failure!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
vc->config = NULL;
|
||||
@@ -70,14 +70,14 @@ static void oidc_vhost_init(void **vctx, void *pool, void *additional)
|
||||
vc->pool = pool;
|
||||
|
||||
if (config == NULL) {
|
||||
oc_syslog(LOG_ERR, "ocserv-oidc: no configuration passed!\n");
|
||||
oc_syslog(LOG_ERR, "ocserv-oidc: no configuration passed!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
vc->config = json_load_file(config, 0, &err);
|
||||
if (vc->config == NULL) {
|
||||
oc_syslog(LOG_ERR,
|
||||
"ocserv-oidc: failed to load config file: %s\n",
|
||||
"ocserv-oidc: failed to load config file: %s",
|
||||
config);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -85,19 +85,19 @@ static void oidc_vhost_init(void **vctx, void *pool, void *additional)
|
||||
if (!json_object_get(vc->config, "openid_configuration_url")) {
|
||||
oc_syslog(
|
||||
LOG_ERR,
|
||||
"ocserv-oidc: config file missing openid_configuration_url\n");
|
||||
"ocserv-oidc: config file missing openid_configuration_url");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (!json_object_get(vc->config, "required_claims")) {
|
||||
oc_syslog(LOG_ERR,
|
||||
"ocserv-oidc: config file missing required_claims\n");
|
||||
"ocserv-oidc: config file missing required_claims");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (!json_object_get(vc->config, "user_name_claim")) {
|
||||
oc_syslog(LOG_ERR,
|
||||
"ocserv-oidc: config file missing user_name_claim\n");
|
||||
"ocserv-oidc: config file missing user_name_claim");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ static void oidc_vhost_init(void **vctx, void *pool, void *additional)
|
||||
}
|
||||
|
||||
if (!oidc_fetch_oidc_keys(vc)) {
|
||||
oc_syslog(LOG_ERR, "ocserv-oidc: failed to load jwks\n");
|
||||
oc_syslog(LOG_ERR, "ocserv-oidc: failed to load jwks");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ static json_t *oidc_fetch_json_from_uri(void *pool, const char *uri)
|
||||
if (!curl) {
|
||||
oc_syslog(
|
||||
LOG_ERR,
|
||||
"ocserv-oidc: failed to download JSON document: URI %s\n",
|
||||
"ocserv-oidc: failed to download JSON document: URI %s",
|
||||
uri);
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -268,7 +268,7 @@ static json_t *oidc_fetch_json_from_uri(void *pool, const char *uri)
|
||||
if (res != CURLE_OK) {
|
||||
oc_syslog(
|
||||
LOG_ERR,
|
||||
"ocserv-oidc: failed to download JSON document: URI %s, CURLcode %d\n",
|
||||
"ocserv-oidc: failed to download JSON document: URI %s, CURLcode %d",
|
||||
uri, res);
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -278,7 +278,7 @@ static json_t *oidc_fetch_json_from_uri(void *pool, const char *uri)
|
||||
if (res != CURLE_OK) {
|
||||
oc_syslog(
|
||||
LOG_ERR,
|
||||
"ocserv-oidc: failed to download JSON document: URI %s, CURLcode %d\n",
|
||||
"ocserv-oidc: failed to download JSON document: URI %s, CURLcode %d",
|
||||
uri, res);
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -287,7 +287,7 @@ static json_t *oidc_fetch_json_from_uri(void *pool, const char *uri)
|
||||
if (res != CURLE_OK) {
|
||||
oc_syslog(
|
||||
LOG_ERR,
|
||||
"ocserv-oidc: failed to download JSON document: URI %s, CURLcode %d\n",
|
||||
"ocserv-oidc: failed to download JSON document: URI %s, CURLcode %d",
|
||||
uri, res);
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -296,17 +296,16 @@ static json_t *oidc_fetch_json_from_uri(void *pool, const char *uri)
|
||||
if (res != CURLE_OK) {
|
||||
oc_syslog(
|
||||
LOG_ERR,
|
||||
"ocserv-oidc: failed to download JSON document: URI %s, CURLcode %d\n",
|
||||
"ocserv-oidc: failed to download JSON document: URI %s, CURLcode %d",
|
||||
uri, res);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
json = json_loadb(context.buffer, context.offset, 0, &err);
|
||||
if (!json) {
|
||||
oc_syslog(
|
||||
LOG_ERR,
|
||||
"ocserv-oidc: failed to parse JSON document: URI %s\n",
|
||||
uri);
|
||||
oc_syslog(LOG_ERR,
|
||||
"ocserv-oidc: failed to parse JSON document: URI %s",
|
||||
uri);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -338,7 +337,7 @@ static bool oidc_fetch_oidc_keys(oidc_vctx_st *vctx)
|
||||
if (!openid_configuration_url) {
|
||||
oc_syslog(
|
||||
LOG_ERR,
|
||||
"ocserv-oidc: openid_configuration_url missing from config\n");
|
||||
"ocserv-oidc: openid_configuration_url missing from config");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -347,7 +346,7 @@ static bool oidc_fetch_oidc_keys(oidc_vctx_st *vctx)
|
||||
|
||||
if (!oidc_config) {
|
||||
oc_syslog(LOG_ERR,
|
||||
"ocserv-oidc: Unable to fetch config doc from %s\n",
|
||||
"ocserv-oidc: Unable to fetch config doc from %s",
|
||||
json_string_value(openid_configuration_url));
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -356,23 +355,22 @@ static bool oidc_fetch_oidc_keys(oidc_vctx_st *vctx)
|
||||
|
||||
if (!jwks_uri || !json_string_value(jwks_uri)) {
|
||||
oc_syslog(LOG_ERR,
|
||||
"ocserv-oidc: jwks_uri missing from config doc\n");
|
||||
"ocserv-oidc: jwks_uri missing from config doc");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
jwks = oidc_fetch_json_from_uri(vctx->pool,
|
||||
json_string_value(jwks_uri));
|
||||
if (!jwks) {
|
||||
oc_syslog(
|
||||
LOG_ERR,
|
||||
"ocserv-oidc: failed to fetch keys from jwks_uri %s\n",
|
||||
json_string_value(jwks_uri));
|
||||
oc_syslog(LOG_ERR,
|
||||
"ocserv-oidc: failed to fetch keys from jwks_uri %s",
|
||||
json_string_value(jwks_uri));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
array = json_object_get(jwks, "keys");
|
||||
if (array == NULL) {
|
||||
oc_syslog(LOG_ERR, "ocserv-oidc: JWK keys malformed\n");
|
||||
oc_syslog(LOG_ERR, "ocserv-oidc: JWK keys malformed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -381,7 +379,7 @@ static bool oidc_fetch_oidc_keys(oidc_vctx_st *vctx)
|
||||
{
|
||||
json_t *key_kid = json_object_get(value, "kid");
|
||||
|
||||
oc_syslog(LOG_INFO, "ocserv-oidc: fetched new JWK %s\n",
|
||||
oc_syslog(LOG_INFO, "ocserv-oidc: fetched new JWK %s",
|
||||
json_string_value(key_kid));
|
||||
}
|
||||
|
||||
@@ -417,20 +415,17 @@ static bool oidc_verify_lifetime(json_t *token_claims)
|
||||
time_t current_time = time(NULL);
|
||||
|
||||
if (!token_nbf || !json_integer_value(token_nbf)) {
|
||||
oc_syslog(LOG_NOTICE,
|
||||
"ocserv-oidc: Token missing 'nbf' claim\n");
|
||||
oc_syslog(LOG_NOTICE, "ocserv-oidc: Token missing 'nbf' claim");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!token_exp || !json_integer_value(token_exp)) {
|
||||
oc_syslog(LOG_NOTICE,
|
||||
"ocserv-oidc: Token missing 'exp' claim\n");
|
||||
oc_syslog(LOG_NOTICE, "ocserv-oidc: Token missing 'exp' claim");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!token_iat || !json_integer_value(token_iat)) {
|
||||
oc_syslog(LOG_NOTICE,
|
||||
"ocserv-oidc: Token missing 'iat' claim\n");
|
||||
oc_syslog(LOG_NOTICE, "ocserv-oidc: Token missing 'iat' claim");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -439,7 +434,7 @@ static bool oidc_verify_lifetime(json_t *token_claims)
|
||||
json_integer_value(token_exp) < current_time) {
|
||||
oc_syslog(
|
||||
LOG_NOTICE,
|
||||
"ocserv-oidc: Token not within validity period NBF: %lld EXP: %lld Current: %ld\n",
|
||||
"ocserv-oidc: Token not within validity period NBF: %lld EXP: %lld Current: %ld",
|
||||
json_integer_value(token_nbf),
|
||||
json_integer_value(token_exp), current_time);
|
||||
goto cleanup;
|
||||
@@ -469,7 +464,7 @@ static bool oidc_verify_required_claims(json_t *required_claims,
|
||||
if (!json_equal(required_claim_value, token_claim_value)) {
|
||||
oc_syslog(
|
||||
LOG_NOTICE,
|
||||
"ocserv-oidc: Required claim not met. Claim: %s Expected Value: %s\n",
|
||||
"ocserv-oidc: Required claim not met. Claim: %s Expected Value: %s",
|
||||
required_claim_name,
|
||||
json_string_value(required_claim_value));
|
||||
goto cleanup;
|
||||
@@ -492,7 +487,7 @@ static bool oidc_map_user_name(json_t *user_name_claim, json_t *token_claims,
|
||||
token_claims, json_string_value(user_name_claim));
|
||||
if (!token_user_name_claim ||
|
||||
!json_string_value(token_user_name_claim)) {
|
||||
oc_syslog(LOG_NOTICE, "ocserv-oidc: Token missing '%s' claim\n",
|
||||
oc_syslog(LOG_NOTICE, "ocserv-oidc: Token missing '%s' claim",
|
||||
json_string_value(user_name_claim));
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -517,7 +512,7 @@ static json_t *oidc_extract_claims(cjose_jws_t *jws)
|
||||
if (!cjose_jws_get_plaintext(jws, &plain_text, &plain_text_size,
|
||||
&err)) {
|
||||
oc_syslog(LOG_NOTICE,
|
||||
"ocserv-oidc: Failed to get plain text from token\n");
|
||||
"ocserv-oidc: Failed to get plain text from token");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -526,7 +521,7 @@ static json_t *oidc_extract_claims(cjose_jws_t *jws)
|
||||
json_loadb((char *)plain_text, plain_text_size, 0, &json_err);
|
||||
if (!token_claims) {
|
||||
oc_syslog(LOG_NOTICE,
|
||||
"ocserv-oidc: Failed to get claims from token\n");
|
||||
"ocserv-oidc: Failed to get claims from token");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -548,13 +543,13 @@ static bool oidc_verify_signature(oidc_vctx_st *vctx, cjose_jws_t *jws)
|
||||
json_t *value;
|
||||
|
||||
if (vctx->jwks == NULL) {
|
||||
oc_syslog(LOG_NOTICE, "ocserv-oidc: JWK keys not available\n");
|
||||
oc_syslog(LOG_NOTICE, "ocserv-oidc: JWK keys not available");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
array = json_object_get(vctx->jwks, "keys");
|
||||
if (array == NULL) {
|
||||
oc_syslog(LOG_NOTICE, "ocserv-oidc: JWK keys malformed\n");
|
||||
oc_syslog(LOG_NOTICE, "ocserv-oidc: JWK keys malformed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -562,15 +557,14 @@ static bool oidc_verify_signature(oidc_vctx_st *vctx, cjose_jws_t *jws)
|
||||
token_header = cjose_jws_get_protected(jws);
|
||||
if (token_header == NULL) {
|
||||
oc_syslog(LOG_NOTICE,
|
||||
"ocserv-oidc: Token malformed - no header\n");
|
||||
"ocserv-oidc: Token malformed - no header");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Get the kid of the key used to sign this token
|
||||
token_kid = json_object_get(token_header, "kid");
|
||||
if (token_kid == NULL || !json_string_value(token_kid)) {
|
||||
oc_syslog(LOG_NOTICE,
|
||||
"ocserv-oidc: Token malformed - no kid\n");
|
||||
oc_syslog(LOG_NOTICE, "ocserv-oidc: Token malformed - no kid");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -578,7 +572,7 @@ static bool oidc_verify_signature(oidc_vctx_st *vctx, cjose_jws_t *jws)
|
||||
if (token_typ == NULL || !json_string_value(token_typ) ||
|
||||
strcmp(json_string_value(token_typ), "JWT")) {
|
||||
oc_syslog(LOG_NOTICE,
|
||||
"ocserv-oidc: Token malformed - wrong typ claim\n");
|
||||
"ocserv-oidc: Token malformed - wrong typ claim");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -596,8 +590,7 @@ static bool oidc_verify_signature(oidc_vctx_st *vctx, cjose_jws_t *jws)
|
||||
if (jwk == NULL) {
|
||||
time_t now;
|
||||
|
||||
oc_syslog(LOG_NOTICE,
|
||||
"ocserv-oidc: JWK with kid=%s not found\n",
|
||||
oc_syslog(LOG_NOTICE, "ocserv-oidc: JWK with kid=%s not found",
|
||||
json_string_value(token_kid));
|
||||
|
||||
oc_syslog(LOG_NOTICE,
|
||||
@@ -616,8 +609,7 @@ static bool oidc_verify_signature(oidc_vctx_st *vctx, cjose_jws_t *jws)
|
||||
}
|
||||
|
||||
if (!cjose_jws_verify(jws, jwk, &err)) {
|
||||
oc_syslog(LOG_NOTICE,
|
||||
"ocserv-oidc: Token failed validation %s\n",
|
||||
oc_syslog(LOG_NOTICE, "ocserv-oidc: Token failed validation %s",
|
||||
err.message);
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -644,27 +636,27 @@ static bool oidc_verify_token(oidc_vctx_st *vctx, const char *token,
|
||||
|
||||
jws = cjose_jws_import(token, token_length, &err);
|
||||
if (jws == NULL) {
|
||||
oc_syslog(LOG_NOTICE, "ocserv-oidc: Token malformed - %s\n",
|
||||
oc_syslog(LOG_NOTICE, "ocserv-oidc: Token malformed - %s",
|
||||
err.message);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!oidc_verify_signature(vctx, jws)) {
|
||||
oc_syslog(LOG_NOTICE,
|
||||
"ocserv-oidc: Token signature validation failed\n");
|
||||
"ocserv-oidc: Token signature validation failed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
token_claims = oidc_extract_claims(jws);
|
||||
if (!token_claims) {
|
||||
oc_syslog(LOG_NOTICE,
|
||||
"ocserv-oidc: Unable to access token claims\n");
|
||||
"ocserv-oidc: Unable to access token claims");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!oidc_verify_lifetime(token_claims)) {
|
||||
oc_syslog(LOG_NOTICE,
|
||||
"ocserv-oidc: Token lifetime validation failed\n");
|
||||
"ocserv-oidc: Token lifetime validation failed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -673,7 +665,7 @@ static bool oidc_verify_token(oidc_vctx_st *vctx, const char *token,
|
||||
token_claims)) {
|
||||
oc_syslog(
|
||||
LOG_NOTICE,
|
||||
"ocserv-oidc: Token required claims validation failed\n");
|
||||
"ocserv-oidc: Token required claims validation failed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -681,7 +673,7 @@ static bool oidc_verify_token(oidc_vctx_st *vctx, const char *token,
|
||||
"user_name_claim"),
|
||||
token_claims, user_name)) {
|
||||
oc_syslog(LOG_NOTICE,
|
||||
"ocserv-oidc: Unable to map user name claim\n");
|
||||
"ocserv-oidc: Unable to map user name claim");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ static int receive_responses(int fd, process_response process, void *context)
|
||||
|
||||
if (h->nlmsg_type != SOCK_DIAG_BY_FAMILY) {
|
||||
oc_syslog(LOG_ERR,
|
||||
"unexpected nlmsg_type %" PRIu16 "\n",
|
||||
"unexpected nlmsg_type %" PRIu16,
|
||||
h->nlmsg_type);
|
||||
return -1;
|
||||
}
|
||||
@@ -207,8 +207,7 @@ static int receive_responses(int fd, process_response process, void *context)
|
||||
}
|
||||
|
||||
if (diag->udiag_family != AF_UNIX) {
|
||||
oc_syslog(LOG_ERR,
|
||||
"unexpected family %" PRIu8 "\n",
|
||||
oc_syslog(LOG_ERR, "unexpected family %" PRIu8,
|
||||
diag->udiag_family);
|
||||
return -1;
|
||||
}
|
||||
|
||||
+3
-4
@@ -101,7 +101,7 @@ int ip_route_sanity_check(void *pool, char **_route)
|
||||
if (p == NULL) {
|
||||
oc_syslog(
|
||||
LOG_ERR,
|
||||
"route '%s' in wrong format, use xxx.xxx.xxx.xxx/xxx.xxx.xxx.xxx\n",
|
||||
"route '%s' in wrong format, use xxx.xxx.xxx.xxx/xxx.xxx.xxx.xxx",
|
||||
route);
|
||||
return -1;
|
||||
}
|
||||
@@ -117,8 +117,7 @@ int ip_route_sanity_check(void *pool, char **_route)
|
||||
|
||||
pstr = ipv4_prefix_to_strmask(pool, prefix);
|
||||
if (pstr == NULL) {
|
||||
oc_syslog(LOG_ERR, "cannot figure format of route '%s'\n",
|
||||
route);
|
||||
oc_syslog(LOG_ERR, "cannot figure format of route '%s'", route);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -126,7 +125,7 @@ int ip_route_sanity_check(void *pool, char **_route)
|
||||
|
||||
n = talloc_asprintf(pool, "%s/%s", route, pstr);
|
||||
if (n == NULL) {
|
||||
oc_syslog(LOG_ERR, "memory error\n");
|
||||
oc_syslog(LOG_ERR, "memory error");
|
||||
return -1;
|
||||
}
|
||||
*_route = n;
|
||||
|
||||
+6
-6
@@ -112,13 +112,13 @@ void set_worker_fd_limits(struct worker_st *ws)
|
||||
if (ret < 0) {
|
||||
int e = errno;
|
||||
|
||||
oclog(ws, LOG_ERR, "error in getrlimit: %s\n", strerror(e));
|
||||
oclog(ws, LOG_ERR, "error in getrlimit: %s", strerror(e));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ret = setrlimit(RLIMIT_NOFILE, &def_set);
|
||||
if (ret < 0) {
|
||||
oclog(ws, LOG_INFO, "cannot update file limit(%u): %s\n",
|
||||
oclog(ws, LOG_INFO, "cannot update file limit(%u): %s",
|
||||
(unsigned int)def_set.rlim_cur, strerror(errno));
|
||||
}
|
||||
#endif
|
||||
@@ -159,7 +159,7 @@ void drop_privileges(struct worker_st *ws, main_server_st *s)
|
||||
ret = setgid(GETSCONFIG(s)->gid);
|
||||
if (ret < 0) {
|
||||
e = errno;
|
||||
oclog(ws, LOG_ERR, "cannot set gid to %d: %s\n",
|
||||
oclog(ws, LOG_ERR, "cannot set gid to %d: %s",
|
||||
(int)GETSCONFIG(s)->gid, strerror(e));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -167,7 +167,7 @@ void drop_privileges(struct worker_st *ws, main_server_st *s)
|
||||
ret = setgroups(1, &GETSCONFIG(s)->gid);
|
||||
if (ret < 0) {
|
||||
e = errno;
|
||||
oclog(ws, LOG_ERR, "cannot set groups to %d: %s\n",
|
||||
oclog(ws, LOG_ERR, "cannot set groups to %d: %s",
|
||||
(int)GETSCONFIG(s)->gid, strerror(e));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -177,7 +177,7 @@ void drop_privileges(struct worker_st *ws, main_server_st *s)
|
||||
ret = setuid(GETSCONFIG(s)->uid);
|
||||
if (ret < 0) {
|
||||
e = errno;
|
||||
oclog(ws, LOG_ERR, "cannot set uid to %d: %s\n",
|
||||
oclog(ws, LOG_ERR, "cannot set uid to %d: %s",
|
||||
(int)GETSCONFIG(s)->uid, strerror(e));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -188,7 +188,7 @@ void drop_privileges(struct worker_st *ws, main_server_st *s)
|
||||
ret = setrlimit(RLIMIT_NPROC, &rl);
|
||||
if (ret < 0) {
|
||||
e = errno;
|
||||
oclog(ws, LOG_ERR, "cannot enforce NPROC limit: %s\n",
|
||||
oclog(ws, LOG_ERR, "cannot enforce NPROC limit: %s",
|
||||
strerror(e));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ void *main_ban_db_init(main_server_st *s)
|
||||
struct htable *db = talloc(s, struct htable);
|
||||
|
||||
if (db == NULL) {
|
||||
oc_syslog(LOG_ERR, "error initializing ban DB\n");
|
||||
oc_syslog(LOG_ERR, "error initializing ban DB");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -31,7 +31,7 @@ void init_fd_limits_default(main_server_st *s)
|
||||
int ret = getrlimit(RLIMIT_NOFILE, &s->fd_limits_default_set);
|
||||
|
||||
if (ret < 0) {
|
||||
oc_syslog(LOG_ERR, "error in getrlimit: %s\n", strerror(errno));
|
||||
oc_syslog(LOG_ERR, "error in getrlimit: %s", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
@@ -65,9 +65,8 @@ void set_main_fd_limits(main_server_st *s)
|
||||
new_set.rlim_max = s->fd_limits_default_set.rlim_max;
|
||||
ret = setrlimit(RLIMIT_NOFILE, &new_set);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr,
|
||||
"error in setrlimit(%u): %s (cur: %u)\n", max,
|
||||
strerror(errno),
|
||||
fprintf(stderr, "error in setrlimit(%u): %s (cur: %u)",
|
||||
max, strerror(errno),
|
||||
(unsigned int)s->fd_limits_default_set.rlim_cur);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,13 +113,13 @@ int handle_sec_mod_commands(sec_mod_instance_st *sec_mod_instance)
|
||||
if (ret < 5 || cmd <= MIN_SECM_CMD || cmd >= MAX_SECM_CMD ||
|
||||
length > MAX_MSG_SIZE) {
|
||||
mslog(s, NULL, LOG_ERR,
|
||||
"main received invalid message from sec-mod of %u bytes (cmd: %u)\n",
|
||||
"main received invalid message from sec-mod of %u bytes (cmd: %u)",
|
||||
(unsigned int)length, (unsigned int)cmd);
|
||||
return ERR_BAD_COMMAND;
|
||||
}
|
||||
|
||||
mslog(s, NULL, LOG_DEBUG,
|
||||
"main received message '%s' from sec-mod of %u bytes\n",
|
||||
"main received message '%s' from sec-mod of %u bytes",
|
||||
cmd_request_to_str(cmd), (unsigned int)length);
|
||||
|
||||
raw = talloc_size(pool, length);
|
||||
|
||||
+21
-21
@@ -61,14 +61,14 @@ static const char *ocserv_fw_script(void)
|
||||
return path;
|
||||
}
|
||||
|
||||
#define APPEND_TO_STR(str, val) \
|
||||
do { \
|
||||
ret = str_append_str(str, val); \
|
||||
if (ret < 0) { \
|
||||
mslog(s, proc, LOG_ERR, \
|
||||
"could not append value to environment\n"); \
|
||||
exit(EXIT_FAILURE); \
|
||||
} \
|
||||
#define APPEND_TO_STR(str, val) \
|
||||
do { \
|
||||
ret = str_append_str(str, val); \
|
||||
if (ret < 0) { \
|
||||
mslog(s, proc, LOG_ERR, \
|
||||
"could not append value to environment"); \
|
||||
exit(EXIT_FAILURE); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
typedef enum script_type_t {
|
||||
@@ -110,19 +110,19 @@ static void export_fw_info(main_server_st *s, struct proc_st *proc)
|
||||
|
||||
if (str4.length > 0 &&
|
||||
setenv("OCSERV_ROUTES4", (char *)str4.data, 1) == -1) {
|
||||
mslog(s, proc, LOG_ERR, "could not export routes\n");
|
||||
mslog(s, proc, LOG_ERR, "could not export routes");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (str6.length > 0 &&
|
||||
setenv("OCSERV_ROUTES6", (char *)str6.data, 1) == -1) {
|
||||
mslog(s, proc, LOG_ERR, "could not export routes\n");
|
||||
mslog(s, proc, LOG_ERR, "could not export routes");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (str_common.length > 0 &&
|
||||
setenv("OCSERV_ROUTES", (char *)str_common.data, 1) == -1) {
|
||||
mslog(s, proc, LOG_ERR, "could not export routes\n");
|
||||
mslog(s, proc, LOG_ERR, "could not export routes");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -148,26 +148,26 @@ static void export_fw_info(main_server_st *s, struct proc_st *proc)
|
||||
|
||||
if (str4.length > 0 &&
|
||||
setenv("OCSERV_NO_ROUTES4", (char *)str4.data, 1) == -1) {
|
||||
mslog(s, proc, LOG_ERR, "could not export no-routes\n");
|
||||
mslog(s, proc, LOG_ERR, "could not export no-routes");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (str6.length > 0 &&
|
||||
setenv("OCSERV_NO_ROUTES6", (char *)str6.data, 1) == -1) {
|
||||
mslog(s, proc, LOG_ERR, "could not export no-routes\n");
|
||||
mslog(s, proc, LOG_ERR, "could not export no-routes");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (str_common.length > 0 &&
|
||||
setenv("OCSERV_NO_ROUTES", (char *)str_common.data, 1) == -1) {
|
||||
mslog(s, proc, LOG_ERR, "could not export no-routes\n");
|
||||
mslog(s, proc, LOG_ERR, "could not export no-routes");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (proc->config->restrict_user_to_routes) {
|
||||
if (setenv("OCSERV_RESTRICT_TO_ROUTES", "1", 1) == -1) {
|
||||
mslog(s, proc, LOG_ERR,
|
||||
"could not export OCSERV_RESTRICT_TO_ROUTES\n");
|
||||
"could not export OCSERV_RESTRICT_TO_ROUTES");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
@@ -194,19 +194,19 @@ static void export_fw_info(main_server_st *s, struct proc_st *proc)
|
||||
|
||||
if (str4.length > 0 &&
|
||||
setenv("OCSERV_DNS4", (char *)str4.data, 1) == -1) {
|
||||
mslog(s, proc, LOG_ERR, "could not export DNS servers\n");
|
||||
mslog(s, proc, LOG_ERR, "could not export DNS servers");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (str6.length > 0 &&
|
||||
setenv("OCSERV_DNS6", (char *)str6.data, 1) == -1) {
|
||||
mslog(s, proc, LOG_ERR, "could not export DNS servers\n");
|
||||
mslog(s, proc, LOG_ERR, "could not export DNS servers");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (str_common.length > 0 &&
|
||||
setenv("OCSERV_DNS", (char *)str_common.data, 1) == -1) {
|
||||
mslog(s, proc, LOG_ERR, "could not export DNS servers\n");
|
||||
mslog(s, proc, LOG_ERR, "could not export DNS servers");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ static void export_fw_info(main_server_st *s, struct proc_st *proc)
|
||||
|
||||
if (ret < 0) {
|
||||
mslog(s, proc, LOG_ERR,
|
||||
"could not append value to environment\n");
|
||||
"could not append value to environment");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
@@ -268,14 +268,14 @@ static void export_fw_info(main_server_st *s, struct proc_st *proc)
|
||||
if (setenv("OCSERV_DENY_PORTS", (char *)str_common.data,
|
||||
1) == -1) {
|
||||
mslog(s, proc, LOG_ERR,
|
||||
"could not export DENY_PORTS\n");
|
||||
"could not export DENY_PORTS");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
if (setenv("OCSERV_ALLOW_PORTS",
|
||||
(char *)str_common.data, 1) == -1) {
|
||||
mslog(s, proc, LOG_ERR,
|
||||
"could not export ALLOW_PORTS\n");
|
||||
"could not export ALLOW_PORTS");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ static int handle_cookie_auth_res(main_server_st *s, struct proc_st *proc,
|
||||
ret = result;
|
||||
} else {
|
||||
proc->status = PS_AUTH_FAILED;
|
||||
mslog(s, proc, LOG_ERR, "unexpected auth result: %d\n", result);
|
||||
mslog(s, proc, LOG_ERR, "unexpected auth result: %d", result);
|
||||
ret = ERR_BAD_COMMAND;
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ int handle_worker_commands(main_server_st *s, struct proc_st *proc)
|
||||
}
|
||||
|
||||
mslog(s, proc, LOG_DEBUG,
|
||||
"main received worker's message '%s' of %u bytes\n",
|
||||
"main received worker's message '%s' of %u bytes",
|
||||
cmd_request_to_str(cmd), (unsigned int)length);
|
||||
|
||||
raw = talloc_size(proc, length);
|
||||
|
||||
+13
-15
@@ -891,15 +891,14 @@ static void sec_mod_child_watcher_cb(struct ev_loop *loop, ev_child *w,
|
||||
|
||||
if (WIFSIGNALED(w->rstatus)) {
|
||||
if (WTERMSIG(w->rstatus) == SIGSEGV)
|
||||
mslog(s, NULL, LOG_ERR,
|
||||
"Sec-mod %u died with sigsegv\n",
|
||||
mslog(s, NULL, LOG_ERR, "Sec-mod %u died with sigsegv",
|
||||
(unsigned int)w->pid);
|
||||
else if (WTERMSIG(w->rstatus) == SIGSYS)
|
||||
mslog(s, NULL, LOG_ERR, "Sec-mod %u died with sigsys\n",
|
||||
mslog(s, NULL, LOG_ERR, "Sec-mod %u died with sigsys",
|
||||
(unsigned int)w->pid);
|
||||
else
|
||||
mslog(s, NULL, LOG_ERR,
|
||||
"Sec-mod %u died with signal %d\n",
|
||||
"Sec-mod %u died with signal %d",
|
||||
(unsigned int)w->pid, (int)WTERMSIG(w->rstatus));
|
||||
}
|
||||
|
||||
@@ -941,14 +940,13 @@ static void worker_child_watcher_cb(struct ev_loop *loop, ev_child *w,
|
||||
|
||||
if (WIFSIGNALED(w->rstatus)) {
|
||||
if (WTERMSIG(w->rstatus) == SIGSEGV)
|
||||
mslog(s, NULL, LOG_ERR, "Child %u died with sigsegv\n",
|
||||
mslog(s, NULL, LOG_ERR, "Child %u died with sigsegv",
|
||||
(unsigned int)w->pid);
|
||||
else if (WTERMSIG(w->rstatus) == SIGSYS)
|
||||
mslog(s, NULL, LOG_ERR, "Child %u died with sigsys\n",
|
||||
mslog(s, NULL, LOG_ERR, "Child %u died with sigsys",
|
||||
(unsigned int)w->pid);
|
||||
else
|
||||
mslog(s, NULL, LOG_ERR,
|
||||
"Child %u died with signal %d\n",
|
||||
mslog(s, NULL, LOG_ERR, "Child %u died with signal %d",
|
||||
(unsigned int)w->pid, (int)WTERMSIG(w->rstatus));
|
||||
}
|
||||
|
||||
@@ -1084,7 +1082,7 @@ static void reload_sig_watcher_cb(struct ev_loop *loop, ev_signal *w,
|
||||
* used key. */
|
||||
ret = secmod_reload(&s->sec_mod_instances[i]);
|
||||
if (ret < 0) {
|
||||
mslog(s, NULL, LOG_ERR, "could not reload sec-mod!\n");
|
||||
mslog(s, NULL, LOG_ERR, "could not reload sec-mod!");
|
||||
ev_feed_signal_event(loop, SIGTERM);
|
||||
}
|
||||
}
|
||||
@@ -1877,7 +1875,7 @@ static bool set_env_from_ws(main_server_st *s)
|
||||
}
|
||||
if (rr < 0) {
|
||||
mslog(s, NULL, LOG_ERR,
|
||||
"snapshot restoration failed (%d)\n", rr);
|
||||
"snapshot restoration failed (%d)", rr);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -1900,31 +1898,31 @@ static bool set_env_from_ws(main_server_st *s)
|
||||
msg_size = worker_startup_msg__get_packed_size(&msg);
|
||||
if (msg_size == 0) {
|
||||
mslog(s, NULL, LOG_ERR,
|
||||
"worker_startup_msg__get_packed_size failed\n");
|
||||
"worker_startup_msg__get_packed_size failed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
msg_buffer = talloc_size(ws, msg_size);
|
||||
if (!msg_buffer) {
|
||||
mslog(s, NULL, LOG_ERR, "talloc_size failed\n");
|
||||
mslog(s, NULL, LOG_ERR, "talloc_size failed");
|
||||
goto cleanup;
|
||||
}
|
||||
msg_size = worker_startup_msg__pack(&msg, msg_buffer);
|
||||
if (msg_size == 0) {
|
||||
mslog(s, NULL, LOG_ERR, "worker_startup_msg__pack failed\n");
|
||||
mslog(s, NULL, LOG_ERR, "worker_startup_msg__pack failed");
|
||||
goto cleanup;
|
||||
}
|
||||
string_size = BASE64_ENCODE_RAW_LENGTH(msg_size) + 1;
|
||||
string_buffer = talloc_size(ws, string_size);
|
||||
if (!msg_buffer) {
|
||||
mslog(s, NULL, LOG_ERR, "talloc_size failed\n");
|
||||
mslog(s, NULL, LOG_ERR, "talloc_size failed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
oc_base64_encode((const char *)msg_buffer, msg_size, string_buffer,
|
||||
string_size);
|
||||
if (setenv(OCSERV_ENV_WORKER_STARTUP_MSG, string_buffer, 1)) {
|
||||
mslog(s, NULL, LOG_ERR, "setenv failed\n");
|
||||
mslog(s, NULL, LOG_ERR, "setenv failed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -398,7 +398,7 @@ static int handle_sec_auth_res(int cfd, sec_mod_st *sec, client_entry_st *e,
|
||||
ret = send_sec_auth_reply_msg(cfd, sec, e);
|
||||
if (ret < 0) {
|
||||
e->status = PS_AUTH_FAILED;
|
||||
seclog(sec, LOG_ERR, "could not send reply auth cmd.");
|
||||
seclog(sec, LOG_ERR, "could not send reply auth cmd");
|
||||
return ret;
|
||||
}
|
||||
return 0; /* wait for another command */
|
||||
@@ -410,7 +410,7 @@ static int handle_sec_auth_res(int cfd, sec_mod_st *sec, client_entry_st *e,
|
||||
ret = check_group(sec, e);
|
||||
if (ret < 0) {
|
||||
e->status = PS_AUTH_FAILED;
|
||||
seclog(sec, LOG_ERR, "could not accept group.");
|
||||
seclog(sec, LOG_ERR, "could not accept group");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ static int handle_sec_auth_res(int cfd, sec_mod_st *sec, client_entry_st *e,
|
||||
ret = send_sec_auth_reply(cfd, sec, e, AUTH__REP__OK);
|
||||
if (ret < 0) {
|
||||
e->status = PS_AUTH_FAILED;
|
||||
seclog(sec, LOG_ERR, "could not send reply auth cmd.");
|
||||
seclog(sec, LOG_ERR, "could not send reply auth cmd");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -446,14 +446,14 @@ static int handle_sec_auth_res(int cfd, sec_mod_st *sec, client_entry_st *e,
|
||||
|
||||
ret = send_sec_auth_reply(cfd, sec, e, AUTH__REP__FAILED);
|
||||
if (ret < 0) {
|
||||
seclog(sec, LOG_ERR, "could not send reply auth cmd.");
|
||||
seclog(sec, LOG_ERR, "could not send reply auth cmd");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (result < 0) {
|
||||
ret = result;
|
||||
} else {
|
||||
seclog(sec, LOG_ERR, "unexpected auth result: %d\n",
|
||||
seclog(sec, LOG_ERR, "unexpected auth result: %d",
|
||||
result);
|
||||
ret = ERR_BAD_COMMAND;
|
||||
}
|
||||
|
||||
+16
-17
@@ -209,7 +209,7 @@ static int process_worker_packet(void *pool, int cfd, pid_t pid,
|
||||
#endif
|
||||
PROTOBUF_ALLOCATOR(pa, pool);
|
||||
|
||||
seclog(sec, LOG_DEBUG, "cmd [size=%d] %s\n", (int)buffer_size,
|
||||
seclog(sec, LOG_DEBUG, "cmd [size=%d] %s", (int)buffer_size,
|
||||
cmd_request_to_str(cmd));
|
||||
data.data = buffer;
|
||||
data.size = buffer_size;
|
||||
@@ -219,7 +219,7 @@ static int process_worker_packet(void *pool, int cfd, pid_t pid,
|
||||
case CMD_SEC_GET_PK:
|
||||
pkm = sec_get_pk_msg__unpack(&pa, data.size, data.data);
|
||||
if (pkm == NULL) {
|
||||
seclog(sec, LOG_INFO, "error unpacking sec get pk\n");
|
||||
seclog(sec, LOG_INFO, "error unpacking sec get pk");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ static int process_worker_packet(void *pool, int cfd, pid_t pid,
|
||||
case CMD_SEC_SIGN_HASH:
|
||||
op = sec_op_msg__unpack(&pa, data.size, data.data);
|
||||
if (op == NULL) {
|
||||
seclog(sec, LOG_INFO, "error unpacking sec op\n");
|
||||
seclog(sec, LOG_INFO, "error unpacking sec op");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ static int process_worker_packet(void *pool, int cfd, pid_t pid,
|
||||
case CMD_SEC_DECRYPT:
|
||||
op = sec_op_msg__unpack(&pa, data.size, data.data);
|
||||
if (op == NULL) {
|
||||
seclog(sec, LOG_INFO, "error unpacking sec op\n");
|
||||
seclog(sec, LOG_INFO, "error unpacking sec op");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ static int process_worker_packet(void *pool, int cfd, pid_t pid,
|
||||
auth_init =
|
||||
sec_auth_init_msg__unpack(&pa, data.size, data.data);
|
||||
if (auth_init == NULL) {
|
||||
seclog(sec, LOG_INFO, "error unpacking auth init\n");
|
||||
seclog(sec, LOG_INFO, "error unpacking auth init");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ static int process_worker_packet(void *pool, int cfd, pid_t pid,
|
||||
auth_cont =
|
||||
sec_auth_cont_msg__unpack(&pa, data.size, data.data);
|
||||
if (auth_cont == NULL) {
|
||||
seclog(sec, LOG_INFO, "error unpacking auth cont\n");
|
||||
seclog(sec, LOG_INFO, "error unpacking auth cont");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -420,7 +420,7 @@ static int process_worker_packet(void *pool, int cfd, pid_t pid,
|
||||
|
||||
if (ret < 0) {
|
||||
seclog(sec, LOG_DEBUG,
|
||||
"could not delete resumption data.");
|
||||
"could not delete resumption data");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ static int process_worker_packet(void *pool, int cfd, pid_t pid,
|
||||
msg.reply =
|
||||
SESSION_RESUME_REPLY_MSG__RESUME__REP__FAILED;
|
||||
seclog(sec, LOG_DEBUG,
|
||||
"could not fetch resumption data.");
|
||||
"could not fetch resumption data");
|
||||
} else {
|
||||
msg.reply = SESSION_RESUME_REPLY_MSG__RESUME__REP__OK;
|
||||
}
|
||||
@@ -456,7 +456,7 @@ static int process_worker_packet(void *pool, int cfd, pid_t pid,
|
||||
(pack_func)session_resume_reply_msg__pack);
|
||||
|
||||
if (ret < 0) {
|
||||
seclog(sec, LOG_ERR, "could not send reply cmd %d.",
|
||||
seclog(sec, LOG_ERR, "could not send reply cmd %d",
|
||||
(unsigned int)cmd);
|
||||
return ERR_BAD_COMMAND;
|
||||
}
|
||||
@@ -482,7 +482,7 @@ static int process_packet_from_main(void *pool, int fd, sec_mod_st *sec,
|
||||
|
||||
PROTOBUF_ALLOCATOR(pa, pool);
|
||||
|
||||
seclog(sec, LOG_DEBUG, "cmd [size=%d] %s\n", (int)buffer_size,
|
||||
seclog(sec, LOG_DEBUG, "cmd [size=%d] %s", (int)buffer_size,
|
||||
cmd_request_to_str(cmd));
|
||||
data.data = buffer;
|
||||
data.size = buffer_size;
|
||||
@@ -495,7 +495,7 @@ static int process_packet_from_main(void *pool, int fd, sec_mod_st *sec,
|
||||
NULL);
|
||||
if (ret < 0) {
|
||||
seclog(sec, LOG_ERR,
|
||||
"could not send reload reply to main!\n");
|
||||
"could not send reload reply to main!");
|
||||
return ERR_BAD_COMMAND;
|
||||
}
|
||||
break;
|
||||
@@ -509,7 +509,7 @@ static int process_packet_from_main(void *pool, int fd, sec_mod_st *sec,
|
||||
msg = ban_ip_reply_msg__unpack(&pa, data.size, data.data);
|
||||
if (msg == NULL) {
|
||||
seclog(sec, LOG_INFO,
|
||||
"error unpacking auth ban ip reply\n");
|
||||
"error unpacking auth ban ip reply");
|
||||
return ERR_BAD_COMMAND;
|
||||
}
|
||||
|
||||
@@ -523,7 +523,7 @@ static int process_packet_from_main(void *pool, int fd, sec_mod_st *sec,
|
||||
|
||||
msg = secm_session_open_msg__unpack(&pa, data.size, data.data);
|
||||
if (msg == NULL) {
|
||||
seclog(sec, LOG_INFO, "error unpacking session open\n");
|
||||
seclog(sec, LOG_INFO, "error unpacking session open");
|
||||
return ERR_BAD_COMMAND;
|
||||
}
|
||||
|
||||
@@ -537,8 +537,7 @@ static int process_packet_from_main(void *pool, int fd, sec_mod_st *sec,
|
||||
|
||||
msg = secm_session_close_msg__unpack(&pa, data.size, data.data);
|
||||
if (msg == NULL) {
|
||||
seclog(sec, LOG_INFO,
|
||||
"error unpacking session close\n");
|
||||
seclog(sec, LOG_INFO, "error unpacking session close");
|
||||
return ERR_BAD_COMMAND;
|
||||
}
|
||||
|
||||
@@ -745,7 +744,7 @@ static int serve_request_main(sec_mod_st *sec, int fd, uint8_t *buffer,
|
||||
seclog(sec, LOG_DEBUG, "received request %s", cmd_request_to_str(cmd));
|
||||
if (cmd <= MIN_SECM_CMD || cmd >= MAX_SECM_CMD) {
|
||||
seclog(sec, LOG_ERR,
|
||||
"received invalid message from main of %u bytes (cmd: %u)\n",
|
||||
"received invalid message from main of %u bytes (cmd: %u)",
|
||||
(unsigned int)length, (unsigned int)cmd);
|
||||
return ERR_BAD_COMMAND;
|
||||
}
|
||||
@@ -888,7 +887,7 @@ static void read_private_key(sec_mod_st *sec, vhost_cfg_st *vhost,
|
||||
}
|
||||
vhost->key[i] = p;
|
||||
}
|
||||
seclog(sec, LOG_DEBUG, "%sloaded %d keys\n", PREFIX_VHOST(vhost),
|
||||
seclog(sec, LOG_DEBUG, "%sloaded %d keys", PREFIX_VHOST(vhost),
|
||||
vhost->key_size);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ static int os_set_ipv6_addr(main_server_st *s, struct proc_st *proc)
|
||||
fd = socket(AF_INET6, SOCK_STREAM, 0);
|
||||
if (fd == -1) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "%s: Error socket(AF_INET6): %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "%s: Error socket(AF_INET6): %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
return -1;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ static int os_set_ipv6_addr(main_server_st *s, struct proc_st *proc)
|
||||
ret = ioctl(fd, SIOGIFINDEX, &ifr);
|
||||
if (ret != 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "%s: Error in SIOGIFINDEX: %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "%s: Error in SIOGIFINDEX: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
@@ -111,7 +111,7 @@ static int os_set_ipv6_addr(main_server_st *s, struct proc_st *proc)
|
||||
ret = ioctl(fd, SIOCSIFADDR, &ifr6);
|
||||
if (ret != 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "%s: Error setting IPv6: %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "%s: Error setting IPv6: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
@@ -126,7 +126,7 @@ static int os_set_ipv6_addr(main_server_st *s, struct proc_st *proc)
|
||||
if (ret != 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR,
|
||||
"%s: Could not bring up IPv6 interface: %s\n",
|
||||
"%s: Could not bring up IPv6 interface: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
@@ -147,7 +147,7 @@ static int os_set_ipv6_addr(main_server_st *s, struct proc_st *proc)
|
||||
if (ret != 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR,
|
||||
"%s: Error setting route to remote IPv6: %s\n",
|
||||
"%s: Error setting route to remote IPv6: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
@@ -227,7 +227,7 @@ static int os_set_ipv6_addr(main_server_st *s, struct proc_st *proc)
|
||||
fd = socket(AF_INET6, SOCK_STREAM, 0);
|
||||
if (fd == -1) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "%s: Error socket(AF_INET6): %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "%s: Error socket(AF_INET6): %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
return -1;
|
||||
}
|
||||
@@ -260,7 +260,7 @@ static int os_set_ipv6_addr(main_server_st *s, struct proc_st *proc)
|
||||
ret = ioctl(fd, SIOCAIFADDR_IN6, &ifr6);
|
||||
if (ret != 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "%s: Error setting IPv6: %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "%s: Error setting IPv6: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
@@ -275,7 +275,7 @@ static int os_set_ipv6_addr(main_server_st *s, struct proc_st *proc)
|
||||
if (ret != 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR,
|
||||
"%s: Could not bring up IPv6 interface: %s\n",
|
||||
"%s: Could not bring up IPv6 interface: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
@@ -359,7 +359,7 @@ static int set_network_info(main_server_st *s, struct proc_st *proc)
|
||||
ret = ioctl(fd, SIOCAIFADDR, &ifr);
|
||||
if (ret != 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "%s: Error setting IPv4: %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "%s: Error setting IPv4: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
@@ -372,7 +372,7 @@ static int set_network_info(main_server_st *s, struct proc_st *proc)
|
||||
ret = ioctl(fd, SIOCSIFADDR, &ifr);
|
||||
if (ret != 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "%s: Error setting IPv4: %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "%s: Error setting IPv4: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
@@ -388,7 +388,7 @@ static int set_network_info(main_server_st *s, struct proc_st *proc)
|
||||
if (ret != 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR,
|
||||
"%s: Error setting DST IPv4: %s\n",
|
||||
"%s: Error setting DST IPv4: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
@@ -403,7 +403,7 @@ static int set_network_info(main_server_st *s, struct proc_st *proc)
|
||||
ret = ioctl(fd, SIOCSIFFLAGS, &ifr);
|
||||
if (ret != 0) {
|
||||
mslog(s, NULL, LOG_ERR,
|
||||
"%s: Could not bring up IPv4 interface.\n",
|
||||
"%s: Could not bring up IPv4 interface.",
|
||||
proc->tun_lease.name);
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
@@ -423,7 +423,7 @@ static int set_network_info(main_server_st *s, struct proc_st *proc)
|
||||
}
|
||||
|
||||
if (proc->ipv6 == 0 && proc->ipv4 == 0) {
|
||||
mslog(s, NULL, LOG_ERR, "%s: Could not set any IP.\n",
|
||||
mslog(s, NULL, LOG_ERR, "%s: Could not set any IP.",
|
||||
proc->tun_lease.name);
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
@@ -472,7 +472,7 @@ static int bsd_ifrename(main_server_st *s, struct proc_st *proc)
|
||||
GETRCONFIG(s)->network->name, i);
|
||||
if (ret != strlen(tun_name)) {
|
||||
mslog(s, NULL, LOG_ERR,
|
||||
"Truncation error in tun name: %s; adjust 'device' option\n",
|
||||
"Truncation error in tun name: %s; adjust 'device' option",
|
||||
proc->tun_lease.name);
|
||||
return -1;
|
||||
}
|
||||
@@ -486,7 +486,7 @@ static int bsd_ifrename(main_server_st *s, struct proc_st *proc)
|
||||
continue;
|
||||
|
||||
mslog(s, NULL, LOG_ERR,
|
||||
"%s: Error renaming interface: %s\n",
|
||||
"%s: Error renaming interface: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
goto fail;
|
||||
}
|
||||
@@ -505,7 +505,7 @@ static int bsd_ifrename(main_server_st *s, struct proc_st *proc)
|
||||
} else {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_WARNING,
|
||||
"Error renaming interface: %s to %s: %s\n",
|
||||
"Error renaming interface: %s to %s: %s",
|
||||
proc->tun_lease.name, tun_name, strerror(e));
|
||||
ret = -1;
|
||||
}
|
||||
@@ -580,8 +580,7 @@ static int os_open_tun(main_server_st *s, struct proc_st *proc)
|
||||
ret = fstat(fd, &st);
|
||||
if (ret < 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "tun fd %d: stat: %s\n", fd,
|
||||
strerror(e));
|
||||
mslog(s, NULL, LOG_ERR, "tun fd %d: stat: %s", fd, strerror(e));
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
@@ -598,7 +597,7 @@ static int os_open_tun(main_server_st *s, struct proc_st *proc)
|
||||
ret = ioctl(fd, TUNGIFINFO, &inf);
|
||||
if (ret < 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "%s: TUNGIFINFO: %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "%s: TUNGIFINFO: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
} else {
|
||||
inf.flags |= IFF_MULTICAST;
|
||||
@@ -606,7 +605,7 @@ static int os_open_tun(main_server_st *s, struct proc_st *proc)
|
||||
ret = ioctl(fd, TUNSIFINFO, &inf);
|
||||
if (ret < 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "%s: TUNSIFINFO: %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "%s: TUNSIFINFO: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
}
|
||||
}
|
||||
@@ -615,7 +614,7 @@ static int os_open_tun(main_server_st *s, struct proc_st *proc)
|
||||
ret = ioctl(fd, TUNSIFMODE, &i);
|
||||
if (ret < 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "%s: TUNSIFMODE: %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "%s: TUNSIFMODE: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
}
|
||||
|
||||
@@ -624,7 +623,7 @@ static int os_open_tun(main_server_st *s, struct proc_st *proc)
|
||||
ret = ioctl(fd, TUNSLMODE, &i);
|
||||
if (ret < 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "%s: TUNSLMODE: %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "%s: TUNSLMODE: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
}
|
||||
#endif
|
||||
@@ -635,7 +634,7 @@ static int os_open_tun(main_server_st *s, struct proc_st *proc)
|
||||
ret = ioctl(fd, TUNSIFHEAD, &i);
|
||||
if (ret < 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "%s: TUNSIFHEAD: %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "%s: TUNSIFHEAD: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
}
|
||||
#endif /* TUNSIFHEAD */
|
||||
@@ -661,7 +660,7 @@ static int os_open_tun(main_server_st *s, struct proc_st *proc)
|
||||
"%s%%d", GETRCONFIG(s)->network->name);
|
||||
if (ret != strlen(proc->tun_lease.name)) {
|
||||
mslog(s, NULL, LOG_ERR,
|
||||
"Truncation error in tun name: %s; adjust 'device' option\n",
|
||||
"Truncation error in tun name: %s; adjust 'device' option",
|
||||
proc->tun_lease.name);
|
||||
return -1;
|
||||
}
|
||||
@@ -671,7 +670,7 @@ static int os_open_tun(main_server_st *s, struct proc_st *proc)
|
||||
if (tunfd < 0) {
|
||||
int e = errno;
|
||||
|
||||
mslog(s, NULL, LOG_ERR, "Can't open /dev/net/tun: %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "Can't open /dev/net/tun: %s",
|
||||
strerror(e));
|
||||
return -1;
|
||||
}
|
||||
@@ -683,18 +682,18 @@ static int os_open_tun(main_server_st *s, struct proc_st *proc)
|
||||
|
||||
if (ioctl(tunfd, TUNSETIFF, (void *)&ifr) < 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "%s: TUNSETIFF: %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "%s: TUNSETIFF: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
goto fail;
|
||||
}
|
||||
memcpy(proc->tun_lease.name, ifr.ifr_name, IFNAMSIZ);
|
||||
mslog(s, proc, LOG_DEBUG, "assigning tun device %s\n",
|
||||
mslog(s, proc, LOG_DEBUG, "assigning tun device %s",
|
||||
proc->tun_lease.name);
|
||||
|
||||
/* we no longer use persistent tun */
|
||||
if (ioctl(tunfd, TUNSETPERSIST, (void *)0) < 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "%s: TUNSETPERSIST: %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "%s: TUNSETPERSIST: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
goto fail;
|
||||
}
|
||||
@@ -704,7 +703,7 @@ static int os_open_tun(main_server_st *s, struct proc_st *proc)
|
||||
ret = ioctl(tunfd, TUNSETOWNER, t);
|
||||
if (ret < 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_INFO, "%s: TUNSETOWNER: %s\n",
|
||||
mslog(s, NULL, LOG_INFO, "%s: TUNSETOWNER: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
goto fail;
|
||||
}
|
||||
@@ -715,7 +714,7 @@ static int os_open_tun(main_server_st *s, struct proc_st *proc)
|
||||
ret = ioctl(tunfd, TUNSETGROUP, t);
|
||||
if (ret < 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "%s: TUNSETGROUP: %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "%s: TUNSETGROUP: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
/* kernels prior to 2.6.23 do not have this ioctl()
|
||||
* and return this error. In that case we ignore the
|
||||
@@ -747,7 +746,7 @@ int open_tun(main_server_st *s, struct proc_st *proc)
|
||||
if (tunfd < 0) {
|
||||
int e = errno;
|
||||
|
||||
mslog(s, NULL, LOG_ERR, "Can't open tun device: %s\n",
|
||||
mslog(s, NULL, LOG_ERR, "Can't open tun device: %s",
|
||||
strerror(e));
|
||||
return -1;
|
||||
}
|
||||
@@ -797,7 +796,7 @@ void close_tun(main_server_st *s, struct proc_st *proc)
|
||||
if (ret != 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR,
|
||||
"%s: Error destroying interface: %s\n",
|
||||
"%s: Error destroying interface: %s",
|
||||
proc->tun_lease.name, strerror(e));
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -107,7 +107,7 @@ int handle_commands_from_main(struct worker_st *ws)
|
||||
|
||||
length = ret;
|
||||
|
||||
oclog(ws, LOG_DEBUG, "worker received message %s of %u bytes\n",
|
||||
oclog(ws, LOG_DEBUG, "worker received message %s of %u bytes",
|
||||
cmd_request_to_str(cmd), (unsigned int)length);
|
||||
|
||||
/*cmd_data_len = ret - 1;*/
|
||||
@@ -238,7 +238,7 @@ void ocsigaltstack(struct worker_st *ws)
|
||||
if (mprotect(ss.ss_sp, SIGSTKSZ, PROT_READ | PROT_WRITE) == -1) {
|
||||
e = errno;
|
||||
free(ss.ss_sp);
|
||||
oclog(ws, LOG_ERR, "mprotect: %s\n", strerror(e));
|
||||
oclog(ws, LOG_ERR, "mprotect: %s", strerror(e));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
ss.ss_size = SIGSTKSZ;
|
||||
@@ -246,7 +246,7 @@ void ocsigaltstack(struct worker_st *ws)
|
||||
if (sigaltstack(&ss, NULL) == -1) {
|
||||
e = errno;
|
||||
free(ss.ss_sp);
|
||||
oclog(ws, LOG_ERR, "sigaltstack: %s\n", strerror(e));
|
||||
oclog(ws, LOG_ERR, "sigaltstack: %s", strerror(e));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -46,8 +46,8 @@ void sigsys_action(int sig, siginfo_t *info, void *ucontext)
|
||||
{
|
||||
char *call_addr = *backtrace_symbols(&info->si_call_addr, 1);
|
||||
|
||||
oc_syslog(LOG_ERR, "Function %s called disabled syscall %d\n",
|
||||
call_addr, info->si_syscall);
|
||||
oc_syslog(LOG_ERR, "Function %s called disabled syscall %d", call_addr,
|
||||
info->si_syscall);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ ssize_t tun_write(int sockfd, const void *buf, size_t len)
|
||||
complained = 1;
|
||||
oc_syslog(
|
||||
LOG_ERR,
|
||||
"tun_write: Unknown packet (len %d) received %02x %02x %02x %02x...\n",
|
||||
"tun_write: Unknown packet (len %d) received %02x %02x %02x %02x...",
|
||||
(int)len, data[0], data[1], data[2], data[3]);
|
||||
}
|
||||
return -1;
|
||||
|
||||
+18
-18
@@ -565,7 +565,7 @@ static void send_stats_to_secmod(worker_st *ws, time_t now,
|
||||
if (e == -1) {
|
||||
e = errno;
|
||||
oclog(ws, LOG_DEBUG,
|
||||
"could not wait for sec-mod: %s\n",
|
||||
"could not wait for sec-mod: %s",
|
||||
strerror(e));
|
||||
}
|
||||
}
|
||||
@@ -579,7 +579,7 @@ static void send_stats_to_secmod(worker_st *ws, time_t now,
|
||||
} else {
|
||||
e = errno;
|
||||
oclog(ws, LOG_WARNING,
|
||||
"could not send periodic stats to sec-mod: %s\n",
|
||||
"could not send periodic stats to sec-mod: %s",
|
||||
strerror(e));
|
||||
}
|
||||
}
|
||||
@@ -973,7 +973,7 @@ void vpn_server(struct worker_st *ws)
|
||||
http_req_init(ws);
|
||||
|
||||
if (WSRCONFIG(ws)->listen_proxy_proto) {
|
||||
oclog(ws, LOG_DEBUG, "proxy-hdr: peer is %s\n",
|
||||
oclog(ws, LOG_DEBUG, "proxy-hdr: peer is %s",
|
||||
ws->remote_ip_str);
|
||||
}
|
||||
|
||||
@@ -1274,7 +1274,7 @@ static void mtu_discovery_init(worker_st *ws, struct dtls_st *dtls,
|
||||
|
||||
if (!WSRCONFIG(ws)->try_mtu)
|
||||
oclog(ws, LOG_DEBUG,
|
||||
"Initializing MTU discovery; initial MTU: %u\n", mtu);
|
||||
"Initializing MTU discovery; initial MTU: %u", mtu);
|
||||
|
||||
ws->last_good_mtu = mtu;
|
||||
ws->last_bad_mtu = mtu;
|
||||
@@ -1589,13 +1589,13 @@ hsk_restart:
|
||||
if (ret < 0 && gnutls_error_is_fatal(ret) != 0) {
|
||||
if (ret == GNUTLS_E_FATAL_ALERT_RECEIVED)
|
||||
oclog(ws, LOG_ERR,
|
||||
"error in DTLS handshake: %s: %s\n",
|
||||
"error in DTLS handshake: %s: %s",
|
||||
gnutls_strerror(ret),
|
||||
gnutls_alert_get_name(gnutls_alert_get(
|
||||
dtls->dtls_session)));
|
||||
else
|
||||
oclog(ws, LOG_ERR,
|
||||
"error in DTLS handshake: %s\n",
|
||||
"error in DTLS handshake: %s",
|
||||
gnutls_strerror(ret));
|
||||
dtls->udp_state = UP_DISABLED;
|
||||
ev_io_stop(worker_loop, &dtls->io);
|
||||
@@ -1616,7 +1616,7 @@ hsk_restart:
|
||||
|
||||
dtls->udp_state = UP_ACTIVE;
|
||||
oclog(ws, LOG_DEBUG,
|
||||
"DTLS handshake completed (link MTU: %u, data MTU: %u)\n",
|
||||
"DTLS handshake completed (link MTU: %u, data MTU: %u)",
|
||||
ws->link_mtu, data_mtu);
|
||||
ws->dtls_active_session++;
|
||||
oclog(ws, LOG_DEBUG,
|
||||
@@ -1763,7 +1763,7 @@ static int tun_mainloop(struct worker_st *ws, struct timespec *tnow)
|
||||
tnow->tv_sec >
|
||||
ws->udp_recv_time + WSRCONFIG(ws)->switch_to_tcp_timeout) {
|
||||
oclog(ws, LOG_DEBUG,
|
||||
"No UDP data received for %li seconds, using TCP instead\n",
|
||||
"No UDP data received for %li seconds, using TCP instead",
|
||||
tnow->tv_sec - ws->udp_recv_time);
|
||||
DTLS_ACTIVE(ws)->udp_state = UP_INACTIVE;
|
||||
}
|
||||
@@ -1776,7 +1776,7 @@ static int tun_mainloop(struct worker_st *ws, struct timespec *tnow)
|
||||
ret = ws->dtls_selected_comp->compress(ws->decomp + 8,
|
||||
sizeof(ws->decomp) - 8,
|
||||
ws->buffer + 8, l);
|
||||
oclog(ws, LOG_TRANSFER_DEBUG, "compressed %d to %d\n", (int)l,
|
||||
oclog(ws, LOG_TRANSFER_DEBUG, "compressed %d to %d", (int)l,
|
||||
ret);
|
||||
if (ret > 0 && ret < l) {
|
||||
dtls_to_send.data = ws->decomp;
|
||||
@@ -1798,7 +1798,7 @@ static int tun_mainloop(struct worker_st *ws, struct timespec *tnow)
|
||||
ret = ws->cstp_selected_comp->compress(ws->decomp + 8,
|
||||
sizeof(ws->decomp) - 8,
|
||||
ws->buffer + 8, l);
|
||||
oclog(ws, LOG_TRANSFER_DEBUG, "compressed %d to %d\n", (int)l,
|
||||
oclog(ws, LOG_TRANSFER_DEBUG, "compressed %d to %d", (int)l,
|
||||
ret);
|
||||
if (ret > 0 && ret < l) {
|
||||
cstp_to_send.data = ws->decomp;
|
||||
@@ -1812,7 +1812,7 @@ static int tun_mainloop(struct worker_st *ws, struct timespec *tnow)
|
||||
if (bandwidth_update(&ws->b_tx, dtls_to_send.size, tnow) != 0) {
|
||||
tls_retry = 0;
|
||||
|
||||
oclog(ws, LOG_TRANSFER_DEBUG, "sending %d byte(s)\n", l);
|
||||
oclog(ws, LOG_TRANSFER_DEBUG, "sending %d byte(s)", l);
|
||||
|
||||
if (DTLS_ACTIVE(ws)->udp_state == UP_ACTIVE) {
|
||||
ws->tun_bytes_out += dtls_to_send.size;
|
||||
@@ -1827,7 +1827,7 @@ static int tun_mainloop(struct worker_st *ws, struct timespec *tnow)
|
||||
mtu_not_ok(ws, DTLS_ACTIVE(ws));
|
||||
|
||||
oclog(ws, LOG_TRANSFER_DEBUG,
|
||||
"retrying (TLS) %d\n", l);
|
||||
"retrying (TLS) %d", l);
|
||||
tls_retry = 1;
|
||||
} else if (ret >= 1 + DATA_MTU(ws, ws->link_mtu) &&
|
||||
WSRCONFIG(ws)->try_mtu != 0) {
|
||||
@@ -2053,7 +2053,7 @@ static int connect_handler(worker_st *ws)
|
||||
* asks for CSCOSSLC/tunnel instead of /CSCOSSLC/tunnel */
|
||||
if (strcmp(req->url, "/CSCOSSLC/tunnel") != 0 &&
|
||||
strcmp(req->url, "CSCOSSLC/tunnel") != 0) {
|
||||
oclog(ws, LOG_INFO, "bad connect request: '%s'\n", req->url);
|
||||
oclog(ws, LOG_INFO, "bad connect request: '%s'", req->url);
|
||||
response_404(ws, 1);
|
||||
cstp_fatal_close(ws, GNUTLS_A_ACCESS_DENIED);
|
||||
exit_worker(ws);
|
||||
@@ -2548,7 +2548,7 @@ static int connect_handler(worker_st *ws)
|
||||
|
||||
/* send any compression methods */
|
||||
if (ws->dtls_selected_comp) {
|
||||
oclog(ws, LOG_INFO, "selected DTLS compression method %s\n",
|
||||
oclog(ws, LOG_INFO, "selected DTLS compression method %s",
|
||||
ws->dtls_selected_comp->name);
|
||||
ret = cstp_printf(ws, "X-DTLS-Content-Encoding: %s\r\n",
|
||||
ws->dtls_selected_comp->name);
|
||||
@@ -2556,7 +2556,7 @@ static int connect_handler(worker_st *ws)
|
||||
}
|
||||
|
||||
if (ws->cstp_selected_comp) {
|
||||
oclog(ws, LOG_INFO, "selected CSTP compression method %s\n",
|
||||
oclog(ws, LOG_INFO, "selected CSTP compression method %s",
|
||||
ws->cstp_selected_comp->name);
|
||||
ret = cstp_printf(ws, "X-CSTP-Content-Encoding: %s\r\n",
|
||||
ws->cstp_selected_comp->name);
|
||||
@@ -2591,7 +2591,7 @@ exit:
|
||||
exit_worker_reason(ws, terminate_reason);
|
||||
|
||||
send_error:
|
||||
oclog(ws, LOG_DEBUG, "error sending data\n");
|
||||
oclog(ws, LOG_DEBUG, "error sending data");
|
||||
exit_worker(ws);
|
||||
|
||||
return -1;
|
||||
@@ -2700,7 +2700,7 @@ static int parse_data(struct worker_st *ws, uint8_t *buf, size_t buf_size,
|
||||
plain_size = ws->cstp_selected_comp->decompress(
|
||||
ws->decomp, sizeof(ws->decomp), plain,
|
||||
plain_size);
|
||||
oclog(ws, LOG_DEBUG, "decompressed %zu to %zd\n",
|
||||
oclog(ws, LOG_DEBUG, "decompressed %zu to %zd",
|
||||
buf_size - 8, plain_size);
|
||||
} else { /* DTLS */
|
||||
if (ws->dtls_selected_comp == NULL) {
|
||||
@@ -2712,7 +2712,7 @@ static int parse_data(struct worker_st *ws, uint8_t *buf, size_t buf_size,
|
||||
plain_size = ws->dtls_selected_comp->decompress(
|
||||
ws->decomp, sizeof(ws->decomp), plain,
|
||||
plain_size);
|
||||
oclog(ws, LOG_DEBUG, "decompressed %zu to %zd\n",
|
||||
oclog(ws, LOG_DEBUG, "decompressed %zu to %zd",
|
||||
buf_size - 1, plain_size);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user