Commit 605141d4 authored by Timothy Stack's avatar Timothy Stack

  * xmlrpc/sslxmlrpc_client.py.in: Need to add a path to the URI used
    to connect to the server.

  * xmlrpc/sslxmlrpc_server.py.in: Only add devel paths for admins
parent 3e1986a5
......@@ -15,12 +15,19 @@
#
import sys
sys.path.append("@prefix@/lib")
import getopt
import os
import os, os.path
import xmlrpclib
TBROOT = "@prefix@"
TBPATH = os.path.join(TBROOT, "lib")
if TBPATH not in sys.path:
sys.path.append(TBPATH)
pass
from emulabclient import *
import xmlrpclib
from M2Crypto.m2xmlrpclib import SSL_Transport
from M2Crypto import SSL
......@@ -213,7 +220,7 @@ ctx.set_verify(SSL.verify_none, 16)
ctx.set_allow_unknown_ca(0)
# This is parsed by the Proxy object.
URI = "https://" + xmlrpc_server + ":" + str(xmlrpc_port)
URI = "https://" + xmlrpc_server + ":" + str(xmlrpc_port) + TBROOT
if debug:
print URI
pass
......
......@@ -65,8 +65,6 @@ STD_DEVEL_PATH = "/usr/testbed/devel"
# connection, any subsequent requests will reuse the same module.
#
ALLOWED_PATHS = [ STD_PATH, "@prefix@" ]
ALLOWED_PATHS.extend(map(lambda x: os.path.join(STD_DEVEL_PATH, x),
os.listdir(STD_DEVEL_PATH)))
# syslog facility
LOGFACIL = "@TBLOGFACIL@"
......@@ -229,6 +227,17 @@ class MyServer(SSL.ForkingSSLServer, SimpleXMLRPCDispatcher):
return -1
return int(userQuery[0][0])
#
# Check if the user is an admin.
#
def isadminuser(self, uid):
res = DBQueryFatal("select admin from users where uid=%s", (uid,))
if len(res) == 0:
return 0
return res[0][0]
#
# Check the certificate serial number.
......@@ -282,6 +291,12 @@ class MyServer(SSL.ForkingSSLServer, SimpleXMLRPCDispatcher):
if self.uid == -1:
self.logit('User "%s" is not active' % self.user)
raise Exception('User "%s" is not active' % self.user)
self.admin = self.isadminuser(self.user)
if not self.admin:
ALLOWED_PATHS.extend(map(lambda x: os.path.join(STD_DEVEL_PATH, x),
os.listdir(STD_DEVEL_PATH)))
pass
self.glist = self.getusergroups(self.user);
if len(self.glist) == 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