Peer-id might change on restart and this should not trigger reopening
tun.

Trac #649
---
 src/openvpn/push.c | 38 ++++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 14 deletions(-)

diff --git a/src/openvpn/push.c b/src/openvpn/push.c
index 71f39c1..6feaa2a 100644
--- a/src/openvpn/push.c
+++ b/src/openvpn/push.c
@@ -473,20 +473,30 @@ process_incoming_push_msg (struct context *c,
                                  permission_mask,
                                  option_types_found,
                                  c->c2.es))
-           switch (c->options.push_continuation)
-             {
-             case 0:
-             case 1:
-               md5_state_update (&c->c2.pulled_options_state, BPTR(&buf_orig), 
BLEN(&buf_orig));
-               md5_state_final (&c->c2.pulled_options_state, 
&c->c2.pulled_options_digest);
-               c->c2.pulled_options_md5_init_done = false;
-               ret = PUSH_MSG_REPLY;
-               break;
-             case 2:
-               md5_state_update (&c->c2.pulled_options_state, BPTR(&buf_orig), 
BLEN(&buf_orig));
-               ret = PUSH_MSG_CONTINUATION;
-               break;
-             }
+           {
+             char line[OPTION_PARM_SIZE];
+             while (buf_parse (&buf_orig, ',', line, sizeof (line)))
+               {
+                 /* peer-id might change on restart and this should not 
trigger reopening tun */
+                 if (strstr (line, "peer-id ") != line)
+                   {
+                     md_ctx_update (&c->c2.pulled_options_state, (const 
uint8_t *) line, strlen(line));
+                   }
+               }
+             switch (c->options.push_continuation)
+               {
+                 case 0:
+                 case 1:
+                   md_ctx_final (&c->c2.pulled_options_state, 
c->c2.pulled_options_digest.digest);
+                   md_ctx_cleanup (&c->c2.pulled_options_state);
+                   c->c2.pulled_options_md5_init_done = false;
+                   ret = PUSH_MSG_REPLY;
+                   break;
+                 case 2:
+                   ret = PUSH_MSG_CONTINUATION;
+                   break;
+               }
+           }
        }
       else if (ch == '\0')
        {
-- 
1.9.1


------------------------------------------------------------------------------
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to