Skip to contentSkip to conversation

Change in openvpn[master]: Allow having an extra function that is called when an env is freed

Openvpn-devel plaisthos (Code Review) 1 participant 4 messages Jan 2, 2024 – Mar 8, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1704203193000.I6899c1af65fbd670d434cdb17f81c82b900bfbd4@...2715...

#1 lore raw

Attention is currently required from: flichtenheld.

Hello flichtenheld,

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

    http://gerrit.openvpn.net/c/openvpn/+/486?usp=email

to review the following change.

Change subject: Allow having an extra function that is called when an env is freed
......................................................................

Allow having an extra function that is called when an env is freed

Change-Id I6899c1af65fbd670d434cdb17f81c82b900bfbd4

---
M CMakeLists.txt
M src/openvpn/env_set.c
M src/openvpn/env_set.h
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_buffer.c

5 files changed, 106 insertions(+), 7 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/86/486/1

CMakeLists.txt +1 -0
index 96328a1..04e9e34 100644
@@ -685,6 +685,7 @@
 
     target_sources(test_buffer PRIVATE
         tests/unit_tests/openvpn/mock_get_random.c
+        src/openvpn/env_set.c
         )
 
     target_sources(test_crypto PRIVATE
src/openvpn/env_set.c +47 -7

98 lines not on this page · raw message

src/openvpn/env_set.h +6 -0
index 4599977..27bc4dd 100644
@@ -36,6 +36,7 @@
 
 struct env_item {
     char *string;
+    void (*free_function)(struct env_item *);
     struct env_item *next;
 };
 
@@ -87,6 +88,11 @@
 
 void env_set_add(struct env_set *es, const char *str);
 
+void
+env_set_add_specialfree(struct env_set *es, const char *str,
+                        void (*free_function)(struct env_item *));
+
+
 const char *env_set_get(const struct env_set *es, const char *name);
 
 void env_set_print(int msglevel, const struct env_set *es);
tests/unit_tests/openvpn/Makefile.am +1 -0
index 6667626..c5098a9 100644
@@ -52,6 +52,7 @@
 buffer_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn -Wl,--wrap=parse_line
 buffer_testdriver_SOURCES = test_buffer.c mock_msg.c mock_msg.h \
 	mock_get_random.c \
+	$(top_srcdir)/src/openvpn/env_set.c \
 	$(top_srcdir)/src/openvpn/win32-util.c \
 	$(top_srcdir)/src/openvpn/platform.c
 
tests/unit_tests/openvpn/test_buffer.c +51 -0

76 lines not on this page · raw message

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

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6899c1af65fbd670d434cdb17f81c82b900bfbd4
Gerrit-Change-Number: 486
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/486?usp=email )

Change subject: Allow having an extra function that is called when an env is freed
......................................................................

Patch Set 1:

(1 comment)

Patchset:

PS1:
From a cursory glance, the code looks OK. I'm not sure if we want it, though, as it adds even more complexity to the env handling.

For "we only want that for --tls-export-cert so the cert files +env produced are cumulative and the last call has them all", I think this is overdoing things - I do not think we had a single request to have "all certs in --tls-verify" and so balance feature <-> complexity goes more toward negative.

If this cleans up other env-set related problems, that would be a different story.

Signature · 18 lines
To view, visit http://gerrit.openvpn.net/c/openvpn/+/486?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6899c1af65fbd670d434cdb17f81c82b900bfbd4
Gerrit-Change-Number: 486
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Sat, 06 Jan 2024 16:22:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/486?usp=email )

Change subject: Allow having an extra function that is called when an env is freed
......................................................................

Patch Set 2: Code-Review-1

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

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6899c1af65fbd670d434cdb17f81c82b900bfbd4
Gerrit-Change-Number: 486
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 17 Jan 2024 07:24:21 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

cron2 has abandoned this change. ( http://gerrit.openvpn.net/c/openvpn/+/486?usp=email )

Change subject: Allow having an extra function that is called when an env is freed
......................................................................

Abandoned

The change that needs this is the one for the --tls-export-cert change which I also declared "abandoned", so let's clean this up as well. --
To view, visit http://gerrit.openvpn.net/c/openvpn/+/486?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6899c1af65fbd670d434cdb17f81c82b900bfbd4
Gerrit-Change-Number: 486
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: abandon