add 0002-hdparam-Remove-security_password-printing.patch.

This commit is contained in:
linfeilong835 2022-01-22 02:43:00 +00:00 committed by Gitee
parent 6714407eef
commit 3ed3581317
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -0,0 +1,50 @@
From deaa52e44c5464a8360e540d7b35895bc51e5143 Mon Sep 17 00:00:00 2001
From: Wenchao Hao <haowenchao@huawei.com>
Date: Mon, 30 Nov 2020 17:29:55 +0800
Subject: [PATCH] hdparam: Remove security_password printing
In consideration of security, passwd should not printed
in log, so this commit remove security_password printing
in code.
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
Signed-off-by: volcanodragon <linfeilong@huawei.com>
---
hdparm.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/hdparm.c b/hdparm.c
index 8045c87..3282d93 100644
--- a/hdparm.c
+++ b/hdparm.c
@@ -989,8 +989,8 @@ do_set_security (int fd)
exit(EINVAL);
}
if (!quiet) {
- printf(" Issuing %s command, password=\"%s\", user=%s",
- description, security_password, (data[0] & 1) ? "master" : "user");
+ printf(" Issuing %s command, user=%s",
+ description, (data[0] & 1) ? "master" : "user");
if (security_command == ATA_OP_SECURITY_SET_PASS)
printf(", mode=%s", data[1] ? "max" : "high");
printf("\n");
@@ -3004,17 +3004,6 @@ static void get_security_password (int handle_NULL)
} else if (!handle_NULL || strcmp(argp, "NULL")) {
strcpy(security_password, argp);
}
- printf("security_password:");
- if (!binary_passwd) {
- printf(" \"%s\"\n", security_password);
- } else {
- unsigned int i;
- for (i = 0; i < maxlen; ++i) {
- unsigned char c = security_password[i];
- printf(" %02x", c);
- }
- putchar('\n');
- }
while (*argp)
++argp;
}
--
2.27.0