I am not looking for -x option. My question was how to do
ldapsearch for digest-md5 without using -U option.
Problem is when I do ldapsearch with only DN (-D option in the
ldapsearch), ldapsearch fails.
What are you trying to do, in a larger sense? The directory server
is quite correctly telling you this is an error.
If you want to use SASL binds and DIGEST-MD5, then what is wrong with
-U? Why do you want to use -D? Do you have some external
application expecting to use the commandline tools with -D? If so,
this isn't an OpenLDAP problem at all and you should make a wrapper
script or fix your broken app.