diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2021-11-29 20:51:58 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2021-11-29 20:51:58 +0100 |
commit | 6e3e95a9da9458ddf0874b4bd1c8ce6b47fcef27 (patch) | |
tree | 6e3667709d99f857d90b9831426f6a32ee70d113 /src/openvpnserv/validate.c | |
parent | b29f419d68b26b75a44e3ac00748875f1003b900 (diff) | |
parent | f2b3dda12a731c2e0971cb7889728edaf23f6cb0 (diff) |
Merge branch 'upstream' into develop
Diffstat (limited to 'src/openvpnserv/validate.c')
-rw-r--r-- | src/openvpnserv/validate.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/openvpnserv/validate.c b/src/openvpnserv/validate.c index d35938c..93f92e3 100644 --- a/src/openvpnserv/validate.c +++ b/src/openvpnserv/validate.c @@ -5,7 +5,7 @@ * packet encryption, packet authentication, and * packet compression. * - * Copyright (C) 2016 Selva Nair <selva.nair@gmail.com> + * Copyright (C) 2016-2021 Selva Nair <selva.nair@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 @@ -51,6 +51,7 @@ static const WCHAR *white_list[] = }; static BOOL IsUserInGroup(PSID sid, const PTOKEN_GROUPS groups, const WCHAR *group_name); + static PTOKEN_GROUPS GetTokenGroups(const HANDLE token); /* @@ -63,12 +64,14 @@ CheckConfigPath(const WCHAR *workdir, const WCHAR *fname, const settings_t *s) WCHAR tmp[MAX_PATH]; const WCHAR *config_file = NULL; const WCHAR *config_dir = NULL; +#ifndef UNICODE + WCHAR widepath[MAX_PATH]; +#endif /* convert fname to full path */ if (PathIsRelativeW(fname) ) { - swprintf(tmp, _countof(tmp), L"%s\\%s", workdir, fname); - tmp[_countof(tmp)-1] = L'\0'; + openvpn_swprintf(tmp, _countof(tmp), L"%s\\%s", workdir, fname); config_file = tmp; } else @@ -300,12 +303,12 @@ IsUserInGroup(PSID sid, const PTOKEN_GROUPS token_groups, const WCHAR *group_nam break; } /* If a match is already found, ret == TRUE and the loop is skipped */ - for (int i = 0; i < nread && !ret; ++i) + for (DWORD i = 0; i < nread && !ret; ++i) { ret = EqualSid(members[i].lgrmi0_sid, sid); } NetApiBufferFree(members); - /* MSDN says the lookup should always iterate until err != ERROR_MORE_DATA */ + /* MSDN says the lookup should always iterate until err != ERROR_MORE_DATA */ } while (err == ERROR_MORE_DATA && nloop++ < 100); if (err != NERR_Success && err != NERR_GroupNotFound) |