diff options
| author | Michael Biebl <biebl@debian.org> | 2025-08-01 19:15:13 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2025-08-01 19:15:13 +0200 |
| commit | 7e9091a5960f67a84787c03153324915220e4816 (patch) | |
| tree | dc743de962532932ebc3b4ed3a36ddd093d97d68 /src/libnm-glib-aux/nm-shared-utils.c | |
| parent | 582eb4472a0f3375042afb9026cbeb50e058a27d (diff) | |
New upstream version 1.54.0 upstream/1.54.0
Diffstat (limited to 'src/libnm-glib-aux/nm-shared-utils.c')
| -rw-r--r-- | src/libnm-glib-aux/nm-shared-utils.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/libnm-glib-aux/nm-shared-utils.c b/src/libnm-glib-aux/nm-shared-utils.c index db730b28..e39831c6 100644 --- a/src/libnm-glib-aux/nm-shared-utils.c +++ b/src/libnm-glib-aux/nm-shared-utils.c @@ -2898,7 +2898,7 @@ nm_utils_buf_utf8safe_unescape(const char *str, * * Depending on @flags, valid UTF-8 characters are not escaped at all * (except the escape character '\\'). This is the difference to g_strescape(), - * which escapes all non-ASCII characters. This allows to pass on + * which escapes all non-ASCII characters. This allows one to pass on * valid UTF-8 characters as-is and can be directly shown to the user * as UTF-8 -- with exception of the backslash escape character, * invalid UTF-8 sequences, and other (depending on @flags). @@ -3113,7 +3113,7 @@ nm_utils_str_utf8safe_unescape(const char *str, NMUtilsStrUtf8SafeFlags flags, c * * Depending on @flags, valid UTF-8 characters are not escaped at all * (except the escape character '\\'). This is the difference to g_strescape(), - * which escapes all non-ASCII characters. This allows to pass on + * which escapes all non-ASCII characters. This allows one to pass on * valid UTF-8 characters as-is and can be directly shown to the user * as UTF-8 -- with exception of the backslash escape character, * invalid UTF-8 sequences, and other (depending on @flags). @@ -6004,8 +6004,8 @@ nm_utils_is_localhost(const char *name) return FALSE; } -gboolean -nm_utils_is_specific_hostname(const char *name) +static gboolean +_nm_utils_check_hostname(const char *name, bool allow_localhost) { if (nm_str_is_empty(name)) return FALSE; @@ -6016,7 +6016,7 @@ nm_utils_is_specific_hostname(const char *name) return FALSE; } - if (nm_utils_is_localhost(name)) + if (!allow_localhost && nm_utils_is_localhost(name)) return FALSE; /* FIXME: properly validate the hostname, like systemd's hostname_is_valid() */ @@ -6024,6 +6024,18 @@ nm_utils_is_specific_hostname(const char *name) return TRUE; } +gboolean +nm_utils_is_specific_hostname(const char *name) +{ + return _nm_utils_check_hostname(name, FALSE); +} + +gboolean +nm_utils_is_not_empty_hostname(const char *name) +{ + return _nm_utils_check_hostname(name, TRUE); +} + /*****************************************************************************/ typedef struct { |