On 09/11/2019 16:13, Arne Schwabe wrote: > OpenVPN 3 implements these messages to send information during the > authentication to the UI, implement these message also in OpenVPN 2.x > > Signed-off-by: Arne Schwabe <a...@rfc2549.org> > --- > src/openvpn/forward.c | 8 ++++++++ > src/openvpn/push.c | 33 +++++++++++++++++++++++++++++++++ > src/openvpn/push.h | 3 +++ > 3 files changed, 44 insertions(+) > > diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c > index 8451706b..0f735384 100644 > --- a/src/openvpn/forward.c > +++ b/src/openvpn/forward.c > @@ -395,6 +395,14 @@ check_incoming_control_channel_dowork(struct context *c) > { > server_pushed_signal(c, &buf, false, 4); > } > + else if (buf_string_match_head_str(&buf, "INFO_PRE")) > + { > + server_pushed_info(c, &buf, 8); > + } > + else if (buf_string_match_head_str(&buf, "INFO")) > + { > + server_pushed_info(c, &buf, 4); > + } > else > { > msg(D_PUSH_ERRORS, "WARNING: Received unknown control > message: %s", BSTR(&buf)); > diff --git a/src/openvpn/push.c b/src/openvpn/push.c > index 368b6920..ee1cb980 100644 > --- a/src/openvpn/push.c > +++ b/src/openvpn/push.c > @@ -178,6 +178,39 @@ server_pushed_signal(struct context *c, const struct > buffer *buffer, const bool > } > } > > +void > +server_pushed_info(struct context *c, const struct buffer *buffer, > + const int adv) > +{ > + const char *m = ""; > + struct buffer buf = *buffer; > + > + if (buf_advance(&buf, adv) && buf_read_u8(&buf) == ',' && BLEN(&buf)) > + { > + m = BSTR(&buf); > + } > + > +#ifdef ENABLE_MANAGEMENT > + struct gc_arena gc; > + if (management) > + { > + gc = gc_new(); > + > + /* > + * We use >INFOMSG here instead of plain >INFO since INFO is used to > + * 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)); > + > + gc_free(&gc); > + } > + #endif
The indent of this #endif is wrong. Wouldn't harm with an "/* ENABLE_MANAGEMENT */" comment as well. This could be fixed at merge time. Otherwise, this looks good. Acked-By: David Sommerseth <dav...@openvpn.net> -- kind regards, David Sommerseth OpenVPN Inc
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel