<div><div>Hi,</div><div><br></div><div>I'm new in the list, I hope I'll find some help here. Thanks in advance.</div><div><br></div><div>I'm trying to do a simple search in a LDAP directory. From a main routine, I call two functions: one to connect to the LDAP directory (I just want to make a search, so I do not bind) and then, I call the function that makes the search. The problem: not all atributtes are returned, I have no way to get "employeeNumber" attribute. No error given. Other attributes (cn, homeDirectory) are returned correctly.</div>
<div><br></div><div>MAIN ROUTINE</div><div><br></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><b>[...]</b></div></div><div><div><b>l.connect2()</b></div></div><div><div><div><b>filter="(cn=*)"</b></div>
</div></div><div><div><div><b>search = l.search2("ou=People",filter,["cn","employeeNumber","homeDirectory"])</b></div></div></div><div><div><b>[...]</b></div></div></blockquote><div>
<div><br></div><div><br></div><div>LDAP CONNECT CLASS</div></div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><b>[...]</b></div></div><div><div><b> def connect2(self):</b></div>
</div><div><div><b> ## first you must open a connection to the server</b></div></div><div><div><b> try:</b></div></div><div><div><b> self.connection = ldap.open("172.23.36.5")</b></div></div>
<div><div><b> self.connection.protocol_version = ldap.VERSION3</b></div></div><div><div><b> except ldap.LDAPError, e:</b></div></div><div><div><b> print e</b></div></div><div><b><br></b></div>
<div><div><b>def search2(self,baseDN,filter,retrieveAttributes):</b></div></div><div><div><b> searchScope = ldap.SCOPE_SUBTREE</b></div></div><div><div><b> import pdb</b></div></div><div><div><b> try:</b></div>
</div><div><div><b> ldap_result_id = self.connection.search(baseDN+ ",dc=instituto,dc=extremadura,dc=es", ldap.SCOPE_SUBTREE, filter, retrieveAttributes)</b></div></div><div><div><b> result_set = []</b></div>
</div><div><div><b> while 1:</b></div></div><div><div><b> result_type, result_data = self.connection.result(ldap_result_id, 0)</b></div></div><div><div><b> pdb.set_trace()</b></div>
</div><div><div><b> if (result_data == []):</b></div></div><div><div><b> break</b></div></div><div><div><b> else:</b></div></div><div><div><b> if result_type == ldap.RES_SEARCH_ENTRY:</b></div>
</div><div><div><b> result_set.append(result_data)</b></div></div><div><div><b> return result_set</b></div></div><div><div><b> except ldap.LDAPError, e:</b></div></div><div><div><b> print e</b></div>
</div><div><b>[...]</b></div></blockquote><div><br></div><div><br></div><div>employeeNumber attribute (from LDAP)</div><div><table class="result_table" width="100%" border="0" style="border:1px solid rgb(170,170,204);border-collapse:collapse;empty-cells:show;color:rgb(0,0,0);font-family:'bitstream vera sans','luxi sans',verdana,geneva,arial,helvetica,sans-serif;font-size:13px;background-color:rgb(252,252,254)">
<tbody><tr class="heading" style="color:rgb(255,255,255);background-color:rgb(0,0,136);font-size:12px;font-weight:bold"><td colspan="2" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px">
<a name="employeenumber" style="font-weight:bold">employeeNumber</a></td></tr><tr class="odd" style="background-color:rgb(240,240,240)"><td class="title" width="30%" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px;font-weight:bold">
Descripción</td><td style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px">RFC2798: numerically identifies an employee within an organization</td></tr><tr class="even" style="background-color:rgb(224,224,224)">
<td class="title" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px;font-weight:bold"><acronym title="Object Identier">OID</acronym></td><td style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px">
2.16.840.1.113730.3.1.3</td></tr><tr class="odd" style="background-color:rgb(240,240,240)"><td class="title" width="30%" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px;font-weight:bold">
Obsoleto</td><td style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px">No</td></tr><tr class="even" style="background-color:rgb(224,224,224)"><td class="title" width="30%" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px;font-weight:bold">
Hereda de</td><td style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px"><a href="http://ldap/phpldapadmin/cmd.php?cmd=schema&server_id=1&view=attributes&viewvalue=" style="color:rgb(0,0,170);text-decoration:none"></a></td>
</tr><tr class="odd" style="background-color:rgb(240,240,240)"><td class="title" width="30%" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px;font-weight:bold">Igualdad</td><td style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px">
<a href="http://ldap/phpldapadmin/cmd.php?cmd=schema&server_id=1&view=matching_rules&viewvalue=caseIgnoreMatch" style="color:rgb(0,0,170);text-decoration:none">caseIgnoreMatch</a></td></tr><tr class="even" style="background-color:rgb(224,224,224)">
<td class="title" width="30%" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px;font-weight:bold">Ordenación</td><td style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px">
(no especificado)</td></tr><tr class="odd" style="background-color:rgb(240,240,240)"><td class="title" width="30%" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px;font-weight:bold">
Regla de subcadena</td><td style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px">caseIgnoreSubstringsMatch</td></tr><tr class="even" style="background-color:rgb(224,224,224)"><td class="title" width="30%" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px;font-weight:bold">
Sintáxis</td><td style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px"><a href="http://ldap/phpldapadmin/cmd.php?cmd=schema&server_id=1&view=syntaxes&highlight_oid=1.3.6.1.4.1.1466.115.121.1.15" style="color:rgb(0,0,170);text-decoration:none">Directory String (1.3.6.1.4.1.1466.115.121.1.15)</a></td>
</tr><tr class="odd" style="background-color:rgb(240,240,240)"><td class="title" width="30%" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px;font-weight:bold">Univaludado</td><td style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px">
Sí</td></tr><tr class="even" style="background-color:rgb(224,224,224)"><td class="title" width="30%" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px;font-weight:bold">Colectivo</td>
<td style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px">No</td></tr><tr class="odd" style="background-color:rgb(240,240,240)"><td class="title" width="30%" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px;font-weight:bold">
Modificado por el usuario</td><td style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px">Sí</td></tr><tr class="even" style="background-color:rgb(224,224,224)"><td class="title" width="30%" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px;font-weight:bold">
Uso</td><td style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px">(no especificado)</td></tr><tr class="odd" style="background-color:rgb(240,240,240)"><td class="title" width="30%" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px;font-weight:bold">
Longitud máxima</td><td style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px">(no aplicable)</td></tr><tr class="even" style="background-color:rgb(224,224,224)"><td class="title" width="30%" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px;font-weight:bold">
Alias</td><td style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px">(ninguno)</td></tr><tr class="odd" style="background-color:rgb(240,240,240)"><td class="title" width="30%" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px;font-weight:bold">
Usado por la clase de objeto</td><td style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px"><a href="http://ldap/phpldapadmin/cmd.php?cmd=schema&server_id=1&view=objectclasses&viewvalue=inetorgperson" style="color:rgb(0,0,170);text-decoration:none">inetOrgPerson</a></td>
</tr><tr class="even" style="background-color:rgb(224,224,224)"><td class="title" width="30%" style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px;font-weight:bold">Forzar a MAY por configuración</td>
<td style="font-size:12px;vertical-align:top;border:1px solid rgb(170,170,204);padding:5px 10px">No</td></tr></tbody></table></div><div><br></div>