netcmd: Change Py3 incompatible long() for tombstone expunge
authorTim Beale <timbeale@catalyst.net.nz>
Thu, 4 Oct 2018 01:37:44 +0000 (14:37 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Fri, 12 Oct 2018 02:16:22 +0000 (04:16 +0200)
The code to expunge tombstones uses long(), which is not Python3
compatible. Python3 uses int() instead, and works out how big it needs
to be.

As long as we don't run the samba-tool command on a 32-bit machine
after the year 2038, then we should avoid any integer overflow on
Python 2.x.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
python/samba/netcmd/domain.py

index 7d0af53adf4cb7092e97e9a882a8199b6cdf8fa3..f022e3718a63243e9753e215aaaba1f27e423ad6 100644 (file)
@@ -3891,10 +3891,10 @@ This command expunges tombstones from the database."""
 
         if current_time_string is not None:
             current_time_obj = time.strptime(current_time_string, "%Y-%m-%d")
-            current_time = long(time.mktime(current_time_obj))
+            current_time = int(time.mktime(current_time_obj))
 
         else:
-            current_time = long(time.time())
+            current_time = int(time.time())
 
         if len(ncs) == 0:
             res = samdb.search(expression="", base="", scope=ldb.SCOPE_BASE,