Attention is currently required from: Arne Schwabe.

Hello Arne Schwabe,

I'd like you to do a code review.
Please visit

    https://gerrit.openvpn.net/c/openvpn/+/2174?usp=email

to review the following change.


Change subject: openvpnserv: don't leave stale domains in unused NRPT exclude 
slot
......................................................................

openvpnserv: don't leave stale domains in unused NRPT exclude slot

GetNrptExcludeData() fills data[i].domains before it knows whether the
interface will be used. If the interface is then skipped, because it
has no name servers or reading them fails, i is not advanced and the
domains stay in data[i] until the next interface overwrites them.

When the skipped interface is the last one enumerated, nothing
overwrites them. SetNrptExcludeRules() stops at the first entry with
domains_size == 0, so it then creates an exclude rule from the stale
domains, with an empty or incomplete name server list.

Clear domains_size of the unused slot on the way out.

Broken since 0f3b7d17 ("win: implement --dns option support with
NRPT").

Change-Id: Ia99aacf7ad7b6863b2f2a7297d0229faae529d9f
Signed-off-by: Antonio Quartulli <[email protected]>
---
M src/openvpnserv/interactive.c
1 file changed, 7 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/74/2174/1

diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c
index 81205d6..ff48bb7 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv/interactive.c
@@ -2482,13 +2482,13 @@
 {
     HKEY v4_itfs = INVALID_HANDLE_VALUE;
     HKEY v6_itfs = INVALID_HANDLE_VALUE;
+    size_t i = 0;

     if (!GetInterfacesKey(AF_INET, &v4_itfs) || !GetInterfacesKey(AF_INET6, 
&v6_itfs))
     {
         goto out;
     }

-    size_t i = 0;
     DWORD enum_index = 0;
     while (i < data_size)
     {
@@ -2583,6 +2583,12 @@
     }

 out:
+    /* data[i] is not in use, but may still hold the domains of a skipped
+     * interface. Clear them, the caller stops at the first empty entry. */
+    if (i < data_size)
+    {
+        data[i].domains_size = 0;
+    }
     RegCloseKey(v6_itfs);
     RegCloseKey(v4_itfs);
 }

--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2174?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia99aacf7ad7b6863b2f2a7297d0229faae529d9f
Gerrit-Change-Number: 2174
Gerrit-PatchSet: 1
Gerrit-Owner: Antonio Quartulli <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to