#
include "defs.php3";
include_once "template_defs.php";
require "Sajax.php";
sajax_init();
sajax_export("ModifyAnno");
#
# Only known and logged in users ...
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
#
# Verify page arguments.
#
$reqargs = RequiredPageArguments("instance", PAGEARG_INSTANCE, "runidx", PAGEARG_INTEGER);
$template = $instance->GetTemplate();
# Need these below.
$guid = $template->guid();
$vers = $template->vers();
$pid = $template->pid();
$eid = $instance->eid();
if (!$template->AccessCheck($this_user, $TB_EXPT_READINFO)) {
    USERERROR("You do not have permission to view experiment template " . "{$guid}/{$version}!", 1);
}
if (!$instance->ValidRun($runidx)) {
    USERERROR("The run {$runidx} is not a valid experiment run!", 1);
}
#
# For the Sajax Interface
#
Esempio n. 2
0
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
include "defs.php3";
#
# Only known and logged in users.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
#
# Verify page arguments.
#
$reqargs = RequiredPageArguments("experiment", PAGEARG_EXPERIMENT);
# Need these below.
$pid = $experiment->pid();
$eid = $experiment->eid();
$project = $experiment->Project();
$unix_pid = $project->unix_gid();
#
# Verify permission.
#
if (!$experiment->AccessCheck($this_user, $TB_EXPT_READINFO)) {
    USERERROR("You do not have permission to view events for {$pid}/{$eid}!", 1);
}
#
# A cleanup function to keep the child from becoming a zombie, since
# the script is terminated, but the children are left to roam.
#
Esempio n. 3
0
# }}}
#
include "defs.php3";
#
# Only known and logged in users can do this.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
if (!$isadmin) {
    USERERROR("You do not have permission to access this page!", 1);
}
#
# Verify form arguments.
#
$reqargs = RequiredPageArguments("project", PAGEARG_PROJECT);
$optargs = OptionalPageArguments("submit", PAGEARG_STRING, "message", PAGEARG_ANYTHING);
$pid = $project->pid();
PAGEHEADER("Resend Project Approval Message");
#
# Form to allow text input.
#
function SPITFORM($project, $message, $errors)
{
    global $this_user;
    $message = CleanString($message);
    if ($errors) {
        echo "<table class=nogrid\n                     align=center border=0 cellpadding=6 cellspacing=0>\n              <tr>\n                 <th align=center colspan=2>\n                   <font size=+1 color=red>\n                      &nbsp;Oops, please fix the following errors!&nbsp;\n                   </font>\n                 </td>\n              </tr>\n";
        while (list($name, $message) = each($errors)) {
            # XSS prevention.
            $message = CleanString($message);
Esempio n. 4
0
#
# }}}
#
require "defs.php3";
#
# Spit back a text message we can display to the user on the console
# of the node running the checkin. We could return an http error, but
# that would be of no help to the user on the other side.
#
function SPITSTATUS($code, $msg)
{
    header("HTTP/1.0 {$code} {$msg}");
    exit;
}
# Required arguments
$reqargs = RequiredPageArguments("xmlstuff", PAGEARG_ANYTHING);
$xmlname = tempnam("/tmp", "sitecheckin");
if (!$xmlname) {
    TBERROR("Could not create temporary filename", 0);
    SPITSTATUS(404, "Could not create temporary file!");
}
if (!($fp = fopen($xmlname, "w"))) {
    TBERROR("Could not open temp file {$xmlname}", 0);
    SPITSTATUS(404, "Could not open temporary file!");
}
fwrite($fp, $xmlstuff);
fclose($fp);
chmod($xmlname, 0666);
#
# Invoke the backend and return the status.
#
Esempio n. 5
0
# }}}
#
include "defs.php3";
include_once "geni_defs.php";
include "table_defs.php";
#
#
# Only known and logged in users allowed.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
#
# Verify Page Arguments.
#
$reqargs = RequiredPageArguments("slice_idx", PAGEARG_INTEGER);
$optargs = OptionalPageArguments("showtype", PAGEARG_STRING);
if (!isset($showtype)) {
    $showtype = 'sa';
}
#
# Standard Testbed Header
#
PAGEHEADER("Geni Slice");
if (!($isadmin || STUDLY())) {
    USERERROR("You do not have permission to view Geni slices!", 1);
}
if (!($showtype == "sa" || $showtype == "cm" || $showtype == "ch")) {
    USERERROR("Improper argument: showtype={$showtype}", 1);
}
$slice = GeniSlice::Lookup($showtype, $slice_idx);
Esempio n. 6
0
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
require "defs.php3";
require "newnode-defs.php3";
include "xmlrpc.php3";
#
# Note - this script is not meant to be called by humans! It returns no useful
# information whatsoever, and expects the client to fill in all fields
# properly.
# Since this script does not cause any action to actually happen, so its save
# to leave 'in the open' - the worst someone can do is annoy the testbed admins
# with it!
#
$reqargs = RequiredPageArguments("cpuspeed", PAGEARG_STRING, "diskdev", PAGEARG_STRING, "disksize", PAGEARG_STRING, "role", PAGEARG_STRING, "messages", PAGEARG_STRING);
$optargs = OptionalPageArguments("node_id", PAGEARG_STRING, "identifier", PAGEARG_STRING, "use_temp_IP", PAGEARG_STRING, "type", PAGEARG_STRING);
#
# Grab the IP address that this node has right now, so that we can contact it
# later if we need to, say, reboot it.
#
$tmpIP = getenv("REMOTE_ADDR");
#
# Find all interfaces
#
$interfaces = array();
foreach ($HTTP_GET_VARS as $key => $value) {
    if (preg_match("/iface(name|mac|driver)(\\d+)/", $key, $matches)) {
        $vartype = $matches[1];
        $ifacenum = $matches[2];
        if ($vartype == "name") {
Esempio n. 7
0
$session_interactive = 0;
$session_errorhandler = 'handle_error';
function handle_error($message, $death)
{
    SPITERROR(400, $message);
}
#
# Must be SSL, even though we do not require an account login.
#
if (!isset($SSL_PROTOCOL)) {
    SPITERROR(400, "Must use https:// to access this page!");
}
#
# Verify page arguments.
#
$reqargs = RequiredPageArguments("image", PAGEARG_IMAGE, "access_key", PAGEARG_STRING);
$optargs = OptionalPageArguments("stamp", PAGEARG_INTEGER);
#
# A cleanup function to keep the child from becoming a zombie, since
# the script is terminated, but the children are left to roam.
#
$fp = 0;
function SPEWCLEANUP()
{
    global $fp;
    if (!$fp || !connection_aborted()) {
        exit;
    }
    pclose($fp);
    exit;
}
#
include "defs.php3";
include_once "template_defs.php";
#
# No PAGEHEADER since we spit out a Location header later. See below.
#
#
# Only known and logged in users.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
#
# Verify page arguments
#
$reqargs = RequiredPageArguments("action", PAGEARG_STRING);
$optargs = OptionalPageArguments("template", PAGEARG_TEMPLATE, "submit", PAGEARG_STRING, "metadata", PAGEARG_METADATA, "metadata_type", PAGEARG_STRING, "referrer", PAGEARG_STRING, "formfields", PAGEARG_ARRAY);
# Need these below.
$guid = $template->guid();
$vers = $template->vers();
$pid = $template->pid();
$unix_gid = $template->UnixGID();
$project = $template->GetProject();
$unix_pid = $project->unix_gid();
#
# Spit the form out using the array of data.
#
function SPITFORM($action, $formfields, $errors)
{
    global $template, $metadata, $referrer;
    global $metadata_type;
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
include "defs.php3";
include_once "template_defs.php";
#
# Only known and logged in users.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
#
# Verify page arguments.
#
$reqargs = RequiredPageArguments("instance", PAGEARG_INSTANCE);
$optargs = OptionalPageArguments("canceled", PAGEARG_BOOLEAN, "confirmed", PAGEARG_BOOLEAN);
$template = $instance->GetTemplate();
# Canceled operation redirects back to template page.
if (isset($canceled) && $canceled) {
    header("Location: " . CreateURL("template_show", $template));
    return;
}
# Need these below.
$guid = $template->guid();
$vers = $template->vers();
$pid = $template->pid();
$eid = $instance->eid();
$unix_gid = $template->UnixGID();
$project = $template->GetProject();
$unix_pid = $project->unix_gid();
Esempio n. 10
0
define("WASTATUS_BADREMOTEIP", 104);
define("WASTATUS_IPADDRINUSE", 105);
define("WASTATUS_MUSTUSESSL", 106);
define("WASTATUS_OTHER", 199);
#
# Spit back a text message we can display to the user on the console
# of the node running the checkin. We could return an http error, but
# that would be of no help to the user on the other side.
#
function SPITSTATUS($status)
{
    header("Content-Type: text/plain");
    echo "emulab_status={$status}\n";
}
# Required arguments
$reqargs = RequiredPageArguments("IP", PAGEARG_STRING, "privkey", PAGEARG_STRING);
$optargs = OptionalPageArguments("hostname", PAGEARG_STRING);
# Must use https,
if (!isset($_SERVER["SSL_PROTOCOL"])) {
    SPITSTATUS(WASTATUS_MUSTUSESSL);
    return;
}
if (!preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/', $IP) || !preg_match('/^[\\w]+$/', $privkey) || isset($hostname) && !preg_match('/^[-\\w\\.]+$/', $hostname)) {
    SPITSTATUS(WASTATUS_INVALIDARGS);
    return;
}
#
# Make sure this is a valid privkey before we invoke the backend.
#
$query_result = DBQueryFatal("select IP from widearea_nodeinfo where privkey='{$privkey}'");
if (!mysql_num_rows($query_result)) {
Esempio n. 11
0
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
require "defs.php3";
require "node_defs.php";
$reqargs = RequiredPageArguments("ip", PAGEARG_STRING);
$optargs = OptionalPageArguments("privkey", PAGEARG_STRING, "check", PAGEARG_BOOLEAN, "os", PAGEARG_STRING, "os_version", PAGEARG_STRING, "distro", PAGEARG_STRING, "distro_version", PAGEARG_STRING, "arch", PAGEARG_STRING, "env", PAGEARG_STRING);
#
# The point of this page is to figure out what osconfig scripts
# the node ought to execute, and return them in a tarball.  We attempt to
# cache the tarballs as much as possible and only rebuild when necessary.
#
# NOTE!  This page is only accessible over SSL, but it is only "secure" for
# widearea nodes (which provide a privkey).  Local connections are not secure
# at all -- eventually this could move to tmcc.  And when you get down to it,
# the widearea privkeys are not well protected.  Consequently, NO PRIVATE DATA
# should go into these scripts.  There should not be a need for that, anyway.
# This is meant to be an operator mechanism, not a user mechanism, and it is
# not meant for private data, just client-side config stuff.
#
#
Esempio n. 12
0
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
chdir("..");
require "defs.php3";
if (!$ISCLRHOUSE) {
    header("HTTP/1.0 404 Not Found");
    return;
}
#
# Note - this script is not meant to be called by humans! It returns no useful
# information whatsoever, and expects the client to fill in all fields
# properly.
#
$reqargs = RequiredPageArguments("cert", PAGEARG_ANYTHING);
# Silent error if unusually big.
if (strlen($cert) > 0x4000) {
    return;
}
$fname = tempnam("/tmp", "register_ca");
if (!$fname) {
    TBERROR("Could not create temporary filename", 0);
    return;
}
if (!($fp = fopen($fname, "w"))) {
    TBERROR("Could not open temp file {$fname}", 0);
    return;
}
fwrite($fp, $cert);
fclose($fp);
Esempio n. 13
0
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
include "defs.php3";
$currentusage = 0;
#
# Only known and logged in users.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
PAGEBEGINNING("Experiment State Change", 0, 1);
#
# Verify page arguments.
#
$reqargs = RequiredPageArguments("experiment", PAGEARG_EXPERIMENT, "state", PAGEARG_STRING);
# Need these below.
$pid = $experiment->pid();
$eid = $experiment->eid();
echo "<div class=contentbody id=statechange>\n";
echo "<br><br><font size=+1>\n          Emulab experiment {$pid}/{$eid} is now {$state}.</font><br>\n";
echo "<br><br>\n";
echo "<center><button name=close type=button onClick='window.close();'>";
echo "Close Window</button></center>\n";
echo "</div>\n";
echo "</body></html>";
Esempio n. 14
0
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
require "defs.php3";
#
# Verify page arguments.
#
$reqargs = RequiredPageArguments("user", PAGEARG_USER, "key", PAGEARG_STRING);
$optargs = OptionalPageArguments("redirected", PAGEARG_BOOLEAN);
if (!$PORTAL_ENABLE) {
    USERERROR("No Portal", 1);
}
#
# Need this extra redirect so that the cookies get set properly.
#
if (!isset($redirected) || $redirected == 0) {
    $uri = $_SERVER['REQUEST_URI'] . "&redirected=1";
    header("Location: https://{$WWWHOST}" . $uri);
    return;
}
#
# Check the login table for the user, and see if the key is really
# the md5 of the login hash. If so, do a login.
Esempio n. 15
0
#
include "defs.php3";
include_once "template_defs.php";
require "Sajax.php";
sajax_init();
sajax_export("Show", "GraphChange");
#
# Only known and logged in users ...
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
#
# Verify page arguments
#
$reqargs = RequiredPageArguments("template", PAGEARG_TEMPLATE);
$optargs = OptionalPageArguments("action", PAGEARG_STRING, "show", PAGEARG_STRING, "confirmed", PAGEARG_STRING);
if (!($experiment = $template->GetExperiment())) {
    TBERROR("Could not find experiment object for template!", 1);
}
# Need these below
$guid = $template->guid();
$vers = $template->vers();
$pid = $template->pid();
$eid = $template->eid();
$tid = $template->tid();
$exptidx = $experiment->idx();
$unix_gid = $experiment->UnixGID();
$this_url = CreateURL("template_show", $template);
$project = $template->GetProject();
$unix_pid = $project->unix_gid();
Esempio n. 16
0
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
include "defs.php3";
# No Pageheader since we spit out a redirection below.
#
# We must get the redirection arguments,
#
$reqargs = RequiredPageArguments("redirect_to", PAGEARG_STRING);
#
# Check format. Also figure out the target.
#
if (!preg_match("/^http[s]?:\\/\\/([-\\w\\.]*)\\//", $redirect_to, $matches)) {
    PAGEARGERROR("Invalid redirection argument!");
}
$redirect_host = $matches[1];
#
# Right now all we allow is www.datapository.net, and that is really
# nfs.emulab.net.
#
if ($redirect_host != "www.datapository.net" && $redirect_host != "nfs.emulab.net") {
    PAGEARGERROR("Invalid redirection host '{$redirect_host}'");
}
#
Esempio n. 17
0
# }}}
#
include "defs.php3";
#
# Only admin users ...
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
if (!$isadmin) {
    USERERROR("You do not have permission to change login names!", 1);
}
#
# Verify page/form arguments.
#
$reqargs = RequiredPageArguments("target_user", PAGEARG_USER);
$optargs = OptionalPageArguments("submit", PAGEARG_STRING, "new_uid", PAGEARG_STRING);
$target_uid = $target_user->uid();
$target_idx = $target_user->uid_idx();
if ($target_user->status() != TBDB_USERSTATUS_UNAPPROVED) {
    USERERROR("The user {$target_uid} must be " . "unapproved (but verified) to change!", 1);
}
function SPITFORM($target_user, $new_uid, $error)
{
    global $TBDB_UIDLEN;
    $target_uid = $target_user->uid();
    $target_webid = $target_user->webid();
    $new_uid = CleanString($new_uid);
    #
    # Standard Testbed Header.
    #
Esempio n. 18
0
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
include "defs.php3";
include_once "geni_defs.php";
include "table_defs.php";
#
# Public info, if you know the public token for the slice.
#
$reqargs = RequiredPageArguments("publicid", PAGEARG_STRING);
#
# Standard Testbed Header
#
PAGEHEADER("Geni Slice");
$slice = GeniSlice::LookupByPublicID("cm", $publicid);
if (!$slice) {
    USERERROR("No such slice {$publicid}", 1);
}
$slice_idx = $slice->idx();
function GeneratePopupDiv($id, $text)
{
    return "<div id=\"{$id}\" " . "style='display:none;width:700;height:400;overflow:auto;'>\n" . "{$text}\n" . "</div>\n";
}
$manifestidx = 0;
# The table attributes: