OpenVPN
src
openvpn
domain_helper.h
Go to the documentation of this file.
1
/*
2
* OpenVPN -- An application to securely tunnel IP networks
3
* over a single UDP port, with support for SSL/TLS-based
4
* session authentication and key exchange,
5
* packet encryption, packet authentication, and
6
* packet compression.
7
*
8
* Copyright (C) 2025 Lev Stipakov <lev@openvpn.net>
9
*
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License version 2
12
* as published by the Free Software Foundation.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License along
20
* with this program; if not, write to the Free Software Foundation, Inc.,
21
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22
*/
23
24
static
inline
bool
25
is_allowed_domain_ascii
(
unsigned
char
c)
26
{
27
return
(c >=
'A'
&& c <=
'Z'
)
28
|| (c >=
'a'
&& c <=
'z'
)
29
|| (c >=
'0'
&& c <=
'9'
)
30
|| c ==
'.'
|| c ==
'-'
|| c ==
'_'
|| c >= 0x80;
31
}
32
33
static
inline
bool
34
validate_domain
(
const
char
*domain)
35
{
36
for
(
const
char
*ch = domain; *ch; ++ch)
37
{
38
if
(!
is_allowed_domain_ascii
((
unsigned
char
)*ch))
39
{
40
return
false
;
41
}
42
}
43
44
return
true
;
45
}
is_allowed_domain_ascii
static bool is_allowed_domain_ascii(unsigned char c)
Definition
domain_helper.h:25
validate_domain
static bool validate_domain(const char *domain)
Definition
domain_helper.h:34
Generated by
1.9.8