From 7bdb07332b9829507582fe8d582dd61b25737b57 Mon Sep 17 00:00:00 2001 From: Quentin W Date: Mon, 22 Jul 2024 12:11:54 -0400 Subject: [PATCH] hash and salt passwords now --- werc/bin/aux/addwuser.rc | 2 +- werc/bin/werclib.rc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/werc/bin/aux/addwuser.rc b/werc/bin/aux/addwuser.rc index 9364d39..ea3e58e 100755 --- a/werc/bin/aux/addwuser.rc +++ b/werc/bin/aux/addwuser.rc @@ -23,7 +23,7 @@ if(~ $"user_name '' || ~ $"user_pass '') usage mkdir etc/users/$user_name -echo $user_pass > etc/users/$user_name/password +mkpasswd $user_pass > etc/users/$user_name/password if(! ~ $#user_groups 0) for(g in $user_groups) { diff --git a/werc/bin/werclib.rc b/werc/bin/werclib.rc index bcebf91..5a9aca8 100755 --- a/werc/bin/werclib.rc +++ b/werc/bin/werclib.rc @@ -70,7 +70,7 @@ fn auth_user { status=('Auth: missing user name or pass: '^$"user_name^' / '^$"user_password) if not if(! test -f $pfile) status=('Auth: cant find '^$pfile) - if not if(! test -s $pfile || ! ~ $user_password `{cat $pfile}) + if not if(! test -s $pfile || ! ~ $user_password `{cat $pfile} && ! ~ `{mkpasswd -S `{cat $pfile | cut -d'$' -f3} $user_password} `{cat $pfile}) status=('Auth: Pass '$user_password' doesnt match '^`{cat $pfile}) if not { logged_user=$user_name