summaryrefslogtreecommitdiffstats
path: root/ipaserver
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2009-01-28 16:12:49 -0700
committerRob Crittenden <rcritten@redhat.com>2009-02-03 15:29:04 -0500
commita0aebd46a11d7cf9563489520ae4a540e2a63827 (patch)
tree07d5056b9281ea770e89329eb1612155538db978 /ipaserver
parent231f0bd65aec9cc0767bd6a76d5aa5b27dd37168 (diff)
downloadfreeipa-a0aebd46a11d7cf9563489520ae4a540e2a63827.tar.gz
freeipa-a0aebd46a11d7cf9563489520ae4a540e2a63827.tar.xz
freeipa-a0aebd46a11d7cf9563489520ae4a540e2a63827.zip
Got new ldap connection working using Connectible.connect()
Diffstat (limited to 'ipaserver')
-rw-r--r--ipaserver/plugins/b_ldap.py15
-rw-r--r--ipaserver/plugins/b_ra.py2
-rw-r--r--ipaserver/rpcserver.py3
-rw-r--r--ipaserver/servercore.py16
4 files changed, 21 insertions, 15 deletions
diff --git a/ipaserver/plugins/b_ldap.py b/ipaserver/plugins/b_ldap.py
index 350870392..1160bf9e7 100644
--- a/ipaserver/plugins/b_ldap.py
+++ b/ipaserver/plugins/b_ldap.py
@@ -28,8 +28,8 @@ import ldap as _ldap
from ipalib import api
from ipalib import errors
from ipalib.crud import CrudBackend
-from ipaserver import servercore
-from ipaserver import ipaldap
+from ipaserver import servercore, ipaldap
+import krbV
class ldap(CrudBackend):
@@ -41,11 +41,16 @@ class ldap(CrudBackend):
self.dn = _ldap.dn
super(ldap, self).__init__()
- def create_connection(self, ccache=None):
- return 'The LDAP connection.'
+ def create_connection(self, ccache):
+ conn = ipaldap.IPAdmin(self.env.ldap_host, self.env.ldap_port)
+ principle = krbV.CCache(
+ name=ccache, context=krbV.default_context()
+ ).principal().name
+ conn.set_krbccache(ccache, principle)
+ return conn
def destroy_connection(self):
- pass
+ self.conn.unbind_s()
def make_user_dn(self, uid):
"""
diff --git a/ipaserver/plugins/b_ra.py b/ipaserver/plugins/b_ra.py
index e6a9b63f4..f0363bf15 100644
--- a/ipaserver/plugins/b_ra.py
+++ b/ipaserver/plugins/b_ra.py
@@ -338,7 +338,7 @@ class ra(Backend):
def __get_ca_chain(self):
headers = {"Content-type": "application/x-www-form-urlencoded"}
- conn = httplib.HTTPConnection(self.ca_host+":"+self.ca_port)
+ conn = httplib.HTTPConnection(self.ca_host, self.ca_port)
conn.request("POST", "/ca/ee/ca/getCertChain", None, headers)
response = conn.getresponse()
api.log.debug("IPA-RA: response.status: %d response.reason: '%s'" % (response.status, response.reason))
diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py
index 9616e481d..cb0a464cc 100644
--- a/ipaserver/rpcserver.py
+++ b/ipaserver/rpcserver.py
@@ -46,11 +46,12 @@ class xmlserver(Executioner):
Also see the `ipalib.rpc.xmlclient` plugin.
"""
- def marshaled_dispatch(self, data):
+ def marshaled_dispatch(self, data, ccache):
"""
Execute the XML-RPC request in contained in ``data``.
"""
try:
+ self.create_context(ccache=ccache)
(params, name) = xml_loads(data)
(args, options) = params_2_args_options(params)
response = (self.execute(name, *args, **options),)
diff --git a/ipaserver/servercore.py b/ipaserver/servercore.py
index 362013401..19adb019f 100644
--- a/ipaserver/servercore.py
+++ b/ipaserver/servercore.py
@@ -20,7 +20,7 @@
import ldap
import string
import re
-from ipaserver.context import context
+from ipalib.request import context
from ipaserver import ipaldap
import ipautil
from ipalib import errors
@@ -86,7 +86,7 @@ def get_entry (base, scope, searchfilter, sattrs=None):
"""
ent=""
- ent = context.conn.getConn().getEntry(base, scope, searchfilter, sattrs)
+ ent = context.ldap.conn.getEntry(base, scope, searchfilter, sattrs)
return convert_entry(ent)
@@ -117,7 +117,7 @@ def get_list (base, searchfilter, sattrs=None, scope=ldap.SCOPE_SUBTREE):
"""
entries = []
- entries = context.conn.getConn().getList(base, scope, searchfilter, sattrs)
+ entries = context.ldap.conn.getList(base, scope, searchfilter, sattrs)
return map(convert_entry, entries)
@@ -252,22 +252,22 @@ def update_entry (entry, remove_keys=[]):
# FIXME: return a missing DN error message
raise e
- return context.conn.getConn().updateEntry(moddn, oldentry, newentry)
+ return context.ldap.conn.updateEntry(moddn, oldentry, newentry)
def add_entry(entry):
"""Add a new entry"""
- return context.conn.getConn().addEntry(entry)
+ return context.ldap.conn.addEntry(entry)
def delete_entry(dn):
"""Remove an entry"""
- return context.conn.getConn().deleteEntry(dn)
+ return context.ldap.conn.deleteEntry(dn)
# FIXME, get time and search limit from cn=ipaconfig
def search(base, filter, attributes, timelimit=1, sizelimit=3000):
"""Perform an LDAP query"""
try:
timelimit = float(timelimit)
- results = context.conn.getConn().getListAsync(base, ldap.SCOPE_SUBTREE,
+ results = context.ldap.conn.getListAsync(base, ldap.SCOPE_SUBTREE,
filter, attributes, 0, None, None, timelimit, sizelimit)
except ldap.NO_SUCH_OBJECT:
raise errors.NotFound
@@ -322,7 +322,7 @@ def get_ipa_config():
return config
def modify_password(dn, oldpass, newpass):
- return context.conn.getConn().modifyPassword(dn, oldpass, newpass)
+ return context.ldap.conn.modifyPassword(dn, oldpass, newpass)
def mark_entry_active (dn):
"""Mark an entry as active in LDAP."""