log UPDATE partially replace ERRARG macro
Added new macro, which works just like ERRARG did before, but it can
take variadic number (up to 5) of arguments and a session the error happened on.
ERRARG still remains and has an extra session argument.
diff --git a/src/session_server_tls.c b/src/session_server_tls.c
index 76b3c8c..0c227ce 100644
--- a/src/session_server_tls.c
+++ b/src/session_server_tls.c
@@ -920,10 +920,7 @@
int ret;
struct nc_endpt *endpt;
- if (!endpt_name) {
- ERRARG("endpt_name");
- return -1;
- }
+ NC_CHECK_ARG_RET(NULL, endpt_name, -1);
/* LOCK */
endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
@@ -964,7 +961,7 @@
void (*free_user_data)(void *user_data))
{
if (!cert_clb) {
- ERRARG("cert_clb");
+ ERRARG(NULL, "cert_clb");
return;
}
@@ -978,7 +975,7 @@
int *cert_path_count, char ***cert_data, int *cert_data_count), void *user_data, void (*free_user_data)(void *user_data))
{
if (!cert_chain_clb) {
- ERRARG("cert_chain_clb");
+ ERRARG(NULL, "cert_chain_clb");
return;
}
@@ -990,10 +987,7 @@
static int
nc_server_tls_add_trusted_cert_list(const char *name, struct nc_server_tls_opts *opts)
{
- if (!name) {
- ERRARG("name");
- return -1;
- }
+ NC_CHECK_ARG_RET(NULL, name, -1);
++opts->trusted_cert_list_count;
opts->trusted_cert_lists = nc_realloc(opts->trusted_cert_lists,
@@ -1013,10 +1007,7 @@
int ret;
struct nc_endpt *endpt;
- if (!endpt_name) {
- ERRARG("endpt_name");
- return -1;
- }
+ NC_CHECK_ARG_RET(NULL, endpt_name, -1);
/* LOCK */
endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
@@ -1057,7 +1048,7 @@
void *user_data, void (*free_user_data)(void *user_data))
{
if (!cert_list_clb) {
- ERRARG("cert_list_clb");
+ ERRARG(NULL, "cert_list_clb");
return;
}
@@ -1104,10 +1095,7 @@
int ret;
struct nc_endpt *endpt;
- if (!endpt_name) {
- ERRARG("endpt_name");
- return -1;
- }
+ NC_CHECK_ARG_RET(NULL, endpt_name, -1);
/* LOCK */
endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
@@ -1146,7 +1134,7 @@
nc_server_tls_set_trusted_ca_paths(const char *ca_file, const char *ca_dir, struct nc_server_tls_opts *opts)
{
if (!ca_file && !ca_dir) {
- ERRARG("ca_file and ca_dir");
+ ERRARG(NULL, "ca_file and ca_dir");
return -1;
}
@@ -1169,10 +1157,7 @@
int ret;
struct nc_endpt *endpt;
- if (!endpt_name) {
- ERRARG("endpt_name");
- return -1;
- }
+ NC_CHECK_ARG_RET(NULL, endpt_name, -1);
/* LOCK */
endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
@@ -1214,7 +1199,7 @@
X509_LOOKUP *lookup;
if (!crl_file && !crl_dir) {
- ERRARG("crl_file and crl_dir");
+ ERRARG(NULL, "crl_file and crl_dir");
return -1;
}
@@ -1260,10 +1245,7 @@
int ret;
struct nc_endpt *endpt;
- if (!endpt_name) {
- ERRARG("endpt_name");
- return -1;
- }
+ NC_CHECK_ARG_RET(NULL, endpt_name, -1);
/* LOCK */
endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
@@ -1316,7 +1298,7 @@
struct nc_endpt *endpt;
if (!endpt_name) {
- ERRARG("endpt_name");
+ ERRARG(NULL, "endpt_name");
return;
}
@@ -1410,10 +1392,7 @@
int ret;
struct nc_endpt *endpt;
- if (!endpt_name) {
- ERRARG("endpt_name");
- return -1;
- }
+ NC_CHECK_ARG_RET(NULL, endpt_name, -1);
/* LOCK */
endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
@@ -1508,10 +1487,7 @@
int ret;
struct nc_endpt *endpt;
- if (!endpt_name) {
- ERRARG("endpt_name");
- return -1;
- }
+ NC_CHECK_ARG_RET(NULL, endpt_name, -1);
/* LOCK */
endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
@@ -1596,10 +1572,7 @@
int ret;
struct nc_endpt *endpt;
- if (!endpt_name) {
- ERRARG("endpt_name");
- return -1;
- }
+ NC_CHECK_ARG_RET(NULL, endpt_name, -1);
/* LOCK */
endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
@@ -1639,7 +1612,7 @@
nc_session_get_client_cert(const struct nc_session *session)
{
if (!session || (session->side != NC_SERVER)) {
- ERRARG("session");
+ ERRARG(session, "session");
return NULL;
}