#!/bin/bash

attributeSyntax=()
results=''

for a in 'objectGUID' 'ipsecData' 'repsFrom' 'replUpToDateVector' 'userCertificate' 'dNSProperty' 'dnsRecord' 'securityIdentifier' 'mS-DS-CreatorSID' 'logonHours' 'mSMQSites' 'mSMQSignKey' 'currentLocation' 'dSASignature' 'linkTrackSecret' 'mSMQDigests' 'mSMQEncryptKey' 'mSMQSignCertificates' 'may' 'sIDHistory' 'msExchMailboxSecurityDescriptor' 'msExchMailboxGuid' 'msExchMasterAccountSid' 'replicationSignature' 'repsTo' 'msRTCSIP- UserRoutingGroupId' 'msPKIRoamingTimeStamp' 'msDFS-GenerationGUIDv2' 'msDFS-LinkSecurityDescriptorv2' 'msDFS-LinkIdentityGUIDv2' 'msDFS-NamespaceIdentityGUIDv2' 'msDFS-TargetListv2' 'msPKIAccountCredentials' 'msPKIDPAPIMasterKeys' 'pKTGuid' 'msExchBlockedSendersHash' 'msExchSafeSendersHash' 'msExchSafeRecipientsHash' 'msExchDisabledArchiveGUID'
do
	ldif=$(univention-s4search --cross-ncs "lDAPDisplayName=$a" attributeSyntax)
	val=$(sed -n 's/^attributeSyntax: //p' <<<"$ldif")
	if [[ -n "$val" ]]; then
		results+="$val\n"
	fi
done
attributeSyntax=($(echo -e "$results" | sort -u))

for val in "${attributeSyntax[@]}"; do
	echo "Attributes with attributeSyntax=$val:"
	ldif=$(univention-s4search --cross-ncs "attributeSyntax=$val" lDAPDisplayName)
	val=$(sed -n 's/^lDAPDisplayName: //p' <<<"$ldif")
	if [[ -n "$val" ]]; then
		echo "$val"
	fi
	echo
done

