@@ -1527,21 +1527,6 @@ initialization_sequence_completed(struct context *c, const unsigned int flags)
/* If we delayed UID/GID downgrade or chroot, do it now */
do_uid_gid_chroot(c, true);
-
-#ifdef ENABLE_CRYPTO
- /*
- * In some cases (i.e. when receiving auth-token via
- * push-reply) the auth-nocache option configured on the
- * client is overridden; for this reason we have to wait
- * for the push-reply message before attempting to wipe
- * the user/pass entered by the user
- */
- if (c->options.mode == MODE_POINT_TO_POINT)
- {
- ssl_clean_user_pass();
- }
-#endif /* ENABLE_CRYPTO */
-
/* Test if errors */
if (flags & ISC_ERRORS)
{
@@ -1326,18 +1326,15 @@ set_auth_token(struct user_pass *up, struct user_pass *tk, const char *token)
if (strlen(token) && (up->defined || tk->defined))
{
- /* auth-token has no password, so it needs the username
- * either already set or copied from up */
strncpynt(tk->password, token, USER_PASS_LEN);
- if (up->defined)
+ /* auth-token has no username, so it needs the username
+ * either already set or copied from up. If set, tk is defined.
+ */
+ if (strlen(tk->username))
{
- strncpynt(tk->username, up->username, USER_PASS_LEN);
+ tk->defined = true;
}
- tk->defined = true;
}
-
- /* Cleans user/pass for nocache */
- purge_user_pass(up, false);
}
/*
@@ -2437,20 +2437,13 @@ key_method_2_write(struct buffer *buf, struct tls_session *session)
{
goto error;
}
- /* if auth-nocache was specified, the auth_user_pass object reaches
- * a "complete" state only after having received the push-reply
- * message. The push message might contain an auth-token that needs
- * the username of auth_user_pass.
- *
- * For this reason, skip the purge operation here if no push-reply
- * message has been received yet.
- *
- * This normally happens upon first negotiation only.
- */
- if (!session->opt->pull)
+ /* save username for auth-token which may get pushed later */
+ if (session->opt->pull && up != &auth_token)
{
- purge_user_pass(&auth_user_pass, false);
+ strncpynt(auth_token.username, up->username, USER_PASS_LEN);
}
+ /* respect auth-nocache */
+ purge_user_pass(&auth_user_pass, false);
}
else
{
@@ -4320,12 +4313,6 @@ done:
return BSTR(&out);
}
-void
-ssl_clean_user_pass(void)
-{
- purge_user_pass(&auth_user_pass, false);
-}
-
char *
mutate_ncp_cipher_list(const char *list, struct gc_arena *gc)
{
@@ -627,12 +627,6 @@ void extract_x509_field_test(void);
*/
bool is_hard_reset(int op, int key_method);
-/**
- * Cleans the saved user/password unless auth-nocache is in use.
- */
-void ssl_clean_user_pass(void);
-
-
/*
* Show the TLS ciphers that are available for us to use in the SSL
* library with headers hinting their usage and warnings about usage.