]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
client-connect: Use inotify for the deferred client-connect status file
authorArne Schwabe <arne@rfc2549.org>
Sun, 19 Jul 2020 17:34:34 +0000 (19:34 +0200)
committerGert Doering <gert@greenie.muc.de>
Sun, 19 Jul 2020 20:07:02 +0000 (22:07 +0200)
As we never do client-connect and authentication at the same time
it is safe to reuse the existing fields for client-connect return
status file

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20200719173436.16431-3-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20481.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/multi.c

index 378becdc52eb043916513f2e1dcc6ede89d4b8f3..08112c98fa2f1a1d3a281c977be34df4c456df9f 100644 (file)
@@ -2600,8 +2600,10 @@ multi_connection_established(struct multi_context *m, struct multi_instance *mi)
 
 #ifdef ENABLE_ASYNC_PUSH
 /*
- * Called when inotify event is fired, which happens when acf file is closed or deleted.
- * Continues authentication and sends push_reply.
+ * Called when inotify event is fired, which happens when acf
+ * or connect-status file is closed or deleted.
+ * Continues authentication and sends push_reply
+ * (or be deferred again by client-connect)
  */
 void
 multi_process_file_closed(struct multi_context *m, const unsigned int mpp_flags)
@@ -2887,7 +2889,15 @@ multi_process_post(struct multi_context *m, struct multi_instance *mi, const uns
             {
                 multi_connection_established(m, mi);
             }
-
+#if defined(ENABLE_ASYNC_PUSH) && defined(ENABLE_DEF_AUTH)
+            if (is_cas_pending(mi->context.c2.context_auth)
+                && mi->client_connect_defer_state.deferred_ret_file)
+            {
+                add_inotify_file_watch(m, mi, m->top.c2.inotify_fd,
+                                       mi->client_connect_defer_state.
+                                       deferred_ret_file);
+            }
+#endif
             /* tell scheduler to wake us up at some point in the future */
             multi_schedule_context_wakeup(m, mi);
         }