#388 Improve replication agreement status messages
Closed: Fixed None Opened 7 years ago by nkinder.

When setting the value for the replication status attributes in replication agreements, we only call ldap_err2string() if the return code is greater than 0. If the return code is negative, we hard code the error description as "System error".

When using OpenLDAP client libraries, you can get a textual error string for negative LDAP return codes, as demonstrated by this test program output:

[nkinder@localhost test]$ ./ldaperr
rc: -1, "Can't contact LDAP server"
rc: -2, "Local error"
rc: -3, "Encoding error"
rc: -4, "Decoding error"
rc: -5, "Timed out"
rc: -6, "Unknown authentication method"
rc: -7, "Bad search filter"
rc: -8, "User cancelled operation"
rc: -9, "Bad parameter to an ldap routine"
rc: -10, "Out of memory"
rc: -11, "Connect error"
rc: -12, "Not Supported"
rc: -13, "Control not found"
rc: -14, "No results returned"
rc: -15, "More results to return"
rc: -16, "Client Loop"
rc: -17, "Referral Limit Exceeded"

I believe we avoid calling ldap_err2string() for negative return codes due to a limitation in MozLDAP. We should get the more informative error strings for negative return codes when using OpenLDAP.

About slapi_err2string(int result) - if we are using mozldap instead of openldap, when will result be negative? Does mozldap return negative error codes?

In replication, the error code can come from:

callback_data (repl5_tot_protocol.c)

I don't think mozldap is returning negative result codes, but some replication functions are returning negative result codes. If we are using mozldap, then ldap_err2string will not work for negative results codes, and we have to give a generic/useless error string.

This fix is just a guarantee, that any result code(positive or negative), will return a useful error string regardless of the ldap library.

[mareynol@localhost servers]$ git merge ticket388
Updating 4d564ef..8f21ac8
ldap/servers/plugins/replication/repl5_agmt.c | 34 +++-----------
ldap/servers/slapd/libglobs.c | 58 +++++++++++++++++++++++++
ldap/servers/slapd/slapi-plugin.h | 9 ++++
3 files changed, 75 insertions(+), 26 deletions(-)

[mareynol@localhost servers]$ git push origin master
Counting objects: 19, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 1.84 KiB, done.
Total 10 (delta 8), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
4d564ef..8f21ac8 master -> master

Added initial screened field value.

Metadata Update from @rmeggins:
- Issue assigned to mreynolds
- Issue set to the milestone:

3 years ago

Login to comment on this ticket.