summaryrefslogtreecommitdiff
path: root/src/openvpn/misc.c
diff options
context:
space:
mode:
authorBernhard Schmidt <berni@debian.org>2021-02-24 19:54:19 +0100
committerBernhard Schmidt <berni@debian.org>2021-02-24 19:54:19 +0100
commitd717dbfa8d0807202f5ad05f7db53925cf63a446 (patch)
treeff434c729e3d55979ee85983296c424e637a1124 /src/openvpn/misc.c
parent76fee93e6fe89e5575bae2840b585d2f025b9050 (diff)
parent4ee98f284a93c3b855092d35ac21371d9dcad65b (diff)
Update upstream source from tag 'upstream/2.5.1'
Update to upstream version '2.5.1' with Debian dir 7ffab8b9a1f4bee8b10a736ef58cdbac4bfd4b14
Diffstat (limited to 'src/openvpn/misc.c')
-rw-r--r--src/openvpn/misc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
index 1038b38..c0c72dd 100644
--- a/src/openvpn/misc.c
+++ b/src/openvpn/misc.c
@@ -510,10 +510,15 @@ void
set_auth_token(struct user_pass *up, struct user_pass *tk, const char *token)
{
- if (token && strlen(token) && up && up->defined)
+ 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);
- strncpynt(tk->username, up->username, USER_PASS_LEN);
+ if (up->defined)
+ {
+ strncpynt(tk->username, up->username, USER_PASS_LEN);
+ }
tk->defined = true;
}