diff options
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/LDAP/get_next_oid | 12 | ||||
-rwxr-xr-x | examples/ad-bench/ad-bench.sh | 14 | ||||
-rw-r--r-- | examples/ad-bench/settings.sh | 5 | ||||
-rw-r--r-- | examples/ad-bench/test_utils.sh | 14 | ||||
-rw-r--r-- | examples/ad-bench/time_group.sh | 38 | ||||
-rw-r--r-- | examples/ad-bench/time_join.sh | 22 | ||||
-rw-r--r-- | examples/ad-bench/time_kinit.sh | 18 | ||||
-rw-r--r-- | examples/ad-bench/time_ldap.sh | 45 | ||||
-rw-r--r-- | examples/ad-bench/time_user.sh | 38 | ||||
-rw-r--r-- | examples/ad-bench/utils.sh | 72 | ||||
-rw-r--r-- | examples/scripts/debugging/linux/backtrace | 12 | ||||
-rw-r--r-- | examples/scripts/debugging/solaris/solaris-oops.sh | 28 | ||||
-rwxr-xr-x | examples/scripts/idmap/idmap_nis.sh | 133 | ||||
-rw-r--r-- | examples/scripts/wins_hook/dns_update | 8 | ||||
-rwxr-xr-x | examples/systemtap/generate-winbindd.stp.sh | 14 |
15 files changed, 255 insertions, 218 deletions
diff --git a/examples/LDAP/get_next_oid b/examples/LDAP/get_next_oid index bf002003753..f268b47b50d 100755 --- a/examples/LDAP/get_next_oid +++ b/examples/LDAP/get_next_oid @@ -1,15 +1,15 @@ #!/bin/bash -nextattrib=`cat samba.schema | grep -i attributetype.*\(.*1.3.6.1.4.1.7165. | grep -v '^#' | \ - awk '{print $3}' | cut -d. -f 10 | sort -n | tail -1` +nextattrib=$(cat samba.schema | grep -i attributetype.*\(.*1.3.6.1.4.1.7165. | grep -v '^#' | + awk '{print $3}' | cut -d. -f 10 | sort -n | tail -1) -(( nextattrib += 1 )) +( (nextattrib += 1)) echo "attributetype ( 1.3.6.1.4.1.7165.2.1.$nextattrib NAME ...." -nextoc=`cat samba.schema | grep -i objectclass.*\(.*1.3.6.1.4.1.7165. | grep -v '^#' | \ - awk '{print $3}' | cut -d. -f 10 | sort -n | tail -1` +nextoc=$(cat samba.schema | grep -i objectclass.*\(.*1.3.6.1.4.1.7165. | grep -v '^#' | + awk '{print $3}' | cut -d. -f 10 | sort -n | tail -1) -(( nextoc += 1 )) +( (nextoc += 1)) echo "objectclass ( 1.3.6.1.4.1.7165.2.2.$nextoc NAME ...." diff --git a/examples/ad-bench/ad-bench.sh b/examples/ad-bench/ad-bench.sh index 84bb770e8c8..c4c2a4a1e7a 100755 --- a/examples/ad-bench/ad-bench.sh +++ b/examples/ad-bench/ad-bench.sh @@ -18,7 +18,7 @@ # You should have received a copy of the GNU General Public License # along with AD-Bench. If not, see <http://www.gnu.org/licenses/>. -source `dirname $0`/utils.sh +source $(dirname $0)/utils.sh if [ ! -f $RUNS ]; then echo "Error: please fill in $RUNS" @@ -27,12 +27,12 @@ if [ ! -f $RUNS ]; then exit 1 fi -for run in `cat $RUNS`; do +for run in $(cat $RUNS); do echo "START RUN" - bash `dirname $0`/time_kinit.sh `echo $run|cut -d ":" -f 1` - bash `dirname $0`/time_join.sh `echo $run|cut -d ":" -f 1` `echo $run|cut -d ":" -f 2` - bash `dirname $0`/time_user.sh `echo $run|cut -d ":" -f 1` `echo $run|cut -d ":" -f 2` - bash `dirname $0`/time_group.sh `echo $run|cut -d ":" -f 1` `echo $run|cut -d ":" -f 2` - bash `dirname $0`/time_ldap.sh `echo $run|cut -d ":" -f 1` `echo $run|cut -d ":" -f 2` + bash $(dirname $0)/time_kinit.sh $(echo $run | cut -d ":" -f 1) + bash $(dirname $0)/time_join.sh $(echo $run | cut -d ":" -f 1) $(echo $run | cut -d ":" -f 2) + bash $(dirname $0)/time_user.sh $(echo $run | cut -d ":" -f 1) $(echo $run | cut -d ":" -f 2) + bash $(dirname $0)/time_group.sh $(echo $run | cut -d ":" -f 1) $(echo $run | cut -d ":" -f 2) + bash $(dirname $0)/time_ldap.sh $(echo $run | cut -d ":" -f 1) $(echo $run | cut -d ":" -f 2) echo "END RUN" done diff --git a/examples/ad-bench/settings.sh b/examples/ad-bench/settings.sh index f01edc3d98a..b4a68ae8963 100644 --- a/examples/ad-bench/settings.sh +++ b/examples/ad-bench/settings.sh @@ -18,7 +18,6 @@ # You should have received a copy of the GNU General Public License # along with AD-Bench. If not, see <http://www.gnu.org/licenses/>. - DATE=date BC=bc SED=sed @@ -36,6 +35,6 @@ SEQ=seq NEW_KRB5CCNAME=/tmp/ad_test_ccname NET="${HOME}/samba/bin/net" -CONFIG_FILE=`dirname $0`/smb.conf +CONFIG_FILE=$(dirname $0)/smb.conf -RUNS=`dirname $0`/runs.txt +RUNS=$(dirname $0)/runs.txt diff --git a/examples/ad-bench/test_utils.sh b/examples/ad-bench/test_utils.sh index 7f46b07d63a..2580c9da73a 100644 --- a/examples/ad-bench/test_utils.sh +++ b/examples/ad-bench/test_utils.sh @@ -18,14 +18,12 @@ # You should have received a copy of the GNU General Public License # along with AD-Bench. If not, see <http://www.gnu.org/licenses/>. - -source `dirname $0`/utils.sh +source $(dirname $0)/utils.sh INPUT="administrator@AD.EXAMPLE.COM%secret" -echo "Principal for $INPUT is " $( get_principal $INPUT ) -echo "Password for $INPUT is " $( get_password $INPUT ) -echo "Realm for $INPUT is " $( get_realm $INPUT ) -echo "NT_DOM for $INPUT is " $( get_nt_dom $INPUT ) - +echo "Principal for $INPUT is " $(get_principal $INPUT) +echo "Password for $INPUT is " $(get_password $INPUT) +echo "Realm for $INPUT is " $(get_realm $INPUT) +echo "NT_DOM for $INPUT is " $(get_nt_dom $INPUT) -echo "Padding 2: " $( pad_number 1 2 ) " 4: " $(pad_number 23 4) +echo "Padding 2: " $(pad_number 1 2) " 4: " $(pad_number 23 4) diff --git a/examples/ad-bench/time_group.sh b/examples/ad-bench/time_group.sh index bb989314b83..be47aac0e6c 100644 --- a/examples/ad-bench/time_group.sh +++ b/examples/ad-bench/time_group.sh @@ -20,7 +20,7 @@ ITERATIONS=100 -source `dirname $0`/utils.sh +source $(dirname $0)/utils.sh PRINCIPAL=$(get_principal $1) PASSWORD=$(get_password $1) @@ -28,9 +28,10 @@ REALM=$(get_realm $1) NT_DOM=$(get_nt_dom $1) SERVER=$2 -add_group () { +add_group() +{ GROUP=$1 - ${NET} ads group add "${GROUP}" -k --configfile=$CONFIG_FILE -S ${SERVER} > /dev/null + ${NET} ads group add "${GROUP}" -k --configfile=$CONFIG_FILE -S ${SERVER} >/dev/null RET=$? if [ $RET -ne 0 ]; then echo "${NET} ads group add returned error: $RET" @@ -38,9 +39,10 @@ add_group () { fi } -del_group () { +del_group() +{ GROUP=$1 - ${NET} ads group delete "${GROUP}" -k --configfile=$CONFIG_FILE -S ${SERVER} > /dev/null + ${NET} ads group delete "${GROUP}" -k --configfile=$CONFIG_FILE -S ${SERVER} >/dev/null RET=$? if [ $RET -ne 0 ]; then echo "${NET} returned error: $RET" @@ -48,8 +50,9 @@ del_group () { fi } -enum_group () { - ${NET} ads group -k --configfile=$CONFIG_FILE -S $SERVER > /dev/null +enum_group() +{ + ${NET} ads group -k --configfile=$CONFIG_FILE -S $SERVER >/dev/null RET=$? if [ $RET -ne 0 ]; then echo "${NET} returned error: $RET" @@ -57,9 +60,10 @@ enum_group () { fi } -info_group () { +info_group() +{ GROUP=$1 - ${NET} ads group info "${GROUP}" -k --configfile=$CONFIG_FILE -S ${SERVER} > /dev/null + ${NET} ads group info "${GROUP}" -k --configfile=$CONFIG_FILE -S ${SERVER} >/dev/null RET=$? if [ $RET -ne 0 ]; then echo "${NET} returned error: $RET" @@ -67,14 +71,16 @@ info_group () { fi } -set_up () { +set_up() +{ set_krb_env setup_kinit call_kinit "${PRINCIPAL}" "${PASSWORD}" write_configfile "${REALM}" "${NT_DOM}" } -tear_down () { +tear_down() +{ ${KDESTROY} restore_krb_env } @@ -86,8 +92,8 @@ echo -e "\tGROUP $SERVER" START_TIME=$(start_timer) echo -en "\t" -for i in $( ${SEQ} 1 $ITERATIONS ); do - GROUP=$( echo "ad_test_$(pad_number $i 3)" ) +for i in $(${SEQ} 1 $ITERATIONS); do + GROUP=$(echo "ad_test_$(pad_number $i 3)") add_group $GROUP echo -n "." done @@ -105,8 +111,8 @@ enum_group #echo "done" echo -en "\t" -for i in $( ${SEQ} 1 $ITERATIONS ); do - GROUP=$( echo "ad_test_$(pad_number $i 3)" ) +for i in $(${SEQ} 1 $ITERATIONS); do + GROUP=$(echo "ad_test_$(pad_number $i 3)") del_group $GROUP echo -n "." done @@ -114,7 +120,7 @@ echo "done" STOP_TIME=$(stop_timer) -TOTAL_TIME=$( total_time $START_TIME $STOP_TIME ) +TOTAL_TIME=$(total_time $START_TIME $STOP_TIME) echo -e "\t\ttotal time:\t\t${TOTAL_TIME}s" diff --git a/examples/ad-bench/time_join.sh b/examples/ad-bench/time_join.sh index 5d6afef68eb..2545a9f26b9 100644 --- a/examples/ad-bench/time_join.sh +++ b/examples/ad-bench/time_join.sh @@ -20,16 +20,17 @@ ITERATIONS=100 -source `dirname $0`/utils.sh +source $(dirname $0)/utils.sh PRINCIPAL=$(get_principal $1) PASSWORD=$(get_password $1) REALM=$(get_realm $1) NT_DOM=$(get_nt_dom $1) -join_domain () { +join_domain() +{ SERVER=$1 - ${NET} ads join -k --configfile=$CONFIG_FILE -S ${SERVER} > /dev/null + ${NET} ads join -k --configfile=$CONFIG_FILE -S ${SERVER} >/dev/null RET=$? if [ $RET -ne 0 ]; then echo "${NET} returned error: $RET" @@ -37,23 +38,26 @@ join_domain () { fi } -leave_domain () { +leave_domain() +{ SERVER=$1 - ${NET} ads leave -k --configfile=$CONFIG_FILE -S ${SERVER} > /dev/null + ${NET} ads leave -k --configfile=$CONFIG_FILE -S ${SERVER} >/dev/null if [ $RET -ne 0 ]; then echo "${NET} returned error: $RET" exit 1 fi } -set_up () { +set_up() +{ set_krb_env setup_kinit call_kinit "${PRINCIPAL}" "${PASSWORD}" write_configfile "${REALM}" "${NT_DOM}" } -tear_down () { +tear_down() +{ ${KDESTROY} restore_krb_env } @@ -65,7 +69,7 @@ echo -e "\tJOIN $2" START_TIME=$(start_timer) echo -en "\t" -for i in $( ${SEQ} 1 $ITERATIONS ); do +for i in $(${SEQ} 1 $ITERATIONS); do join_domain $2 leave_domain $2 echo -n "." @@ -74,7 +78,7 @@ echo "done" STOP_TIME=$(stop_timer) -TOTAL_TIME=$( total_time $START_TIME $STOP_TIME ) +TOTAL_TIME=$(total_time $START_TIME $STOP_TIME) echo -e "\t\ttotal time:\t\t${TOTAL_TIME}s" diff --git a/examples/ad-bench/time_kinit.sh b/examples/ad-bench/time_kinit.sh index 76c4ff4acec..b2e0030616b 100644 --- a/examples/ad-bench/time_kinit.sh +++ b/examples/ad-bench/time_kinit.sh @@ -22,25 +22,27 @@ # often ITERATIONS=100 -source `dirname $0`/utils.sh +source $(dirname $0)/utils.sh -set_up () { +set_up() +{ set_krb_env setup_kinit } -tear_down () { +tear_down() +{ restore_krb_env } set_up -PRINCIPAL=$( get_principal $1) -PASSWORD=$( get_password $1) +PRINCIPAL=$(get_principal $1) +PASSWORD=$(get_password $1) echo -e "\tKINIT ${PRINCIPAL}" -START_TIME=$( start_timer ) +START_TIME=$(start_timer) echo -en "\t" for i in $(${SEQ} 1 $ITERATIONS); do @@ -50,9 +52,9 @@ for i in $(${SEQ} 1 $ITERATIONS); do done echo "done" -STOP_TIME=$( stop_timer ) +STOP_TIME=$(stop_timer) -TOTAL_TIME=$( total_time $START_TIME $STOP_TIME ) +TOTAL_TIME=$(total_time $START_TIME $STOP_TIME) echo -e "\t\ttotal time:\t\t${TOTAL_TIME}s" diff --git a/examples/ad-bench/time_ldap.sh b/examples/ad-bench/time_ldap.sh index 1f28a5d145a..4af6ef1592c 100644 --- a/examples/ad-bench/time_ldap.sh +++ b/examples/ad-bench/time_ldap.sh @@ -2,7 +2,7 @@ ITERATIONS=100 -source `dirname $0`/utils.sh +source $(dirname $0)/utils.sh PRINCIPAL=$(get_principal $1) PASSWORD=$(get_password $1) @@ -10,8 +10,9 @@ REALM=$(get_realm $1) NT_DOM=$(get_nt_dom $1) SERVER=$2 -search_users () { - ${NET} ads search '(objectCategory=user)' sAMAccountName -k --configfile=$CONFIG_FILE -S ${SERVER} > /dev/null +search_users() +{ + ${NET} ads search '(objectCategory=user)' sAMAccountName -k --configfile=$CONFIG_FILE -S ${SERVER} >/dev/null RET=$? if [ $RET -ne 0 ]; then echo "${NET} returned error: $RET" @@ -19,46 +20,52 @@ search_users () { fi } -search_groups () { - ${NET} ads search '(objectCategory=group)' sAMAccountName -k --configfile=$CONFIG_FILE -S ${SERVER} > /dev/null +search_groups() +{ + ${NET} ads search '(objectCategory=group)' sAMAccountName -k --configfile=$CONFIG_FILE -S ${SERVER} >/dev/null if [ $RET -ne 0 ]; then echo "${NET} returned error: $RET" exit 1 fi } -search_computers () { - ${NET} ads search '(objectCategory=computer)' sAMAccountName -k --configfile=$CONFIG_FILE -S ${SERVER} > /dev/null +search_computers() +{ + ${NET} ads search '(objectCategory=computer)' sAMAccountName -k --configfile=$CONFIG_FILE -S ${SERVER} >/dev/null if [ $RET -ne 0 ]; then echo "${NET} returned error: $RET" exit 1 fi } -search_wildcard () { - ${NET} ads search '(objectCategory=*)' sAMAccountName -k --configfile=$CONFIG_FILE -S ${SERVER} > /dev/null +search_wildcard() +{ + ${NET} ads search '(objectCategory=*)' sAMAccountName -k --configfile=$CONFIG_FILE -S ${SERVER} >/dev/null if [ $RET -ne 0 ]; then echo "${NET} returned error: $RET" exit 1 fi } -search_unindexed () { - ${NET} ads search '(description=Built-in account for adminstering the computer/domain)' sAMAccountName -k --configfile=$CONFIG_FILE -S ${SERVER} > /dev/null +search_unindexed() +{ + ${NET} ads search '(description=Built-in account for adminstering the computer/domain)' sAMAccountName -k --configfile=$CONFIG_FILE -S ${SERVER} >/dev/null if [ $RET -ne 0 ]; then echo "${NET} returned error: $RET" exit 1 fi } -set_up () { +set_up() +{ set_krb_env setup_kinit call_kinit "${PRINCIPAL}" "${PASSWORD}" write_configfile "${REALM}" "${NT_DOM}" } -tear_down () { +tear_down() +{ ${KDESTROY} restore_krb_env } @@ -70,7 +77,7 @@ echo -e "\tSEARCH INDEXED $2" START_TIME=$(start_timer) echo -en "\t" -for i in $( ${SEQ} 1 $ITERATIONS ); do +for i in $(${SEQ} 1 $ITERATIONS); do search_users search_groups search_computers @@ -80,7 +87,7 @@ echo "done" STOP_TIME=$(stop_timer) -TOTAL_TIME=$( total_time $START_TIME $STOP_TIME ) +TOTAL_TIME=$(total_time $START_TIME $STOP_TIME) echo -e "\t\ttotal time:\t\t${TOTAL_TIME}s" @@ -95,7 +102,7 @@ echo -e "\tSEARCH WILDCARD $2" START_TIME=$(start_timer) echo -en "\t" -for i in $( ${SEQ} 1 $ITERATIONS ); do +for i in $(${SEQ} 1 $ITERATIONS); do search_wildcard echo -n "." done @@ -103,7 +110,7 @@ echo "done" STOP_TIME=$(stop_timer) -TOTAL_TIME=$( total_time $START_TIME $STOP_TIME ) +TOTAL_TIME=$(total_time $START_TIME $STOP_TIME) echo -e "\t\ttotal time:\t\t${TOTAL_TIME}s" @@ -118,7 +125,7 @@ echo -e "\tSEARCH UNINDEXED $2" START_TIME=$(start_timer) echo -en "\t" -for i in $( ${SEQ} 1 $ITERATIONS ); do +for i in $(${SEQ} 1 $ITERATIONS); do search_unindexed echo -n "." done @@ -126,7 +133,7 @@ echo "done" STOP_TIME=$(stop_timer) -TOTAL_TIME=$( total_time $START_TIME $STOP_TIME ) +TOTAL_TIME=$(total_time $START_TIME $STOP_TIME) echo -e "\t\ttotal time:\t\t${TOTAL_TIME}s" diff --git a/examples/ad-bench/time_user.sh b/examples/ad-bench/time_user.sh index 549960b1733..5fedb7ab30e 100644 --- a/examples/ad-bench/time_user.sh +++ b/examples/ad-bench/time_user.sh @@ -20,7 +20,7 @@ ITERATIONS=100 -source `dirname $0`/utils.sh +source $(dirname $0)/utils.sh PRINCIPAL=$(get_principal $1) PASSWORD=$(get_password $1) @@ -28,9 +28,10 @@ REALM=$(get_realm $1) NT_DOM=$(get_nt_dom $1) SERVER=$2 -add_user () { +add_user() +{ USER=$1 - ${NET} ads user add "${USER}" 'Sup3rS3cr3T!' -k --configfile=$CONFIG_FILE -S ${SERVER} > /dev/null + ${NET} ads user add "${USER}" 'Sup3rS3cr3T!' -k --configfile=$CONFIG_FILE -S ${SERVER} >/dev/null RET=$? if [ $RET -ne 0 ]; then echo "${NET} ads user add returned error: $RET" @@ -38,9 +39,10 @@ add_user () { fi } -del_user () { +del_user() +{ USER=$1 - ${NET} ads user delete "${USER}" -k --configfile=$CONFIG_FILE -S ${SERVER} > /dev/null + ${NET} ads user delete "${USER}" -k --configfile=$CONFIG_FILE -S ${SERVER} >/dev/null RET=$? if [ $RET -ne 0 ]; then echo "${NET} returned error: $RET" @@ -48,8 +50,9 @@ del_user () { fi } -enum_user () { - ${NET} ads user -k --configfile=$CONFIG_FILE -S $SERVER > /dev/null +enum_user() +{ + ${NET} ads user -k --configfile=$CONFIG_FILE -S $SERVER >/dev/null RET=$? if [ $RET -ne 0 ]; then echo "${NET} returned error: $RET" @@ -57,9 +60,10 @@ enum_user () { fi } -info_user () { +info_user() +{ USER=$1 - ${NET} ads user info "${USER}" -k --configfile=$CONFIG_FILE -S ${SERVER} > /dev/null + ${NET} ads user info "${USER}" -k --configfile=$CONFIG_FILE -S ${SERVER} >/dev/null RET=$? if [ $RET -ne 0 ]; then echo "${NET} returned error: $RET" @@ -67,14 +71,16 @@ info_user () { fi } -set_up () { +set_up() +{ set_krb_env setup_kinit call_kinit "${PRINCIPAL}" "${PASSWORD}" write_configfile "${REALM}" "${NT_DOM}" } -tear_down () { +tear_down() +{ ${KDESTROY} restore_krb_env } @@ -86,8 +92,8 @@ echo -e "\tUSER $SERVER" START_TIME=$(start_timer) echo -en "\t" -for i in $( ${SEQ} 1 $ITERATIONS ); do - USER=$( echo "ad_test_$(pad_number $i 3)" ) +for i in $(${SEQ} 1 $ITERATIONS); do + USER=$(echo "ad_test_$(pad_number $i 3)") add_user $USER echo -n "." done @@ -105,8 +111,8 @@ enum_user #echo "done" echo -en "\t" -for i in $( ${SEQ} 1 $ITERATIONS ); do - USER=$( echo "ad_test_$(pad_number $i 3)" ) +for i in $(${SEQ} 1 $ITERATIONS); do + USER=$(echo "ad_test_$(pad_number $i 3)") del_user $USER echo -n "." done @@ -114,7 +120,7 @@ echo "done" STOP_TIME=$(stop_timer) -TOTAL_TIME=$( total_time $START_TIME $STOP_TIME ) +TOTAL_TIME=$(total_time $START_TIME $STOP_TIME) echo -e "\t\ttotal time:\t\t${TOTAL_TIME}s" diff --git a/examples/ad-bench/utils.sh b/examples/ad-bench/utils.sh index 89da09cb1f2..5a7c015b58f 100644 --- a/examples/ad-bench/utils.sh +++ b/examples/ad-bench/utils.sh @@ -18,68 +18,79 @@ # You should have received a copy of the GNU General Public License # along with AD-Bench. If not, see <http://www.gnu.org/licenses/>. -source `dirname $0`/settings.sh +source $(dirname $0)/settings.sh -start_timer () { - START_TIME=$( ${DATE} ${DATE_FORMATSTR} ) +start_timer() +{ + START_TIME=$(${DATE} ${DATE_FORMATSTR}) echo "$START_TIME" } -stop_timer () { - STOP_TIME=$( ${DATE} ${DATE_FORMATSTR} ) +stop_timer() +{ + STOP_TIME=$(${DATE} ${DATE_FORMATSTR}) echo "$STOP_TIME" } -total_time () { +total_time() +{ START_TIME=$1 END_TIME=$2 - TOTAL_TIME=$( echo "scale=9;$STOP_TIME - $START_TIME" | ${BC} ) + TOTAL_TIME=$(echo "scale=9;$STOP_TIME - $START_TIME" | ${BC}) echo "$TOTAL_TIME" } -iterations_per_minute () { +iterations_per_minute() +{ START_TIME=$1 STOP_TIME=$2 TOTAL_RUNS=$3 - TOTAL_TIME=$( total_time $START_TIME $STOP_TIME ) + TOTAL_TIME=$(total_time $START_TIME $STOP_TIME) - ITER_PER_MIN=$( echo "scale=2; 60 * $TOTAL_RUNS / $TOTAL_TIME" | ${BC} ) + ITER_PER_MIN=$(echo "scale=2; 60 * $TOTAL_RUNS / $TOTAL_TIME" | ${BC}) echo "$ITER_PER_MIN" } -get_principal () { - PRINCIPAL=$( echo $1 | ${SED} -e "s/\(.*\)%.*/\1/" ) +get_principal() +{ + PRINCIPAL=$(echo $1 | ${SED} -e "s/\(.*\)%.*/\1/") echo "$PRINCIPAL" } -get_password () { - PASSWORD=$( echo $1 | ${SED} -e "s/.*%\(.*\)/\1/" ) +get_password() +{ + PASSWORD=$(echo $1 | ${SED} -e "s/.*%\(.*\)/\1/") echo "$PASSWORD" } -get_realm () { - REALM=$( echo $1 | ${SED} -e "s/.*@\(.*\)%.*/\1/" ) +get_realm() +{ + REALM=$(echo $1 | ${SED} -e "s/.*@\(.*\)%.*/\1/") echo "$REALM" } -get_nt_dom () { - NT_DOM=$( echo $1 | ${SED} -e "s/.*@\([A-Z1-9-]*\)\..*/\1/" ) +get_nt_dom() +{ + NT_DOM=$(echo $1 | ${SED} -e "s/.*@\([A-Z1-9-]*\)\..*/\1/") echo "$NT_DOM" } -set_krb_env () { +set_krb_env() +{ OLD_KRB5CCNAME="${KRB5CCNAME}" KRB5CCNAME="${NEW_KRB5CCNAME}" export KRB5CCNAME } -restore_krb_env () { +restore_krb_env() +{ KRB5CCNAME="${OLD_KRB5CCNAME}" export KRB5CCNAME } -setup_kinit () { +setup_kinit() +{ ${KINIT} --invalid 2>&1 | grep -q "password-file" if [ $? -eq 0 ]; then KINIT="${KINIT} ${KINIT_PARAM_OLD}" @@ -88,19 +99,21 @@ setup_kinit () { fi } -write_configfile () { +write_configfile() +{ REALM=$1 NT_DOM=$2 - echo -e "[global]" > $CONFIG_FILE - echo -e "\trealm = $REALM" >> $CONFIG_FILE - echo -e "\tworkgroup = $NT_DOM" >> $CONFIG_FILE - echo -e "\tsecurity = ADS" >> $CONFIG_FILE + echo -e "[global]" >$CONFIG_FILE + echo -e "\trealm = $REALM" >>$CONFIG_FILE + echo -e "\tworkgroup = $NT_DOM" >>$CONFIG_FILE + echo -e "\tsecurity = ADS" >>$CONFIG_FILE } -call_kinit () { +call_kinit() +{ PRINCIPAL=$1 PASSWORD=$2 - echo "${PASSWORD}" | ${KINIT} ${PRINCIPAL} > /dev/null + echo "${PASSWORD}" | ${KINIT} ${PRINCIPAL} >/dev/null RET=$? if [ $RET -ne 0 ]; then echo "kinit returned an error: $RET" @@ -108,7 +121,8 @@ call_kinit () { fi } -pad_number () { +pad_number() +{ NUMBER=$1 DIGITS=$2 PADDED_NO=$(printf "%0${DIGITS}d" $NUMBER) diff --git a/examples/scripts/debugging/linux/backtrace b/examples/scripts/debugging/linux/backtrace index 2ea6a4d00a1..7d14ff8704e 100644 --- a/examples/scripts/debugging/linux/backtrace +++ b/examples/scripts/debugging/linux/backtrace @@ -5,9 +5,9 @@ # we want everything on stderr, so the program is not disturbed exec 1>&2 -BASENAME=$( basename $0) +BASENAME=$(basename $0) -test -z ${GDB_BIN} && GDB_BIN=$( type -p gdb) +test -z ${GDB_BIN} && GDB_BIN=$(type -p gdb) if [ -z ${GDB_BIN} ]; then echo "ERROR: ${BASENAME} needs an installed gdb. " exit 1 @@ -20,16 +20,16 @@ fi PID=$1 # use /dev/shm as default temp directory -test -d /dev/shm && \ - TMP_BASE_DIR=/dev/shm || \ +test -d /dev/shm && + TMP_BASE_DIR=/dev/shm || TMP_BASE_DIR=/var/tmp -TMPFILE=$( mktemp -p ${TMP_BASE_DIR} backtrace.XXXXXX) +TMPFILE=$(mktemp -p ${TMP_BASE_DIR} backtrace.XXXXXX) if [ $? -ne 0 ]; then echo "ERROR: ${basename} can't create temp file in ${TMP_BASE_DIR}. " exit 1 fi -cat << EOF > "${TMPFILE}" +cat <<EOF >"${TMPFILE}" set height 0 up 8 bt full diff --git a/examples/scripts/debugging/solaris/solaris-oops.sh b/examples/scripts/debugging/solaris/solaris-oops.sh index 82c49efdf62..2d8587d1d5b 100644 --- a/examples/scripts/debugging/solaris/solaris-oops.sh +++ b/examples/scripts/debugging/solaris/solaris-oops.sh @@ -2,10 +2,11 @@ # # solaris_panic_action -- capture supporting information after a failure # -ProgName=`basename $0` +ProgName=$(basename $0) LOGDIR=/usr/local/samba/var -main() { +main() +{ pid=$1 if [ $# -lt 1 ]; then @@ -15,40 +16,41 @@ main() { fi cat >>$LOGDIR/log.solaris_panic_action <<! -`date` +$(date) State information and vountary core dump for process $pid Related processes were: -`/usr/bin/ptree $pid` +$(/usr/bin/ptree $pid) Stack(s) were: -`/usr/bin/pstack $pid` +$(/usr/bin/pstack $pid) Flags were: -`/usr/bin/pflags $pid` +$(/usr/bin/pflags $pid) Credentials were: -`/usr/bin/pcred $pid` +$(/usr/bin/pcred $pid) Libraries used were: -`/usr/bin/pldd $pid` +$(/usr/bin/pldd $pid) Signal-handler settings were: -`/usr/bin/psig $pid` +$(/usr/bin/psig $pid) Files and devices in use were: -`/usr/bin/pfiles $pid` +$(/usr/bin/pfiles $pid) Directory in use was: -`/usr/bin/pwdx $pid` +$(/usr/bin/pwdx $pid) A voluntary core dump was placed in /var/tmp/samba_solaris_panic_action_gcore.$pid -`gcore -o /var/tmp/samba_solaris_panic_action_gcore $pid` +$(gcore -o /var/tmp/samba_solaris_panic_action_gcore $pid) ! } -say() { +say() +{ echo "$@" 1>&2 } diff --git a/examples/scripts/idmap/idmap_nis.sh b/examples/scripts/idmap/idmap_nis.sh index 28d9952eab5..a5ea79de9cc 100755 --- a/examples/scripts/idmap/idmap_nis.sh +++ b/examples/scripts/idmap/idmap_nis.sh @@ -5,9 +5,9 @@ DOMAIN=$(ypdomainname) ( - date - echo $* -) >> /var/log/samba/idmap.log + date + echo $* +) >>/var/log/samba/idmap.log cmd=$1 shift @@ -15,104 +15,105 @@ shift PATH=/usr/bin:bin:$PATH shopt -s nocasematch || { - echo "shell option nocasematch not supported" - exit 1 + echo "shell option nocasematch not supported" + exit 1 } # map from a domain and name to a uid/gid -map_name() { - domain="$1" - name="$2" - ntype="$3" - case $ntype in +map_name() +{ + domain="$1" + name="$2" + ntype="$3" + case $ntype in 1) - rtype="UID" - map="passwd" - ;; + rtype="UID" + map="passwd" + ;; 2) - rtype="GID" - map="group" - ;; + rtype="GID" + map="group" + ;; *) - echo "ERR: bad name type $ntype" - exit 1 - ;; - esac - id=$(ypmatch "$name" "$map".byname 2>/dev/null | cut -d: -f3) - [ -z "$id" ] && { - echo "ERR: bad match for $name in map $map" - exit 1 - } - echo "$rtype":"$id" + echo "ERR: bad name type $ntype" + exit 1 + ;; + esac + id=$(ypmatch "$name" "$map".byname 2>/dev/null | cut -d: -f3) + [ -z "$id" ] && { + echo "ERR: bad match for $name in map $map" + exit 1 + } + echo "$rtype":"$id" } # map from a unix id to a name -map_id() { - ntype="$1" - id="$2" - case $ntype in +map_id() +{ + ntype="$1" + id="$2" + case $ntype in UID) - map="passwd.byuid" - ;; + map="passwd.byuid" + ;; GID) - map="group.bygid" - ;; + map="group.bygid" + ;; *) - echo "ERR: bad name type $ntype" - exit 1 - ;; - esac - name="$(ypmatch "$id" "$map" 2>/dev/null | cut -d: -f1)" - [ -z "$name" ] && { - echo "ERR: bad match for $name in map $map" - exit 1 - } - echo "$name" + echo "ERR: bad name type $ntype" + exit 1 + ;; + esac + name="$(ypmatch "$id" "$map" 2>/dev/null | cut -d: -f1)" + [ -z "$name" ] && { + echo "ERR: bad match for $name in map $map" + exit 1 + } + echo "$name" } - case $cmd in - SIDTOID) +SIDTOID) sid=$1 - rid=`echo $sid | cut -d- -f8` + rid=$(echo $sid | cut -d- -f8) [ -z "$rid" ] && { - echo "ERR: bad rid in SID $sid" - exit 1 + echo "ERR: bad rid in SID $sid" + exit 1 } - + unset _NO_WINBINDD # oh, this is ugly. Shell is just not meant for parsing text - fullname=`wbinfo -s $sid 2> /dev/null` - domain=`echo $fullname | cut -d'\' -f1` + fullname=$(wbinfo -s $sid 2>/dev/null) + domain=$(echo $fullname | cut -d'\' -f1) [[ "$domain" = $DOMAIN ]] || { - echo "ERR: bad domain $domain" - exit 1 + echo "ERR: bad domain $domain" + exit 1 } - name=`echo $fullname | cut -d'\' -f2` - nwords=`echo $name | wc -w` - ntype=`echo $name | cut -d' ' -f$nwords` - nminusone=`expr $nwords - 1` - name=`echo $name | cut -d' ' -f-$nminusone` + name=$(echo $fullname | cut -d'\' -f2) + nwords=$(echo $name | wc -w) + ntype=$(echo $name | cut -d' ' -f$nwords) + nminusone=$(expr $nwords - 1) + name=$(echo $name | cut -d' ' -f-$nminusone) [ -z "$name" ] && { - echo "ERR: bad name $fullname for SID $sid" - exit 1 + echo "ERR: bad name $fullname for SID $sid" + exit 1 } map_name "$domain" "$name" "$ntype" ;; - IDTOSID) +IDTOSID) ntype=$1 id=$2 name="$(map_id "$ntype" "$id")" sid="$(wbinfo -n "$name" 2>/dev/null | cut -d' ' -f1)" [ -z "$sid" ] && { - echo "ERR: name $name not found in ADS" - exit 1 + echo "ERR: name $name not found in ADS" + exit 1 } echo "SID:$sid" ;; - *) +*) echo "ERR: Unknown command $cmd" - exit 1; + exit 1 ;; esac diff --git a/examples/scripts/wins_hook/dns_update b/examples/scripts/wins_hook/dns_update index a4c1a79ab9c..2e8b717e657 100644 --- a/examples/scripts/wins_hook/dns_update +++ b/examples/scripts/wins_hook/dns_update @@ -48,7 +48,7 @@ if [ $# -lt 4 ]; then exit 1 fi -NSUPDATE=`which nsupdate` +NSUPDATE=$(which nsupdate) [ -x "$NSUPDATE" ] || NSUPDATE=/usr/bin/nsupdate [ -x "$NSUPDATE" ] || NSUPDATE=/sbin/nsupdate [ -x "$NSUPDATE" ] || NSUPDATE=/usr/sbin/nsupdate @@ -65,8 +65,7 @@ shift 4 IP_ADDRS="$@" do_update=0 -for i in $USEFUL_TYPES -do +for i in $USEFUL_TYPES; do [ "$TYPE" = "$i" ] && do_update=1 done [ $do_update = 1 ] || exit 0 @@ -84,8 +83,7 @@ fi { echo update delete $NAME.$DOMAIN - for i in $IP_ADDRS - do + for i in $IP_ADDRS; do echo update add $NAME.$DOMAIN $TTL A $i done echo diff --git a/examples/systemtap/generate-winbindd.stp.sh b/examples/systemtap/generate-winbindd.stp.sh index 002fb5bf7dc..d38bf2cab00 100755 --- a/examples/systemtap/generate-winbindd.stp.sh +++ b/examples/systemtap/generate-winbindd.stp.sh @@ -288,20 +288,20 @@ probe end { } }' -cat <<EOF > $outfile +cat <<EOF >$outfile $header EOF -printf "$child_funcs\n" | while read func ; do - printf "$domchild_req_template\n" | sed -e s/XXX/$func/g >> $outfile +printf "$child_funcs\n" | while read func; do + printf "$domchild_req_template\n" | sed -e s/XXX/$func/g >>$outfile done -printf "$backend_funcs\n" | while read func ; do - printf "$backend_req_template\n" | sed -e "s|XXX|$func|g" >> $outfile +printf "$backend_funcs\n" | while read func; do + printf "$backend_req_template\n" | sed -e "s|XXX|$func|g" >>$outfile done -printf "$async_funcs\n" | while read func ; do - printf "$async_req_template\n" | sed -e s/XXX/$func/g >> $outfile +printf "$async_funcs\n" | while read func; do + printf "$async_req_template\n" | sed -e s/XXX/$func/g >>$outfile done cat <<EOF >>$outfile |