ref: 26a3cc20018516429d9544e09513cba565427dcf
parent: 9c6cf1c4ef9250ba4d56f52fe164ad83b66c02bf
author: sl <uriel@engel.se.cat-v.org>
date: Mon Mar 9 18:08:22 EDT 2009
Fix a bug where check_user would not work properly when called from config files.
--- a/bin/werclib.rc
+++ b/bin/werclib.rc
@@ -26,10 +26,11 @@
# Check login status, if called with group arg we check membership too
fn check_user {
get_user
+ g=($* admin)
_status=$status
if(! ~ $"_status '')
_status=(Not logged in: $"_status)
- if not if(! ~ $#* 0 && ! ~ $logged_user $* && ! grep -s '^'^$logged_user^'$' etc/users/$*/members etc/users/admin/members >[2]/dev/null)
+ if not if(! ~ $#* 0 && ! ~ $logged_user $* && ! grep -s '^'^$logged_user^'$' $werc_root/etc/users/$g/members >[2]/dev/null)
_status=(User $logged_user not in: $*)
status=$_status
}
@@ -63,7 +64,7 @@
user_name=$1
user_password=$2
- pfile='etc/users/'^$"user_name^'/password'
+ pfile=$werc_root/etc/users/$"user_name/password
if(~ $#user_name 0 || ~ $#user_password 0)
status=('Auth: missing user name or pass: '^$"user_name^' / '^$"user_password)
if not if(! test -f $pfile)