Attention is currently required from: Arne Schwabe, Frank Lichtenheld, Răzvan
Cojocaru.
Hello Arne Schwabe, Frank Lichtenheld,
I'd like you to reexamine a change. Please visit
https://gerrit.openvpn.net/c/openvpn/+/2217?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review-1 by Frank Lichtenheld
Change subject: ssl_verify: use check_for_client_reason() in
tls_authentication_status()
......................................................................
ssl_verify: use check_for_client_reason() in tls_authentication_status()
tls_authentication_status() open-coded check_for_client_reason() for
the plugin and script auth status. Call the helper instead.
key_state_check_auth_failed_message_file() had no other caller, so
fold it into the helper.
Change-Id: Ia48c1efc9a687383a1dc87edd49d8ba3eb5a87ad
Signed-off-by: Razvan Cojocaru <[email protected]>
---
M src/openvpn/ssl_verify.c
1 file changed, 10 insertions(+), 39 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/17/2217/2
diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c
index 8641d15..f33a59c 100644
--- a/src/openvpn/ssl_verify.c
+++ b/src/openvpn/ssl_verify.c
@@ -1037,24 +1037,22 @@
}
/**
- * Checks if the auth failed reason file has any content and if yes it will
- * be returned as string allocated in gc to the caller.
- */
-static char *
-key_state_check_auth_failed_message_file(const struct auth_deferred_status
*ads,
- struct gc_arena *gc)
+ * Check if the script/plugin left a message in the auth failed message
+ * file and relay it to the user */
+static void
+check_for_client_reason(struct tls_multi *multi, const struct
auth_deferred_status *ads)
{
- char *ret = NULL;
if (ads->auth_failed_reason_file)
{
- struct buffer reason =
buffer_read_from_file(ads->auth_failed_reason_file, gc);
+ struct gc_arena gc = gc_new();
+ struct buffer reason =
buffer_read_from_file(ads->auth_failed_reason_file, &gc);
if (BLEN(&reason))
{
- ret = BSTR(&reason);
+ auth_set_client_reason(multi, BSTR(&reason));
}
+ gc_free(&gc);
}
- return ret;
}
@@ -1221,21 +1219,9 @@
#endif
if (failed_auth)
{
- struct gc_arena gc = gc_new();
const struct key_state *ks = get_primary_key(multi);
- const char *plugin_message =
- key_state_check_auth_failed_message_file(&ks->plugin_auth, &gc);
- const char *script_message =
- key_state_check_auth_failed_message_file(&ks->script_auth, &gc);
-
- if (plugin_message)
- {
- auth_set_client_reason(multi, plugin_message);
- }
- if (script_message)
- {
- auth_set_client_reason(multi, script_message);
- }
+ check_for_client_reason(multi, &ks->plugin_auth);
+ check_for_client_reason(multi, &ks->script_auth);
/* We have at least one session that failed authentication. There
* might be still another session with valid keys.
@@ -1243,7 +1229,6 @@
* with the other session (and we actually did that in earlier
* version, this behaviour is really strange from a user (admin)
* experience */
- gc_free(&gc);
return TLS_AUTHENTICATION_FAILED;
}
else if (success)
@@ -1305,20 +1290,6 @@
* this is the place to start.
*************************************************************************** */
-/**
- * Check if the script/plugin left a message in the auth failed message
- * file and relay it to the user */
-static void
-check_for_client_reason(struct tls_multi *multi, const struct
auth_deferred_status *status)
-{
- struct gc_arena gc = gc_new();
- const char *msg = key_state_check_auth_failed_message_file(status, &gc);
- if (msg)
- {
- auth_set_client_reason(multi, msg);
- }
- gc_free(&gc);
-}
/*
* Verify the user name and password using a script
*/
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2217?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia48c1efc9a687383a1dc87edd49d8ba3eb5a87ad
Gerrit-Change-Number: 2217
Gerrit-PatchSet: 2
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Frank Lichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Răzvan Cojocaru <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
Gerrit-Attention: Frank Lichtenheld <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel