ldap3
ldap3 copied to clipboard
Missing attributes
I'm trying to get a list of all attributes that have a value but I'm facing an issue where there are many missing attributes both operational and user/effective.
server = Server(AD_SERVER, port=389, use_ssl=False, get_info=ALL)
conn = Connection(server, AD_SERVER_USERNAME, AD_SERVER_PASSWORD, client_strategy=SAFE_SYNC, auto_bind=True)
conn.search(
search_base=SEARCH_BASE,
search_filter=SEARCH_FILTER',
search_scope=ldap3.BASE,
attributes=['*', '+'],
get_operational_attributes=True, #I know this is redundant
)
when I use the search operation like this I get a ton of missing operational attributes like modify_time_stamp
, create_time_stamp
, allowed_attributes_effective
, allowed_attributes
, allowed_child_classes_effective
and many others.
reader = Reader(conn, OBJECT_DEF, SEARCH_BASE)
result = reader.search(attributes='*')
And when using the Reader
class without the attributes
parameter I get most of the missing operational attributes but the effective attributes have sAMAccountName
, sAMAccountType
, info
and many others missing.
If I use the Reader
class like above I get an LDAPCursor
error:
LDAPCursorError: attribute 'sAMAccountName' not in object class 'group' for entry CN=Fetch-Users,OU=Cairo - Users,DC=daas365,DC=local
and If I use the attributes
parameter in the Reader
class, not the search:
reader = Reader(conn, OBJECT_DEF, SEARCH_BASE, attributes='*')
I get an LDAPCursor
error:
LDAPCursorError: Attributes '*' non in definition
This worked for me on our openldap:
attributes=[ldap.ALL_ATTRIBUTES, ldap3.ALL_OPERATIONAL_ATTRIBUTES]
but when I look up the source:
# search attributes
ALL_ATTRIBUTES = '*'
NO_ATTRIBUTES = '1.1' # as per RFC 4511
ALL_OPERATIONAL_ATTRIBUTES = '+' # as per RFC 3673
I suspect some kind of user or searchbase limitation