Skip to contentSkip to conversation

Change in openvpn[release/2.6]: Warn user if INFO control command is too long

Openvpn-devel In review stipa (Code Review) 3 participants 7 messages Sep 11, 2023 – Sep 22, 2023 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.1694436141000.If3c27a2a2ba24f2af0e3e3c95eea57ed420b2542@...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/+/329?usp=email

to review the following change.

Change subject: Warn user if INFO control command is too long
......................................................................

Warn user if INFO control command is too long

"INFO_PRE,..." command length is limited to 256 bytes. If the server implementation pushes command which is too long, warn the user and don't send the truncated command to a management client.

Change-Id If3c27a2a2ba24f2af0e3e3c95eea57ed420b2542

---
M src/openvpn/push.c

1 file changed, 8 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/29/329/1

src/openvpn/push.c +8 -2
index d468211..19849c5 100644
@@ -244,8 +244,14 @@
          * for management greeting and we don't want to confuse the client
          */
         struct buffer out = alloc_buf_gc(256, &gc);
-        buf_printf(&out, ">%s:%s", "INFOMSG", m);
-        management_notify_generic(management, BSTR(&out));
+        if (buf_printf(&out, ">%s:%s", "INFOMSG", m))
+        {
+            management_notify_generic(management, BSTR(&out));
+        }
+        else
+        {
+            msg(D_PUSH_ERRORS, "WARNING: Received INFO command is too long, won't notify management client.");
+        }
 
         gc_free(&gc);
     }

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

Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: If3c27a2a2ba24f2af0e3e3c95eea57ed420b2542
Gerrit-Change-Number: 329
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[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: stipa.

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

Change subject: Warn user if INFO control command is too long
......................................................................

Patch Set 1: Code-Review+2

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

Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: If3c27a2a2ba24f2af0e3e3c95eea57ed420b2542
Gerrit-Change-Number: 329
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Tue, 12 Sep 2023 09:53:59 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

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

Attention is currently required from: stipa.

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

Change subject: Warn user if INFO control command is too long
......................................................................

Patch Set 1:

(1 comment)

Patchset:

PS1:
Honestly, I still prefer the original patch. But this at least gives the user a chance to notice the problem...

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

Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: If3c27a2a2ba24f2af0e3e3c95eea57ed420b2542
Gerrit-Change-Number: 329
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Tue, 12 Sep 2023 09:54:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#4 lore raw

PATCH 1/1 Warn user if INFO control command is too long

In reply to a message not in the archive

From: Lev Stipakov <[email protected]...>

"INFO_PRE,..." command length is limited to 256 bytes. If the server implementation pushes command which is too long, warn the user and don't send the truncated command to a management client.

Change-Id If3c27a2a2ba24f2af0e3e3c95eea57ed420b2542

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to release/2.6.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/329
This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>

src/openvpn/push.c +8 -2
index d468211..19849c5 100644
@@ -244,8 +244,14 @@
          * for management greeting and we don't want to confuse the client
          */
         struct buffer out = alloc_buf_gc(256, &gc);
-        buf_printf(&out, ">%s:%s", "INFOMSG", m);
-        management_notify_generic(management, BSTR(&out));
+        if (buf_printf(&out, ">%s:%s", "INFOMSG", m))
+        {
+            management_notify_generic(management, BSTR(&out));
+        }
+        else
+        {
+            msg(D_PUSH_ERRORS, "WARNING: Received INFO command is too long, won't notify management client.");
+        }
 
         gc_free(&gc);
     }
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: Warn user if INFO control command is too long

Have not tested it beyond "test compile", but change looks reasonable.

Your patch has been applied to the master and release/2.6 branch ("make things more robust").

commit df624fb6d63db6b2a3b0c40597cee74c61b8ab2c (master) commit 785b50127ecf0c440c016f85cef0c59f56894fc4 (release/2.6)

Author: Lev Stipakov
Date:   Fri Sep 22 12:50:55 2023 +0200
     Warn user if INFO control command is too long

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Frank Lichtenheld <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg27062.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

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

cron2 has uploaded a new patch set (#2) to the change originally created by stipa. ( http://gerrit.openvpn.net/c/openvpn/+/329?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld

Change subject: Warn user if INFO control command is too long
......................................................................

Warn user if INFO control command is too long

"INFO_PRE,..." command length is limited to 256 bytes. If the server implementation pushes command which is too long, warn the user and don't send the truncated command to a management client.

Change-Id If3c27a2a2ba24f2af0e3e3c95eea57ed420b2542

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg27062.html

(cherry picked from commit df624fb6d63db6b2a3b0c40597cee74c61b8ab2c)

---
M src/openvpn/push.c

1 file changed, 8 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/29/329/2

src/openvpn/push.c +8 -2
index d468211..19849c5 100644
@@ -244,8 +244,14 @@
          * for management greeting and we don't want to confuse the client
          */
         struct buffer out = alloc_buf_gc(256, &gc);
-        buf_printf(&out, ">%s:%s", "INFOMSG", m);
-        management_notify_generic(management, BSTR(&out));
+        if (buf_printf(&out, ">%s:%s", "INFOMSG", m))
+        {
+            management_notify_generic(management, BSTR(&out));
+        }
+        else
+        {
+            msg(D_PUSH_ERRORS, "WARNING: Received INFO command is too long, won't notify management client.");
+        }
 
         gc_free(&gc);
     }
Signature · 12 lines
To view, visit http://gerrit.openvpn.net/c/openvpn/+/329?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: If3c27a2a2ba24f2af0e3e3c95eea57ed420b2542
Gerrit-Change-Number: 329
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
#7 lore raw
In reply to a message not in the archive

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

Change subject: Warn user if INFO control command is too long
......................................................................

Warn user if INFO control command is too long

"INFO_PRE,..." command length is limited to 256 bytes. If the server implementation pushes command which is too long, warn the user and don't send the truncated command to a management client.

Change-Id If3c27a2a2ba24f2af0e3e3c95eea57ed420b2542

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg27062.html

(cherry picked from commit df624fb6d63db6b2a3b0c40597cee74c61b8ab2c)

---
M src/openvpn/push.c

1 file changed, 8 insertions(+), 2 deletions(-)
src/openvpn/push.c +8 -2
index d468211..19849c5 100644
@@ -244,8 +244,14 @@
          * for management greeting and we don't want to confuse the client
          */
         struct buffer out = alloc_buf_gc(256, &gc);
-        buf_printf(&out, ">%s:%s", "INFOMSG", m);
-        management_notify_generic(management, BSTR(&out));
+        if (buf_printf(&out, ">%s:%s", "INFOMSG", m))
+        {
+            management_notify_generic(management, BSTR(&out));
+        }
+        else
+        {
+            msg(D_PUSH_ERRORS, "WARNING: Received INFO command is too long, won't notify management client.");
+        }
 
         gc_free(&gc);
     }

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

Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: If3c27a2a2ba24f2af0e3e3c95eea57ed420b2542
Gerrit-Change-Number: 329
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged