#!/usr/bin/perl -w
# This script (sophomorix-test) is maintained by Rüdiger Beck
# It is Free Software (License GPLv3)
# If you find errors, contact the author
# jeffbeck@web.de  or  jeffbeck@linuxmuster.net

# modules
use strict;
#use Quota;
use Getopt::Long;
Getopt::Long::Configure ("bundling");
use Sophomorix::SophomorixConfig;
#use IMAP::Admin;
#use DBI;
use Net::LDAP;
#use Test::More "no_plan";
use Config::IniFiles;
use Data::Dumper;
$Data::Dumper::Indent = 1;
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Useqq = 1;
$Data::Dumper::Terse = 1; 

# for smb://
use POSIX;
use Filesys::SmbClient;

use Sophomorix::SophomorixBase qw(
                                 print_line
                                 print_title
                                 NTACL_set_file
                                 unlock_sophomorix
                                 json_dump
                                 lock_sophomorix
                                 log_script_start
                                 log_script_end
                                 log_script_exit
                                 backup_auk_file
                                 get_passwd_charlist
                                 filelist_fetch
                                 get_plain_password
                                 check_options
                                 config_sophomorix_read
                                 result_sophomorix_init
                                 );
use Sophomorix::SophomorixTest qw(
                                 file_test_lines
                                 );
use Sophomorix::SophomorixSambaAD qw(
                                 AD_school_create
                                 AD_bind_admin
                                 AD_get_user
                                 AD_user_kill
                                 AD_remove_sam_from_sophomorix_attributes
                                 AD_dns_get
                                 AD_unbind_admin
                                 AD_user_create
                                 AD_object_search
                                 AD_object_move
                                 AD_group_create
                                 AD_group_addmember
                                 AD_get_name_tokened
                                 AD_login_test
                                 AD_repdir_using_file
                                 AD_get_schoolname
                                 AD_dns_zonecreate
                                    );

$Conf::log_level=1;
my $help=0;


# OK:
# sophomorix-minitest -l 22
# sophomorix-minitest --length 22 -w 30 --info
# 
my %opt = ();
my $testopt=GetOptions (\%opt, 'length|l=i', 
                               'width|w=i',
                               'info|i',
                       );    


print Dumper (\%opt);

my $json=0;
my @arguments = @ARGV;



# Parsen der Optionen
my $testopt2=GetOptions(
           "verbose|v+" => \$Conf::log_level,
           "help|h" => \$help
          );

my %sophomorix_result=&result_sophomorix_init("sophomorix-school");

# Reading Configuration
my ($ldap,$root_dse) = &AD_bind_admin();
my $root_dns=&AD_dns_get($root_dse);
my %sophomorix_config=&config_sophomorix_read($ldap,$root_dse,\%sophomorix_result);
my @filelist=&filelist_fetch({filetype=>"users",
                              sophomorix_config=>\%sophomorix_config,
                            });



############################################################
# BEGIN: Test code goes here
############################################################


print "HERE\n";


############################################################
# END: Test code goes here
############################################################

&AD_unbind_admin($ldap);

