aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe2022-12-15 20:01:39 +0100
committerGert Doering2022-12-16 18:07:40 +0100
commitfad810fff33946e1b79d408e97ea8b7c017e9fb4 (patch)
tree0537a1abab19db3acef74e575d9fb6215efc8dbc
parent01bed788b0ec4007591b81398b56b5f9632ca33c (diff)
downloadopenvpn-fad810fff33946e1b79d408e97ea8b7c017e9fb4.zip
openvpn-fad810fff33946e1b79d408e97ea8b7c017e9fb4.tar.gz
Improve documentation on user/password requirement and unicodize function
Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20221215190143.2107896-5-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25733.html Signed-off-by: Gert Doering <gert@greenie.muc.de> (cherry picked from commit 4b6854881c36e16054878e0467ef87d925e20cae)
-rw-r--r--src/openvpn/misc.h1
-rw-r--r--src/openvpn/ntlm.c13
2 files changed, 14 insertions, 0 deletions
diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h
index 570e473..1e52056 100644
--- a/src/openvpn/misc.h
+++ b/src/openvpn/misc.h
@@ -74,6 +74,7 @@ struct user_pass
#else
#define USER_PASS_LEN 128
#endif
+ /* Note that username and password are expected to be null-terminated */
char username[USER_PASS_LEN];
char password[USER_PASS_LEN];
};
diff --git a/src/openvpn/ntlm.c b/src/openvpn/ntlm.c
index e370748..9158cfd 100644
--- a/src/openvpn/ntlm.c
+++ b/src/openvpn/ntlm.c
@@ -143,6 +143,19 @@ my_strupr(char *str)
}
}
+/**
+ * This function expects a null-terminated string in src and will
+ * copy it (including the terminating NUL byte),
+ * alternating it with 0 to dst.
+ *
+ * This basically will transform a ASCII string into valid UTF-16.
+ * Characters that are 8bit in src, will get the same treatment, resulting in
+ * invalid or wrong unicode code points.
+ *
+ * @note the function will blindly assume that dst has double
+ * the space of src.
+ * @return the length of the number of bytes written to dst
+ */
static int
unicodize(char *dst, const char *src)
{