Skip to content

Commit

Permalink
Add fsquery check to fs{download,delete} methods
Browse files Browse the repository at this point in the history
  • Loading branch information
wvu committed Feb 25, 2015
1 parent ea5b6f6 commit ed9213e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/rex/proto/pjl/client.rb
Expand Up @@ -183,7 +183,7 @@ def fsupload(path, size = SIZE_MAX)
#
# @param lpath [String] Local path
# @param rpath [String] Remote path
# @return [void]
# @return [Boolean] True if the file was uploaded
def fsdownload(lpath, rpath)
if rpath !~ /^[0-2]:/
raise ArgumentError, "Path must begin with 0:, 1:, or 2:"
Expand All @@ -197,18 +197,22 @@ def fsdownload(lpath, rpath)

@sock.put(file)
@sock.put(UEL)

fsquery(rpath)
end

# Delete a file
#
# @param path [String] Remote path
# @return [void]
# @return [Boolean] True if the file was deleted
def fsdelete(path)
if path !~ /^[0-2]:/
raise ArgumentError, "Path must begin with 0:, 1:, or 2:"
end

@sock.put(%Q{#{FSDELETE} NAME = "#{path}"\n})

!fsquery(path)
end

end
Expand Down

0 comments on commit ed9213e

Please sign in to comment.