summaryrefslogtreecommitdiff
path: root/src/openvpnserv/validate.c
diff options
context:
space:
mode:
authorBernhard Schmidt <berni@debian.org>2020-09-01 16:52:17 +0200
committerBernhard Schmidt <berni@debian.org>2020-09-01 16:52:17 +0200
commit9fc3b98112217f2d92a67977dbde0987cc7a1803 (patch)
tree29fcc8654ee65d9dd89ade797bea2f3d9dfd9cfd /src/openvpnserv/validate.c
parenta8758c0e03eed188dcb9da0e4fd781a67c25bf1e (diff)
parent69b02b1f7fd609d84ace13ab04697158de2418a9 (diff)
Merge branch 'debian/experimental-2.5'
Diffstat (limited to 'src/openvpnserv/validate.c')
-rw-r--r--src/openvpnserv/validate.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/openvpnserv/validate.c b/src/openvpnserv/validate.c
index d35938c..9b01770 100644
--- a/src/openvpnserv/validate.c
+++ b/src/openvpnserv/validate.c
@@ -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)