summaryrefslogtreecommitdiff
path: root/src/firstboot
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-10-20 10:31:38 +0200
committerDaniel Mack <github@zonque.org>2015-10-20 10:31:38 +0200
commit824b35c3859bc99b97ac5fa6e09aa34627e9bcd5 (patch)
tree266c8f9988ba8d1cab00a55b360b3f2e42096dde /src/firstboot
parentec566e4c7cee67ec2c39475ef08f18a9f1b80efd (diff)
parent2229f656677f0d50c507aec40cda59f66da5c949 (diff)
Merge pull request #1568 from poettering/netclass
various fixes, for various things
Diffstat (limited to 'src/firstboot')
-rw-r--r--src/firstboot/firstboot.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c
index 1562ccf0d7..82ebb91788 100644
--- a/src/firstboot/firstboot.c
+++ b/src/firstboot/firstboot.c
@@ -51,15 +51,6 @@ static bool arg_copy_locale = false;
static bool arg_copy_timezone = false;
static bool arg_copy_root_password = false;
-static void clear_string(char *x) {
-
- if (!x)
- return;
-
- /* A delicious drop of snake-oil! */
- memset(x, 'x', strlen(x));
-}
-
static bool press_any_key(void) {
char k = 0;
bool need_nl = true;
@@ -464,7 +455,7 @@ static int prompt_root_password(void) {
msg2 = strjoina(draw_special_char(DRAW_TRIANGULAR_BULLET), " Please enter new root password again: ");
for (;;) {
- _cleanup_free_ char *a = NULL, *b = NULL;
+ _cleanup_string_free_erase_ char *a = NULL, *b = NULL;
r = ask_password_tty(msg1, NULL, 0, 0, NULL, &a);
if (r < 0)
@@ -476,19 +467,14 @@ static int prompt_root_password(void) {
}
r = ask_password_tty(msg2, NULL, 0, 0, NULL, &b);
- if (r < 0) {
- clear_string(a);
+ if (r < 0)
return log_error_errno(r, "Failed to query root password: %m");
- }
if (!streq(a, b)) {
log_error("Entered passwords did not match, please try again.");
- clear_string(a);
- clear_string(b);
continue;
}
- clear_string(b);
arg_root_password = a;
a = NULL;
break;
@@ -881,7 +867,7 @@ finish:
free(arg_locale_messages);
free(arg_timezone);
free(arg_hostname);
- clear_string(arg_root_password);
+ string_erase(arg_root_password);
free(arg_root_password);
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;