|
38 |
import sys |
38 |
import sys |
39 |
import base64 |
39 |
import base64 |
40 |
import time |
40 |
import time |
|
|
41 |
import calendar |
41 |
import os |
42 |
import os |
42 |
import copy |
43 |
import copy |
43 |
import types |
44 |
import types |
Lines 262-273
def encode_ad_resultlist(ad_resultlist):
|
Link Here
|
---|
|
262 |
|
263 |
|
263 |
def unix2ad_time(l): |
264 |
def unix2ad_time(l): |
264 |
d = 116444736000000000 # difference between 1601 and 1970 |
265 |
d = 116444736000000000 # difference between 1601 and 1970 |
265 |
return int(time.mktime(time.gmtime(time.mktime(time.strptime(l, "%Y-%m-%d")) + 90000))) * 10000000 + d # 90000s are one day and one hour |
266 |
return int(calendar.timegm(time.strptime(l, "%Y-%m-%d")) - 86400) * 10000000 + d # AD stores end of day in accountExpires |
266 |
|
267 |
|
267 |
|
268 |
|
268 |
def ad2unix_time(l): |
269 |
def ad2unix_time(l): |
269 |
d = 116444736000000000 # difference between 1601 and 1970 |
270 |
d = 116444736000000000 # difference between 1601 and 1970 |
270 |
return time.strftime("%d.%m.%y", time.gmtime((l - d) / 10000000)) |
271 |
return time.strftime("%Y-%m-%d", time.gmtime((l - d) / 10000000 + 86400)) # shadowExpire treats day of expiry as exclusive |
271 |
|
272 |
|
272 |
|
273 |
|
273 |
def samba2ad_time(l): |
274 |
def samba2ad_time(l): |