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-2024 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, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 */
24
25#ifndef VALIDATE_H
26#define VALIDATE_H
27
28#include "service.h"
29
30/* Authorized groups who can use any options and config locations */
31#define SYSTEM_ADMIN_GROUP L"Administrators"
32#define OVPN_ADMIN_GROUP L"OpenVPN Administrators" /* may be set in HKLM\Software\OpenVPN\ovpn_admin_group */
33#define OVPN_SERVICE_USER L"OpenVPNService" /* may be set in HKLM\Software\OpenVPN\ovpn_service_user */
34
35/*
36 * Check whether user is a member of Administrators group or
37 * the group specified in ovpn_admin_group or
38 * OpenVPN Virtual Service Account user
39 */
40BOOL
41IsAuthorizedUser(PSID sid, const HANDLE token, const WCHAR *ovpn_admin_group, const WCHAR *ovpn_service_user);
42
43BOOL
44CheckOption(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:319
BOOL IsAuthorizedUser(PSID sid, const HANDLE token, const WCHAR *ovpn_admin_group, const WCHAR *ovpn_service_user)
Definition validate.c:144
static BOOL IsOption(const WCHAR *o)
Definition validate.h:47