]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
netcmd: getpassword: print OK message on stderr
authorRob van der Linde <rob@catalyst.net.nz>
Thu, 7 Dec 2023 02:28:04 +0000 (15:28 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Thu, 21 Dec 2023 02:05:38 +0000 (02:05 +0000)
This makes it easier to machine parse the output in tests

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/netcmd/user/readpasswords/getpassword.py
python/samba/tests/samba_tool/user.py
python/samba/tests/samba_tool/user_virtualCryptSHA.py
python/samba/tests/samba_tool/user_virtualCryptSHA_base.py
python/samba/tests/samba_tool/user_wdigest.py

index b06bf58fdead4cbd0f5782eb45d272383b851210..b5496a8d631b697e4f49a57edd3a1fc5db09db7d 100644 (file)
@@ -197,4 +197,4 @@ samba-tool user getpassword --filter=samaccountname=TestUser3 --attributes=msDS-
 
         ldif = samdb.write_ldif(obj, ldb.CHANGETYPE_NONE)
         self.outf.write("%s" % ldif)
-        self.outf.write("Got password OK\n")
+        self.errf.write("Got password OK\n")
index e43a00c472e1829b2130f39ad724855537b028d9..00f667bc48717ecc79d5cc177b47ea66e3e6a609 100644 (file)
@@ -346,8 +346,7 @@ class UserCmdTestCase(SambaToolCmdTest):
                                                 "--attributes=%s" % attributes,
                                                 "--decrypt-samba-gpg")
             self.assertCmdSuccess(result, out, err, "Ensure getpassword runs")
-            self.assertEqual(err, "", "getpassword without url")
-            self.assertMatch(out, "Got password OK", "getpassword without url")
+            self.assertEqual(err, "Got password OK\n", "getpassword without url")
             self.assertMatch(out, "sAMAccountName: %s" % (user["name"]),
                              "getpassword: 'sAMAccountName': %s out[%s]" % (user["name"], out))
             if expect_nt_hash:
@@ -357,7 +356,7 @@ class UserCmdTestCase(SambaToolCmdTest):
                 self.assertNotIn("unicodePwd:: %s" % unicodePwd, out)
             self.assertMatch(out, "supplementalCredentials:: ",
                              "getpassword supplementalCredentials: out[%s]" % out)
-            self._verify_supplementalCredentials(out.replace("\nGot password OK\n", ""))
+            self._verify_supplementalCredentials(out)
             if "virtualSambaGPG:: " in out:
                 self.assertMatch(out, "virtualClearTextUTF8:: %s" % virtualClearTextUTF8,
                                  "getpassword virtualClearTextUTF8: out[%s]" % out)
index e58340436a26451472e3a53c763695ff035ccc1f..e95a4be2aa970558e0335cd1c067aba8a0b45297 100644 (file)
@@ -73,10 +73,7 @@ class UserCmdCryptShaTestCase(SambaToolCmdTest):
                               out,
                               err,
                               "Ensure getpassword runs")
-        self.assertEqual(err, "", "getpassword")
-        self.assertMatch(out,
-                         "Got password OK",
-                         "getpassword out[%s]" % out)
+        self.assertEqual(err, "Got password OK\n", "getpassword")
         return out
 
     # Change the just the NT password hash, as would happen if the password
index 19cd713eacf22c3e774c89ea9836f8ef2165bca5..14e3de97a2f79bd8085e72917fa840021cac1a68 100644 (file)
@@ -79,10 +79,7 @@ class UserCmdCryptShaTestCase(SambaToolCmdTest):
                               out,
                               err,
                               "Ensure getpassword runs")
-        self.assertEqual(err, "", "getpassword")
-        self.assertMatch(out,
-                         "Got password OK",
-                         "getpassword out[%s]" % out)
+        self.assertEqual(err, "Got password OK\n", "getpassword")
         return out
 
     # Change the just the NT password hash, as would happen if the password
index d11531205993e37b686a0b4557e93d73ccc5e191..0d8776203de7490fcb0c762b5c4683d1277d8b33 100644 (file)
@@ -89,10 +89,7 @@ class UserCmdWdigestTestCase(SambaToolCmdTest):
                               out,
                               err,
                               "Ensure getpassword runs")
-        self.assertEqual(err, "", "getpassword")
-        self.assertMatch(out,
-                         "Got password OK",
-                         "getpassword out[%s]" % out)
+        self.assertEqual(err, "Got password OK\n", "getpassword")
 
         if missing:
             self.assertTrue(attribute not in out)