* [Cluster-devel] [PATCH] fence_scsi: fix regular expression for grep
@ 2011-01-19 17:03 Ryan O'Hara
2011-01-21 18:17 ` Lon Hohberger
0 siblings, 1 reply; 2+ messages in thread
From: Ryan O'Hara @ 2011-01-19 17:03 UTC (permalink / raw)
To: cluster-devel.redhat.com
When fence_scsi checks to see if a specific keys is registered for a
specific device, it uses grep to look through a list of all registered
keys. The existing regular expression was not specific enough, and could
result in false positives. This patch fixes the problem by using anchors
to make the regular expression more specific.
Resolves: rhbz#670910
Signed-off-by: Ryan O'Hara <rohara@redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 8ddde4e..818e1d9 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -71,7 +71,7 @@ sub do_action_off ($@)
log_error ("device $dev does not exist") if (! -e $dev);
log_error ("device $dev is not a block device") if (! -b $dev);
- my @keys = grep { /$node_key/ } get_registration_keys ($dev);
+ my @keys = grep { /^$node_key$/ } get_registration_keys ($dev);
if (scalar (@keys) != 0) {
do_preempt_abort ($host_key, $node_key, $dev);
@@ -93,7 +93,7 @@ sub do_action_status ($@)
log_error ("device $dev does not exist") if (! -e $dev);
log_error ("device $dev is not a block device") if (! -b $dev);
- my @keys = grep { /$node_key/ } get_registration_keys ($dev);
+ my @keys = grep { /^$node_key$/ } get_registration_keys ($dev);
if (scalar (@keys) != 0) {
$dev_count++;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Cluster-devel] [PATCH] fence_scsi: fix regular expression for grep
2011-01-19 17:03 [Cluster-devel] [PATCH] fence_scsi: fix regular expression for grep Ryan O'Hara
@ 2011-01-21 18:17 ` Lon Hohberger
0 siblings, 0 replies; 2+ messages in thread
From: Lon Hohberger @ 2011-01-21 18:17 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Wed, 2011-01-19 at 11:03 -0600, Ryan O'Hara wrote:
> When fence_scsi checks to see if a specific keys is registered for a
> specific device, it uses grep to look through a list of all registered
> keys. The existing regular expression was not specific enough, and could
> result in false positives. This patch fixes the problem by using anchors
> to make the regular expression more specific.
>
> Resolves: rhbz#670910
ACK
-- Lon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-21 18:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-19 17:03 [Cluster-devel] [PATCH] fence_scsi: fix regular expression for grep Ryan O'Hara
2011-01-21 18:17 ` Lon Hohberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).