OpenVPN
validate.h
Go to the documentation of this file.
1
2/*
3 * OpenVPN -- An application to securely tunnel IP networks
4 * over a single TCP/UDP port, with support for SSL/TLS-based
5 * session authentication and key exchange,
6 * packet encryption, packet authentication, and
7 * packet compression.
8 *
9 * Copyright (C) 2016-2025 Selva Nair <selva.nair@gmail.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2
13 * as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef VALIDATE_H
25#define VALIDATE_H
26
27#include "service.h"
28
29/* Authorized groups who can use any options and config locations */
30#define SYSTEM_ADMIN_GROUP L"Administrators"
31#define OVPN_ADMIN_GROUP \
32 L"OpenVPN Administrators" /* may be set in HKLM\Software\OpenVPN\ovpn_admin_group */
33#define OVPN_SERVICE_USER \
34 L"OpenVPNService" /* may be set in HKLM\Software\OpenVPN\ovpn_service_user */
35
36/*
37 * Check whether user is a member of Administrators group or
38 * the group specified in ovpn_admin_group or
39 * OpenVPN Virtual Service Account user
40 */
41BOOL IsAuthorizedUser(PSID sid, const HANDLE token, const WCHAR *ovpn_admin_group,
42 const WCHAR *ovpn_service_user);
43
44BOOL CheckOption(const WCHAR *workdir, int narg, WCHAR *argv[], const settings_t *s);
45
46static inline BOOL
47IsOption(const WCHAR *o)
48{
49 return (wcsncmp(o, L"--", 2) == 0);
50}
51
52#endif /* ifndef VALIDATE_H */
Definition argv.h:35
BOOL CheckOption(const WCHAR *workdir, int narg, WCHAR *argv[], const settings_t *s)
Definition validate.c:320
BOOL IsAuthorizedUser(PSID sid, const HANDLE token, const WCHAR *ovpn_admin_group, const WCHAR *ovpn_service_user)
Definition validate.c:142
static BOOL IsOption(const WCHAR *o)
Definition validate.h:47