!73 [sync] PR-72: fix Hostname validation and fix mount.glusterfs: Remove \ from grep command
From: @openeuler-sync-bot Reviewed-by: @swf504 Signed-off-by: @swf504
This commit is contained in:
commit
12f7736ea4
113
0002-fix-Hostname-validation.patch
Normal file
113
0002-fix-Hostname-validation.patch
Normal file
@ -0,0 +1,113 @@
|
||||
From 1e5c3a6b6f8722ebe120d56c4d010285d6bad3de Mon Sep 17 00:00:00 2001
|
||||
From: Aravinda VK <aravinda@kadalu.tech>
|
||||
Date: Sat, 17 Feb 2024 09:39:09 +0530
|
||||
Subject: [PATCH] cli: Fix Hostname validation
|
||||
|
||||
Gluster volume create command fails to use the hostnames
|
||||
that starts with `0.`
|
||||
|
||||
```
|
||||
Please provide a valid hostname/ip other than localhost, 127.0.0.1 or
|
||||
loopback address (0.0.0.0 to 0.255.255.255).
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
gluster volume create vol1 0.s1.dev:/data/gfs/vol1/b1 force
|
||||
```
|
||||
|
||||
Signed-off-by: Aravinda VK <aravinda@kadalu.tech>
|
||||
---
|
||||
cli/src/cli-cmd-parser.c | 44 ++++++++++++++++++++++++----------------
|
||||
1 file changed, 26 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
|
||||
index 74e5ad7..7ff7652 100644
|
||||
--- a/cli/src/cli-cmd-parser.c
|
||||
+++ b/cli/src/cli-cmd-parser.c
|
||||
@@ -87,6 +87,25 @@ validate_brick_name(char *brick)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+bool
|
||||
+handle_local_or_loopback_address(char *host_name)
|
||||
+{
|
||||
+ int ip_len;
|
||||
+ ip_len = strlen(host_name);
|
||||
+
|
||||
+ if (!(strcmp(host_name, "localhost") && strcmp(host_name, "127.0.0.1")) ||
|
||||
+ (valid_ipv4_address(host_name, ip_len, 0) &&
|
||||
+ !strncmp(host_name, "0.", 2))) {
|
||||
+ cli_err(
|
||||
+ "Please provide a valid hostname/ip other "
|
||||
+ "than localhost, 127.0.0.1 or loopback "
|
||||
+ "address (0.0.0.0 to 0.255.255.255).");
|
||||
+ return _gf_false;
|
||||
+ }
|
||||
+
|
||||
+ return _gf_true;
|
||||
+}
|
||||
+
|
||||
int32_t
|
||||
cli_cmd_ta_brick_parse(const char **words, int wordcount, char **ta_brick)
|
||||
{
|
||||
@@ -128,15 +147,11 @@ cli_cmd_ta_brick_parse(const char **words, int wordcount, char **ta_brick)
|
||||
goto out;
|
||||
}
|
||||
|
||||
- if (!(strcmp(host_name, "localhost") && strcmp(host_name, "127.0.0.1") &&
|
||||
- strncmp(host_name, "0.", 2))) {
|
||||
- cli_err(
|
||||
- "Please provide a valid hostname/ip other "
|
||||
- "than localhost, 127.0.0.1 or loopback "
|
||||
- "address (0.0.0.0 to 0.255.255.255).");
|
||||
+ if (!handle_local_or_loopback_address(host_name)) {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
+
|
||||
if (!valid_internet_address(host_name, _gf_false, _gf_false)) {
|
||||
cli_err(
|
||||
"internet address '%s' does not conform to "
|
||||
@@ -228,16 +243,12 @@ cli_cmd_bricks_parse(const char **words, int wordcount, int brick_index,
|
||||
goto out;
|
||||
}
|
||||
|
||||
- if (!(strcmp(host_name, "localhost") &&
|
||||
- strcmp(host_name, "127.0.0.1") && strncmp(host_name, "0.", 2))) {
|
||||
- cli_err(
|
||||
- "Please provide a valid hostname/ip other "
|
||||
- "than localhost, 127.0.0.1 or loopback "
|
||||
- "address (0.0.0.0 to 0.255.255.255).");
|
||||
+ if (!handle_local_or_loopback_address(host_name)) {
|
||||
ret = -1;
|
||||
GF_FREE(tmp_host);
|
||||
goto out;
|
||||
}
|
||||
+
|
||||
if (!valid_internet_address(host_name, _gf_false, _gf_false)) {
|
||||
cli_err(
|
||||
"internet address '%s' does not conform to "
|
||||
@@ -3728,15 +3739,12 @@ extract_hostname_path_from_token(const char *tmp_words, char **hostname,
|
||||
"memory");
|
||||
goto out;
|
||||
}
|
||||
- if (!(strcmp(host_name, "localhost") && strcmp(host_name, "127.0.0.1") &&
|
||||
- strncmp(host_name, "0.", 2))) {
|
||||
- cli_err(
|
||||
- "Please provide a valid hostname/ip other "
|
||||
- "than localhost, 127.0.0.1 or loopback "
|
||||
- "address (0.0.0.0 to 0.255.255.255).");
|
||||
+
|
||||
+ if (!handle_local_or_loopback_address(host_name)) {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
+
|
||||
if (!valid_internet_address(host_name, _gf_false, _gf_false)) {
|
||||
cli_err(
|
||||
"internet address '%s' does not conform to "
|
||||
--
|
||||
2.27.0
|
||||
|
||||
40
0003-fix-mount.glusterfs-Remove-from-grep-command.patch
Normal file
40
0003-fix-mount.glusterfs-Remove-from-grep-command.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From 42e3cb18f5d1f9692615e55c82e7a7c83f0f3a04 Mon Sep 17 00:00:00 2001
|
||||
From: Anoop C S <anoopcs@cryptolab.net>
|
||||
Date: Wed, 6 Dec 2023 16:32:24 +0530
|
||||
Subject: [PATCH] mount.glusterfs: Remove `\` from grep command (#4275)
|
||||
|
||||
GNU grep v3.8 release notes[1] has the following mention about the usage
|
||||
of backslahes:
|
||||
|
||||
"Regular expressions with stray backslashes now cause warnings, as their
|
||||
unspecified behavior can lead to unexpected results."
|
||||
|
||||
As a result we see the warning "grep: warning: stray \ before -" during
|
||||
script execution. Therefore remove the extra `\` from grep command.
|
||||
|
||||
Please note that this exact change was committed into mount_glusterfs.in
|
||||
via 162d007dae167ec961b4a0970f6c37c6a2f9f641 but not here.
|
||||
|
||||
[1] https://savannah.gnu.org/forum/forum.php?forum_id=10227
|
||||
|
||||
Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
|
||||
---
|
||||
xlators/mount/fuse/utils/mount.glusterfs.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in
|
||||
index 6c9ff7a..c1cf17b 100755
|
||||
--- a/xlators/mount/fuse/utils/mount.glusterfs.in
|
||||
+++ b/xlators/mount/fuse/utils/mount.glusterfs.in
|
||||
@@ -839,7 +839,7 @@ EOF
|
||||
}
|
||||
}
|
||||
|
||||
- grep_ret=$(echo ${mount_point} | grep '^\-o');
|
||||
+ grep_ret=$(echo ${mount_point} | grep '^-o');
|
||||
[ "x" != "x${grep_ret}" ] && {
|
||||
cat <<EOF >&2
|
||||
ERROR: -o options cannot be specified in either first two arguments..
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -224,7 +224,7 @@
|
||||
Summary: Distributed File System
|
||||
Name: glusterfs
|
||||
Version: 11.1
|
||||
Release: 2
|
||||
Release: 3
|
||||
License: GPLv3 or GPLv2+ or LGPLv3+
|
||||
URL: http://docs.gluster.org/
|
||||
%if ( 0%{_for_fedora_koji_builds} )
|
||||
@ -238,6 +238,8 @@ Source0: https://download.gluster.org/pub/gluster/glusterfs/11/%{versio
|
||||
%endif
|
||||
|
||||
Patch1: 0001-fuse-Resolve-asan-bug-in-during-receive-event-notifi.patch
|
||||
Patch2: 0002-fix-Hostname-validation.patch
|
||||
Patch3: 0003-fix-mount.glusterfs-Remove-from-grep-command.patch
|
||||
|
||||
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
||||
BuildRequires: rpcgen gperftools-devel libunwind-devel
|
||||
@ -1500,6 +1502,10 @@ exit 0
|
||||
%{_mandir}/man8/*gluster*.8*
|
||||
|
||||
%changelog
|
||||
* Wed May 22 2024 xuchenchen <xuchenchen@kylinos.cn> - 11.1-3
|
||||
- fix Hostname validation
|
||||
- fix mount.glusterfs Remove \ from grep command
|
||||
|
||||
* Wed Mar 13 2024 wangxiaomeng <wangxiaomeng@kylinos.cn> - 11.1-2
|
||||
- fix upgrade error that %{_mandir}/man8/*gluster*.8* belong to package glusterfs currently conflict with that belong to package help in the lower version.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user