summaryrefslogtreecommitdiffstats
path: root/scripts/webui.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/webui.cgi')
-rwxr-xr-xscripts/webui.cgi26
1 files changed, 12 insertions, 14 deletions
diff --git a/scripts/webui.cgi b/scripts/webui.cgi
index ed0690f..1a7257d 100755
--- a/scripts/webui.cgi
+++ b/scripts/webui.cgi
@@ -16,6 +16,7 @@ import cgitb
import Cookie
import os
import sys
+import ConfigParser
from cobbler.webui.CobblerWeb import CobblerWeb
def map_modes():
@@ -44,8 +45,6 @@ def configure():
'password': None,
'cgitb_enabled': 1
}
- #config.username = 'testuser',
- #config.password = 'llamas2007'
# defaults
if config['server'] is None:
@@ -54,6 +53,17 @@ def configure():
if config['base_url'] is None:
config['base_url'] = base_url()
+ if ( os.access('/etc/cobbler/auth.conf', os.R_OK) ):
+ config_parser = ConfigParser.ConfigParser()
+ auth_conf = open("/etc/cobbler/auth.conf")
+ config_parser.readfp(auth_conf)
+ auth_conf.close()
+ for auth in config_parser.items("xmlrpc_service_users"):
+ sys.stderr.write( str(auth) )
+ if auth[1].lower() != "disabled":
+ config['username'] = auth[0]
+ config['password'] = auth[1]
+
return config
def main():
@@ -61,7 +71,6 @@ def main():
cw_conf = configure()
path = map_modes()
form = cgi.parse()
- cookies = Cookie.SimpleCookie(os.environ.get("HTTP_COOKIE",""))
# make cgitb enablement configurable
if cw_conf['cgitb_enabled'] == 1:
@@ -80,12 +89,6 @@ def main():
# instantiate a CobblerWeb object
cw = CobblerWeb( **cw_conf )
- # FIXME: allow for direct URL access and pages will redirect appropriately.
-
- #if not path.startswith('login') and (cw_conf['token'] is None and (cw_conf['username'] is None or cw_conf['password'] is None)):
- # func = getattr( cw, 'login' )
- # content = func( message="Authentication Required." )
-
# check for a valid path/mode
if path in cw.modes():
func = getattr( cw, path )
@@ -96,11 +99,6 @@ def main():
func = getattr( cw, 'error_page' )
content = func( "Invalid Mode: \"%s\"" % path )
- # finally, get any cookies generated by the CobblerWeb object
- cookie_header = cw.cookies().output()
- if cookie_header:
- print cookie_header
-
# deliver content
print "Content-type: text/html"
print