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


In reply to r1soft cpanel-auth.pl script by danutzu117

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.