diff mbox series

ksmbd-tools: set a minimum character limit for password

Message ID 20211009054903.9788-1-linkinjeon@kernel.org
State New
Headers show
Series ksmbd-tools: set a minimum character limit for password | expand

Commit Message

Namjae Jeon Oct. 9, 2021, 5:49 a.m. UTC
Set minimum password length with 8 characters by default to protect
passwords vulnerable.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
 adduser/user_admin.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Namjae Jeon Oct. 10, 2021, 1:12 a.m. UTC | #1
2021-10-10 0:12 GMT+09:00, Steve French <smfrench@gmail.com>:
> Maybe make it configurable but default to 8 as minimum!
Okay. I will check it.

Thanks!
>
> On Sat, Oct 9, 2021, 00:49 Namjae Jeon <linkinjeon@kernel.org> wrote:
>
>> Set minimum password length with 8 characters by default to protect
>> passwords vulnerable.
>>
>> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
>> ---
>>  adduser/user_admin.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/adduser/user_admin.c b/adduser/user_admin.c
>> index 4e85915..36b9ad2 100644
>> --- a/adduser/user_admin.c
>> +++ b/adduser/user_admin.c
>> @@ -119,6 +119,11 @@ again:
>>                 goto again;
>>         }
>>
>> +       if (len <= 7) {
>> +               pr_err("Minimum password length is 8 characters\n");
>> +               goto again;
>> +       }
>> +
>>         *sz = len;
>>         free(pswd2);
>>         return pswd1;
>> --
>> 2.25.1
>>
>>
>
diff mbox series

Patch

diff --git a/adduser/user_admin.c b/adduser/user_admin.c
index 4e85915..36b9ad2 100644
--- a/adduser/user_admin.c
+++ b/adduser/user_admin.c
@@ -119,6 +119,11 @@  again:
 		goto again;
 	}
 
+	if (len <= 7) {
+		pr_err("Minimum password length is 8 characters\n");
+		goto again;
+	}
+
 	*sz = len;
 	free(pswd2);
 	return pswd1;