[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Fri Nov 29 02:10:05 UTC 2019


The branch, master has been updated
       via  cddc229a468 selftest: Test partial parse behaviour in ndrdump
       via  b866018c2c8 ndrdump: Do not run the validate step after a failure
       via  ef0257b1055 ndrdump: Improve error message when the pipes fail to dump
       via  bbae56411c7 ndrdump: Show the actual struct/function name in the print, not just what it was called
       via  674d2cfd04e librpc/ndr: Remove unused ndr_cab_generate_checksum()
       via  bd81733bb7c librpc: Make CFDATA private to cab.idl and remove pull and push functions
       via  12b3f26eee8 samba-tool tests: re-add tests for attribute value verification using samba-tool
       via  6d1a0eb8d11 samba-tool {user,group,computer,contact} show: avoid base64 encoded strings if possible
       via  0b04d9f2ec8 samba-tool tests: prepare tests for new samba-tool functionality
       via  c35b3ef2e1e samba-tool tests: remove duplicate definitions of test functions
       via  9983caaa47d samba-tool group show: fix a copy-paste mistake
      from  2b88890adad krb5: move disabling dns-canon to lower level init calls

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit cddc229a4689f1d1757f427cd58816c1af2e628f
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Nov 20 18:55:47 2019 +1300

    selftest: Test partial parse behaviour in ndrdump
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Fri Nov 29 02:09:11 UTC 2019 on sn-devel-184

commit b866018c2c89f6118c18d7a3527a0fa6d9916b9e
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Nov 20 18:54:28 2019 +1300

    ndrdump: Do not run the validate step after a failure
    
    This avoids ending a failed parse with 'dump OK'
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

commit ef0257b1055cfea3ca0bee69d8848f5719300911
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Nov 20 18:54:04 2019 +1300

    ndrdump: Improve error message when the pipes fail to dump
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

commit bbae56411c716d8678687cf7c559488b618e8935
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Nov 20 18:53:09 2019 +1300

    ndrdump: Show the actual struct/function name in the print, not just what it was called
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

commit 674d2cfd04e79fc35317198c5e9e88734b14a5b9
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Nov 21 11:28:36 2019 +1300

    librpc/ndr: Remove unused ndr_cab_generate_checksum()
    
    This function is not just unused, it is a problem because there is no
    enforced connection between r->ab.length and r->cbData.
    
    The last caller was removed in the previous commit.
    
    Found by Douglas Bagnall using Hongfuzz and the new fuzz_ndr_X
    fuzzer.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

commit bd81733bb7c5af3fb2f98bf475d53507c3955b31
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 19 16:07:50 2019 +1300

    librpc: Make CFDATA private to cab.idl and remove pull and push functions
    
    We can do this because ndr_{pull,push}_CFDATA is unused.
    
    The earlier commit 466d5e814727046dd630d5503b43874ec46a365e removed
    the link between "uint16 cbData" and the size of "DATA_BLOB ab" so
    when the new ndr_fuzz_X fusser pushed a new structure this allowed
    a read beyond the end of allocated memory.
    
    The ndr_push_cab_file() function is also manually written and
    does not rely on the value of cbData to calculate the checksum.
    
    Found by Douglas Bagnall using Hongfuzz and the new fuzz_ndr_X
    fuzzer, which like ndrdump's struct mode uses the public structure
    tables.  (This is how it found the unused functions to test).
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

commit 12b3f26eee88ac810d08197d64019f5c4cfa2a03
Author: Björn Baumbach <bb at sernet.de>
Date:   Tue Nov 26 10:56:15 2019 +0100

    samba-tool tests: re-add tests for attribute value verification using samba-tool
    
    Signed-off-by: Björn Baumbach <bb at sernet.de>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 6d1a0eb8d11dc0ad62500d977fafc7411d6f39ed
Author: Björn Baumbach <bb at sernet.de>
Date:   Mon Nov 25 14:13:37 2019 +0100

    samba-tool {user,group,computer,contact} show: avoid base64 encoded strings if possible
    
    Be more user friendly and use clear text argument strings if possible.
    
    Signed-off-by: Björn Baumbach <bb at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 0b04d9f2ec85f10dac8cd8723deea3a18925deea
Author: Björn Baumbach <bb at sernet.de>
Date:   Tue Nov 26 10:41:29 2019 +0100

    samba-tool tests: prepare tests for new samba-tool functionality
    
    Use ldbsearch instead of "samba-tool user show" to get base64 encoded
    attribute. Used to verify that the attribute value has been changed
    successfully.
    
    Signed-off-by: Björn Baumbach <bb at sernet.de>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c35b3ef2e1e79559c4293a413f5d422908546919
Author: Björn Baumbach <bb at sernet.de>
Date:   Mon Nov 25 20:53:35 2019 +0100

    samba-tool tests: remove duplicate definitions of test functions
    
    Signed-off-by: Björn Baumbach <bb at sernet.de>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 9983caaa47de2dd983f704867fad509f4d7196b1
Author: Björn Baumbach <bb at sernet.de>
Date:   Mon Nov 25 16:36:03 2019 +0100

    samba-tool group show: fix a copy-paste mistake
    
    Signed-off-by: Björn Baumbach <bb at sernet.de>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 librpc/idl/cab.idl                             |  4 +-
 librpc/ndr/ndr_cab.c                           | 11 ------
 librpc/ndr/ndr_cab.h                           |  1 -
 librpc/tools/ndrdump.c                         | 16 ++++++--
 python/samba/netcmd/computer.py                |  5 +--
 python/samba/netcmd/contact.py                 |  5 +--
 python/samba/netcmd/group.py                   |  9 ++---
 python/samba/netcmd/user.py                    |  6 +--
 python/samba/tests/blackbox/ndrdump.py         | 53 +++++++++++++++++++++++++-
 python/samba/tests/samba_tool/computer_edit.sh | 18 ++++-----
 python/samba/tests/samba_tool/contact_edit.sh  | 19 ++++-----
 python/samba/tests/samba_tool/group_edit.sh    | 18 ++++-----
 python/samba/tests/samba_tool/user_edit.sh     | 18 ++++-----
 13 files changed, 114 insertions(+), 69 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/idl/cab.idl b/librpc/idl/cab.idl
index 8eaae591c1f..d08b53566db 100644
--- a/librpc/idl/cab.idl
+++ b/librpc/idl/cab.idl
@@ -110,8 +110,8 @@ import "misc.idl";
 		[flag(r->attribs & _A_NAME_IS_UTF ? STR_UTF8|STR_NULLTERM : STR_ASCII|STR_NULLTERM)] string szName;
 	} CFFILE;
 
-	typedef [public,flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN)] struct {
-		[value(ndr_cab_generate_checksum(r))] uint32 csum;		/* checksum of this CFDATA entry */
+	typedef [flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN),nopull,nopush] struct {
+		uint32 csum;		/* checksum of this CFDATA entry */
 		uint16 cbData;		/* number of compressed bytes in this block */
 		uint16 cbUncomp;	/* number of uncompressed bytes in this block */
 #if 0
diff --git a/librpc/ndr/ndr_cab.c b/librpc/ndr/ndr_cab.c
index c415bfab34c..476e21cd417 100644
--- a/librpc/ndr/ndr_cab.c
+++ b/librpc/ndr/ndr_cab.c
@@ -111,17 +111,6 @@ static uint32_t ndr_cab_compute_checksum(uint8_t *data, uint32_t length, uint32_
 	return checksum;
 }
 
-uint32_t ndr_cab_generate_checksum(const struct CFDATA *r)
-{
-	uint32_t csumPartial;
-
-	csumPartial = ndr_cab_compute_checksum(&r->ab.data[0], r->cbData, 0);
-
-	return ndr_cab_compute_checksum((uint8_t *)discard_const(&r->cbData),
-					sizeof(r->cbData) + sizeof(r->cbUncomp),
-					csumPartial);
-}
-
 /* Push all CFDATA of a folder.
  *
  * This works on a folder level because compression type is set per
diff --git a/librpc/ndr/ndr_cab.h b/librpc/ndr/ndr_cab.h
index 59dbc991442..39b6bc9b483 100644
--- a/librpc/ndr/ndr_cab.h
+++ b/librpc/ndr/ndr_cab.h
@@ -20,4 +20,3 @@
 */
 
 uint32_t ndr_count_cfdata(const struct cab_file *r);
-uint32_t ndr_cab_generate_checksum(const struct CFDATA *r);
diff --git a/librpc/tools/ndrdump.c b/librpc/tools/ndrdump.c
index f02b1edab02..914c67e98e2 100644
--- a/librpc/tools/ndrdump.c
+++ b/librpc/tools/ndrdump.c
@@ -584,7 +584,8 @@ static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...)
 						      ndr_print,
 						      &f->out_pipes);
 		if (!NT_STATUS_IS_OK(status)) {
-			printf("pull and dump of pipes FAILED\n");
+			printf("pull and dump of OUT pipes FAILED: %s\n",
+			       nt_errstr(status));
 			TALLOC_FREE(mem_ctx);
 			exit(2);
 		}
@@ -623,7 +624,7 @@ static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...)
 			f->name);
 	}
 
-	f->ndr_print(ndr_print, format, flags, st);
+	f->ndr_print(ndr_print, f->name, flags, st);
 
 	if (flags & NDR_IN) {
 		status = ndrdump_pull_and_print_pipes(format,
@@ -631,11 +632,20 @@ static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...)
 						      ndr_print,
 						      &f->in_pipes);
 		if (!NT_STATUS_IS_OK(status)) {
-			printf("dump FAILED\n");
+			printf("pull and dump of IN pipes FAILED: %s\n",
+			       nt_errstr(status));
 			exit(1);
 		}
 	}
 
+	/* Do not proceed to validate if we got an error */
+	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+		printf("dump of failed-to-parse %s complete\n",
+		       f->name);
+		TALLOC_FREE(mem_ctx);
+		exit(2);
+	}
+
 	if (validate) {
 		DATA_BLOB v_blob;
 		struct ndr_push *ndr_v_push;
diff --git a/python/samba/netcmd/computer.py b/python/samba/netcmd/computer.py
index b66dcc4a7a5..11b2938464a 100644
--- a/python/samba/netcmd/computer.py
+++ b/python/samba/netcmd/computer.py
@@ -36,6 +36,7 @@ from samba.auth import system_session
 from samba.samdb import SamDB
 from samba.compat import get_bytes
 from subprocess import check_call, CalledProcessError
+from . import common
 
 from samba import (
     credentials,
@@ -457,8 +458,6 @@ class cmd_computer_edit(Command):
 
     def run(self, computername, credopts=None, sambaopts=None, versionopts=None,
             H=None, editor=None):
-        from . import common
-
         lp = sambaopts.get_loadparm()
         creds = credopts.get_credentials(lp, fallback_machine=True)
         samdb = SamDB(url=H, session_info=system_session(),
@@ -639,7 +638,7 @@ attribute.
                                samaccountname)
 
         for msg in res:
-            computer_ldif = samdb.write_ldif(msg, ldb.CHANGETYPE_NONE)
+            computer_ldif = common.get_ldif_for_editor(samdb, msg)
             self.outf.write(computer_ldif)
 
 
diff --git a/python/samba/netcmd/contact.py b/python/samba/netcmd/contact.py
index 506e644c3f8..b35f3f16a88 100644
--- a/python/samba/netcmd/contact.py
+++ b/python/samba/netcmd/contact.py
@@ -37,6 +37,7 @@ from samba.netcmd import (
     Option,
 )
 from samba.compat import get_bytes
+from . import common
 
 
 class cmd_create(Command):
@@ -365,8 +366,6 @@ class cmd_edit(Command):
             versionopts=None,
             H=None,
             editor=None):
-        from . import common
-
         lp = sambaopts.get_loadparm()
         creds = credopts.get_credentials(lp, fallback_machine=True)
         samdb = SamDB(url=H, session_info=system_session(),
@@ -548,7 +547,7 @@ class cmd_show(Command):
                                contactname)
 
         for msg in res:
-            contact_ldif = samdb.write_ldif(msg, ldb.CHANGETYPE_NONE)
+            contact_ldif = common.get_ldif_for_editor(samdb, msg)
             self.outf.write(contact_ldif)
 
 
diff --git a/python/samba/netcmd/group.py b/python/samba/netcmd/group.py
index 4798b773ddf..95843eecea4 100644
--- a/python/samba/netcmd/group.py
+++ b/python/samba/netcmd/group.py
@@ -39,6 +39,7 @@ from subprocess import check_call, CalledProcessError
 from samba.compat import get_bytes
 import os
 import tempfile
+from . import common
 
 security_group = dict({"Builtin": GTYPE_SECURITY_BUILTIN_LOCAL_GROUP,
                        "Domain": GTYPE_SECURITY_DOMAIN_LOCAL_GROUP,
@@ -543,7 +544,7 @@ LDAP server.
 Example3:
 samba-tool group show Group3 --attributes=member,objectGUID
 
-Example3 shows how to display a users objectGUID and member attributes.
+Example3 shows how to display a groups objectGUID and member attributes.
 """
     synopsis = "%prog <group name> [options]"
 
@@ -589,8 +590,8 @@ Example3 shows how to display a users objectGUID and member attributes.
             raise CommandError('Unable to find group "%s"' % (groupname))
 
         for msg in res:
-            user_ldif = samdb.write_ldif(msg, ldb.CHANGETYPE_NONE)
-            self.outf.write(user_ldif)
+            group_ldif = common.get_ldif_for_editor(samdb, msg)
+            self.outf.write(group_ldif)
 
 
 class cmd_group_stats(Command):
@@ -747,8 +748,6 @@ class cmd_group_edit(Command):
 
     def run(self, groupname, credopts=None, sambaopts=None, versionopts=None,
             H=None, editor=None):
-        from . import common
-
         lp = sambaopts.get_loadparm()
         creds = credopts.get_credentials(lp, fallback_machine=True)
         samdb = SamDB(url=H, session_info=system_session(),
diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py
index cadd80fd991..fb8da3d3d51 100644
--- a/python/samba/netcmd/user.py
+++ b/python/samba/netcmd/user.py
@@ -56,7 +56,7 @@ from samba.netcmd import (
 from samba.compat import text_type
 from samba.compat import get_bytes
 from samba.compat import get_string
-
+from . import common
 
 # python[3]-gpgme is abandoned since ubuntu 1804 and debian 9
 # have to use python[3]-gpg instead
@@ -2389,8 +2389,6 @@ LDAP server using the 'nano' editor.
 
     def run(self, username, credopts=None, sambaopts=None, versionopts=None,
             H=None, editor=None):
-        from . import common
-
         lp = sambaopts.get_loadparm()
         creds = credopts.get_credentials(lp, fallback_machine=True)
         samdb = SamDB(url=H, session_info=system_session(),
@@ -2520,7 +2518,7 @@ Example3 shows how to display a users objectSid and memberOf attributes.
             raise CommandError('Unable to find user "%s"' % (username))
 
         for msg in res:
-            user_ldif = samdb.write_ldif(msg, ldb.CHANGETYPE_NONE)
+            user_ldif = common.get_ldif_for_editor(samdb, msg)
             self.outf.write(user_ldif)
 
 
diff --git a/python/samba/tests/blackbox/ndrdump.py b/python/samba/tests/blackbox/ndrdump.py
index ca637b3ac7b..92a6c090c48 100644
--- a/python/samba/tests/blackbox/ndrdump.py
+++ b/python/samba/tests/blackbox/ndrdump.py
@@ -97,7 +97,7 @@ class NdrDumpTests(BlackboxTestCase):
 
     def test_ndrdump_with_binary_struct_number(self):
         expected = '''pull returned Success
-    0                        : 33323130-3534-3736-3839-616263646566
+    GUID                     : 33323130-3534-3736-3839-616263646566
 dump OK
 '''
         try:
@@ -111,6 +111,57 @@ dump OK
         # convert expected to bytes for python 3
         self.assertEqual(actual, expected.encode('utf-8'))
 
+    def test_ndrdump_input_cmdline_short_struct_name(self):
+        expected = '''pull returned Buffer Size Error
+'''
+        try:
+            actual = self.check_exit_code(
+                "ndrdump -d0 misc GUID struct --input=abcdefg", 2)
+        except BlackboxProcessError as e:
+            self.fail(e)
+
+        # check_output will return bytes
+        # convert expected to bytes for python 3
+        self.assertEqual(actual, expected.encode('utf-8'))
+
+    def test_ndrdump_input_cmdline_short_struct_name_dump(self):
+        expected = '''pull returned Buffer Size Error
+6 bytes consumed
+[0000] 61 62 63 64 65 66 67                               abcdefg ''' \
+        '''
+'''
+        try:
+            actual = self.check_exit_code(
+                "ndrdump -d0 misc GUID struct --input=abcdefg --dump-data", 2)
+        except BlackboxProcessError as e:
+            self.fail(e)
+
+        # check_output will return bytes
+        # convert expected to bytes for python 3
+        self.assertEqual(actual, expected.encode('utf-8'))
+
+    def test_ndrdump_input_cmdline_short_struct_name_print_fail(self):
+        expected = '''pull returned Buffer Size Error
+6 bytes consumed
+[0000] 61 62 63 64 65 66 67                               abcdefg ''' \
+        '''
+WARNING! 1 unread bytes
+[0000] 67                                                 g ''' \
+    '''
+WARNING: pull of GUID was incomplete, therefore the parse below may SEGFAULT
+    GUID                     : 64636261-6665-0000-0000-000000000000
+dump of failed-to-parse GUID complete
+'''
+        try:
+            actual = self.check_exit_code(
+                "ndrdump -d0 misc GUID struct --input=abcdefg --dump-data --print-after-parse-failure", 2)
+        except BlackboxProcessError as e:
+            self.fail(e)
+
+        # check_output will return bytes
+        # convert expected to bytes for python 3
+        self.assertEqual(actual, expected.encode('utf-8'))
+
     def test_ndrdump_fuzzed_clusapi_QueryAllValues(self):
         expected = b'''pull returned Success
 WARNING! 53 unread bytes
diff --git a/python/samba/tests/samba_tool/computer_edit.sh b/python/samba/tests/samba_tool/computer_edit.sh
index fb6c668f2a3..7459c396603 100755
--- a/python/samba/tests/samba_tool/computer_edit.sh
+++ b/python/samba/tests/samba_tool/computer_edit.sh
@@ -66,8 +66,7 @@ EOF
 }
 
 get_attribute_base64() {
-	$PYTHON ${STpath}/source4/scripting/bin/samba-tool computer show \
-		testmachine1 --attributes=displayName \
+	${STpath}/bin/ldbsearch '(sAMAccountName=testmachine1$)' displayName \
 		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
@@ -108,6 +107,12 @@ get_attribute_base64_control() {
 		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
+get_attribute_force_no_base64() {
+	# LDB_FLAG_FORCE_NO_BASE64_LDIF should be used here.
+	$PYTHON ${STpath}/source4/scripting/bin/samba-tool computer show \
+		testmachine1 --attributes=displayName \
+		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
+}
 
 # Test edit computer - change base64 attribute value including control character
 change_attribute_base64_control() {
@@ -124,12 +129,6 @@ EOF
 		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_attribute_base64_control() {
-	$PYTHON ${STpath}/source4/scripting/bin/samba-tool computer show \
-		testmachine1 --attributes=displayName \
-		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
-}
-
 # Test edit computer - change attributes with LDB_FLAG_FORCE_NO_BASE64_LDIF
 change_attribute_force_no_base64() {
 	# create editor.sh
@@ -170,7 +169,8 @@ testit "delete_attribute" delete_attribute || failed=`expr $failed + 1`
 testit "add_attribute_base64_control" add_attribute_base64_control || failed=`expr $failed + 1`
 testit_grep "get_attribute_base64_control" "^displayName:: $display_name_con_b64" get_attribute_base64_control || failed=`expr $failed + 1`
 testit "change_attribute_base64_control" change_attribute_base64_control || failed=`expr $failed + 1`
-testit_grep "get_attribute_base64_control" "^displayName:: $display_name_b64" get_attribute_base64_control || failed=`expr $failed + 1`
+testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=`expr $failed + 1`
+testit_grep "get_attribute_force_no_base64" "^displayName: $display_name" get_attribute_force_no_base64 || failed=`expr $failed + 1`
 testit "change_attribute_force_no_base64" change_attribute_force_no_base64 || failed=`expr $failed + 1`
 testit_grep "get_changed_attribute_force_no_base64" "^displayName: $display_name_new" get_changed_attribute_force_no_base64 || failed=`expr $failed + 1`
 testit "delete_computer" delete_computer || failed=`expr $failed + 1`
diff --git a/python/samba/tests/samba_tool/contact_edit.sh b/python/samba/tests/samba_tool/contact_edit.sh
index ca38900062a..ee9c40b59ce 100755
--- a/python/samba/tests/samba_tool/contact_edit.sh
+++ b/python/samba/tests/samba_tool/contact_edit.sh
@@ -51,8 +51,8 @@ EOF
 }
 
 get_attribute_base64() {
-	$PYTHON ${STpath}/source4/scripting/bin/samba-tool contact show \
-		testcontact1 --attributes=displayName \
+	${STpath}/bin/ldbsearch '(&(objectClass=contact)(name=testcontact1))' \
+		displayName \
 		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
@@ -93,6 +93,12 @@ get_attribute_base64_control() {
 		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
+get_attribute_force_no_base64() {
+       # LDB_FLAG_FORCE_NO_BASE64_LDIF should be used here.
+       $PYTHON ${STpath}/source4/scripting/bin/samba-tool contact show \
+               testcontact1 --attributes=displayName \
+               -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
+}
 
 # Test edit contact - change base64 attribute value including control character
 change_attribute_base64_control() {
@@ -109,12 +115,6 @@ EOF
 		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_attribute_base64_control() {
-	$PYTHON ${STpath}/source4/scripting/bin/samba-tool contact show \
-		testcontact1 --attributes=displayName \
-		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
-}
-
 # Test edit contact - change attributes with LDB_FLAG_FORCE_NO_BASE64_LDIF
 change_attribute_force_no_base64() {
 	# create editor.sh
@@ -154,7 +154,8 @@ testit "delete_attribute" delete_attribute || failed=`expr $failed + 1`
 testit "add_attribute_base64_control" add_attribute_base64_control || failed=`expr $failed + 1`
 testit_grep "get_attribute_base64_control" "^displayName:: $display_name_con_b64" get_attribute_base64_control || failed=`expr $failed + 1`
 testit "change_attribute_base64_control" change_attribute_base64_control || failed=`expr $failed + 1`
-testit_grep "get_attribute_base64_control" "^displayName:: $display_name_b64" get_attribute_base64_control || failed=`expr $failed + 1`
+testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=`expr $failed + 1`
+testit_grep "get_attribute_force_no_base64" "^displayName: $display_name" get_attribute_force_no_base64 || failed=`expr $failed + 1`
 testit "change_attribute_force_no_base64" change_attribute_force_no_base64 || failed=`expr $failed + 1`
 testit_grep "get_changed_attribute_force_no_base64" "^displayName: $display_name_new" get_changed_attribute_force_no_base64 || failed=`expr $failed + 1`
 testit "delete_contact" delete_contact || failed=`expr $failed + 1`
diff --git a/python/samba/tests/samba_tool/group_edit.sh b/python/samba/tests/samba_tool/group_edit.sh
index 90f5252d926..d0428af9169 100755
--- a/python/samba/tests/samba_tool/group_edit.sh
+++ b/python/samba/tests/samba_tool/group_edit.sh
@@ -97,8 +97,7 @@ EOF
 }
 
 get_attribute_base64() {
-	$PYTHON ${STpath}/source4/scripting/bin/samba-tool group show \
-		testgroup1 --attributes=displayName \
+	${STpath}/bin/ldbsearch '(sAMAccountName=testgroup1)' displayName \
 		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
@@ -139,6 +138,12 @@ get_attribute_base64_control() {
 		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
+get_attribute_force_no_base64() {
+       # LDB_FLAG_FORCE_NO_BASE64_LDIF should be used here.
+       $PYTHON ${STpath}/source4/scripting/bin/samba-tool group show \
+               testgroup1 --attributes=displayName \
+               -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
+}
 
 # Test edit group - change base64 attribute value including control character
 change_attribute_base64_control() {
@@ -155,12 +160,6 @@ EOF
 		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_attribute_base64_control() {
-	$PYTHON ${STpath}/source4/scripting/bin/samba-tool group show \
-		testgroup1 --attributes=displayName \
-		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
-}
-
 # Test edit group - change attributes with LDB_FLAG_FORCE_NO_BASE64_LDIF
 change_attribute_force_no_base64() {
 	# create editor.sh
@@ -197,7 +196,8 @@ testit "delete_attribute" delete_attribute || failed=`expr $failed + 1`
 testit "add_attribute_base64_control" add_attribute_base64_control || failed=`expr $failed + 1`
 testit_grep "get_attribute_base64_control" "^displayName:: $display_name_con_b64" get_attribute_base64_control || failed=`expr $failed + 1`
 testit "change_attribute_base64_control" change_attribute_base64_control || failed=`expr $failed + 1`
-testit_grep "get_attribute_base64_control" "^displayName:: $display_name_b64" get_attribute_base64_control || failed=`expr $failed + 1`
+testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=`expr $failed + 1`
+testit_grep "get_attribute_force_no_base64" "^displayName: $display_name" get_attribute_force_no_base64 || failed=`expr $failed + 1`
 testit "change_attribute_force_no_base64" change_attribute_force_no_base64 || failed=`expr $failed + 1`
 testit_grep "get_changed_attribute_force_no_base64" "^displayName: $display_name_new" get_changed_attribute_force_no_base64 || failed=`expr $failed + 1`
 testit "delete_test_group" delete_test_group || failed=`expr $failed + 1`
diff --git a/python/samba/tests/samba_tool/user_edit.sh b/python/samba/tests/samba_tool/user_edit.sh
index 03fbd61ff5d..ae0854e89f6 100755
--- a/python/samba/tests/samba_tool/user_edit.sh
+++ b/python/samba/tests/samba_tool/user_edit.sh
@@ -65,8 +65,7 @@ EOF
 }
 
 get_attribute_base64() {
-	$PYTHON ${STpath}/source4/scripting/bin/samba-tool user show \
-		sambatool1 --attributes=displayName \
+	${STpath}/bin/ldbsearch '(sAMAccountName=sambatool1)' displayName \
 		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
@@ -107,6 +106,12 @@ get_attribute_base64_control() {
 		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
+get_attribute_force_no_base64() {
+	# LDB_FLAG_FORCE_NO_BASE64_LDIF should be used here.
+	$PYTHON ${STpath}/source4/scripting/bin/samba-tool user show \
+		sambatool1 --attributes=displayName \
+		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
+}
 
 # Test edit user - change base64 attribute value including control character
 change_attribute_base64_control() {
@@ -123,12 +128,6 @@ EOF
 		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_attribute_base64_control() {
-	$PYTHON ${STpath}/source4/scripting/bin/samba-tool user show \
-		sambatool1 --attributes=displayName \
-		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
-}
-
 # Test edit user - change attributes with LDB_FLAG_FORCE_NO_BASE64_LDIF
 change_attribute_force_no_base64() {
 	# create editor.sh
@@ -169,7 +168,8 @@ testit "delete_attribute" delete_attribute || failed=`expr $failed + 1`
 testit "add_attribute_base64_control" add_attribute_base64_control || failed=`expr $failed + 1`
 testit_grep "get_attribute_base64_control" "^displayName:: $display_name_con_b64" get_attribute_base64_control || failed=`expr $failed + 1`
 testit "change_attribute_base64_control" change_attribute_base64_control || failed=`expr $failed + 1`
-testit_grep "get_attribute_base64_control" "^displayName:: $display_name_b64" get_attribute_base64_control || failed=`expr $failed + 1`
+testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=`expr $failed + 1`
+testit_grep "get_attribute_force_no_base64" "^displayName: $display_name" get_attribute_force_no_base64 || failed=`expr $failed + 1`
 testit "change_attribute_force_no_base64" change_attribute_force_no_base64 || failed=`expr $failed + 1`
 testit_grep "get_changed_attribute_force_no_base64" "^displayName: $display_name_new" get_changed_attribute_force_no_base64 || failed=`expr $failed + 1`
 testit "delete_user" delete_user || failed=`expr $failed + 1`


-- 
Samba Shared Repository



More information about the samba-cvs mailing list