Commit 8664e568 authored by Leigh Stoller's avatar Leigh Stoller

Minor fixes.

parent 776dc702
#!/usr/bin/perl -w #!/usr/bin/perl -w
# #
# Copyright (c) 2008-2013 University of Utah and the Flux Group. # Copyright (c) 2008-2014 University of Utah and the Flux Group.
# #
# {{{GENIPUBLIC-LICENSE # {{{GENIPUBLIC-LICENSE
# #
...@@ -85,6 +85,7 @@ $| = 1; ...@@ -85,6 +85,7 @@ $| = 1;
use lib "@prefix@/lib"; use lib "@prefix@/lib";
use libtestbed; use libtestbed;
use libaudit; use libaudit;
use APT_Profile;
use User; use User;
use OSinfo; use OSinfo;
use emutil; use emutil;
...@@ -266,20 +267,15 @@ $user_email = $value; ...@@ -266,20 +267,15 @@ $user_email = $value;
# Not many choices; see if it exists. # Not many choices; see if it exists.
# #
$value = $xmlparse->{'attribute'}->{"profile"}->{'value'}; $value = $xmlparse->{'attribute'}->{"profile"}->{'value'};
if (! TBcheck_dbslot($value, "os_info", "osname", if ($value !~ /^\d*$/) {
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR)) { fatal("Illegal imageid: $value");
fatal("Illegal imageid: $profile");
} }
my $safe_profile = DBQuoteSpecial($value); my $profile_object = APT_Profile->Lookup($value);
my $profile_result = if (!defined($profile_object)) {
GeniDB::DBQueryWarn("select * from quickvm_rspecs ".
"where name=$safe_profile");
if (!$profile_result || !$profile_result->numrows()) {
fatal("No such profile: $value"); fatal("No such profile: $value");
} }
my $row = $profile_result->fetchrow_hashref(); my $rspecstr = $profile_object->rspec();
my $rspecstr = $row->{'rspec'}; $profile = $value;
my $profile = $value;
# #
# This is so the php code can look it up in the DB. Silly. # This is so the php code can look it up in the DB. Silly.
......
...@@ -313,9 +313,6 @@ if (!isset($profile) || $profile == "") { ...@@ -313,9 +313,6 @@ if (!isset($profile) || $profile == "") {
elseif (! array_key_exists($profile, $profile_array)) { elseif (! array_key_exists($profile, $profile_array)) {
$errors["profile"] = "Invalid Profile: $profile"; $errors["profile"] = "Invalid Profile: $profile";
} }
elseif (! in_array($profile, $profile_array)) {
$errors["profile"] = "Nonexistant Profile: $profile";
}
if (count($errors)) { if (count($errors)) {
SPITFORM($username, $email, $sshkey, $profile, false, $errors); SPITFORM($username, $email, $sshkey, $profile, false, $errors);
......
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