Comments (7)
The accountExpires attribute is an AD timestamp like lastLogon and badPasswordTime.
accountExpires
attribute: https://msdn.microsoft.com/en-us/library/ms675098(v=vs.85).aspx
schema: https://msdn.microsoft.com/en-us/library/Cc221084.aspx
badPasswordTime
attribute: https://msdn.microsoft.com/en-us/library/ms675243(v=vs.85).aspx
schema: https://msdn.microsoft.com/en-us/library/Cc221229.aspx
Both of these attributes have the same attributeSyntax and omSyntax values however, while badPasswordTime is sent through the formatter, accountExpires is not.
from ldap3.
Hi Will, what is the syntax of this attribute in the schema? Are you using the get_info=SCHEMA parameter in the server object? If the accountExpires has a custom format it can be added to the standard formatter of ldap3.
from ldap3.
Apologies, the issue is apparently not that the attribute itself is not being formatted but rather that the value presented by AD is not being accounted for. In the case of accountExpires the AD timestamp uses the value 9223372036854775807 to indicate that the account will never expire.
I don't think there is an infinity representation of a datetime object in Python so perhaps returning float('inf') in this particular case would make sense? This works nicely for JSON representation.
So, in format_ad_timestamp() there could be something like:
if raw_value == b'9223372036854775807':
return float('inf')
I'm not sure of the performance implications though.
from ldap3.
HI Will, that value is used to represent the highest value that can be stored in a 64 bit signed integer ( 2^63 − 1 or 7FFF FFFF FFFF FFFF in hex) and in this case should mean the highest date that can be stored in the accountExpires attribute.
To be consistent with the value returned by format_ad_timestamp() I prefer:
if raw_value == b'9223372036854775807': # max value to be stored in a 64 bit signed int
return datetime.max # returns datetime.datetime(9999, 12, 31, 23, 59, 59, 999999)
This return the highest date managed by the python datetime module and should not break existing code.
from ldap3.
I was just about to revise my previous assertion. You are correct. Staying standard is the right way to go. Thanks.
from ldap3.
Will release it in the next release.
bye,
Giovanni
from ldap3.
Fixed in 0.9.9
from ldap3.
Related Issues (20)
- > @cannatag Yeah, I was able to reach the server, and then suddenly this error would come up. I'm now wondering if it was because of some pool of connections or something, I got around this error by rebooting the server machine and the service machine. I'll reopen if I get this error again.
- RecursionError: maximum recursion depth exceeded ( HOT 2
- Accessing conn.entries leads to TypeError: string indices must be integers HOT 1
- Rebind as anonymous after
- windows package within requirements.txt HOT 3
- Hi, HOT 3
- REUSABLE client_strategy and page search switch
- Please remove password from the Connection class HOT 1
- Entry.entry_commit_change() does not check if a auxiliary class is already added HOT 1
- Issue in ldap3.utils.dn.parse_dn when strip=True
- conn.extend.standard.paged_search is invalid in the AD domain service
- Ignore servers in pool with invalid credentials
- Using modify to change the password failed
- Creating a user,problem 5003 (WILL_NOT_PERFORM) HOT 1
- Running tests with SERVER=NONE fails
- Support for Sync Content Synchronization Operation RFC 4533
- Performance improvement querying Active Directory HOT 1
- Query size limit not available in abstraction layer.
- Clarification needed regarding empty attributes
- paged_search error with REUSABLE client_strategy in Active Directory HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ldap3.