bernhard: utils/testing create_ldap_users.py,1.1,1.2

cvs at intevation.de cvs at intevation.de
Thu Jun 30 11:34:47 CEST 2005


Author: bernhard

Update of /kolabrepository/utils/testing
In directory doto:/tmp/cvs-serv597

Modified Files:
	create_ldap_users.py 
Log Message:
Added documentation: security consideration: connection unencrypted.
Used recommended function ldap.initialize() instead of ldap.open()
 which is decprecated.
Seperated server, ldap_uri and kolabhomeserver in the variables.


Index: create_ldap_users.py
===================================================================
RCS file: /kolabrepository/utils/testing/create_ldap_users.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- create_ldap_users.py	18 Apr 2005 18:30:57 -0000	1.1
+++ create_ldap_users.py	30 Jun 2005 09:34:45 -0000	1.2
@@ -1,5 +1,10 @@
 #!/bin/env python
-"""Create some few kolab users in ldap"""
+"""Create some few kolab users in ldap.
+
+Security considerations: 
+    The connection is not encrypted by default and thus the password
+    can be sniffed.
+"""
 
 # requires the python-ldap module from
 # http://python-ldap.sourceforge.net/
@@ -14,7 +19,9 @@
 mail_domain = "example.com"
 base_dn = "dc=example,dc=com"
 admin_dn_part = "cn=some admin,cn=internal"
-hostname = "kolabserver.example.com"
+kolabserver = "kolabserver.example.com"
+ldap_uri = "ldap://"+ kolabserver + ":389/"
+home_server = kolabserver
 
 # number of users to create.  All users have email addresses of the form
 # autotest%d at mail_domain where %d will be replaced by a number in
@@ -22,13 +29,13 @@
 num_users = 10
 
 def add_user():
-    conn = ldap.open(hostname)
+    conn = ldap.initialize(ldap_uri)
     pwd = getpass.getpass("ldap bind password:")
     conn.simple_bind_s(admin_dn_part + "," + base_dn, pwd)
 
     common_attrs = {
         'objectClass': ['top', 'inetOrgPerson', 'kolabInetOrgPerson'],
-        'kolabHomeServer': ['neso.test.hq'],
+        'kolabHomeServer': [home_server],
         'kolabInvitationPolicy': ['ACT_MANUAL'],
         }
 





More information about the commits mailing list