netcmd/ldapcmp: fix wrong way for string copy
authorJoe Guo <joeg@catalyst.net.nz>
Tue, 6 Nov 2018 04:41:12 +0000 (17:41 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 21 Nov 2018 06:46:20 +0000 (07:46 +0100)
Two mistakes here:

- res[:-1] will copy but lost the last char
- string is immutable in python, there is no need to copy it explicitly

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/ldapcmp.py

index eca1ecd91e6c0bfb69d131ea66de6218d712e702..646eedc0e8079f2d4ca95c5fc8570cb492f5194c 100644 (file)
@@ -565,8 +565,8 @@ class LDAPObject(object):
         else:
             raise Exception("Unknown --view option value.")
         #
-        self.screen_output = res[1][:-1]
-        other.screen_output = res[1][:-1]
+        self.screen_output = res[1]
+        other.screen_output = res[1]
         #
         return res[0]
 
@@ -681,8 +681,8 @@ class LDAPObject(object):
         other.summary["unique_attrs"] += other.unique_attrs
         other.summary["df_value_attrs"] += self.df_value_attrs  # they are the same
         #
-        self.screen_output = res[:-1]
-        other.screen_output = res[:-1]
+        self.screen_output = res
+        other.screen_output = res
         #
         return res == ""