MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //proc/self/root/proc/self/root/scripts.20110531.215904.25158/add_dns
#!/usr/bin/perl
# cpanel - add_dns                                Copyright(c) 2010 cPanel, Inc.
#                                                           All rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

BEGIN { unshift @INC, '/usr/local/cpanel'; }

use strict;
use warnings;
use Cpanel::DIp         ();
use Cpanel::DomainIp    ();
use Cpanel::DomainTools ();
use Cpanel::DnsUtils    ();
use Getopt::Long        ();

my ( $domain, $ip, $reseller, $allowoverwrite );

my $opts = Getopt::Long::GetOptions(
    'domain=s'   => \$domain,
    'ip=s'       => \$ip,
    'reseller=s' => \$reseller,
    'overwrite'  => \$allowoverwrite,
);

# Domain
if ( !$domain ) {
    show_usage();
    exit 1;
}
else {
    $domain = Cpanel::DomainTools::normalize($domain);
    if ( !Cpanel::DomainTools::is_valid($domain) ) {
        print "No valid domain specified.\n";
        show_usage();
        exit 1;
    }
}

# IP
if ( !$ip || !Cpanel::DomainIp::isvalidipv4($ip) ) {
    $ip = Cpanel::DIp::getmainip();
    print "No valid IP specified. Using $ip\n";
}

# Reseller
if ( !$reseller ) {
    $reseller = 'root';
}

# Allow Over Write
if ($allowoverwrite) {
    if ( $allowoverwrite =~ m/^n/i ) {
        $allowoverwrite = 0;
    }
    else {
        $allowoverwrite = 1;
    }
}
else {
    $allowoverwrite = 0;
}

my ( $status, $error ) = Cpanel::DnsUtils::doadddns( 'domain' => $domain, 'ip' => $ip, 'reseller' => $reseller, 'allowoverwrite' => $allowoverwrite );
if ( !$status ) {
    print $error . "\n";
}

sub show_usage {
    print <<"EOM";
$0

Control Flags:
--domain    (required)
    Domain for zone creation

--ip        (optional)
    IP for zone creation. Defaults to server's main shared IP

--reseller  (optional)
    Set reseller (zone administrator) to utilize name server IPs assigned via WHM to the reseller.
    Defaults to using main server name server IPs

EOM
}