import BIND::SDB::LDAP::Helper from my personal repo

git-svn-id: svn://127.0.0.1/Perl/BIND::SDB::LDAP::Helper/trunk@114 0c1c3402-1be1-de11-8092-0022686faf23
This commit is contained in:
Zane C. B-H 2010-04-28 02:21:12 +00:00
commit 1663574937
18 changed files with 3869 additions and 0 deletions

View File

@ -0,0 +1,10 @@
blib*
Makefile
Makefile.old
Build
_build*
pm_to_blib*
*.tar.gz
.lwpcookies
BIND-SDB-LDAP-Helper-*
cover_db

View File

@ -0,0 +1,4 @@
Revision history for BIND-SDB-LDAP-Helper
0.0.0 2009-10-28/15:30
-Initial release.

View File

@ -0,0 +1,16 @@
Changes
MANIFEST
Makefile.PL
README
lib/BIND/SDB/LDAP/Helper.pm
t/00-load.t
t/pod-coverage.t
t/pod.t
bin/pldm-radd
bin/pldm-rget
bin/pldm-rls
bin/pldm-rmod
bin/pldm-rrm
bin/pldm-zadd
bin/pldm-zls
bin/pldm-zrm

View File

@ -0,0 +1,25 @@
use strict;
use warnings;
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'BIND::SDB::LDAP::Helper',
AUTHOR => 'Zane C. Bowers <vvelox@vvelox.net>',
VERSION_FROM => 'lib/BIND/SDB/LDAP/Helper.pm',
ABSTRACT_FROM => 'lib/BIND/SDB/LDAP/Helper.pm',
($ExtUtils::MakeMaker::VERSION >= 6.3002
? ('LICENSE'=> 'perl')
: ()),
PL_FILES => {},
INST_SCRIPT => 'bin',
PREREQ_PM => {
'Test::More' => 0,
'Config::IniHash'=>0,
'File::BaseDir'=>0,
'Net::LDAP'=>0,
'Net::LDAP::Entry'=>0,
'Net::LDAP::AutoDNs'=>0,
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'BIND-SDB-LDAP-Helper-*' },
);

View File

@ -0,0 +1,52 @@
BIND-SDB-LDAP-Helper
The README is used to introduce the module and provide instructions on
how to install the module, any machine dependencies it may have (for
example C compilers and installed libraries) and any other information
that should be provided before the module is installed.
A README file is required for CPAN modules since CPAN extracts the README
file from a module distribution so that people browsing the archive
can use it to get an idea of the module's uses. It is usually a good idea
to provide version information here so that people can decide whether
fixes for the module are worth downloading.
INSTALLATION
To install this module, run the following commands:
perl Makefile.PL
make
make test
make install
SUPPORT AND DOCUMENTATION
After installing, you can find documentation for this module with the
perldoc command.
perldoc BIND::SDB::LDAP::Helper
You can also look for information at:
RT, CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=BIND-SDB-LDAP-Helper
AnnoCPAN, Annotated CPAN documentation
http://annocpan.org/dist/BIND-SDB-LDAP-Helper
CPAN Ratings
http://cpanratings.perl.org/d/BIND-SDB-LDAP-Helper
Search CPAN
http://search.cpan.org/dist/BIND-SDB-LDAP-Helper/
COPYRIGHT AND LICENCE
Copyright (C) 2009 Zane C. Bowers
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

View File

@ -0,0 +1,190 @@
#!/usr/bin/perl
#Copyright (c) 2009, Zane C. Bowers
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without modification,
#are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
#IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
#INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
#LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
#THE POSSIBILITY OF SUCH DAMAGE.
use strict;
use warnings;
use Getopt::Std;
use BIND::SDB::LDAP::Helper;
$Getopt::Std::STANDARD_HELP_VERSION = 1;
#version function
sub main::VERSION_MESSAGE {
print "pldm-radd 0.0.0\n";
}
#print help
sub main::HELP_MESSAGE {
print "\n".
"-a <A records> A comma seperated list of A records.\n".
"-A <AAAA records> A comma seperated list of AAAA records.\n".
"-c <config> The config file to use.\n".
"-m <MX records> A comma seperated list of MX records.\n".
"-r <relative> The name of the relative domain name to add.\n".
"-p <PTR records> A comma seperated list of PTR records.\n".
"-t <TXT record> A comma seperated txt record.\n".
"-T <TTL> Time to live for the relative domain name.\n".
"-z <zone>\n";
exit 1;
}
#gets the options
my %opts=();
getopts('a:A:c:m:r:p:t:T:z:', \%opts);
#init it
my $pldm=BIND::SDB::LDAP::Helper->new({configfile=>$opts{c}});
if ($pldm->{error}) {
exit $pldm->{error};
}
my @a;
if (defined($opts{a})) {
@a=split(/\,/, $opts{a});
}
my @aaaa;
if (defined($opts{A})) {
@aaaa=split(/\,/, $opts{A});
}
my @mx;
if (defined($opts{m})) {
@mx=split(/\,/, $opts{m});
}
my @ptr;
if (defined($opts{p})) {
@ptr=split(/\,/, $opts{p});
}
my @txt;
if (defined($opts{t})) {
$txt[0]=$opts{t};
}
$pldm->addRelative({
zone=>$opts{z},
relative=>$opts{r},
ttl=>$opts{T},
a=>\@a,
aaaa=>\@aaaa,
mx=>\@mx,
ptr=>\@ptr,
txt=>\@txt,
});
if ($pldm->{error}) {
exit $pldm->{error};
}
exit 0;
=head1 NAME
pldm-radd - Adds a new relative domain name to a zone in LDAP.
=head1 SYNOPSIS
pldm-radd [B<-c> <config>] B<-z> <zone> B<-r> <relative> [B<-a> <A records>] [B<-A> <AAAA records>]
[B<-m> <MX records>] [B<-t> <TXT records>] [B<-T> <TTL>]
=head1 SWITCHES
=head2 -a <A records>
A comma seperated list of A records.
=head2 -A <AAAA records>
A comma seperated list of AAAA records.
=head2 -c <config>
Override the default config file.
=head2 -m <MX records>
A comma seperated ist of MX records.
=head2 -r <relative>
The relative domain to add to the zone.
=head2 -p <PTR records>
A comma seperated list of PTR records.
=head2 -t <TXT record>
This is the text record to add.
=head2 -z <zone>
This is the zone to add.
=head1 EXIT CODES
These reflect the error values returned by BIND::SDB::LDAP::Helper.
=head1 AUTHOR
Copyright (c) 2009, Zame C. Bowers <vvelox@vvelox.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
xFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS` OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=head1 SCRIPT CATEGORIES
UNIX : System_administration
=head1 OSNAMES
any
=head2 SEE ALSO
BIND::SDB::LDAP::Helper
=head1 README
pldm-radd - Adds a new relative domain name to a zone in LDAP.
=cut

View File

@ -0,0 +1,223 @@
#!/usr/bin/perl
#Copyright (c) 2009, Zane C. Bowers
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without modification,
#are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
#IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
#INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
#LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
#THE POSSIBILITY OF SUCH DAMAGE.
use strict;
use warnings;
use Getopt::Std;
use BIND::SDB::LDAP::Helper;
$Getopt::Std::STANDARD_HELP_VERSION = 1;
#version function
sub main::VERSION_MESSAGE {
print "pldm-rget 0.0.0\n";
}
#print help
sub main::HELP_MESSAGE {
print "\n".
"-c <config> The config file to use.".
"-r <relative> The relative domain name to get.\n".
"-z <zone> The zone to act on.\n".
"-Z Don't replace the '\@' with the name of the zone.\n";
exit 1;
}
#gets the options
my %opts=();
getopts('ac:r:z:Z', \%opts);
#init it
my $pldm=BIND::SDB::LDAP::Helper->new({configfile=>$opts{c}});
if ($pldm->{error}) {
exit $pldm->{error};
}
my @relatives;
if ($opts{a}) {
@relatives=$pldm->listRelatives($opts{z});
if ($pldm->{error}) {
exit $pldm->{error};
}
@relatives=sort(@relatives);
}else {
push(@relatives, $opts{r});
}
#
my $int=0;
while (defined($relatives[$int])) {
my %info=$pldm->getRelativeInfo($relatives[$int], $opts{z});
if ($pldm->{error}) {
exit $pldm->{error};
}
if (!$opts{Z}) {
if ($relatives[$int] eq '@') {
$relatives[$int]=$opts{z};
}
}
#get what to use for the TTL value
my $ttl='';
if (defined($info{dNSTTL})) {
$ttl=$info{dNSTTL}[0];
}
#get the class type
my $class='';
if (defined($info{dNSClass})) {
$class=$info{dNSClass}[0];
}
if (defined($info{sOARecord})) {
print $relatives[$int]. ' '.$ttl.' '.$class.' SOA '.$info{sOARecord}[0]."\n";
}
if (defined($info{aRecord})) {
my $rint=0;
while ($info{aRecord}[$rint]) {
print $relatives[$int]. ' '.$ttl.' '.$class.' A '.$info{aRecord}[0]."\n";
$rint++;
}
}
if (defined($info{aAAARecord})) {
my $rint=0;
while ($info{aAAARecord}[$rint]) {
print $relatives[$int]. ' '.$ttl.' '.$class.' AAAA '.$info{aAAARecord}[0]."\n";
$rint++;
}
}
if (defined($info{cNAMERecord})) {
my $rint=0;
while ($info{cNAMERecord}[$rint]) {
print $relatives[$int]. ' '.$ttl.' '.$class.' CNAME '.$info{cNAMERecord}[0]."\n";
$rint++;
}
}
if (defined($info{mXRecord})) {
my $rint=0;
while ($info{mXRecord}[$rint]) {
print $relatives[$int]. ' '.$ttl.' '.$class.' MX '.$info{mXRecord}[0]."\n";
$rint++;
}
}
if (defined($info{pTRRecord})) {
my $rint=0;
while ($info{pTRRecord}[$rint]) {
print $relatives[$int]. ' '.$ttl.' '.$class.' PTR '.$info{pTRRecord}[0]."\n";
$rint++;
}
}
$int++;
}
exit 0;
=head1 NAME
pldm-rget - Gets information for records in a zone.
=head1 SYNOPSIS
pldm-rget [B<-c> <config>] B<-z> <zone> B<-r> <relative> [B<-Z>]
pldm-rget [B<-c> <config>] B<-z> <zone> B<-a> [B<-Z>]
=head1 SWITCHES
=head2 -a
Get all the names for a domain.
=head2 -c <config>
The config file to use if the default is not desired.
=head2 -r <relative>
This is the relative domain name to act on.
=head2 -z <zone>
The zone to act on.
=head2 -Z
Don't replace '@' with the zone name.
=head1 EXIT CODES
These reflect the error values returned by BIND::SDB::LDAP::Helper.
=head1 AUTHOR
Copyright (c) 2009, Zame C. Bowers <vvelox@vvelox.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
xFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS` OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=head1 SCRIPT CATEGORIES
UNIX : System_administration
=head1 OSNAMES
any
=head2 SEE ALSO
BIND::SDB::LDAP::Helper
=head1 README
pldm-rget - Gets information for records in a zone.
=cut

161
BIND-SDB-LDAP-Helper/bin/pldm-rls Executable file
View File

@ -0,0 +1,161 @@
#!/usr/bin/perl
#Copyright (c) 2009, Zane C. Bowers
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without modification,
#are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
#IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
#INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
#LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
#THE POSSIBILITY OF SUCH DAMAGE.
use strict;
use warnings;
use Getopt::Std;
use BIND::SDB::LDAP::Helper;
$Getopt::Std::STANDARD_HELP_VERSION = 1;
#version function
sub main::VERSION_MESSAGE {
print "pldm-rls 0.0.0\n";
}
#print help
sub main::HELP_MESSAGE {
print "\n".
"-a Remove the @ entry.\n";
"-c <config> The config file to use.\n".
"-d If a full domain is being printed, append a period.\n".
"-f Print the full hostname.\n".
"-z <zone> The zone to list the relatives for.\n";
exit 1;
}
#gets the options
my %opts=();
getopts('c:dfz:', \%opts);
#init it
my $pldm=BIND::SDB::LDAP::Helper->new({configfile=>$opts{c}});
if ($pldm->{error}) {
exit $pldm->{error};
}
#figure out how to join it
my $joinstring="\n";
if ($opts{f}) {
if ($opts{d}) {
$joinstring='.'.$opts{z}.".\n";
}else {
$joinstring='.'.$opts{z}."\n";
}
}
#get the list
my @relatives=$pldm->listRelatives($opts{z});
if ($pldm->{error}) {
exit $pldm->{error};
}
my $relatives=join($joinstring, sort(@relatives)).$joinstring;
#removes @ if desired
if ($opts{a}) {
$relatives=~s/\@.*\n//;
}
print $relatives;
exit 0;
=head1 NAME
pldm-rls - List the relative domain names for a zone in LDAP.
=head1 SYNOPSIS
pldm-rls [B<-c> <config>] B<-z>
=head1 SWITCHES
=head2 -a
Remove the @.
=head2 -c <config>
The config file to use if the default is not desired.
=head2 -d
If -f is specified add a period on to the end.
=head2 -f
Print the full domain name.
=head2 -z
The zone to list the relative domain names for.
=head1 EXIT CODES
These reflect the error values returned by BIND::SDB::LDAP::Helper.
=head1 AUTHOR
Copyright (c) 2009, Zame C. Bowers <vvelox@vvelox.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
xFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS` OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=head1 SCRIPT CATEGORIES
UNIX : System_administration
=head1 OSNAMES
any
=head2 SEE ALSO
BIND::SDB::LDAP::Helper
=head1 README
pldm-rls - List relative domain names for a zone in LDAP.
=cut

View File

@ -0,0 +1,242 @@
#!/usr/bin/perl
#Copyright (c) 2009, Zane C. Bowers
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without modification,
#are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
#IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
#INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
#LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
#THE POSSIBILITY OF SUCH DAMAGE.
use strict;
use warnings;
use Getopt::Std;
use BIND::SDB::LDAP::Helper;
$Getopt::Std::STANDARD_HELP_VERSION = 1;
#version function
sub main::VERSION_MESSAGE {
print "pldm-rmod 0.0.0\n";
}
#print help
sub main::HELP_MESSAGE {
print "\n".
"-a <A records> A comma seperated list of A records.\n".
"-A <AAAA records> A comma seperated list of AAAA records.\n".
"-c <config> The config file to use.\n".
"-m <MX records> A comma seperated list of MX records.\n".
"-r <relative> The name of the relative domain name to add.\n".
"-p <PTR records> A comma seperated list of PTR records.\n".
"-s <action type> This if if the specified records should be added or removed.\n".
"-t <TXT record> A comma seperated txt record.\n".
"-T <TTL> Time to live for the relative domain name.\n".
"-z <zone>\n".
"\n".
"Action Types:\n".
"a - Add these to the specified record. This is the default.\n".
"d - Remove these from the specified record.\n";
exit 1;
}
#gets the options
my %opts=();
getopts('a:A:c:m:r:p:s:t:T:z:', \%opts);
#init it
my $pldm=BIND::SDB::LDAP::Helper->new({configfile=>$opts{c}});
if ($pldm->{error}) {
exit $pldm->{error};
}
if (!defined($opts{s})) {
$opts{s}='a';
}
my @a;
if (defined($opts{a})) {
@a=split(/\,/, $opts{a});
}
my @aaaa;
if (defined($opts{A})) {
@aaaa=split(/\,/, $opts{A});
}
my @mx;
if (defined($opts{m})) {
@mx=split(/\,/, $opts{m});
}
my @ptr;
if (defined($opts{p})) {
@ptr=split(/\,/, $opts{p});
}
my @txt;
if (defined($opts{t})) {
$txt[0]=$opts{t};
}
#handle adding it
if ($opts{s} eq 'a') {
$pldm->addRecords({
zone=>$opts{z},
relative=>$opts{r},
ttl=>$opts{T},
a=>\@a,
aaaa=>\@aaaa,
mx=>\@mx,
ptr=>\@ptr,
txt=>\@txt,
});
if ($pldm->{error}) {
exit $pldm->{error};
}
exit 0;
}
#handle adding it
if ($opts{s} eq 'd') {
$pldm->removeRecords({
zone=>$opts{z},
relative=>$opts{r},
ttl=>$opts{T},
a=>\@a,
aaaa=>\@aaaa,
mx=>\@mx,
ptr=>\@ptr,
txt=>\@txt,
});
if ($pldm->{error}) {
exit $pldm->{error};
}
exit 0;
}
exit 254;
=head1 NAME
pldm-rmod - Modify a relative domain name for a zone in LDAP.
=head1 SYNOPSIS
pldm-rmod [B<-c> <config>] B<-z> <zone> B<-r> <relative> [B<-a> <A records>] [B<-A> <AAAA records>]
[B<-m> <MX records>] [B<-t> <TXT records>] [B<-T> <TTL>]
=head1 SWITCHES
=head2 -a <A records>
A comma seperated list of A records.
=head2 -A <AAAA records>
A comma seperated list of AAAA records.
=head2 -c <config>
Override the default config file.
=head2 -m <MX records>
A comma seperated ist of MX records.
=head2 -r <relative>
The relative domain to work on..
=head2 -p <PTR records>
A comma seperated list of PTR records.
=head2 -s <action type>
=head3 a
Add the records.
=head4 d
Delete the records.
=head2 -t <TXT record>
A text record add/remove. Unlike the others,
only one is accepted.
=head2 -T <TTL>
This is the TTL to set it to if being added. If
being removed
=head2 -z <zone>
This is the zone to work on.
=head1 EXIT CODES
These reflect the error values returned by BIND::SDB::LDAP::Helper.
=head2 254
No matching action found.
=head1 AUTHOR
Copyright (c) 2009, Zame C. Bowers <vvelox@vvelox.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
xFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS` OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=head1 SCRIPT CATEGORIES
UNIX : System_administration
=head1 OSNAMES
any
=head2 SEE ALSO
BIND::SDB::LDAP::Helper
=head1 README
pldm-rmod - Modify a relative domain name for a zone in LDAP.
=cut

132
BIND-SDB-LDAP-Helper/bin/pldm-rrm Executable file
View File

@ -0,0 +1,132 @@
#!/usr/bin/perl
#Copyright (c) 2009, Zane C. Bowers
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without modification,
#are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
#IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
#INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
#LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
#THE POSSIBILITY OF SUCH DAMAGE.
use strict;
use warnings;
use Getopt::Std;
use BIND::SDB::LDAP::Helper;
$Getopt::Std::STANDARD_HELP_VERSION = 1;
#version function
sub main::VERSION_MESSAGE {
print "pldm-rrm 0.0.0\n";
}
#print help
sub main::HELP_MESSAGE {
print "\n".
"-c <config> The config file to use.".
"-r <relative> The relative domain name to remove.\n".
"-z <zone> The zone to act on.\n";
exit 1;
}
#gets the options
my %opts=();
getopts('z:c:r:', \%opts);
#init it
my $pldm=BIND::SDB::LDAP::Helper->new({configfile=>$opts{c}});
if ($pldm->{error}) {
exit $pldm->{error};
}
$pldm->removeRelative($opts{r}, $opts{z});
if ($pldm->{error}) {
exit $pldm->{error};
}
exit 0;
=head1 NAME
pldm-rrm - Removes a relative domain name for a zone.
=head1 SYNOPSIS
pldm-zrm [B<-c> <config>] B<-z> <zone> B<-r> <relative>
=head1 SWITCHES
=head2 -c <config>
The config file to use if the default is not desired.
=head2 -r <relative>
This is the relative domain name to act on.
=head2 -z <zone>
The zone to act on.
=head1 EXIT CODES
These reflect the error values returned by BIND::SDB::LDAP::Helper.
=head1 AUTHOR
Copyright (c) 2009, Zame C. Bowers <vvelox@vvelox.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
xFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS` OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=head1 SCRIPT CATEGORIES
UNIX : System_administration
=head1 OSNAMES
any
=head2 SEE ALSO
BIND::SDB::LDAP::Helper
=head1 README
pldm-rrm - Removes a relative domain name for a zone.
=cut

View File

@ -0,0 +1,187 @@
#!/usr/bin/perl
#Copyright (c) 2009, Zane C. Bowers
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without modification,
#are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
#IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
#INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
#LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
#THE POSSIBILITY OF SUCH DAMAGE.
use strict;
use warnings;
use Getopt::Std;
use BIND::SDB::LDAP::Helper;
$Getopt::Std::STANDARD_HELP_VERSION = 1;
#version function
sub main::VERSION_MESSAGE {
print "pldm-zadd 0.0.0\n";
}
#print help
sub main::HELP_MESSAGE {
print "\n".
"-c <config> A config file.\n".
"-d Only add a DC structure object.\n".
"-e <email address> The email address for the one responsible for the zone.\n".
"-E <expire time> The expire time for the SOA.\n".
"-n <name servers> This is a comma seperated list of name servers.\n".
"-m <minimum time> This is the minimum time for the SOA.\n".
"-r <retry time> This is the retry time for the SOA.\n".
"-R <refresh time> This is the refresh time for the SOA.\n".
"-t <ttl> This is the TTL for the zone.\n".
"-z <zone> This is the zone to add.\n";
exit 1;
}
#gets the options
my %opts=();
getopts('c:de:E:n:m:r:R:t:z:', \%opts);
#init it
my $pldm=BIND::SDB::LDAP::Helper->new({configfile=>$opts{c}});
if ($pldm->{error}) {
exit $pldm->{error};
}
#adds the DC structure only
if ($opts{d}) {
$pldm->addZoneDC($opts{z});
if ($pldm->{error}) {
exit $pldm->{error};
}
exit 0;
}
my @NSs=split(/\,/, $opts{n});
$pldm->addZone({
zone=>$opts{z},
email=>$opts{e},
ns=>\@NSs,
ttl=>$opts{t},
expire=>$opts{E},
minimum=>$opts{m},
refresh=>$opts{R},
retry=>$opts{r},
});
exit 0;
=head1 NAME
pldm-zadd - Adds a new zone in LDAP.
=head1 SYNOPSIS
pldm-zadd [B<-c> <config>] [B<-d>] B<-z> <zone>
pldm-zadd [B<-c> <config>] B<-z> <zone> B<-e> <email address> B<-n> <name servers> [B<-t> <ttl>]
[B<-E> <expire>] [B<-m> <minimum>] [B<-R> <refresh>] [B<-r> <retry>]
=head1 SWITCHES
=head2 -c <config>
The config file to use if the default is not desired.
=head2 -d
Add it as a DC structure only.
=head2 -e <email>
This is the email address for the SOA.
=head2 -E <expire>
This is the expire for the SOA.
=head2 -n <name servers>
A comma seperated list of name servers.
=head2 -m <minimum>
This is the minimum time for the SOA.
=head2 -r <retry>
This is the retry time for the SOA.
=head2 -R <refresh>
This is the refresh time for the SOA.
=head2 -t <ttl>
This is the TTL for the domain.
=head2 -z <zone>
The zone to add
=head1 EXIT CODES
These reflect the error values returned by BIND::SDB::LDAP::Helper.
=head1 AUTHOR
Copyright (c) 2009, Zame C. Bowers <vvelox@vvelox.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
xFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS` OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=head1 SCRIPT CATEGORIES
UNIX : System_administration
=head1 OSNAMES
any
=head2 SEE ALSO
BIND::SDB::LDAP::Helper
=head1 README
pldm-zrm - Removes a zone from LDAP.
=cut

152
BIND-SDB-LDAP-Helper/bin/pldm-zls Executable file
View File

@ -0,0 +1,152 @@
#!/usr/bin/perl
#Copyright (c) 2009, Zane C. Bowers
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without modification,
#are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
#IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
#INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
#LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
#THE POSSIBILITY OF SUCH DAMAGE.
use strict;
use warnings;
use Getopt::Std;
use BIND::SDB::LDAP::Helper;
$Getopt::Std::STANDARD_HELP_VERSION = 1;
#version function
sub main::VERSION_MESSAGE {
print "pldm-zls 0.0.0\n";
}
#print help
sub main::HELP_MESSAGE {
print "\n".
"-c <config> The config file to use.\n".
"-d Show structural zones.\n".
"-D Show structural only zones.\n";
exit 1;
}
#gets the options
my %opts=();
getopts('c:dD', \%opts);
#init it
my $pldm=BIND::SDB::LDAP::Helper->new({configfile=>$opts{c}});
if ($pldm->{error}) {
exit $pldm->{error};
}
my @zones=$pldm->listZones;
my @dczones=$pldm->listZoneDCs;
#all DC
if ($opts{d}) {
print join("\n", @dczones)."\n";
exit 0;
}
#if DC only
if ($opts{D}) {
my $int=0;
while (defined($dczones[$int])) {
my $isdconly=$pldm->zoneIsDConly($dczones[$int]);
if ($isdconly) {
print $dczones[$int]."\n";
}
$int++;
}
exit 0;
}
print join("\n", @zones)."\n";
exit 0;
=head1 NAME
pldm-zls - List zones in LDAP.
=head1 SYNOPSIS
pldm-zls [B<-c> <config>] [B<-d>] [B<-D>]
=head1 SWITCHES
=head2 -c <config>
The config file to use if the default is not desired.
=head2 -d
List zones wether they are structural or not.
=head2 -D
List zones wether zones that are structural only.
=head1 EXIT CODES
These reflect the error values returned by BIND::SDB::LDAP::Helper.
=head1 AUTHOR
Copyright (c) 2009, Zame C. Bowers <vvelox@vvelox.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
xFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS` OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=head1 SCRIPT CATEGORIES
UNIX : System_administration
=head1 OSNAMES
any
=head2 SEE ALSO
BIND::SDB::LDAP::Helper
=head1 README
pldm-zls - List zones in LDAP.
=cut

150
BIND-SDB-LDAP-Helper/bin/pldm-zrm Executable file
View File

@ -0,0 +1,150 @@
#!/usr/bin/perl
#Copyright (c) 2009, Zane C. Bowers
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without modification,
#are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
#IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
#INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
#LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
#THE POSSIBILITY OF SUCH DAMAGE.
use strict;
use warnings;
use Getopt::Std;
use BIND::SDB::LDAP::Helper;
$Getopt::Std::STANDARD_HELP_VERSION = 1;
#version function
sub main::VERSION_MESSAGE {
print "pldm-zrm 0.0.0\n";
}
#print help
sub main::HELP_MESSAGE {
print "\n".
"-c <config> The config file to use.\n".
"-z <zone> The zone to remove.\n";
exit 1;
}
#gets the options
my %opts=();
getopts('z:c:', \%opts);
#init it
my $pldm=BIND::SDB::LDAP::Helper->new({configfile=>$opts{c}});
if ($pldm->{error}) {
exit $pldm->{error};
}
#check if it is DC only
my $isdconly=$pldm->zoneIsDConly($zone);
if ($pldm->{error}) {
exit $pldm->{error};
}
#
if ($isdconly) {
$pldm->removeZoneDC($zone);
if ($pldm->{error}) {
exit $pldm->{error};
}
}
#handle it if it is a DC only
if ($isdconly) {
$pldm->removeZoneDC($zone);
if ($pldm->{error}) {
exit $pldm->{error};
}
exit 0;
}
$pldm->removeZone($zone);
if ($pldm->{error}) {
exit $pldm->{error};
}
exit 0;
=head1 NAME
pldm-zrm - Removes a zone from LDAP.
=head1 SYNOPSIS
pldm-zrm [B<-c> <config>] B<-z> <zone>
=head1 SWITCHES
=head2 -c <config>
The config file to use if the default is not desired.
=head2 -z <zone>
The zone to remove.
=head1 EXIT CODES
These reflect the error values returned by BIND::SDB::LDAP::Helper.
=head1 AUTHOR
Copyright (c) 2009, Zame C. Bowers <vvelox@vvelox.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
xFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS` OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=head1 SCRIPT CATEGORIES
UNIX : System_administration
=head1 OSNAMES
any
=head2 SEE ALSO
BIND::SDB::LDAP::Helper
=head1 README
pldm-zrm - Removes a zone from LDAP.
=cut

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,9 @@
#!perl -T
use Test::More tests => 1;
BEGIN {
use_ok( 'BIND::SDB::LDAP::Helper' );
}
diag( "Testing BIND::SDB::LDAP::Helper $BIND::SDB::LDAP::Helper::VERSION, Perl $], $^X" );

View File

@ -0,0 +1,55 @@
#!perl -T
use strict;
use warnings;
use Test::More tests => 3;
sub not_in_file_ok {
my ($filename, %regex) = @_;
open( my $fh, '<', $filename )
or die "couldn't open $filename for reading: $!";
my %violated;
while (my $line = <$fh>) {
while (my ($desc, $regex) = each %regex) {
if ($line =~ $regex) {
push @{$violated{$desc}||=[]}, $.;
}
}
}
if (%violated) {
fail("$filename contains boilerplate text");
diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
} else {
pass("$filename contains no boilerplate text");
}
}
sub module_boilerplate_ok {
my ($module) = @_;
not_in_file_ok($module =>
'the great new $MODULENAME' => qr/ - The great new /,
'boilerplate description' => qr/Quick summary of what the module/,
'stub function definition' => qr/function[12]/,
);
}
TODO: {
local $TODO = "Need to replace the boilerplate text";
not_in_file_ok(README =>
"The README is used..." => qr/The README is used/,
"'version information here'" => qr/to provide version information/,
);
not_in_file_ok(Changes =>
"placeholder date/time" => qr(Date/time)
);
module_boilerplate_ok('lib/BIND/SDB/LDAP/Helper.pm');
}

View File

@ -0,0 +1,18 @@
use strict;
use warnings;
use Test::More;
# Ensure a recent version of Test::Pod::Coverage
my $min_tpc = 1.08;
eval "use Test::Pod::Coverage $min_tpc";
plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
if $@;
# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
# but older versions don't recognize some common documentation styles
my $min_pc = 0.18;
eval "use Pod::Coverage $min_pc";
plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
if $@;
all_pod_coverage_ok();

View File

@ -0,0 +1,12 @@
#!perl -T
use strict;
use warnings;
use Test::More;
# Ensure a recent version of Test::Pod
my $min_tp = 1.22;
eval "use Test::Pod $min_tp";
plan skip_all => "Test::Pod $min_tp required for testing POD" if $@;
all_pod_files_ok();