From 8db94ace40695d25206f85e17ad8e34a44932704 Mon Sep 17 00:00:00 2001 From: David Adam Date: Sat, 9 Apr 2011 03:25:33 +0000 Subject: [PATCH] Back out revision 1.3 & update for new password file; credentials are required to add new cards in LDAP. --- sql-edition/servers/LDAPConnector.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sql-edition/servers/LDAPConnector.py b/sql-edition/servers/LDAPConnector.py index 6a8d67a..7bdcd2b 100644 --- a/sql-edition/servers/LDAPConnector.py +++ b/sql-edition/servers/LDAPConnector.py @@ -10,10 +10,14 @@ def get_ldap_connection(): ldap.set_option(ldap.OPT_X_TLS,1) ldap.set_option(ldap.OPT_X_TLS_ALLOW,1) #ldap.set_option(ldap.OPT_DEBUG_LEVEL,255) - conn = ldap.initialize('ldaps://mussel.ucc.gu.uwa.edu.au:636/') + conn = ldap.initialize('ldaps://mussel.ucc.gu.uwa.edu.au/') - # Anonymous bind - server ACLs should allow searching on uccDispenseMIFARE - conn.simple_bind_s() + binddn = 'cn=mifareagent,ou=profile,dc=ucc,dc=gu,dc=uwa,dc=edu,dc=au' + passfile = open('/etc/dispense/ldap.passwd') + password = passfile.readline().strip() + passfile.close() + + conn.simple_bind_s(binddn, password) return conn def get_uid(card_id): @@ -68,5 +72,5 @@ def set_card_id(uidNumber, card_id): ldapconn.unbind() if __name__ == '__main__': - #print get_uid('\x01\x02\x03\x04\x05\x06') - set_card_id('11251', '\x01\x02\x03\x04\x05\x06') + set_card_id('11126', '\x01\x02\x03\x04\x05\x06') + print get_uid('\x01\x02\x03\x04\x05\x06') -- 2.20.1