Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

r1soft cpanel-auth.pl script

by danutzu117 (Initiate)
on Oct 12, 2017 at 13:05 UTC ( [id://1201212]=perlquestion: print w/replies, xml ) Need Help??

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

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"; }
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...

Thanks

Replies are listed 'Best First'.
Re: r1soft cpanel-auth.pl script
by Laurent_R (Canon) on Oct 12, 2017 at 13:09 UTC
      Hi, what I'm trying to do is to give access only to users that are in /etc/r1user file and not to all of the ones that have this option active in cPanel. Thanks.
        Alright, I think I understand what you're trying to do, but I still don't know what your question is.

        Let me try to be more specific on what we need. Does your program compile without any warning? Is the program that you've shown working or failing? Or is it doing something, but not quite what you want? In which way is it not doing what you want? If possible, please show input data as well as current result versus expected result. In short, please help us to help you.

Re: r1soft cpanel-auth.pl script
by LanX (Saint) on Oct 12, 2017 at 13:21 UTC
    Your question is hardly readable, please click edit and eliminate the <b> starting your post.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1201212]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-26 02:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found