Commit c850a6d7 authored by Leigh Stoller's avatar Leigh Stoller

My final act before leaving the country ... hooks flyspray into emulab

interface with cross machine login support.
parent 1d8d0b43
......@@ -13,7 +13,7 @@ include $(OBJDIR)/Makeconf
SBIN_SCRIPTS = addbugdbproj addbugdbuser setbugdbgroups \
bugdbsetup
LIBEXEC_SCRIPTS =
LIBEXEC_SCRIPTS = bugdbxlogin
CTRL_SBIN_SCRIPTS = bugdbproxy
......@@ -38,6 +38,8 @@ post-install:
chmod u+s $(INSTALL_SBINDIR)/addbugdbuser
chown root $(INSTALL_SBINDIR)/setbugdbgroups
chmod u+s $(INSTALL_SBINDIR)/setbugdbgroups
chown root $(INSTALL_LIBEXECDIR)/bugdbxlogin
chmod u+s $(INSTALL_LIBEXECDIR)/bugdbxlogin
#
# Control node installation (okay, plastic)
......
......@@ -129,6 +129,9 @@ elsif ($action eq "addgroup") {
elsif ($action eq "setgroups") {
exit(SetGroups(@ARGV));
}
elsif ($action eq "xlogin") {
exit(xLogin(@ARGV));
}
else {
die("*** $0:\n".
" Do not know what to do with '$action'!\n");
......@@ -569,6 +572,27 @@ sub SetGroups(@)
return 0;
}
#
# Backdoor Login
#
sub xLogin(@)
{
usage()
if (@_ != 2);
my ($user, $secretkey) = @_;
my $user_id = FlysprayUserid($user);
if ($user_id < 0) {
print("*** $user does not exist in the flyspray DB! Skipping\n");
return 0;
}
DBQueryFatal("update flyspray_users set ".
" cred='$secretkey'".
"where user_id=$user_id");
return 0;
}
sub fatal($)
{
my($mesg) = $_[0];
......
......@@ -16,10 +16,13 @@ $TBWWW = "@TBWWW@";
$THISHOMEBASE = "@THISHOMEBASE@";
$ELABINELAB = @ELABINELAB@;
$WIKISUPPORT = @WIKISUPPORT@;
$BUGDBSUPPORT = @BUGDBSUPPORT@;
$CVSSUPPORT = @CVSSUPPORT@;
$CONTROL_NETWORK= "@CONTROL_NETWORK@";
$WIKIURL = "https://${USERNODE}/twiki/bin/newlogon";
$WIKICOOKIENAME = "WikiCookie";
$BUGDBURL = "https://${USERNODE}/flyspray";
$BUGDBCOOKIENAME= "FlysprayCookie";
$TBMAILADDR_OPS = "@TBOPSEMAIL_NOSLASH@";
$TBMAILADDR_WWW = "@TBWWWEMAIL_NOSLASH@";
......
......@@ -223,6 +223,7 @@ function WRITEPLABBOTTOMBAR() {
function WRITESIDEBAR() {
global $login_status, $login_uid;
global $TBBASE, $TBDOCBASE, $BASEPATH, $WIKISUPPORT, $WIKIURL;
global $BUGDBSUPPORT, $BUGDBURL;
global $CHECKLOGIN_WIKINAME;
global $THISHOMEBASE;
$firstinitstate = TBGetFirstInitState();
......@@ -386,6 +387,11 @@ function WRITESIDEBAR() {
"gotowiki.php3?redurl=Main/$wikiname");
}
if ($BUGDBSUPPORT) {
WRITESIDEBARBUTTON_ABSCOOL("My Bug Databases",
"gotobugdb.php3", "gotobugdb.php3");
}
WRITESIDEBARBUTTON("Update User Information",
$TBBASE, "moduserinfo.php3");
......@@ -411,6 +417,11 @@ function WRITESIDEBAR() {
"gotowiki.php3?redurl=Main/$wikiname");
}
if ($BUGDBSUPPORT) {
WRITESIDEBARBUTTON_ABSCOOL("My Bug Databases",
"gotobugdb.php3", "gotobugdb.php3");
}
# Since a user can be a member of more than one project,
# display this option, and let the form decide if the
# user is allowed to do this.
......
......@@ -553,6 +553,7 @@ function DOLOGIN($token, $password, $adminmode = 0) {
global $TBNAMECOOKIE, $TBLOGINCOOKIE, $TBSECURECOOKIES;
global $TBMAIL_OPS, $TBMAIL_AUDIT, $TBMAIL_WWW;
global $WIKISUPPORT, $WIKICOOKIENAME;
global $BUGDBSUPPORT, $BUGDBCOOKIENAME;
# Caller makes these checks too.
if ((!TBvalid_uid($token) && !TBvalid_email($token)) ||
......@@ -719,6 +720,16 @@ function DOLOGIN($token, $password, $adminmode = 0) {
$TBAUTHDOMAIN, $TBSECURECOOKIES);
}
#
# Ditto for bugdb
#
if ($BUGDBSUPPORT) {
$flushtime = time() - 1000000;
setcookie($BUGDBCOOKIENAME, "", $flushtime, "/",
$TBAUTHDOMAIN, $TBSECURECOOKIES);
}
#
# Set adminoff on new logins, unless user requested to be
# logged in as admin (and is an admin of course!). This is
......@@ -820,6 +831,7 @@ function VERIFYPASSWD($uid, $password) {
function DOLOGOUT($uid) {
global $CHECKLOGIN_STATUS, $TBAUTHCOOKIE, $TBLOGINCOOKIE, $TBAUTHDOMAIN;
global $WIKISUPPORT, $WIKICOOKIENAME;
global $BUGDBSUPPORT, $BUGDBCOOKIENAME;
# Pedantic check.
if (!TBvalid_uid($uid)) {
......@@ -849,6 +861,9 @@ function DOLOGOUT($uid) {
if ($WIKISUPPORT) {
setcookie($WIKICOOKIENAME, "", $timeout, "/", $TBAUTHDOMAIN, 0);
}
if ($BUGDBSUPPORT) {
setcookie($BUGDBCOOKIENAME, "", $timeout, "/", $TBAUTHDOMAIN, 0);
}
return 0;
}
......
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