Hello, I'm in searching of an answer regarding a perl script that search, find and let the authorized users to access a page. This is the cpanel-auth.pl script (original and untouched code from r1soft):
use warnings; use strict; use FindBin; use lib "$FindBin::RealBin/"; use BuagentAuth; my $auth_ok = 0; my $user = <>; chomp($user); my $pass = <>; chomp($pass); my $auth_ref = BuagentAuth::auth($user, $pass); print "auth_ok:" . $auth_ref->{auth_ok} . "\n"; if ($auth_ref->{auth_ok} == 1) { print "uid:" . $auth_ref->{uid} . "\n"; print "gid:" . $auth_ref->{gid} . "\n"; print "dir:home:" . $auth_ref->{homedir} . "\n"; }
This is the code that I've tried after I follow this steps: http://wiki.r1soft.com/display/kb3/Limiting+Control+Panel+User+Access
I need to mention that I don't know a scratch of perl and about two days ago was the first time when I see a perl script, so, I'm lost...use warnings; use strict; use FindBin; use lib "$FindBin::RealBin/"; use BuagentAuth; my $auth_ok = 0; my $user = <>; chomp($user); my $pass = <>; chomp($pass); my @userdb; open(USERDB, '/etc/r1user') or die "The user doesn't exist: $!"; @userdb = <USERDB>; my @r1user_ref = 0; my $t; foreach $t (@userdb) { if ($t =~ $user) { $r1user_ref = 1; } } my $auth_ref = BuagentAuth::auth($user, $pass); print "auth_ok:" . $auth_ref->{auth_ok} . "\n"; if ($auth_ref->{auth_ok} ==1) { print "uid:" . $auth_ref->{uid} . "\n"; print "gid:" . $auth_ref->{gid} . "\n"; print "dir:home:" . $auth_ref->{homedir} . "\n"; }
Thanks
In reply to r1soft cpanel-auth.pl script by danutzu117
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |