Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    2

    Default Bug(s) in /scripts/restorepkg

    Hello,

    I am trying to restore a cpmove file and I keep getting this error:

    /scripts/restorepkg usage: /scripts/restorepkg [--skipresellerprivs] [--force] user

    Security Note: It is recommended that you do not restore a package from an untrusted source.
    If you choose to ignore this warning, you should use --skipresellerprivs to minimize the risk.


    So, I'm thinking wtf! I have restored hundreds of them without this happening. I couldn't find any solution so my last grasp was to look at the script and try to see what is triggering this error.

    When I looked at the script I was pretty shoced to see such bad coding.

    if (grep(/force/i,@ARGV)) {
    $force = 1;
    }

    if (grep(/skipres/i,@ARGV)) {
    $skipres = 1;
    }


    Are you kidding? In the first if, it checks @ARGV for "force". What's wrong with this?
    1) If the word "force" is in my cpanel username the script goes into force mode when I did not tell it to!
    2) Should not be case insensitive!
    3) It should be checking for "--force"

    All of the above apply to the second if as well and what is up with checking only for the "skipres", when the switch is "--skipresellerprivs".

    Now, let's look at this block where I found my problem:

    if (!$user || $user eq '' || !@ARGV || grep(/help/, @ARGV)) {
    print "User: $user\nARGV @ARGV\n";
    print qq{$0 usage: $0 [--skipresellerprivs] [--force] user\n};
    print qq{\n};
    print qq{Security Note: It is recommended that you do not restore a package from an untrusted source.\n};
    print qq{If you choose to ignore this warning, you should use --skipresellerprivs to minimize the risk.\n};
    exit(0);
    }


    Why on earth is it grepping for "help" and then dying? My username was "esshelpd" and I could not proceed because of this. I have modified my copy and now have no problems.

    Here is what I did:
    grep(/--force/,@ARGV)
    grep(/--skipresellerprivs/,@ARGV)
    grep(/--help/, @ARGV)

    I'm surprised that I couldn't find this issue anywhere on the net. I mean any username with "help" is going to fail.

    Regards,

    Marty

  2. #2
    Member
    Join Date
    Aug 2002
    Posts
    1,120

    Default

    Good catch.

    I created a bugzilla report for this (hope you don't mind, it still your bug since you were the one that discovered it). You can read the bug report at:

    http://bugzilla.cpanel.net/show_bug.cgi?id=6265

    You may want to consider creating a bugzilla account and if you find a bug, post information about the bug in the forums, but also create a bugzilla report and link to it in your forum thread so that it will get attention.

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    2

    Default

    Thanks for filing the report! I was just thinking that I should have done that instead of posting it here.

    Marty

Similar Threads & Tags
Similar threads

  1. /scripts/restorepkg question - can 2 or more restorepkg run at the same time?
    By sharmaine001 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 03-05-2010, 10:54 AM
  2. /scripts/restorepkg mailman chowning
    By sparek-3 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 11-11-2009, 04:51 PM
  3. /scripts/restorepkg ?
    By meeven in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 03-11-2008, 06:47 PM
  4. /scripts/restorepkg errors
    By ANewDay in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 05-19-2007, 01:47 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube