Commit d4510041 authored by Leigh Stoller's avatar Leigh Stoller

Attempt to address login problems reported by Rob in Trac ticket #213.

parent c5c4ea22
......@@ -58,7 +58,7 @@ class EmulabAuthModule(auth.LoginModule):
return
auth.LoginModule._do_login(self, req)
if req.args.get('goto'):
req.redirect(self.env.abs_href() + req.args.get('goto'))
req.redirect(self.env.abs_href() + "/" + req.args.get('goto'))
else:
req.redirect(self.env.abs_href())
pass
......@@ -135,7 +135,9 @@ class EmulabAuthModule(auth.LoginModule):
html.A('Logout', href=req.href.logout()))
else:
shortname = os.path.basename(self.env.path)
url = 'https://www.emulab.net/gototrac.php3?login=1&wiki=%s' % shortname
page = req.path_info[1:] or 'wiki/WikiStart'
url = 'https://www.emulab.net/gototrac.php3?login=1&wiki=%s&do=%s' % (shortname, page)
yield ('metanav', 'login', html.A('Login', href=url))
pass
pass
......
......@@ -15,7 +15,7 @@ $OURDOMAIN = "@OURDOMAIN@";
$BOSSNODE = "@BOSSNODE@";
$USERNODE = "@USERNODE@";
$CVSNODE = "cvs.${OURDOMAIN}";
$WIKINODE = "wiki.${OURDOMAIN}";
$WIKINODE = $USERNODE;
$TBADMINGROUP = "@TBADMINGROUP@";
$WWWHOST = "@WWWHOST@";
$WWW = "@WWW@";
......@@ -40,10 +40,10 @@ $WIKIURL = "${WIKIHOME}/bin/newlogon";
$WIKICOOKIENAME = "WikiCookie";
$BUGDBURL = "https://${USERNODE}/flyspray";
$BUGDBCOOKIENAME= "FlysprayCookie";
$TRACCOOKIENAME = "TracCookie";
$MAILMANURL = "http://${USERNODE}/mailman";
$OPSCVSURL = "http://${USERNODE}/cvsweb/cvsweb.cgi";
$OPSJETIURL = "http://${USERNODE}/jabber/jeti.php";
$WIKIDOCURL = "http://${WIKINODE}/wikidocs";
$MIN_UNIX_UID = @MIN_UNIX_UID@;
$MIN_UNIX_GID = @MIN_UNIX_GID@;
$EXPOSELINKTEST = 1;
......@@ -51,6 +51,7 @@ $EXPOSESTATESAVE= 0;
$EXPOSEARCHIVE = 0;
$EXPOSETEMPLATES= 0;
$USERSELECTUIDS = 1;
$REMOTEWIKIDOCS = 0;
$TBMAILADDR_OPS = "@TBOPSEMAIL_NOSLASH@";
$TBMAILADDR_WWW = "@TBWWWEMAIL_NOSLASH@";
......@@ -82,6 +83,20 @@ if ($WWWHOST != "www.emulab.net") {
$TBMAINSITE = 0;
}
#
# The wiki docs either come from the local node, or in most cases
# they are redirected back to Utah's emulab.
#
if ($TBMAINSITE) {
$WIKIDOCURL = "https://${WIKINODE}/wikidocs/wiki";
}
elseif ($REMOTEWIKIDOCS) {
$WIKIDOCURL = "https://wiki.emulab.net/wikidocs/wiki";
}
else {
$WIKIDOCURL = "/wikidocs/wiki";
}
$TBPROJ_DIR = "@PROJROOT_DIR@";
$TBUSER_DIR = "@USERSROOT_DIR@";
$TBGROUP_DIR = "@GROUPSROOT_DIR@";
......
......@@ -38,22 +38,22 @@ if ($wiki == "geni") {
USERERROR("You do not have permission to access the Trac wiki!", 1);
}
$wiki = "protogeni";
$TRACURL = "https://www.protogeni.net/trac/$wiki";
$TRACCOOKIENAME = "trac_auth_protogeni_priv";
$TRACURL = "https://www.protogeni.net/trac/$wiki";
$COOKIENAME = "trac_auth_protogeni_priv";
}
elseif ($wiki != "emulab") {
USERERROR("Unknown Trac wiki $wiki!", 1);
}
else {
$TRACURL = "https://${USERNODE}/trac/$wiki";
$TRACCOOKIENAME = "trac_auth_${wiki}";
$TRACURL = "https://${USERNODE}/trac/$wiki";
$COOKIENAME = "trac_auth_${wiki}";
}
#
# Look for our cookie. If the browser has it, then there is nothing
# more to do; just redirect the user over to the wiki.
#
if (!$login) {
if (!$login && isset($_COOKIE[$TRACCOOKIENAME])) {
$url = $TRACURL;
if (isset($do)) {
$url .= "/" . $do;
......@@ -75,8 +75,11 @@ $hash = $matches[1];
if ($wiki == "protogeni") {
# We do this for the private wiki. Temporary.
setcookie($TRACCOOKIENAME, $hash, 0, "/", $TBAUTHDOMAIN, $TBSECURECOOKIES);
setcookie($COOKIENAME, $hash, 0, "/", $TBAUTHDOMAIN, $TBSECURECOOKIES);
}
# This cookie tells boss that we have logged into Trac, but nothing else.
setcookie($TRACCOOKIENAME, $hash, 0, "/", $TBAUTHDOMAIN, $TBSECURECOOKIES);
header("Location: ${TRACURL}/xlogin?user=$uid&hash=$hash" .
(isset($do) ? "&goto=/${do}" : ""));
(isset($do) ? "&goto=${do}" : ""));
......@@ -901,7 +901,7 @@ function DOLOGIN_MAGIC($uid, $uid_idx, $email = null, $adminon = 0)
global $TBNAMECOOKIE, $TBLOGINCOOKIE, $TBSECURECOOKIES, $TBEMAILCOOKIE;
global $TBMAIL_OPS, $TBMAIL_AUDIT, $TBMAIL_WWW;
global $WIKISUPPORT, $WIKICOOKIENAME;
global $BUGDBSUPPORT, $BUGDBCOOKIENAME, $TRACSUPPORT;
global $BUGDBSUPPORT, $BUGDBCOOKIENAME, $TRACSUPPORT, $TRACCOOKIENAME;
# Caller makes these checks too.
if (!TBvalid_uid($uid)) {
......@@ -994,6 +994,7 @@ function DOLOGIN_MAGIC($uid, $uid_idx, $email = null, $adminon = 0)
$TBAUTHDOMAIN, $TBSECURECOOKIES);
setcookie("trac_auth_protogeni_priv", "", $flushtime, "/",
$TBAUTHDOMAIN, $TBSECURECOOKIES);
setcookie($TRACCOOKIENAME, "", $flushtime, "/", $TBAUTHDOMAIN, 0);
}
DBQueryFatal("update users set ".
......@@ -1032,7 +1033,7 @@ function DOLOGOUT($user) {
global $CHECKLOGIN_STATUS, $CHECKLOGIN_USER;
global $TBAUTHCOOKIE, $TBLOGINCOOKIE, $TBAUTHDOMAIN;
global $WIKISUPPORT, $WIKICOOKIENAME, $HTTP_COOKIE_VARS;
global $BUGDBSUPPORT, $BUGDBCOOKIENAME;
global $BUGDBSUPPORT, $BUGDBCOOKIENAME, $TRACSUPPORT, $TRACCOOKIENAME;
if (! $CHECKLOGIN_USER)
return 1;
......@@ -1090,6 +1091,10 @@ function DOLOGOUT($user) {
setcookie($TBAUTHCOOKIE, "", $timeout, "/", $TBAUTHDOMAIN, 0);
setcookie($TBLOGINCOOKIE, "", $timeout, "/", $TBAUTHDOMAIN, 0);
if ($TRACSUPPORT) {
setcookie($TRACCOOKIENAME, "", $timeout, "/", $TBAUTHDOMAIN, 0);
}
if ($WIKISUPPORT) {
setcookie($WIKICOOKIENAME, "", $timeout, "/", $TBAUTHDOMAIN, 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