commit 830934bef1a21448ed59896145c566594bf6980d
parent 64cf18cd0dbbd2f1ad7c0126385c8b9e0d084696
Author: finwo <finwo@pm.me>
Date: Sat, 3 Jan 2026 19:38:38 +0100
2.67
Diffstat:
4 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,7 @@
+2.67 [KK 2010-06-11]
+- Further bugfix in xrctl to shell-escape all XR parameters where
+ necessary (including e.g. url matching regexps etc.).
+
2.66 [KK 2010-06-09]
- Bugfix in xrctl, --host-match arguments are now shell-quoted (they
are regular expressions and can contain pipe characters etc). Thanks
diff --git a/Makefile b/Makefile
@@ -1,7 +1,7 @@
# Top-level Makefile for XR
# -------------------------
-VER = 2.66
+VER = 2.67
PREFIX = $(DESTDIR)/usr
BINDIR = $(PREFIX)/sbin
MANDIR = $(PREFIX)/share/man
diff --git a/xr/Dispatchers/httpdispatcher/dispatch.cc b/xr/Dispatchers/httpdispatcher/dispatch.cc
@@ -50,14 +50,16 @@ void HttpDispatcher::dispatch() {
if (hostmatchused &&
regexec(&(balancer.backend(i).hostregex()),
host_header.c_str(), 0, 0, 0)) {
- debugmsg("Back end " + balancer.backend(i).description() +
+ debugmsg("Back end " +
+ balancer.backend(i).description() +
" forbidden due to hostmatch\n");
host_allowed = false;
}
if (urlmatchused &&
regexec(&(balancer.backend(i).urlregex()),
url.c_str(), 0, 0, 0)) {
- debugmsg("Back end " + balancer.backend(i).description() +
+ debugmsg("Back end " +
+ balancer.backend(i).description() +
" forbidden due to urlmatch\n");
url_allowed = false;
}
diff --git a/xrctl/xrctl b/xrctl/xrctl
@@ -464,16 +464,15 @@ sub log_file {
sub xr_command {
my $service = shift;
my @parts = xr_cmdarr($service);
- msg ("Command: @parts\n");
+ msg ("Exec command: @parts\n");
my $ret = xfind_bin('xr');
for (my $i = 1; $i <= $#parts; $i++) {
my $sub = $parts[$i];
$sub =~ s/^\s+//;
$sub =~ s/\s+$//;
- $sub = "'$sub'" if ($sub =~ /\s/);
- $ret .= ' ' . $sub;
+ $ret .= ' ' . shquote($sub);
}
- msg ("Quoted command: $ret\n");
+ msg ("Shell command: $ret\n");
return ($ret);
}
@@ -599,9 +598,9 @@ sub xr_cmdarr {
# Handle host match
my $hm = $bp->data('hostmatch');
if ($hm and $hm ne $last_hostmatch) {
- push (@cmd, '--host-match', shquote($hm));
+ push (@cmd, '--host-match', $hm);
} elsif ($hm eq '' and $last_hostmatch ne '') {
- push (@cmd, '--host-match', shquote($default_hostmatch));
+ push (@cmd, '--host-match', $default_hostmatch);
}
$last_hostmatch = $hm;
@@ -654,7 +653,7 @@ sub xr_cmdarr {
sub shquote($) {
my $s = shift;
- return $s unless ($s =~ /[\(\)\'\"\|]/);
+ return $s unless ($s =~ /[\(\)\'\"\| \*\[\]\^\$]/);
if ($s !~ /'/) {
$s = "'$s'";