mirror of
https://github.com/nishiki/manage-password.git
synced 2024-11-30 08:53:05 +00:00
add security for "port" when you insert data
This commit is contained in:
parent
94bd846bc7
commit
c12c370b42
1 changed files with 19 additions and 1 deletions
20
lib/MPW.rb
20
lib/MPW.rb
|
@ -173,7 +173,7 @@ class MPW
|
||||||
|
|
||||||
# Search in some csv data
|
# Search in some csv data
|
||||||
# @args: search -> the string to search
|
# @args: search -> the string to search
|
||||||
# type -> the connection type (ssh, web, other)
|
# protocol -> the connection protocol (ssh, web, other)
|
||||||
# @rtrn: a list with the resultat of the search
|
# @rtrn: a list with the resultat of the search
|
||||||
def search(search, protocol=nil)
|
def search(search, protocol=nil)
|
||||||
result = Array.new()
|
result = Array.new()
|
||||||
|
@ -221,6 +221,10 @@ class MPW
|
||||||
group = 'No Group'
|
group = 'No Group'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if port.to_i <= 0
|
||||||
|
port = nil
|
||||||
|
end
|
||||||
|
|
||||||
if not @data.last.nil?
|
if not @data.last.nil?
|
||||||
id = @data.last
|
id = @data.last
|
||||||
id = id[ID].to_i + 1
|
id = id[ID].to_i + 1
|
||||||
|
@ -258,6 +262,20 @@ class MPW
|
||||||
id = id.to_i
|
id = id.to_i
|
||||||
|
|
||||||
if not @data[id].nil?
|
if not @data[id].nil?
|
||||||
|
|
||||||
|
if name.nil? || name.empty?
|
||||||
|
@error_msg = "You must define a name!"
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
if group.nil? || group.empty?
|
||||||
|
group = 'No Group'
|
||||||
|
end
|
||||||
|
|
||||||
|
if port.to_i <= 0
|
||||||
|
port = nil
|
||||||
|
end
|
||||||
|
|
||||||
row = @data[id]
|
row = @data[id]
|
||||||
row_update = Array.new()
|
row_update = Array.new()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue