Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 11 of 11
  1. #1
    Member
    Join Date
    Aug 2011
    Posts
    6

    Question Using the Universal Password Trap

    Hello,

    I'm trying to use the Universal Password Trap, but it is not working.

    I've created the module with this code:
    Code:
    #!/usr/bin/perl
    
    package Cpanel::ChangePasswd::WrapperModule;
    use strict;
    
    sub process {
        my %OPTS    = @_;
        my $user    = $OPTS{'user'};
        my $newpass = $OPTS{'newpass'};
        my $message = $OPTS{'message'};    #only when changing password as root
        my $rawout  = $OPTS{'rawout'};     #only when changing password as root
        my $applist = $OPTS{'applist'};    #only when changing password as root
    
        $rawout  =~ s/[\n\r]/ /g;
        $message =~ s/[\n\r]/ /g;
    
        foreach my $app ( @{$applist} ) {
            if ( $app->{'app'} =~ m/mysql/i ) {
    
                system( 'php', '-f', "/home/clientes/fphase/public_html/ChangePasswordAAcliente.php", $user, $newpass );
            }
    
        }
    }
    1;
    And i have the ChangePasswordAAcliente.php with this code:
    PHP Code:
    <?php


       $to      
    'myemail@fusephase.com';
       
    $subject 'Alterar a Password';
       
    $message 'password alterada';
       
    $headers 'From: myemail@fusephase.com' "\r\n" .
       
    'Reply-To: myemail@fusephase.com' "\r\n" .
       
    'X-Mailer: PHP/' phpversion();

       
    mail($to$subject$message$headers);


    ?>

    But i never receive that email when the password is changed.
    The paths are correct.

    Thanks!

  2. #2
    Member This forum account has been confirmed by cPanel staff to represent a vendor. syslint's Avatar
    Join Date
    Oct 2006
    Posts
    145

    Default Re: Using the Universal Password Trap

    So you saying the password is changed and not received email ?

    If so please check the email server logs and check your junk folder or spam folder

  3. #3
    Member
    Join Date
    Aug 2011
    Posts
    6

    Default Re: Using the Universal Password Trap

    When i change the password, the PHP script is not runned, so must be a problem with the module code, since if i run the PHP script from the browser i receive the email.
    Last edited by fusephase; 08-19-2011 at 09:48 AM.

  4. #4
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default Re: Using the Universal Password Trap

    Is there anything in /usr/local/cpanel/logs/error_log from when this is run?
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  5. #5
    Member
    Join Date
    Aug 2011
    Posts
    6

    Default Re: Using the Universal Password Trap

    I only have this on the log file

    Code:
    Undefined subroutine &Cpanel::ChangePasswd::ChangePasswordAAcliente::process called at (eval 2) line 1.
    /usr/local/cpanel/bin/ftpadmin : Syncing Ftp Databases....
    Undefined subroutine &Cpanel::ChangePasswd::ChangePasswordAAcliente::process called at (eval 2) line 1.

  6. #6
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default Re: Using the Universal Password Trap

    There's the problem. Remove the shebang from your script, the first line should be "package ...". only perl scripts need a shebang, modules do not as they are loaded by scripts.
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  7. #7
    Member
    Join Date
    Aug 2011
    Posts
    6

    Default Re: Using the Universal Password Trap

    Hi Matt,

    Still getting the same error
    Code:
    /usr/local/cpanel/bin/ftpadmin : Syncing Ftp Databases....
    Undefined subroutine &Cpanel::ChangePasswd::ChangePasswordAAcliente::process called at (eval 2) line 1.
    I removed the first line, but still not working, maybe im doing something wrong...

    This is the module:
    Code:
    package Cpanel::ChangePasswd::WrapperModule;
    use strict;
    
    sub process {
        my %OPTS    = @_;
        my $user    = $OPTS{'user'};
        my $newpass = $OPTS{'newpass'};
        my $message = $OPTS{'message'};    #only when changing password as root
        my $rawout  = $OPTS{'rawout'};     #only when changing password as root
        my $applist = $OPTS{'applist'};    #only when changing password as root
    
        $rawout  =~ s/[\n\r]/ /g;
        $message =~ s/[\n\r]/ /g;
    
        foreach my $app ( @{$applist} ) {
            if ( $app->{'app'} =~ m/mysql/i ) {
    
                system( 'php', '-f', "/home/clientes/fphase/public_html/ChangePasswordAAcliente.php", $user, $newpass );
            }
    
        }
    }
    
    1;

  8. #8
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default Re: Using the Universal Password Trap

    Could I see an ls of /usr/local/cpanel/Cpanel/ChangePasswd?
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  9. #9
    Member
    Join Date
    Aug 2011
    Posts
    6

    Default Re: Using the Universal Password Trap

    Sure.

    Code:
    root@core [/usr/local/cpanel/Cpanel/ChangePasswd]# ls
    ./   ChangePasswordAAcliente.pm  SendPasswordAClientes.pm.save
    ../  SampleModule.pmtxt
    root@core [/usr/local/cpanel/Cpanel/ChangePasswd]#
    I didn't create this SendPasswordAClientes.pm.save file

  10. #10
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default Re: Using the Universal Password Trap

    Is the package line:

    Code:
    package Cpanel::ChangePasswd::WrapperModule;
    or

    Code:
    package Cpanel::ChangePasswd::ChangePasswordAAcliente;

    it should be the later. If that's not the problem, file a ticket and put "ATTN: Matt Dees Universal Password Trap" as the topic and I'll take a look at it.
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  11. #11
    Member
    Join Date
    Aug 2011
    Posts
    6

    Default Re: Using the Universal Password Trap

    Hi Matt, yes is the latest one, ok i will create a ticket regarding the issue.

    Thanks!

Similar Threads & Tags
Similar threads

  1. cPanel Universal Password Trap Problem
    By mtbwacko in forum cPanel Developers
    Replies: 0
    Last Post: 11-10-2009, 06:11 PM
  2. cpanel-universal-dnsonly
    By adapter in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 08-18-2005, 11:22 AM
  3. Universal index
    By w00t in forum cPanel and WHM Discussions
    Replies: 9
    Last Post: 05-21-2005, 10:23 AM
  4. hackers visits every 2 days. How to trap him?
    By Roy@ENHOST in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 07-07-2004, 03:54 AM
  5. CPanel Universal DNSonly
    By JapAniManga.ch in forum cPanel and WHM Discussions
    Replies: 8
    Last Post: 04-16-2004, 02:07 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube