1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00
samba-mirror/lib/cmdline
Douglas Bagnall 1315b61e1f cmdline:burn: always return true if burnt
Before we have been trying to cram three cases into a boolean return
value:

 * cmdline had secrets, we burnt them       ->  true
 * cmdline had no secrets, all good         ->  false
 * cmdline has NULL string, WTF! emergency! ->  false

This return value is only used by Python which wants to know whether to
go to the trouble of replacing the command line. If samba_cmdline_burn()
returns false, no action is taken.

If samba_cmdline_burn() burns a password and then hits a NULL, it would
be better not to do nothing. It would be better to crash. And that is
what Python will end up doing, by some talloc returning NULL triggering
a MemoryError.

What about the case like {"--foo", NULL, "-Ua%b"} where the secret comes
after the NULL? That will still be ignored by Python, as it is by all C
tools, but we are hoping that can't happen anyway.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15674

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
(cherry picked from commit d3d8dffc02)
2024-07-23 07:33:12 +00:00
..
tests cmdline:tests: extend cmdline_burn tests 2024-07-23 07:33:12 +00:00
closefrom_except.c lib: Move closefrom_except*() to a separate file 2021-09-21 01:12:12 +00:00
closefrom_except.h lib: Move closefrom_except*() to a separate file 2021-09-21 01:12:12 +00:00
cmdline_private.h lib:cmdline: Fix code spelling 2023-12-21 20:21:34 +00:00
cmdline_s3.c cmdline: Make -P work in clustered mode 2021-11-17 18:29:09 +00:00
cmdline_s4.c cmdline_s4: re-initialise logging once loadparm is ready 2022-05-30 10:11:28 +00:00
cmdline.c cmdline:burn: always return true if burnt 2024-07-23 07:33:12 +00:00
cmdline.h lib/cmdline: Return if the commandline was redacted in samba_cmdline_burn() 2023-07-21 05:23:32 +00:00
wscript cmdline: Make -P work in clustered mode 2021-11-17 18:29:09 +00:00