From 884224058c7afe260e047b9239fd75936f1a28f2 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 13 Mar 2018 16:04:18 +0100 Subject: [PATCH] - if we have no RID but a SID, calculate the RID - if both numeric ids are identical, dont try to change them --- doc/ad-migration.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/ad-migration.sh b/doc/ad-migration.sh index b89d3088e0..b9d02140bf 100755 --- a/doc/ad-migration.sh +++ b/doc/ad-migration.sh @@ -21,6 +21,9 @@ PASSWD=PW CHANGE= while IFS=, read account_lid account_id ad_user SID RID rest do + # if we have no RID but a SID, calculate the RID + [ -z "$RID" -a -n "$SID" ] && RID=${SID##*-} + if [ -n "$account_id" -a -n "$RID" ] then [ -z "$account_lid" -o -z "$ad_user" -o "$account_lid" = "$ad_user" ] && { @@ -33,8 +36,13 @@ do echo "admin/admin-cli.php --edit-group '$ADMIN,$PASSWD,$account_lid=$ad_user'" RID=-$RID fi - [ -n "$CHANGE" ] && CHANGE=$CHANGE, - CHANGE=$CHANGE$account_id,$RID + + # if no change necessary, dont + if [ $account_id != $RID ] + then + [ -n "$CHANGE" ] && CHANGE=$CHANGE, + CHANGE=$CHANGE$account_id,$RID + fi fi done