+/* Two empty callback functions to avoid sending results */
+void slap_cb_null_response( Connection *conn, Operation *o, ber_tag_t tag,
+ ber_int_t msgid, ber_int_t err, const char *matched,
+ const char *text, BerVarray ref, const char *resoid,
+ struct berval *resdata, struct berval *sasldata, LDAPControl **c)
+{
+}
+
+void slap_cb_null_sresult( Connection *conn, Operation *o, ber_int_t err,
+ const char *matched, const char *text, BerVarray refs, LDAPControl **c,
+ int nentries)
+{
+}
+
+/* This callback actually does some work...*/
+static int sasl_sc_sasl2dn( BackendDB *be, Connection *conn, Operation *o,
+ Entry *e, AttributeName *an, int ao, LDAPControl **c)
+{
+ struct berval *ndn = o->o_callback->sc_private;
+
+ /* We only want to be called once */
+ if( ndn->bv_val ) {
+ free(ndn->bv_val);
+ ndn->bv_val = NULL;
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( TRANSPORT, DETAIL1,
+ "slap_sasl2dn: search DN returned more than 1 entry\n", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE,
+ "slap_sasl2dn: search DN returned more than 1 entry\n", 0,0,0 );
+#endif
+ return -1;
+ }
+
+ ber_dupbv(ndn, &e->e_nname);
+ return 0;
+}