Thanks to Ludwig for his suggestions. I followed his advice and revised
Description: slapi_entry_add_value is used to add values for sorting,
which did not pass the attribute syntax info and the fallback compare
algorithm was used. It sometimes different from the attribute syntax
based sorting and failed to find out an attribute. This patch passes
an attribute syntax info for sorting.
Plus, featuring slapi_berval_cmp for the fallback compare algorithm.
It is closer to the syntax based sorting.