File: perldap.py

package info (click to toggle)
python-ldap 1.9.999.pre04-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 312 kB
  • ctags: 475
  • sloc: ansic: 2,973; python: 1,141; makefile: 84; sh: 4
file content (83 lines) | stat: -rw-r--r-- 2,343 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# python
# $Id: perldap.py,v 1.2 2001/11/13 01:51:47 leonard Exp $

'''PerLDAP-like interface to the Python LDAP library
'''

__author__ = "David Leonard"
__version__ = "$Revision: 1.2 $"

class Conn:
	def __init__(self, host, port = str(_ldap.PORT), 
			bind = '', pswd = '', cert = ldap.AUTH_SIMPLE):
		self.host, self.port, self.binf = host, port, bind
		self._l = _ldap.open(host, int(port))
		self._l.bind_s(bind, pswd, cert)
	def search(self, base, scope, pattern):
		'''search(base, scope, pattern) -> Entry'''
		self._context = self._l.search(scope, pattern)
		return self.nextEntry()
	def searchURL(self, url):
		'''searchURL(url) -> Entry'''
	def nextEntry(self):
		'''nextEntry() -> Entry'''
		ret = self._l.result(self._context)
		if ret[0] == _ldap.RES_SEARCH_RESULT:
			del self._context
			return None
		assert ret[0] == _ldap.RES_SEARCH_ENTRY
		return Entry(ret[1])
	def update(self, entry):
		'''update(entry) -> int'''
	def add(self, entry):
		'''add(entry) -> int'''
	def delete(self, entry):
		'''delete(entry) -> int'''
	def close(self):
		'''close() -> Entry'''
	def modifyRDN(self, rdn, dn):
		'''modifyRDN(rdn, dn) -> Entry'''
	def isURL(self, url):
		'''isURL(url) -> int'''
	def getLD(self):
		'''getLD() -> fd int'''
	def getErrorCode(self):
		'''getErrorCode() -> int'''
	def getErrorString(self):
		'''getErrorString() -> string'''
	def printError(self):
		'''printError()'''
	def setRebindProc(self, func):
		'''setRebindProc(func)'''
	def setDefaultRebindProc(self):
		'''setDefaultRebindProc()'''

class Entry:
	def attrModified(self, attr):
		'''attrModified(attr)'''
	def isModified(self, attr):
		'''isModified(attr) -> int'''
	def remove(self, attr):
		'''remove(attr)'''
	def removeValue(self, attr, val):
		'''removeValue(attr, val)'''
	def addValue(self, attr, val):
		'''addValue(attr, val)'''
	def hasValue(self, attr, val, ignorecase = 0):
		'''hasValue(attr, val [, ignorecase]) -> int'''
	def matchValue(self, attr, ignorecase = 0):
		'''matchValue(attr [, ignorecase]) -> int'''
	def setDN(self, dn):
		'''setDN(dn)'''
	def getDN(self, dn):
		'''getDN(dn) -> string'''
	def size(self, attr):
		'''size(attr) -> int'''
	def exists(self, attr):
		'''exists(attr) -> int'''
	def printLDIF(self):
		'''printLDIF(self)'''
	def __getitem__(self, attr):
		pass
	def __setitem__(self, attr, value):
		pass