Commit d4510041 authored by Leigh B. Stoller's avatar Leigh B. Stoller

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

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