diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2011-04-26 23:04:18 +0200 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2011-04-26 23:04:18 +0200 |
commit | 20b18fd799e2ea9d0651f3ef913dd9ce2e481471 (patch) | |
tree | 86867a1128f35087f37d4b49ecf241b7b8e6b38e /misc.c | |
parent | c5f7d08b8c3d4287dd40bbdf52525add8f5cee20 (diff) | |
parent | e4359af463463097dd80e679836905bcd8ad7a13 (diff) | |
download | openvpn-20b18fd799e2ea9d0651f3ef913dd9ce2e481471.tar.gz openvpn-20b18fd799e2ea9d0651f3ef913dd9ce2e481471.tar.xz openvpn-20b18fd799e2ea9d0651f3ef913dd9ce2e481471.zip |
Merge branch 'svn-branch-2.1' into merge
Pulling in changes from James' 2.1/openvpn branch in SVN.
Conflicts:
buffer.c
init.c
manage.h
multi.c
openvpn.8
options.c
ssl.c
version.m4
win/sign.py
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -1713,6 +1713,16 @@ purge_user_pass (struct user_pass *up, const bool force) } } +void +set_auth_token (struct user_pass *up, const char *token) +{ + if (token && strlen(token) && up && up->defined && !up->nocache) + { + CLEAR (up->password); + strncpynt (up->password, token, USER_PASS_LEN); + } +} + /* * Process string received by untrusted peer before * printing to console or log file. @@ -2381,3 +2391,37 @@ openvpn_basename (const char *path) } return NULL; } + +/* + * Remove SESS_ID_x strings (i.e. auth tokens) from control message + * strings so that they will not be output to log file. + */ +const char * +sanitize_control_message(const char *str, struct gc_arena *gc) +{ + char *ret = gc_malloc (strlen(str)+1, false, gc); + char *cp = ret; + bool redact = false; + + strcpy(ret, str); + for (;;) + { + const char c = *cp; + if (c == '\0') + break; + if (c == 'S' && !strncmp(cp, "SESS_ID_", 8)) + { + cp += 7; + redact = true; + } + else + { + if (c == ',') /* end of session id? */ + redact = false; + if (redact) + *cp = '_'; + } + ++cp; + } + return ret; +} |