summaryrefslogtreecommitdiffstats
path: root/ipaserver/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipaserver/__init__.py')
-rw-r--r--ipaserver/__init__.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/ipaserver/__init__.py b/ipaserver/__init__.py
index b0be96bd2..35f96c7f6 100644
--- a/ipaserver/__init__.py
+++ b/ipaserver/__init__.py
@@ -20,3 +20,31 @@
"""
Package containing server backend.
"""
+
+from xmlrpclib import dumps, Fault
+from ipalib import api
+
+try:
+ from mod_python import apache
+ api.bootstrap(context='server', log=None, debug=True)
+ api.finalize()
+except ImportError:
+ pass
+
+
+def xmlrpc(req):
+ if req.method != 'POST':
+ req.allow_methods(['POST'], 1)
+ return apache.HTTP_METHOD_NOT_ALLOWED
+
+ if apache.mpm_query(apache.AP_MPMQ_IS_THREADED):
+ response = dumps(
+ Fault(3, 'Apache must use the forked model'), methodresponse=True
+ )
+ else:
+ response = api.Backend.xmlserver.marshaled_dispatch(req.read(), None)
+
+ req.content_type = 'text/xml'
+ req.set_content_length(len(response))
+ req.write(response)
+ return apache.OK