-use Encode qw/encode decode/;
-use vars qw { $ldapserver $domain $username $password $basedn };
-
-# --- configuration ---
-$ldapserver = "domaincontroller.yourdomain.com";
-$domain = "YOURDOMAIN";
-$username = "myuser";
-$password = "mypassword";
-$basedn = "ou=companyxy,dc=companyxy,dc=tld";
-# --- end configuration ---
-
-#my $search=shift;
-my $search=encode("UTF-8", join(" ", @ARGV));
-
-if (!$search=~/[\.\*\w\s]+/) {
- print("Invalid search parameters\n");
- exit 1;
+use warnings;
+
+use FindBin (qw($Bin));
+use lib ("$Bin/lib");
+
+use LiCoM::Config (qw(get_config));
+use LiCoM::Person;
+
+our $Config;
+
+if (-e $ENV{'HOME'} . '/.licomrc')
+{
+ $Config = get_config ($ENV{'HOME'} . '/.licomrc');
+}
+elsif (-e '/etc/licom/licom.conf')
+{
+ $Config = get_config ('/etc/licom/licom.conf');
+}
+else
+{
+ $Config = get_config ();
+}
+
+if ($ENV{'DEBUG'})
+{
+ require Data::Dumper;
+ print STDERR Data::Dumper->Dump ([$Config], ['Config']);
+}
+
+unless (defined ($Config->{'uri'}) and defined ($Config->{'bind_dn'})
+ and defined ($Config->{'password'}))
+{
+ die (<<ERROR);
+The configuration has not been found or is not complete. At least the options
+uri, bind_dn and password are needed.
+ERROR