I am using a backup script that queries the ldap server for email and server of each user.
This is what I run
Code:
ldapsearch -x -H ldap://mail.example.com:389 -D uid=zimbra,cn=admins,cn=zimbra -w password -LLL "(objectclass=zimbraAccount)" zimbraMailDeliveryAddress zimbraMailHost | grep -A1 -B1 -e user1 -e user2 -e user3
I assumed the output would be sorted following the query order: first the key '
zimbraMailDeliveryAddress', then '
zimbraMailHost'.
Out of around 700 users, I get 690 answers following that rule, but I get 10 or so that are inverted, like this
Code:
dn: uid=user1,ou=people,dc=example,dc=com
zimbraMailDeliveryAddress: user1@example.com
zimbraMailHost: mail.example.com
--
dn: uid=user2,ou=people,dc=example,dc=com
zimbraMailHost: mail.example.com <------
zimbraMailDeliveryAddress: user2@example.com <------
--
dn: uid=user3,ou=people,dc=example,dc=com
zimbraMailDeliveryAddress: user3@example.com
zimbraMailHost: mail.example.com
Is this a expected behaviour? The -S flag to sort output doesn't work on the key-value pair order...