Skip to content

Commit 09f3426

Browse files
committed
Deal with blank or missing config-dir better
Just deleting at an index will be surprising when you've already deleted the wait/nowait. Use an Array#compact strategy instead. Also, always define a sensible config-dir, even if none is given. If the user wants to pass one especially, they can. [FixRM rapid7#7297]
1 parent f247379 commit 09f3426

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

msfupdate

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,23 @@ end
3232
when "wait", "nowait"
3333
@wait_index = i
3434
@actually_wait = (arg == "wait")
35-
# Handle passing a config-dir especially
36-
when /--config-dir/
35+
# An empty or absent config-dir means a default config-dir
36+
when "--config-dir"
37+
@configdir_index = i
38+
# A defined config dir means a defined config-dir
39+
when /--config-dir=(.*)?/
3740
# Spaces in the directory should be fine since this whole thing is passed
3841
# as a single argument via the multi-arg syntax for system() below.
3942
# TODO: Test this spaces business. I don't buy it. -todb
43+
@configdir = $1
4044
@configdir_index = i
4145
end
4246
end
4347

44-
@args.delete_at @wait_index if @wait_index
45-
@args.push("--config-dir=#{@configdir}") unless @configdir_index
48+
@args[@wait_index] = nil if @wait_index
49+
@args[@configdir_index] = nil if @configdir_index
50+
@args = @args.compact
51+
@args.push("--config-dir=#{@configdir}")
4652
@args.push("--non-interactive")
4753

4854
res = system("svn", "cleanup")

0 commit comments

Comments
 (0)