From a3684346f4d60715512c7ca30ba9fc7bb270c38e Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sun, 3 Jun 2012 22:20:58 +0200 Subject: Merge everything into a single executable. --- fripost-searchdomain | 146 --------------------------------------------------- 1 file changed, 146 deletions(-) delete mode 100755 fripost-searchdomain (limited to 'fripost-searchdomain') diff --git a/fripost-searchdomain b/fripost-searchdomain deleted file mode 100755 index 0896683..0000000 --- a/fripost-searchdomain +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/perl - -use 5.010_000; -use strict; -use warnings; -use utf8; - -=head1 NAME - -fripost-searchdomain - List matching domains - -=head1 SYNOPSIS - -B [B<--debug>] [I [I]] - -=head1 DESCRIPTION - -B list virtual domains matching exactly I, -and whose owner is I. -Wildcards I<*> can appear in I, to match zero or more characters. -If no I is given, list all domains I, regardless of the -owner; If I is the empty string I<''>, list only the non -self-managed domains. -If neither I nor I are given, B lists -all existing virtual domains. - -=head1 OPTIONS - -=over 8 - -=item B<--server_host=>I - -The LDAP URI to connect to. -The default value is read from the configuration file, see B. - -=item B<--bind_dn=>I - -The Distinguished Name (DN) to bind to the LDAP directory. -(If not set, B binds anonymously.) -The default value is read from the configuration file, see B. - -=item B<--bind_pw=>I - -The password to to bind with. -The default value is read from the configuration file, see B. - -=item B<--base_dn=>I - -The root DN for everything done by B. -The default value is read from the configuration file, see B. - -=item B<-d>, B<--debug> - -Debug mode. - -=back - -=head1 CONFIGURATION - -The configuration is read from the file C<$HOME/.fripost.yml>. -Valid keys include: - -=over 4 - -=item I - -The LDAP URI to connect to. Defaults to C. - -=item I - -The Distinguished Name (DN) to bind to the LDAP directory. -(If not set, B binds anonymously.) - -=item I - -The password to to bind with. - -=item I - -The root DN for everything done by B. - -=back - -=cut - -use FindBin qw($Bin); -use lib "$Bin/lib"; - -use Env qw /HOME/; -use File::Spec::Functions; - -use Fripost::Schema; -use Getopt::Long qw /:config noauto_abbrev no_ignore_case - gnu_compat bundling permute nogetopt_compat - auto_version auto_help/; -use Pod::Usage; -use YAML::Syck; - - -## Get command line options -our $conf = LoadFile( catfile ($HOME, '.fripost.yml') ); - -GetOptions( - 'server_host=s' => \$conf->{server_host}, - 'base_dn=s' => \$conf->{base_dn}, - 'bind_dn=s' => \$conf->{bind_dn}, - 'bind_pw=s' => \$conf->{bind_pw}, - 'pretend' => \$conf->{pretend}, - 'debug|d' => \$conf->{debug}, - 'man' => sub { pod2usage(-exitstatus => 0, - -verbose => 2) } -) or pod2usage(2); - - -# Connect to the LDAP server -my $ldap = Fripost::Schema->new( $conf ); - -my %domain; -$domain{domain} = $ARGV[0] if defined $ARGV[0]; -$domain{owner} = $ARGV[1] if defined $ARGV[1]; - -foreach my $domain ($ldap->domain->search( \%domain )->entries) { - say '' . ($domain->{isActive} ? 'ACTIVE' : 'INACTIVE') - . ' domain ' . $domain->{domain} - . ' is owned by ' - . (defined $domain->{owner} ? join ', ', @{$domain->{owner}} - : '(none)'); -} - -$ldap->unbind(); - - -=head1 AUTHOR - -Guilhem Moulin C<< >> - -=head1 COPYRIGHT - -Copyright 2012 Guilhem Moulin. - -=head1 LICENSE - -This program is free software; you can redistribute it and/or modify it -under the same terms as perl itself. - -=cut -- cgit v1.2.3