]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Remove string_free_erase
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 10 Jul 2019 11:48:55 +0000 (13:48 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 10 Jul 2019 11:48:55 +0000 (13:48 +0200)
TODO
src/basic/string-util.c
src/basic/string-util.h
src/firstboot/firstboot.c
src/reply-password/reply-password.c

diff --git a/TODO b/TODO
index a575f9ab737cf356c7004debd556cdf8cc96336b..6331c9bd2ea25011f9a40d22f7bc0006b96df55a 100644 (file)
--- a/TODO
+++ b/TODO
@@ -90,8 +90,8 @@ Features:
   usefaultd() and make systemd-analyze check for it.
 
 * paranoia: whenever we process passwords, call mlock() on the memory
-  first. i.e. look for all places we use string_erase()/string_free_erase() and
-  augment them with mlock(). Also use MADV_DONTDUMP
+  first. i.e. look for all places we use string_erase()/free_and_erasep() and
+  augment them with mlock(). Also use MADV_DONTDUMP.
 
 * Move RestrictAddressFamily= to the new cgroup create socket
 
index 779048904a08f0ed67b3099a59f7497d1eb8f772..08a10e8787964b1a6e8e83f6dc4f5eb3ab4ba4dd 100644 (file)
@@ -1042,10 +1042,6 @@ char* string_erase(char *x) {
         return x;
 }
 
-char *string_free_erase(char *s) {
-        return mfree(string_erase(s));
-}
-
 bool string_is_safe(const char *p) {
         const char *t;
 
index 47b17c9d3e7c07f30ff3687ab8a27580c0973b1c..5ad78be1d3abffa5d5d799146eb405ee3e5c5933 100644 (file)
@@ -199,10 +199,6 @@ int free_and_strndup(char **p, const char *s, size_t l);
 
 char *string_erase(char *x);
 
-char *string_free_erase(char *s);
-DEFINE_TRIVIAL_CLEANUP_FUNC(char *, string_free_erase);
-#define _cleanup_string_free_erase_ _cleanup_(string_free_erasep)
-
 bool string_is_safe(const char *p) _pure_;
 
 static inline size_t strlen_ptr(const char *s) {
index e6b40294bf6df17883eb6867c4a767e363136d11..e0c834cfc3221ecbb5faad3c8688d1c346ca6ffb 100644 (file)
@@ -30,6 +30,7 @@
 #include "kbd-util.h"
 #include "locale-util.h"
 #include "main-func.h"
+#include "memory-util.h"
 #include "mkdir.h"
 #include "os-util.h"
 #include "parse-util.h"
@@ -68,7 +69,7 @@ STATIC_DESTRUCTOR_REGISTER(arg_locale_messages, freep);
 STATIC_DESTRUCTOR_REGISTER(arg_keymap, freep);
 STATIC_DESTRUCTOR_REGISTER(arg_timezone, freep);
 STATIC_DESTRUCTOR_REGISTER(arg_hostname, freep);
-STATIC_DESTRUCTOR_REGISTER(arg_root_password, string_free_erasep);
+STATIC_DESTRUCTOR_REGISTER(arg_root_password, erase_and_freep);
 
 static bool press_any_key(void) {
         char k = 0;
index 455788a1840c712bc8fc8a60554de6f6ea838321..1a8a9a6d623911f3ff6d354552aad214bc9f15b3 100644 (file)
@@ -47,7 +47,7 @@ static int run(int argc, char *argv[]) {
                 return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Wrong number of arguments.");
 
         if (streq(argv[1], "1")) {
-                _cleanup_string_free_erase_ char *line = NULL;
+                _cleanup_(erase_and_freep) char *line = NULL;
 
                 r = read_line(stdin, LONG_LINE_MAX, &line);
                 if (r < 0)