@@ -539,12 +539,20 @@ nsdb_new_get_ncedn_s(nsdb_t host, const char *naming_context, char **dn)
}
entries = ldap_count_messages(ld, response);
- if (entries == -1) {
- xlog(D_GENERAL, "%s: Empty LDAP response\n", __func__);
+ switch (entries) {
+ case -1:
+ xlog(D_GENERAL, "%s: Empty LDAP response", __func__);
retval = FEDFS_ERR_NSDB_FAULT;
goto out;
+ case 1:
+ xlog(D_GENERAL, "%s: %s does not contain a new-style NCE",
+ __func__, naming_context);
+ retval = FEDFS_ERR_NSDB_NONCE;
+ goto out;
+ default:
+ xlog(D_CALL, "%s: received %d messages", __func__, entries);
+ break;
}
- xlog(D_CALL, "%s: received %d messages", __func__, entries);
retval = FEDFS_OK;
for (message = ldap_first_message(ld, response), count = 0;
Rob Thurlow reports: nsdbparams: nsdb_new_get_ncedn_s: ldapsearch -H ldap://nfsmpit2-02:389 -b "dc=cthon,dc=org" -s sub '(objectClass=fedfsNsdbContainerEntry)' * nsdbparams: nsdb_new_get_ncedn_s: received 1 messages nsdbparams: nsdb_parse_result: Search completed successfully Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7ba5cbf in ldap_unbind_ext () from /lib64/libldap-2.4.so.2 Missing separate debuginfos, use: debuginfo-install fedfs-utils-nsdbparams-0.10.0-2.fc20.x86_64 (gdb) backtrace #0 0x00007ffff7ba5cbf in ldap_unbind_ext () from /lib64/libldap-2.4.so.2 #1 0x000055555555fba1 in nsdb_close_nsdb (host=0x55555578ace0) at nsdb.c:1562 #2 0x000055555555d0d8 in nsdb_ping_s ( hostname=hostname@entry=0x7fffffffe876 "nfsmpit2-02", port=port@entry=389, ldap_err=ldap_err@entry=0x7fffffffe464) at fileserver.c:1954 #3 0x00005555555593be in nsdbparams_test_nsdb (nsdbport=389, nsdbname=0x7fffffffe876 "nfsmpit2-02") at update.c:111 #4 nsdbparams_update (progname=0x7fffffffe830 "nsdbparams", argc=<optimized out>, argv=0x7fffffffe5d0) at update.c:406 #5 0x00005555555578df in main (argc=8, argv=0x7fffffffe5c8) at main.c:212 His old-style NSDB returned just one LDAP message in reply to the query to see if the NSDB had a new-style NCE. Fixes: ea9cadee (libnsdb: simplify NCE discovery) Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- src/libnsdb/fileserver.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)