2009-10-07 17:45:17 +04:00
#!/bin/bash
ITERATIONS = 100
2022-02-19 18:06:32 +03:00
source $( dirname $0 ) /utils.sh
2009-10-07 17:45:17 +04:00
PRINCIPAL = $( get_principal $1 )
PASSWORD = $( get_password $1 )
REALM = $( get_realm $1 )
NT_DOM = $( get_nt_dom $1 )
SERVER = $2
2022-02-19 18:06:32 +03:00
search_users( )
{
${ NET } ads search '(objectCategory=user)' sAMAccountName -k --configfile= $CONFIG_FILE -S ${ SERVER } >/dev/null
2009-10-07 17:45:17 +04:00
RET = $?
if [ $RET -ne 0 ] ; then
echo " ${ NET } returned error: $RET "
exit 1
fi
}
2022-02-19 18:06:32 +03:00
search_groups( )
{
${ NET } ads search '(objectCategory=group)' sAMAccountName -k --configfile= $CONFIG_FILE -S ${ SERVER } >/dev/null
2009-10-07 17:45:17 +04:00
if [ $RET -ne 0 ] ; then
echo " ${ NET } returned error: $RET "
exit 1
fi
}
2022-02-19 18:06:32 +03:00
search_computers( )
{
${ NET } ads search '(objectCategory=computer)' sAMAccountName -k --configfile= $CONFIG_FILE -S ${ SERVER } >/dev/null
2009-10-07 17:45:17 +04:00
if [ $RET -ne 0 ] ; then
echo " ${ NET } returned error: $RET "
exit 1
fi
}
2022-02-19 18:06:32 +03:00
search_wildcard( )
{
${ NET } ads search '(objectCategory=*)' sAMAccountName -k --configfile= $CONFIG_FILE -S ${ SERVER } >/dev/null
2009-10-07 17:45:17 +04:00
if [ $RET -ne 0 ] ; then
echo " ${ NET } returned error: $RET "
exit 1
fi
}
2022-02-19 18:06:32 +03:00
search_unindexed( )
{
${ NET } ads search '(description=Built-in account for adminstering the computer/domain)' sAMAccountName -k --configfile= $CONFIG_FILE -S ${ SERVER } >/dev/null
2009-10-07 17:45:17 +04:00
if [ $RET -ne 0 ] ; then
echo " ${ NET } returned error: $RET "
exit 1
fi
}
2022-02-19 18:06:32 +03:00
set_up( )
{
2009-10-07 17:45:17 +04:00
set_krb_env
setup_kinit
call_kinit " ${ PRINCIPAL } " " ${ PASSWORD } "
write_configfile " ${ REALM } " " ${ NT_DOM } "
}
2022-02-19 18:06:32 +03:00
tear_down( )
{
2009-10-07 17:45:17 +04:00
${ KDESTROY }
restore_krb_env
}
set_up
echo -e " \tSEARCH INDEXED $2 "
START_TIME = $( start_timer)
echo -en "\t"
2022-02-19 18:06:32 +03:00
for i in $( ${ SEQ } 1 $ITERATIONS ) ; do
2009-10-07 17:45:17 +04:00
search_users
search_groups
search_computers
echo -n "."
done
echo "done"
STOP_TIME = $( stop_timer)
2022-02-19 18:06:32 +03:00
TOTAL_TIME = $( total_time $START_TIME $STOP_TIME )
2009-10-07 17:45:17 +04:00
echo -e " \t\ttotal time:\t\t ${ TOTAL_TIME } s "
LOGINS_PER_MINUTE = $( iterations_per_minute $START_TIME $STOP_TIME $ITERATIONS )
echo -e " \t\titerations/min:\t\t $LOGINS_PER_MINUTE "
########################
echo -e " \tSEARCH WILDCARD $2 "
START_TIME = $( start_timer)
echo -en "\t"
2022-02-19 18:06:32 +03:00
for i in $( ${ SEQ } 1 $ITERATIONS ) ; do
2009-10-07 17:45:17 +04:00
search_wildcard
echo -n "."
done
echo "done"
STOP_TIME = $( stop_timer)
2022-02-19 18:06:32 +03:00
TOTAL_TIME = $( total_time $START_TIME $STOP_TIME )
2009-10-07 17:45:17 +04:00
echo -e " \t\ttotal time:\t\t ${ TOTAL_TIME } s "
LOGINS_PER_MINUTE = $( iterations_per_minute $START_TIME $STOP_TIME $ITERATIONS )
echo -e " \t\titerations/min:\t\t $LOGINS_PER_MINUTE "
########################
echo -e " \tSEARCH UNINDEXED $2 "
START_TIME = $( start_timer)
echo -en "\t"
2022-02-19 18:06:32 +03:00
for i in $( ${ SEQ } 1 $ITERATIONS ) ; do
2009-10-07 17:45:17 +04:00
search_unindexed
echo -n "."
done
echo "done"
STOP_TIME = $( stop_timer)
2022-02-19 18:06:32 +03:00
TOTAL_TIME = $( total_time $START_TIME $STOP_TIME )
2009-10-07 17:45:17 +04:00
echo -e " \t\ttotal time:\t\t ${ TOTAL_TIME } s "
LOGINS_PER_MINUTE = $( iterations_per_minute $START_TIME $STOP_TIME $ITERATIONS )
echo -e " \t\titerations/min:\t\t $LOGINS_PER_MINUTE "
tear_down