From: "flichtenheld (Code Review)"
Date: Fri, 8 May 2026 11:26:56 +0000
In-Reply-To:
References:
Reply-To: frank@...2641..., arne-openvpn@...1227...,
openvpn-devel@lists.sourceforge.net
Message-ID: <8655a806a1c58a0233a302c57cd1dae21b72d7e3-EmailReplacePatchSet-HTML@...2715...>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="RDCjjV159dw="; charset=UTF-8
Subject: [Openvpn-devel] [M] Change in openvpn[master]: Rename variables
that shadow other variables or functions
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
To: plaisthos
Cc: openvpn-devel
--RDCjjV159dw=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1618?usp=3Demail
to look at the new patch set (#7).
Change subject: Rename variables that shadow other variables or functions
......................................................................
Rename variables that shadow other variables or functions
Identified by cppcheck.
Change-Id: I528f5fd200d877841e473e5e05b7ac7915fa2e33
Signed-off-by: Frank Lichtenheld
---
M src/openvpn/manage.c
M src/openvpn/options.c
M src/openvpn/ps.c
M src/openvpn/push.c
M src/openvpn/tls_crypt.c
M src/openvpnserv/interactive.c
M tests/unit_tests/openvpn/test_dhcp.c
M tests/unit_tests/openvpn/test_push_update_msg.c
8 files changed, 49 insertions(+), 52 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/18/1618/7
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index f1dccc1..c082f51 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -1328,8 +1328,6 @@
static void
man_load_stats(struct management *man)
{
- extern counter_type link_read_bytes_global;
- extern counter_type link_write_bytes_global;
int nclients =3D 0;
if (man->persist.callback.n_clients)
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 1d3d649..53fb060 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -2689,12 +2689,12 @@
"may accept clients which do not present a certificate=
");
}
- const unsigned int tls_version_max =3D
+ const unsigned int tls_ver_max =3D
(options->ssl_flags >> SSLF_TLS_VERSION_MAX_SHIFT) & SSLF_TLS_VERS=
ION_MAX_MASK;
- const unsigned int tls_version_min =3D
+ const unsigned int tls_ver_min =3D
(options->ssl_flags >> SSLF_TLS_VERSION_MIN_SHIFT) & SSLF_TLS_VERS=
ION_MIN_MASK;
- if (tls_version_max > 0 && tls_version_max < tls_version_min)
+ if (tls_ver_max > 0 && tls_ver_max < tls_ver_min)
{
msg(M_USAGE, "--tls-version-min bigger than --tls-version-max");
}
@@ -3641,16 +3641,16 @@
{
struct dns_domain **entry =3D &dns->search_domains;
ALLOC_OBJ_CLEAR_GC(*entry, struct dns_domain, &dns->gc);
- struct dns_domain *new =3D *entry;
- new->name =3D dhcp->domain;
- entry =3D &new->next;
+ struct dns_domain *domain =3D *entry;
+ domain->name =3D dhcp->domain;
+ entry =3D &domain->next;
for (unsigned int i =3D 0; i < dhcp->domain_search_list_len; +=
+i)
{
ALLOC_OBJ_CLEAR_GC(*entry, struct dns_domain, &dns->gc);
- struct dns_domain *new =3D *entry;
- new->name =3D dhcp->domain_search_list[i];
- entry =3D &new->next;
+ struct dns_domain *search_domain =3D *entry;
+ search_domain->name =3D dhcp->domain_search_list[i];
+ entry =3D &search_domain->next;
}
struct dns_server *server =3D dns_server_get(&dns->servers, 0,=
&dns->gc);
@@ -3743,7 +3743,6 @@
static void
options_postprocess_mutate(struct options *o, struct env_set *es)
{
- int i;
/*
* Process helper-type options which map to other, more complex
* sequences of options.
@@ -3776,7 +3775,7 @@
* Convert remotes into connection list
*/
const struct remote_list *rl =3D o->remote_list;
- for (i =3D 0; i < rl->len; ++i)
+ for (int i =3D 0; i < rl->len; ++i)
{
const struct remote_entry *re =3D rl->array[i];
struct connection_entry ce =3D o->ce;
@@ -3798,14 +3797,14 @@
}
ASSERT(o->connection_list);
- for (i =3D 0; i < o->connection_list->len; ++i)
+ for (int i =3D 0; i < o->connection_list->len; ++i)
{
options_postprocess_mutate_ce(o, o->connection_list->array[i]);
}
=20
if (o->ce.local_list)
{
- for (i =3D 0; i < o->ce.local_list->len; i++)
+ for (int i =3D 0; i < o->ce.local_list->len; i++)
{
options_postprocess_mutate_le(&o->ce, o->ce.local_list->array[=
i], o->mode);
}
@@ -3833,7 +3832,7 @@
}
/* use the same listen list for every outgoing connection */
- for (i =3D 0; i < o->connection_list->len; ++i)
+ for (int i =3D 0; i < o->connection_list->len; ++i)
{
o->connection_list->array[i]->local_list =3D o->ce.local_list;
}
diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c
index c3f54ed..57afacd 100644
--- a/src/openvpn/ps.c
+++ b/src/openvpn/ps.c
@@ -863,8 +863,8 @@
set_cloexec(fd[0]);
=20
/* wait for background child process to initialize */
- int status =3D recv_control(fd[0]);
- if (status =3D=3D RESPONSE_INIT_SUCCEEDED)
+ int recv_status =3D recv_control(fd[0]);
+ if (recv_status =3D=3D RESPONSE_INIT_SUCCEEDED)
{
/* note that this will cause possible EAGAIN when writing to
* control socket if proxy process is backlogged */
diff --git a/src/openvpn/push.c b/src/openvpn/push.c
index 564ce86..ae0f0e2 100644
--- a/src/openvpn/push.c
+++ b/src/openvpn/push.c
@@ -994,10 +994,10 @@
else if (tls_authentication_status(c->c2.tls_multi) =3D=3D TLS_AUTHENT=
ICATION_SUCCEEDED
&& c->c2.tls_multi->multi_state >=3D CAS_CONNECT_DONE)
{
- time_t now;
+ time_t local_now;
- openvpn_time(&now);
- if (c->c2.sent_push_reply_expiry > now)
+ openvpn_time(&local_now);
+ if (c->c2.sent_push_reply_expiry > local_now)
{
ret =3D PUSH_MSG_ALREADY_REPLIED;
}
@@ -1011,7 +1011,7 @@
if (send_push_reply(c, &push_list))
{
ret =3D PUSH_MSG_REQUEST;
- c->c2.sent_push_reply_expiry =3D now + 30;
+ c->c2.sent_push_reply_expiry =3D local_now + 30;
}
gc_free(&gc);
}
diff --git a/src/openvpn/tls_crypt.c b/src/openvpn/tls_crypt.c
index e91f80c..4f9d218 100644
--- a/src/openvpn/tls_crypt.c
+++ b/src/openvpn/tls_crypt.c
@@ -769,24 +769,24 @@
}
/* Sanity check: load client key (as "client") */
- struct key_ctx_bi test_client_key;
- struct buffer test_wrapped_client_key;
+ struct key_ctx_bi check_client_key;
+ struct buffer check_wrapped_client_key;
struct key2 keydata;
msg(D_GENKEY, "Testing client-side key loading...");
- tls_crypt_v2_init_client_key(&test_client_key, &keydata, &test_wrapped=
_client_key, client_file,
+ tls_crypt_v2_init_client_key(&check_client_key, &keydata, &check_wrapp=
ed_client_key, client_file,
client_inline);
- free_key_ctx_bi(&test_client_key);
+ free_key_ctx_bi(&check_client_key);
/* Sanity check: unwrap and load client key (as "server") */
- struct buffer test_metadata =3D alloc_buf_gc(TLS_CRYPT_V2_MAX_METADATA=
_LEN, &gc);
- struct key2 test_client_key2 =3D { 0 };
+ struct buffer check_metadata =3D alloc_buf_gc(TLS_CRYPT_V2_MAX_METADAT=
A_LEN, &gc);
+ struct key2 check_client_key2 =3D { 0 };
free_key_ctx(&server_key);
tls_crypt_v2_init_server_key(&server_key, false, server_key_file, serv=
er_key_inline);
msg(D_GENKEY, "Testing server-side key loading...");
- ASSERT(tls_crypt_v2_unwrap_client_key(&test_client_key2, &test_metadat=
a,
- test_wrapped_client_key, &server=
_key));
- secure_memzero(&test_client_key2, sizeof(test_client_key2));
- free_buf(&test_wrapped_client_key);
+ ASSERT(tls_crypt_v2_unwrap_client_key(&check_client_key2, &check_metad=
ata,
+ check_wrapped_client_key, &serve=
r_key));
+ secure_memzero(&check_client_key2, sizeof(check_client_key2));
+ free_buf(&check_wrapped_client_key);
cleanup:
secure_memzero(&client_key, sizeof(client_key));
diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c
index 473a8d3..ace25b9 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv/interactive.c
@@ -540,19 +540,19 @@
static DWORD
InterfaceLuid(const char *iface_name, PNET_LUID luid)
{
- NETIO_STATUS status;
+ NETIO_STATUS convert_status;
LPWSTR wide_name =3D utf8to16(iface_name);
if (wide_name)
{
- status =3D ConvertInterfaceAliasToLuid(wide_name, luid);
+ convert_status =3D ConvertInterfaceAliasToLuid(wide_name, luid);
free(wide_name);
}
else
{
- status =3D ERROR_OUTOFMEMORY;
+ convert_status =3D ERROR_OUTOFMEMORY;
}
- return status;
+ return convert_status;
}
static BOOL
@@ -1174,8 +1174,8 @@
goto out;
}
- SERVICE_STATUS status;
- if (ControlService(dnssvc, SERVICE_CONTROL_PARAMCHANGE, &status) =3D=
=3D 0)
+ SERVICE_STATUS control_status;
+ if (ControlService(dnssvc, SERVICE_CONTROL_PARAMCHANGE, &control_statu=
s) =3D=3D 0)
{
MsgToEventLog(M_ERR, L"%S: ControlService call failed (%lu)", __fu=
nc__, GetLastError());
goto out;
@@ -3644,12 +3644,12 @@
static DWORD WINAPI
ServiceCtrlInteractive(DWORD ctrl_code, DWORD event, LPVOID data, LPVOID c=
tx)
{
- SERVICE_STATUS *status =3D ctx;
+ SERVICE_STATUS *svc_status =3D ctx;
switch (ctrl_code)
{
case SERVICE_CONTROL_STOP:
- status->dwCurrentState =3D SERVICE_STOP_PENDING;
- ReportStatusToSCMgr(service, status);
+ svc_status->dwCurrentState =3D SERVICE_STOP_PENDING;
+ ReportStatusToSCMgr(service, svc_status);
if (exit_event)
{
SetEvent(exit_event);
diff --git a/tests/unit_tests/openvpn/test_dhcp.c b/tests/unit_tests/openvp=
n/test_dhcp.c
index 150a3aa..104fc9a 100644
--- a/tests/unit_tests/openvpn/test_dhcp.c
+++ b/tests/unit_tests/openvpn/test_dhcp.c
@@ -55,8 +55,8 @@
{
struct gc_arena gc =3D gc_new();
struct buffer out_buf =3D alloc_buf_gc(512, &gc);
- struct buffer clear_buf =3D alloc_buf_gc(512, &gc);
- buf_clear(&clear_buf);
+ struct buffer clean_buf =3D alloc_buf_gc(512, &gc);
+ buf_clear(&clean_buf);
bool error =3D false;
#define LONGDOMAIN "a-reaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa=
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa=
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa=
aaaaaaaaaaaaaaaaally-long-domain"
@@ -79,7 +79,7 @@
struct buffer small_buf =3D alloc_buf_gc(sizeof(output_1) - 1, &gc);
buf_clear(&small_buf);
write_dhcp_search_str(&small_buf, DHCP_DOMAIN_SEARCH, search_list, 2, =
&error);
- assert_memory_equal(BPTR(&small_buf), BPTR(&clear_buf), buf_forward_ca=
pacity_total(&small_buf));
+ assert_memory_equal(BPTR(&small_buf), BPTR(&clean_buf), buf_forward_ca=
pacity_total(&small_buf));
assert_true(error);
error =3D false;
@@ -103,13 +103,13 @@
buf_clear(&out_buf);
write_dhcp_search_str(&out_buf, DHCP_DOMAIN_SEARCH, search_list + 5, 1=
, &error);
- assert_memory_equal(BPTR(&out_buf), BPTR(&clear_buf), buf_forward_capa=
city_total(&clear_buf));
+ assert_memory_equal(BPTR(&out_buf), BPTR(&clean_buf), buf_forward_capa=
city_total(&clean_buf));
assert_true(error);
error =3D false;
buf_clear(&out_buf);
write_dhcp_search_str(&out_buf, DHCP_DOMAIN_SEARCH, search_list, 3, &e=
rror);
- assert_memory_equal(BPTR(&out_buf), BPTR(&clear_buf), buf_forward_capa=
city_total(&clear_buf));
+ assert_memory_equal(BPTR(&out_buf), BPTR(&clean_buf), buf_forward_capa=
city_total(&clean_buf));
assert_true(error);
error =3D false;
diff --git a/tests/unit_tests/openvpn/test_push_update_msg.c b/tests/unit_t=
ests/openvpn/test_push_update_msg.c
index 219b476..eb5b22c 100644
--- a/tests/unit_tests/openvpn/test_push_update_msg.c
+++ b/tests/unit_tests/openvpn/test_push_update_msg.c
@@ -350,8 +350,8 @@
/* Message 1: first batch of routes, continuation 2 (more coming) */
struct buffer buf1 =3D alloc_buf(512);
- const char *msg1 =3D "PUSH_UPDATE, route 10.1.0.0 255.255.0.0, route 1=
0.2.0.0 255.255.0.0, route 10.3.0.0 255.255.0.0,push-continuation 2";
- buf_write(&buf1, msg1, strlen(msg1));
+ const char *cmsg1 =3D "PUSH_UPDATE, route 10.1.0.0 255.255.0.0, route =
10.2.0.0 255.255.0.0, route 10.3.0.0 255.255.0.0,push-continuation 2";
+ buf_write(&buf1, cmsg1, strlen(cmsg1));
assert_int_equal(process_incoming_push_msg(c, &buf1, c->options.pull, =
pull_permission_mask(c),
&option_types_found),
@@ -360,8 +360,8 @@
/* Message 2: more routes, continuation 2 (more coming) */
struct buffer buf2 =3D alloc_buf(512);
- const char *msg2 =3D "PUSH_UPDATE, route 10.4.0.0 255.255.0.0, route 1=
0.5.0.0 255.255.0.0, route 10.6.0.0 255.255.0.0,push-continuation 2";
- buf_write(&buf2, msg2, strlen(msg2));
+ const char *cmsg2 =3D "PUSH_UPDATE, route 10.4.0.0 255.255.0.0, route =
10.5.0.0 255.255.0.0, route 10.6.0.0 255.255.0.0,push-continuation 2";
+ buf_write(&buf2, cmsg2, strlen(cmsg2));
assert_int_equal(process_incoming_push_msg(c, &buf2, c->options.pull, =
pull_permission_mask(c),
&option_types_found),
@@ -370,8 +370,8 @@
/* Message 3: final batch of routes, continuation 1 (last message) */
struct buffer buf3 =3D alloc_buf(512);
- const char *msg3 =3D "PUSH_UPDATE, route 10.7.0.0 255.255.0.0, route 1=
0.8.0.0 255.255.0.0, route 10.9.0.0 255.255.0.0,push-continuation 1";
- buf_write(&buf3, msg3, strlen(msg3));
+ const char *cmsg3 =3D "PUSH_UPDATE, route 10.7.0.0 255.255.0.0, route =
10.8.0.0 255.255.0.0, route 10.9.0.0 255.255.0.0,push-continuation 1";
+ buf_write(&buf3, cmsg3, strlen(cmsg3));
assert_int_equal(process_incoming_push_msg(c, &buf3, c->options.pull, =
pull_permission_mask(c),
&option_types_found),
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1618?usp=3Demail
To unsubscribe, or for help writing mail filters, visit http://gerrit.openv=
pn.net/settings?usp=3Demail
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I528f5fd200d877841e473e5e05b7ac7915fa2e33
Gerrit-Change-Number: 1618
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld
Gerrit-Reviewer: plaisthos
Gerrit-CC: openvpn-devel
Gerrit-Attention: plaisthos
--RDCjjV159dw=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is cur=
rently required from: plaisthos.
flichtenheld uploaded patch set #7 to this change.
<=
p>View C=
hange
Rename variables that shadow other variables or =
functions
Identified by cppcheck.
Change-Id: I528f5fd200d8778=
41e473e5e05b7ac7915fa2e33
Signed-off-by: Frank Lichtenheld <frank@...493...=
2641...>
---
M src/openvpn/manage.c
M src/openvpn/options.c
=
M src/openvpn/ps.c
M src/openvpn/push.c
M src/openvpn/tls_crypt.c
=
M src/openvpnserv/interactive.c
M tests/unit_tests/openvpn/test_dhcp.cM tests/unit_tests/openvpn/test_push_update_msg.c
8 files changed, 49 =
insertions(+), 52 deletions(-)
git pull ssh://ge=
rrit.openvpn.net:29418/openvpn refs/changes/18/1618/7
diff --git a/=
src/openvpn/manage.c b/src/openvpn/manage.c
index f1dccc1..=
c082f51 100644
--- a/src/openvpn/manage.c
+=
++ b/src/openvpn/manage.c
@@ -1328,8 +1328,6 @@
<=
span> static void
man_load_stats(struct management *man)=
span>
{
- =
extern counter_type link_read_bytes_global;
- extern counter_type link_write_bytes_global;
int nclients =3D 0;
=
if (man->persist.callback.n_clients)
diff --git a/src/o=
penvpn/options.c b/src/openvpn/options.c
index 1d3d649..53f=
b060 100644
--- a/src/openvpn/options.c
+++=
b/src/openvpn/options.c
@@ -2689,12 +2689,12 @@
=
"may accept clients which do not present a =
certificate");
}
- const unsigned int tls_version_m=
ax =3D
+ const uns=
igned int tls_ver_max =3D
(options->ssl_flags &=
gt;> SSLF_TLS_VERSION_MAX_SHIFT) & SSLF_TLS_VERSION_MAX_MASK;=
- const unsigned int tls_v=
ersion_min =3D
+ c=
onst unsigned int tls_ver_min =3D
(options->ssl=
_flags >> SSLF_TLS_VERSION_MIN_SHIFT) & SSLF_TLS_VERSION_MIN_MASK=
;
- =
if (tls_version_max > 0 && tls_version_max < tls_version_mi=
n)
+ if (tls_ver_m=
ax > 0 && tls_ver_max < tls_ver_min)
{=
span>
msg(M_USAGE, "--tls-version-min bigger than --=
tls-version-max");
}
@@ -3641,16 =
+3641,16 @@
{
struct =
dns_domain **entry =3D &dns->search_domains;
=
ALLOC_OBJ_CLEAR_GC(*entry, struct dns_domain, &dns->gc);
- struct dns_doma=
in *new =3D *entry;
- =
new->name =3D dhcp->domain;
- entry =3D &new->next;
+ struct dns_domain *d=
omain =3D *entry;
+ =
domain->name =3D dhcp->domain;
+ entry =3D &domain->next;
for (unsigned int i =3D 0; i <=
; dhcp->domain_search_list_len; ++i)
{
ALLOC_OBJ_CLEAR_GC(*entry, struct dns_domain, =
&dns->gc);
- =
struct dns_domain *new =3D *entry;
- new->name =3D dhcp->domain_s=
earch_list[i];
- =
entry =3D &new->next;
+ struct dns_domain *search_domain =3D *ent=
ry;
+ =
search_domain->name =3D dhcp->domain_search_list[i];
+ entry =3D &searc=
h_domain->next;
}
<=
br> struct dns_server *server =3D dns_server_get(&dns=
->servers, 0, &dns->gc);
@@ -3743,7 +3743,6 @@
static void
options_postprocess_mutate(stru=
ct options *o, struct env_set *es)
{
- int i;
/* * Process helper-type options which map to other, more comple=
x
* sequences of options.
@@ -3776,7 =
+3775,7 @@
* Convert remotes into connection list=
*/
const struct remote_=
list *rl =3D o->remote_list;
- for (i =3D 0; i < rl->len; ++i)
+ for (int i =3D 0; i < rl->=
;len; ++i)
{
const st=
ruct remote_entry *re =3D rl->array[i];
str=
uct connection_entry ce =3D o->ce;
@@ -3798,14 +3797,14 =
@@
}
ASSERT(o-&=
gt;connection_list);
- =
for (i =3D 0; i < o->connection_list->len; ++i)
+ for (int i =3D 0; i < o->=
connection_list->len; ++i)
{
=
options_postprocess_mutate_ce(o, o->connection_list->array[i]);
}
if (o->ce.lo=
cal_list)
{
- for (i =3D 0; i < o->ce.local_list->len; i++)=
span>
+ for (int i =
=3D 0; i < o->ce.local_list->len; i++)
{<=
/span>
options_postprocess_mutate_le(&o->ce, o=
->ce.local_list->array[i], o->mode);
}
@@ -3833,7 +3832,7 @@
}
=
/* use the same listen list for every outgoing conne=
ction */
- for (i =
=3D 0; i < o->connection_list->len; ++i)
+ for (int i =3D 0; i < o->connection=
_list->len; ++i)
{
o->c=
onnection_list->array[i]->local_list =3D o->ce.local_list;<=
br> }
diff --git a/src/openvpn/ps.c b/src/openvpn=
/ps.c
index c3f54ed..57afacd 100644
--- a/s=
rc/openvpn/ps.c
+++ b/src/openvpn/ps.c
@@ -=
863,8 +863,8 @@
set_cloexec(fd[0]);
/* wait for background child process to initia=
lize */
- int st=
atus =3D recv_control(fd[0]);
- if (status =3D=3D RESPONSE_INIT_SUCCEEDED)
+ int recv_status =3D recv_con=
trol(fd[0]);
+ =
if (recv_status =3D=3D RESPONSE_INIT_SUCCEEDED)
{=
/* note that this will cause possible EAGAIN =
when writing to
* control socket if proxy pro=
cess is backlogged */
diff --git a/src/openvpn/push.c b/src=
/openvpn/push.c
index 564ce86..ae0f0e2 100644
--- a/src/openvpn/push.c
+++ b/src/openvpn/push.c=
@@ -994,10 +994,10 @@
else if (tls_authentic=
ation_status(c->c2.tls_multi) =3D=3D TLS_AUTHENTICATION_SUCCEEDED=
&& c->c2.tls_multi->multi_state >=
=3D CAS_CONNECT_DONE)
{
- time_t now;
+ time_t local_now;
- openvpn_time(&now)=
;
- if (c->c2=
.sent_push_reply_expiry > now)
+ openvpn_time(&local_now);
+ if (c->c2.sent_push_reply_expi=
ry > local_now)
{
=
ret =3D PUSH_MSG_ALREADY_REPLIED;
}
@@ -1011,7 +1011,7 @@
if (send_push_reply(c,=
&push_list))
{
=
ret =3D PUSH_MSG_REQUEST;
- c->c2.sent_push_reply_expiry =3D now + 30;
+ c->=
c2.sent_push_reply_expiry =3D local_now + 30;
=
}
gc_free(&gc);
}=
diff --git a/src/openvpn/tls_crypt.c b/src/openvpn/tls_cry=
pt.c
index e91f80c..4f9d218 100644
--- a/sr=
c/openvpn/tls_crypt.c
+++ b/src/openvpn/tls_crypt.c<=
br>@@ -769,24 +769,24 @@
}
/* Sanity check: load client key (as "client") =
*/
- struct key_ctx_=
bi test_client_key;
- =
struct buffer test_wrapped_client_key;
+ struct key_ctx_bi check_client_key;
+ struct buffer check_wrapped_cl=
ient_key;
struct key2 keydata;
ms=
g(D_GENKEY, "Testing client-side key loading...");
- tls_crypt_v2_init_client_key(&am=
p;test_client_key, &keydata, &test_wrapped_client_key, client_file,=
+ tls_crypt_v2_in=
it_client_key(&check_client_key, &keydata, &check_wrapped_clien=
t_key, client_file,
clien=
t_inline);
- free_ke=
y_ctx_bi(&test_client_key);
+ free_key_ctx_bi(&check_client_key);
=
span>
/* Sanity check: unwrap and load client key (as "s=
erver") */
- st=
ruct buffer test_metadata =3D alloc_buf_gc(TLS_CRYPT_V2_MAX_METADATA_LEN, &=
amp;gc);
- struct ke=
y2 test_client_key2 =3D { 0 };
+ struct buffer check_metadata =3D alloc_buf_gc(TLS_CRYPT_V2_M=
AX_METADATA_LEN, &gc);
+ struct key2 check_client_key2 =3D { 0 };
fr=
ee_key_ctx(&server_key);
tls_crypt_v2_init_server_=
key(&server_key, false, server_key_file, server_key_inline);
=
msg(D_GENKEY, "Testing server-side key loading...");=
span>
- ASSERT(tls_crypt_v2=
_unwrap_client_key(&test_client_key2, &test_metadata,
- =
test_wrapped_client_key, &server_key));
- secure_memzero(&test_client_key2, size=
of(test_client_key2));
=
- free_buf(&test_wrapped_client_key);
+ ASSERT(tls_crypt_v2_unwrap_client_key(&che=
ck_client_key2, &check_metadata,
+ check_wrapped_cl=
ient_key, &server_key));
+ secure_memzero(&check_client_key2, sizeof(check_client_key=
2));
+ free_buf(&a=
mp;check_wrapped_client_key);
cleanup:=
span>
secure_memzero(&client_key, sizeof(client_key));
diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/=
interactive.c
index 473a8d3..ace25b9 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv/=
interactive.c
@@ -540,19 +540,19 @@
static=
DWORD
InterfaceLuid(const char *iface_name, PNET_LUID lui=
d)
{
-=
NETIO_STATUS status;
+ NETIO_STATUS convert_status;
LPWSTR wide_name=
=3D utf8to16(iface_name);
if (wide_=
name)
{
- status =3D ConvertInterfaceAliasToLuid(wide_name, luid);
+ convert_status =
=3D ConvertInterfaceAliasToLuid(wide_name, luid);
=
free(wide_name);
}
else
{
- =
status =3D ERROR_OUTOFMEMORY;
+ convert_status =3D ERROR_OUTOFMEMORY;
=
}
- return status;=
+ return convert_=
status;
}
static BOOL=
span>
@@ -1174,8 +1174,8 @@
goto out;
}
- SERVICE_STATUS status;
- if (ControlService(dnssvc, SERVICE_CONTROL_PARAMCH=
ANGE, &status) =3D=3D 0)
+ SERVICE_STATUS control_status;
+ if (ControlService(dnssvc, SERVICE_CONTROL_PARA=
MCHANGE, &control_status) =3D=3D 0)
{
MsgToEventLog(M_ERR, L"%S: ControlService call failed (%l=
u)", __func__, GetLastError());
goto out;
@@ -3644,12 +3644,12 @@
static DWORD WINAPI=
span>
ServiceCtrlInteractive(DWORD ctrl_code, DWORD event, LPVOID=
data, LPVOID ctx)
{
- SERVICE_STATUS *status =3D ctx;
+ SERVICE_STATUS *svc_status =3D ctx;=
span>
switch (ctrl_code)
{
case SERVICE_CONTROL_STOP:
- status->dwCurrentState =3D SERVICE_STOP_PEN=
DING;
- Repo=
rtStatusToSCMgr(service, status);
+ svc_status->dwCurrentState =3D SERVICE_STOP_PE=
NDING;
+ R=
eportStatusToSCMgr(service, svc_status);
if (e=
xit_event)
{
=
SetEvent(exit_event);
diff --git a/tests/unit_tests/openvpn=
/test_dhcp.c b/tests/unit_tests/openvpn/test_dhcp.c
index 1=
50a3aa..104fc9a 100644
--- a/tests/unit_tests/openvpn/test_=
dhcp.c
+++ b/tests/unit_tests/openvpn/test_dhcp.c
@@ -55,8 +55,8 @@
{
struct gc_=
arena gc =3D gc_new();
struct buffer out_buf =3D alloc=
_buf_gc(512, &gc);
=
- struct buffer clear_buf =3D alloc_buf_gc(512, &gc);
- buf_clear(&clear_buf);
+ struct buffer clean_b=
uf =3D alloc_buf_gc(512, &gc);
+ buf_clear(&clean_buf);
bool err=
or =3D false;
#define LONGDOMAIN "a=
-reaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa=
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa=
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaally-l=
ong-domain"
@@ -79,7 +79,7 @@
str=
uct buffer small_buf =3D alloc_buf_gc(sizeof(output_1) - 1, &gc);
buf_clear(&small_buf);
write_dhcp_=
search_str(&small_buf, DHCP_DOMAIN_SEARCH, search_list, 2, &error);=
- assert_memory_equ=
al(BPTR(&small_buf), BPTR(&clear_buf), buf_forward_capacity_total(&=
amp;small_buf));
+ =
assert_memory_equal(BPTR(&small_buf), BPTR(&clean_buf), buf_forwar=
d_capacity_total(&small_buf));
assert_true(error);=
error =3D false;
@@=
-103,13 +103,13 @@
buf_clear(&o=
ut_buf);
write_dhcp_search_str(&out_buf, DHCP_DOMA=
IN_SEARCH, search_list + 5, 1, &error);
- assert_memory_equal(BPTR(&out_buf), BPTR(&=
;clear_buf), buf_forward_capacity_total(&clear_buf));
+ assert_memory_equal(BPTR(&out=
_buf), BPTR(&clean_buf), buf_forward_capacity_total(&clean_buf));=
span>
assert_true(error);
error =3D fals=
e;
buf_clear(&out_buf); write_dhcp_search_str(&out_buf, DHCP_DOMAIN_SEARCH, search=
_list, 3, &error);
=
- assert_memory_equal(BPTR(&out_buf), BPTR(&clear_buf), buf_forw=
ard_capacity_total(&clear_buf));
+ assert_memory_equal(BPTR(&out_buf), BPTR(&clea=
n_buf), buf_forward_capacity_total(&clean_buf));
a=
ssert_true(error);
error =3D false;
<=
/span>
diff --git a/tests/unit_tests/openvpn/test_push_update_msg.=
c b/tests/unit_tests/openvpn/test_push_update_msg.c
index 2=
19b476..eb5b22c 100644
--- a/tests/unit_tests/openvpn/test_=
push_update_msg.c
+++ b/tests/unit_tests/openvpn/test_push_=
update_msg.c
@@ -350,8 +350,8 @@
/* Message 1: first batch of routes, continuation 2 (more comi=
ng) */
struct buffer buf1 =3D alloc_buf(512);- const char *msg1 =3D "=
;PUSH_UPDATE, route 10.1.0.0 255.255.0.0, route 10.2.0.0 255.255.0.0, route=
10.3.0.0 255.255.0.0,push-continuation 2";
- buf_write(&buf1, msg1, strlen(msg1));
+ const char *cmsg1 =
=3D "PUSH_UPDATE, route 10.1.0.0 255.255.0.0, route 10.2.0.0 255.255.0=
.0, route 10.3.0.0 255.255.0.0,push-continuation 2";
+ buf_write(&buf1, cmsg1, strle=
n(cmsg1));
assert_int_equal(process_=
incoming_push_msg(c, &buf1, c->options.pull, pull_permission_mask(c)=
,
&opti=
on_types_found),
@@ -360,8 +360,8 @@
/* Message 2: more routes, continuation 2 (more coming) */=
struct buffer buf2 =3D alloc_buf(512);
- const char *msg2 =3D "PUSH_=
UPDATE, route 10.4.0.0 255.255.0.0, route 10.5.0.0 255.255.0.0, route 10.6.=
0.0 255.255.0.0,push-continuation 2";
- buf_write(&buf2, msg2, strlen(msg2));+ const char *cmsg2 =3D &q=
uot;PUSH_UPDATE, route 10.4.0.0 255.255.0.0, route 10.5.0.0 255.255.0.0, ro=
ute 10.6.0.0 255.255.0.0,push-continuation 2";
+ buf_write(&buf2, cmsg2, strlen(cm=
sg2));
assert_int_equal(process_inco=
ming_push_msg(c, &buf2, c->options.pull, pull_permission_mask(c),
&option_t=
ypes_found),
@@ -370,8 +370,8 @@
/* Message 3: final batch of routes, continuation 1 (last mess=
age) */
struct buffer buf3 =3D alloc_buf(512);<=
br>- const char *msg3 =3D &quo=
t;PUSH_UPDATE, route 10.7.0.0 255.255.0.0, route 10.8.0.0 255.255.0.0, rout=
e 10.9.0.0 255.255.0.0,push-continuation 1";
- buf_write(&buf3, msg3, strlen(msg3));=
span>
+ const char *cmsg3=
=3D "PUSH_UPDATE, route 10.7.0.0 255.255.0.0, route 10.8.0.0 255.255.=
0.0, route 10.9.0.0 255.255.0.0,push-continuation 1";
+ buf_write(&buf3, cmsg3, strl=
en(cmsg3));
assert_int_equal(process=
_incoming_push_msg(c, &buf3, c->options.pull, pull_permission_mask(c=
),
&opt=
ion_types_found),
To view, visit change 1618. To unsubscribe, or for help writing mail filters, visit settings.
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I528f5fd200d877841e473e5e05b=
7ac7915fa2e33
Gerrit-Change-Number: 1618
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <frank@...2723...=
.>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...=
.1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...=
ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...=
..1227...>
=
--RDCjjV159dw=--