danutzu117 has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: r1soft cpanel-auth.pl script
by Laurent_R (Canon) on Oct 12, 2017 at 13:09 UTC | |
by danutzu117 (Initiate) on Oct 12, 2017 at 13:48 UTC | |
by Laurent_R (Canon) on Oct 12, 2017 at 21:24 UTC | |
|
Re: r1soft cpanel-auth.pl script
by LanX (Saint) on Oct 12, 2017 at 13:21 UTC |