Commit abcbe37c authored by Leigh B Stoller's avatar Leigh B Stoller

Better sanity checking on ssh keys.

parent 6d7bbb83
...@@ -333,8 +333,11 @@ sub Create($$$$;$) ...@@ -333,8 +333,11 @@ sub Create($$$$;$)
} }
# Insert the sshkey if we got one. # Insert the sshkey if we got one.
if (defined($keys)) { if (defined($keys) && ref($keys)) {
foreach my $keyref (@{ $keys }) { foreach my $keyref (@{ $keys }) {
next
if (!ref($keyref));
my $key = $keyref->{'key'}; my $key = $keyref->{'key'};
my $type = $keyref->{'type'}; my $type = $keyref->{'type'};
...@@ -385,11 +388,14 @@ sub Modify($$$$) ...@@ -385,11 +388,14 @@ sub Modify($$$$)
"where idx='$idx'")); "where idx='$idx'"));
} }
if (defined($keys)) { if (defined($keys) && ref($keys)) {
return -1 return -1
if (!DBQueryWarn("delete from geni_userkeys where uuid='$uuid'")); if (!DBQueryWarn("delete from geni_userkeys where uuid='$uuid'"));
foreach my $keyref (@{ $keys }) { foreach my $keyref (@{ $keys }) {
next
if (!ref($keyref));
my $key = $keyref->{'key'}; my $key = $keyref->{'key'};
my $type = $keyref->{'type'}; my $type = $keyref->{'type'};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment