1 /* bind.c - decode an ldap bind operation and pass it to a backend db */
4 * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
9 * Copyright (c) 1995 Regents of the University of Michigan.
10 * All rights reserved.
12 * Redistribution and use in source and binary forms are permitted
13 * provided that this notice is preserved and that due credit is given
14 * to the University of Michigan at Ann Arbor. The name of the University
15 * may not be used to endorse or promote products derived from this
16 * software without specific prior written permission. This software
17 * is provided ``as is'' without express or implied warranty.
24 #include <ac/string.h>
25 #include <ac/socket.h>
40 BerElement *ber = op->o_ber;
43 struct berval mech = { 0, NULL };
44 struct berval dn = { 0, NULL };
49 Slapi_PBlock *pb = op->o_pb;
53 LDAP_LOG( OPERATION, ENTRY, "do_bind: conn %d\n", op->o_connid, 0, 0 );
55 Debug( LDAP_DEBUG_TRACE, "do_bind\n", 0, 0, 0 );
59 * Force to connection to "anonymous" until bind succeeds.
61 ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
62 if ( op->o_conn->c_sasl_bind_in_progress ) be = op->o_conn->c_authz_backend;
64 /* log authorization identity demotion */
65 if ( op->o_conn->c_dn.bv_len ) {
66 Statslog( LDAP_DEBUG_STATS,
67 "conn=%lu op=%lu BIND anonymous mech=implicit ssf=0\n",
68 op->o_connid, op->o_opid, 0, 0, 0 );
71 connection2anonymous( op->o_conn );
72 if ( op->o_conn->c_sasl_bind_in_progress ) op->o_conn->c_authz_backend = be;
73 ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
75 if ( op->o_dn.bv_val != NULL ) {
76 free( op->o_dn.bv_val );
77 op->o_dn.bv_val = ch_strdup( "" );
81 if ( op->o_ndn.bv_val != NULL ) {
82 free( op->o_ndn.bv_val );
83 op->o_ndn.bv_val = ch_strdup( "" );
88 * Parse the bind request. It looks like this:
90 * BindRequest ::= SEQUENCE {
91 * version INTEGER, -- version
92 * name DistinguishedName, -- dn
93 * authentication CHOICE {
94 * simple [0] OCTET STRING -- passwd
95 * krbv42ldap [1] OCTET STRING
96 * krbv42dsa [2] OCTET STRING
97 * SASL [3] SaslCredentials
101 * SaslCredentials ::= SEQUENCE {
102 * mechanism LDAPString,
103 * credentials OCTET STRING OPTIONAL
107 tag = ber_scanf( ber, "{imt" /*}*/, &version, &dn, &method );
109 if ( tag == LBER_ERROR ) {
111 LDAP_LOG( OPERATION, ERR,
112 "do_bind: conn %d ber_scanf failed\n", op->o_connid, 0, 0 );
114 Debug( LDAP_DEBUG_ANY, "bind: ber_scanf failed\n", 0, 0, 0 );
116 send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
121 op->o_protocol = version;
123 if( method != LDAP_AUTH_SASL ) {
124 tag = ber_scanf( ber, /*{*/ "m}", &op->orb_cred );
127 tag = ber_scanf( ber, "{m" /*}*/, &mech );
129 if ( tag != LBER_ERROR ) {
131 tag = ber_peek_tag( ber, &len );
133 if ( tag == LDAP_TAG_LDAPCRED ) {
134 tag = ber_scanf( ber, "m", &op->orb_cred );
136 tag = LDAP_TAG_LDAPCRED;
137 op->orb_cred.bv_val = NULL;
138 op->orb_cred.bv_len = 0;
141 if ( tag != LBER_ERROR ) {
142 tag = ber_scanf( ber, /*{{*/ "}}" );
147 if ( tag == LBER_ERROR ) {
148 send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR,
150 rs->sr_err = SLAPD_DISCONNECT;
154 if( get_ctrls( op, rs, 1 ) != LDAP_SUCCESS ) {
156 LDAP_LOG( OPERATION, INFO,
157 "do_bind: conn %d get_ctrls failed\n", op->o_connid, 0, 0 );
159 Debug( LDAP_DEBUG_ANY, "do_bind: get_ctrls failed\n", 0, 0, 0 );
164 /* We use the tmpmemctx here because it speeds up normalization.
165 * However, we must dup with regular malloc when storing any
166 * resulting DNs in the op or conn structures.
168 rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx );
169 if ( rs->sr_err != LDAP_SUCCESS ) {
171 LDAP_LOG( OPERATION, INFO,
172 "do_bind: conn %d invalid dn (%s)\n",
173 op->o_connid, dn.bv_val, 0 );
175 Debug( LDAP_DEBUG_ANY, "bind: invalid dn (%s)\n",
178 send_ldap_error( op, rs, LDAP_INVALID_DN_SYNTAX, "invalid DN" );
182 if( method == LDAP_AUTH_SASL ) {
184 LDAP_LOG( OPERATION, DETAIL1,
185 "do_sasl_bind: conn %d dn (%s) mech %s\n",
186 op->o_connid, op->o_req_dn.bv_val, mech.bv_val );
188 Debug( LDAP_DEBUG_TRACE, "do_sasl_bind: dn (%s) mech %s\n",
189 op->o_req_dn.bv_val, mech.bv_val, NULL );
194 LDAP_LOG( OPERATION, DETAIL1,
195 "do_bind: version=%ld dn=\"%s\" method=%ld\n",
196 (unsigned long) version, op->o_req_dn.bv_val, (unsigned long)method );
198 Debug( LDAP_DEBUG_TRACE,
199 "do_bind: version=%ld dn=\"%s\" method=%ld\n",
200 (unsigned long) version,
201 op->o_req_dn.bv_val, (unsigned long) method );
205 Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu BIND dn=\"%s\" method=%ld\n",
206 op->o_connid, op->o_opid, op->o_req_dn.bv_val, (unsigned long) method, 0 );
208 if ( version < LDAP_VERSION_MIN || version > LDAP_VERSION_MAX ) {
210 LDAP_LOG( OPERATION, INFO,
211 "do_bind: conn %d unknown version = %ld\n",
212 op->o_connid, (unsigned long)version, 0 );
214 Debug( LDAP_DEBUG_ANY, "do_bind: unknown version=%ld\n",
215 (unsigned long) version, 0, 0 );
217 send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR,
218 "requested protocol version not supported" );
221 } else if (!( global_allows & SLAP_ALLOW_BIND_V2 ) &&
222 version < LDAP_VERSION3 )
224 send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR,
225 "historical protocol version requested, use LDAPv3 instead" );
229 /* we set connection version regardless of whether bind succeeds
232 ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
233 op->o_conn->c_protocol = version;
234 ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
236 /* check for inappropriate controls */
237 if( get_manageDSAit( op ) == SLAP_CRITICAL_CONTROL ) {
238 send_ldap_error( op, rs,
239 LDAP_UNAVAILABLE_CRITICAL_EXTENSION,
240 "manageDSAit control inappropriate" );
244 /* Set the bindop for the benefit of in-directory SASL lookups */
245 op->o_conn->c_sasl_bindop = op;
247 if ( method == LDAP_AUTH_SASL ) {
248 if ( version < LDAP_VERSION3 ) {
250 LDAP_LOG( OPERATION, INFO,
251 "do_bind: conn %d sasl with LDAPv%ld\n",
252 op->o_connid, (unsigned long)version , 0 );
254 Debug( LDAP_DEBUG_ANY, "do_bind: sasl with LDAPv%ld\n",
255 (unsigned long) version, 0, 0 );
257 send_ldap_discon( op, rs,
258 LDAP_PROTOCOL_ERROR, "SASL bind requires LDAPv3" );
259 rs->sr_err = SLAPD_DISCONNECT;
263 if( mech.bv_len == 0 ) {
265 LDAP_LOG( OPERATION, INFO,
266 "do_bind: conn %d no SASL mechanism provided\n",
267 op->o_connid, 0, 0 );
269 Debug( LDAP_DEBUG_ANY,
270 "do_bind: no sasl mechanism provided\n",
273 send_ldap_error( op, rs, LDAP_AUTH_METHOD_NOT_SUPPORTED,
274 "no SASL mechanism provided" );
278 /* check restrictions */
279 if( backend_check_restrictions( op, rs, &mech ) != LDAP_SUCCESS ) {
280 send_ldap_result( op, rs );
284 ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
285 if ( op->o_conn->c_sasl_bind_in_progress ) {
286 if( !bvmatch( &op->o_conn->c_sasl_bind_mech, &mech ) ) {
287 /* mechanism changed between bind steps */
288 slap_sasl_reset(op->o_conn);
291 ber_dupbv(&op->o_conn->c_sasl_bind_mech, &mech);
293 ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
295 rs->sr_err = slap_sasl_bind( op, rs );
299 * Normally post-operation plugins are called only after the
300 * backend operation. Because the front-end performs SASL
301 * binds on behalf of the backend, we'll make a special
302 * exception to call the post-operation plugins after a
305 slapi_x_pblock_set_operation( pb, op );
306 slapi_pblock_set( pb, SLAPI_BIND_TARGET, (void *)dn.bv_val );
307 slapi_pblock_set( pb, SLAPI_BIND_METHOD, (void *)method );
308 slapi_pblock_set( pb, SLAPI_BIND_CREDENTIALS, (void *)&op->orb_cred );
309 slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(0) );
310 (void) doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_BIND_FN, pb );
311 #endif /* LDAP_SLAPI */
313 ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
314 if( rs->sr_err == LDAP_SUCCESS ) {
315 ber_dupbv(&op->o_conn->c_dn, &op->orb_edn);
316 if( op->orb_edn.bv_len != 0 ) {
317 /* edn is always normalized already */
318 ber_dupbv( &op->o_conn->c_ndn, &op->o_conn->c_dn );
320 op->o_tmpfree( op->orb_edn.bv_val, op->o_tmpmemctx );
321 op->orb_edn.bv_val = NULL;
322 op->orb_edn.bv_len = 0;
323 op->o_conn->c_authmech = op->o_conn->c_sasl_bind_mech;
324 op->o_conn->c_sasl_bind_mech.bv_val = NULL;
325 op->o_conn->c_sasl_bind_mech.bv_len = 0;
326 op->o_conn->c_sasl_bind_in_progress = 0;
328 op->o_conn->c_sasl_ssf = op->orb_ssf;
329 if( op->orb_ssf > op->o_conn->c_ssf ) {
330 op->o_conn->c_ssf = op->orb_ssf;
333 if( op->o_conn->c_dn.bv_len != 0 ) {
334 ber_len_t max = sockbuf_max_incoming_auth;
335 ber_sockbuf_ctrl( op->o_conn->c_sb,
336 LBER_SB_OPT_SET_MAX_INCOMING, &max );
339 /* log authorization identity */
340 Statslog( LDAP_DEBUG_STATS,
341 "conn=%lu op=%lu BIND dn=\"%s\" mech=%s ssf=%d\n",
342 op->o_connid, op->o_opid,
343 op->o_conn->c_dn.bv_val ? op->o_conn->c_dn.bv_val : "<empty>",
344 op->o_conn->c_authmech.bv_val, op->orb_ssf );
347 LDAP_LOG( OPERATION, DETAIL1,
348 "do_bind: SASL/%s bind: dn=\"%s\" ssf=%d\n",
349 op->o_conn->c_authmech.bv_val,
350 op->o_conn->c_dn.bv_val ? op->o_conn->c_dn.bv_val : "<empty>",
353 Debug( LDAP_DEBUG_TRACE,
354 "do_bind: SASL/%s bind: dn=\"%s\" ssf=%d\n",
355 op->o_conn->c_authmech.bv_val,
356 op->o_conn->c_dn.bv_val ? op->o_conn->c_dn.bv_val : "<empty>",
360 } else if ( rs->sr_err == LDAP_SASL_BIND_IN_PROGRESS ) {
361 op->o_conn->c_sasl_bind_in_progress = 1;
364 if ( op->o_conn->c_sasl_bind_mech.bv_val ) {
365 free( op->o_conn->c_sasl_bind_mech.bv_val );
366 op->o_conn->c_sasl_bind_mech.bv_val = NULL;
367 op->o_conn->c_sasl_bind_mech.bv_len = 0;
369 op->o_conn->c_sasl_bind_in_progress = 0;
371 ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
376 /* Not SASL, cancel any in-progress bind */
377 ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
379 if ( op->o_conn->c_sasl_bind_mech.bv_val != NULL ) {
380 free(op->o_conn->c_sasl_bind_mech.bv_val);
381 op->o_conn->c_sasl_bind_mech.bv_val = NULL;
382 op->o_conn->c_sasl_bind_mech.bv_len = 0;
384 op->o_conn->c_sasl_bind_in_progress = 0;
386 slap_sasl_reset( op->o_conn );
387 ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
390 if ( method == LDAP_AUTH_SIMPLE ) {
391 /* accept "anonymous" binds */
392 if ( op->orb_cred.bv_len == 0 || op->o_req_ndn.bv_len == 0 ) {
393 rs->sr_err = LDAP_SUCCESS;
395 if( op->orb_cred.bv_len &&
396 !( global_allows & SLAP_ALLOW_BIND_ANON_CRED ))
398 /* cred is not empty, disallow */
399 rs->sr_err = LDAP_INVALID_CREDENTIALS;
401 } else if ( op->o_req_ndn.bv_len &&
402 !( global_allows & SLAP_ALLOW_BIND_ANON_DN ))
404 /* DN is not empty, disallow */
405 rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
406 rs->sr_text = "unauthenticated bind (DN with no password) disallowed";
408 } else if ( global_disallows & SLAP_DISALLOW_BIND_ANON ) {
410 rs->sr_err = LDAP_INAPPROPRIATE_AUTH;
411 rs->sr_text = "anonymous bind disallowed";
414 backend_check_restrictions( op, rs, &mech );
418 * we already forced connection to "anonymous",
419 * just need to send success
421 send_ldap_result( op, rs );
423 LDAP_LOG( OPERATION, DETAIL1,
424 "do_bind: conn %d v%d anonymous bind\n",
425 op->o_connid, version , 0 );
427 Debug( LDAP_DEBUG_TRACE, "do_bind: v%d anonymous bind\n",
432 } else if ( global_disallows & SLAP_DISALLOW_BIND_SIMPLE ) {
433 /* disallow simple authentication */
434 rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
435 rs->sr_text = "unwilling to perform simple authentication";
437 send_ldap_result( op, rs );
439 LDAP_LOG( OPERATION, INFO,
440 "do_bind: conn %d v%d simple bind(%s) disallowed\n",
441 op->o_connid, version, op->o_req_ndn.bv_val );
443 Debug( LDAP_DEBUG_TRACE,
444 "do_bind: v%d simple bind(%s) disallowed\n",
445 version, op->o_req_ndn.bv_val, 0 );
450 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
451 } else if ( method == LDAP_AUTH_KRBV41 || method == LDAP_AUTH_KRBV42 ) {
452 if ( global_disallows & SLAP_DISALLOW_BIND_KRBV4 ) {
453 /* disallow simple authentication */
454 rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
455 rs->sr_text = "unwilling to perform Kerberos V4 bind";
457 send_ldap_result( op, rs );
459 LDAP_LOG( OPERATION, DETAIL1,
460 "do_bind: conn %d v%d Kerberos V4 bind\n",
461 op->o_connid, version , 0 );
463 Debug( LDAP_DEBUG_TRACE, "do_bind: v%d Kerberos V4 bind\n",
471 rs->sr_err = LDAP_AUTH_METHOD_NOT_SUPPORTED;
472 rs->sr_text = "unknown authentication method";
474 send_ldap_result( op, rs );
476 LDAP_LOG( OPERATION, INFO,
477 "do_bind: conn %ld v%d unknown authentication method (%ld)\n",
478 op->o_connid, version, method );
480 Debug( LDAP_DEBUG_TRACE,
481 "do_bind: v%d unknown authentication method (%ld)\n",
482 version, method, 0 );
488 * We could be serving multiple database backends. Select the
489 * appropriate one, or send a referral to our "referral server"
490 * if we don't hold it.
493 if ( (op->o_bd = select_backend( &op->o_req_ndn, 0, 0 )) == NULL ) {
494 if ( default_referral ) {
495 rs->sr_ref = referral_rewrite( default_referral,
496 NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
497 if (!rs->sr_ref) rs->sr_ref = default_referral;
499 rs->sr_err = LDAP_REFERRAL;
500 send_ldap_result( op, rs );
502 if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
505 /* noSuchObject is not allowed to be returned by bind */
506 rs->sr_err = LDAP_INVALID_CREDENTIALS;
507 send_ldap_result( op, rs );
513 /* check restrictions */
514 if( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) {
515 send_ldap_result( op, rs );
519 #if defined( LDAP_SLAPI )
520 slapi_x_pblock_set_operation( pb, op );
521 slapi_pblock_set( pb, SLAPI_BIND_TARGET, (void *)dn.bv_val );
522 slapi_pblock_set( pb, SLAPI_BIND_METHOD, (void *)method );
523 slapi_pblock_set( pb, SLAPI_BIND_CREDENTIALS, (void *)&op->orb_cred );
524 slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(0) );
526 rs->sr_err = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_BIND_FN, pb );
527 if ( rs->sr_err < 0 ) {
529 * Binding is a special case for SLAPI plugins. It is
530 * possible for a bind plugin to be successful *and*
531 * abort further processing; this means it has handled
532 * a bind request authoritatively. If we have reached
533 * here, a result has been sent to the client (XXX
534 * need to check with Sun whether SLAPI_BIND_ANONYMOUS
535 * means a result has been sent).
539 if ( ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&ldapRc ) != 0 ) ||
540 ldapRc == LDAP_SUCCESS ) {
543 op->orb_edn.bv_val = NULL;
544 op->orb_edn.bv_len = 0;
545 if ( rs->sr_err != SLAPI_BIND_FAIL && ldapRc == LDAP_SUCCESS ) {
546 /* Set the new connection DN. */
547 if ( rs->sr_err != SLAPI_BIND_ANONYMOUS ) {
548 slapi_pblock_get( pb, SLAPI_CONN_DN, (void *)&op->orb_edn.bv_val );
549 if ( op->orb_edn.bv_val ) op->orb_edn.bv_len = strlen( op->orb_edn.bv_val );
551 rs->sr_err = dnPrettyNormal( NULL, &op->orb_edn, &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx );
552 ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
553 ber_dupbv(&op->o_conn->c_dn, &op->o_req_dn);
554 ber_dupbv(&op->o_conn->c_ndn, &op->o_req_ndn);
555 op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
556 op->o_req_dn.bv_val = NULL;
557 op->o_req_dn.bv_len = 0;
558 op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
559 op->o_req_ndn.bv_val = NULL;
560 op->o_req_ndn.bv_len = 0;
561 if ( op->o_conn->c_dn.bv_len != 0 ) {
562 ber_len_t max = sockbuf_max_incoming_auth;
563 ber_sockbuf_ctrl( op->o_conn->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &max );
565 /* log authorization identity */
566 Statslog( LDAP_DEBUG_STATS,
567 "conn=%lu op=%lu BIND dn=\"%s\" mech=simple (SLAPI) ssf=0\n",
568 op->o_connid, op->o_opid,
569 op->o_conn->c_dn.bv_val, 0, 0 );
570 ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
573 LDAP_LOG( OPERATION, INFO, "do_bind: Bind preoperation plugin returned %d\n",
576 Debug(LDAP_DEBUG_TRACE, "do_bind: Bind preoperation plugin returned %d.\n",
582 #endif /* defined( LDAP_SLAPI ) */
584 if ( op->o_bd->be_bind ) {
585 op->orb_method = method;
586 rs->sr_err = (op->o_bd->be_bind)( op, rs );
588 if ( rs->sr_err == 0 ) {
589 ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
591 if( op->o_conn->c_authz_backend == NULL ) {
592 op->o_conn->c_authz_backend = op->o_bd;
595 /* be_bind returns regular/global edn */
596 if(op->orb_edn.bv_len) {
597 op->o_conn->c_dn = op->orb_edn;
599 ber_dupbv(&op->o_conn->c_dn, &op->o_req_dn);
602 ber_dupbv( &op->o_conn->c_ndn, &op->o_req_ndn );
604 if( op->o_conn->c_dn.bv_len != 0 ) {
605 ber_len_t max = sockbuf_max_incoming_auth;
606 ber_sockbuf_ctrl( op->o_conn->c_sb,
607 LBER_SB_OPT_SET_MAX_INCOMING, &max );
610 /* log authorization identity */
611 Statslog( LDAP_DEBUG_STATS,
612 "conn=%lu op=%lu BIND dn=\"%s\" mech=simple ssf=0\n",
613 op->o_connid, op->o_opid,
614 op->o_conn->c_dn.bv_val, 0, 0 );
617 LDAP_LOG( OPERATION, DETAIL1,
618 "do_bind: v%d bind: \"%s\" to \"%s\" \n",
619 version, op->o_conn->c_dn.bv_val, op->o_conn->c_dn.bv_val );
621 Debug( LDAP_DEBUG_TRACE,
622 "do_bind: v%d bind: \"%s\" to \"%s\"\n",
623 version, dn.bv_val, op->o_conn->c_dn.bv_val );
626 ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
628 /* send this here to avoid a race condition */
629 send_ldap_result( op, rs );
631 } else if (op->orb_edn.bv_val != NULL) {
632 free( op->orb_edn.bv_val );
636 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
637 "operation not supported within namingContext" );
640 #if defined( LDAP_SLAPI )
641 if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_BIND_FN, pb ) < 0 ) {
643 LDAP_LOG( OPERATION, INFO, "do_bind: Bind postoperation plugins failed\n",
646 Debug(LDAP_DEBUG_TRACE, "do_bind: Bind postoperation plugins failed.\n",
650 #endif /* defined( LDAP_SLAPI ) */
654 op->o_conn->c_sasl_bindop = NULL;
656 if( op->o_req_dn.bv_val != NULL ) {
657 sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
658 op->o_req_dn.bv_val = NULL;
660 if( op->o_req_ndn.bv_val != NULL ) {
661 sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
662 op->o_req_ndn.bv_val = NULL;