]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/saslauthz.c
use asynchronous StartTLS
[openldap] / servers / slapd / saslauthz.c
index 52d928f51236d1a688c203ea1cf5e3b5ee3abc4b..28e44248cd71df6f374ff5eb30119c134fd7d86f 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2005 The OpenLDAP Foundation.
  * Portions Copyright 2000 Mark Adamson, Carnegie Mellon.
  * All rights reserved.
  *
@@ -411,6 +411,13 @@ is_dn:             bv.bv_len = uri->bv_len - (bv.bv_val - uri->bv_val);
        rc = ldap_url_parse( uri->bv_val, &ludp );
        switch ( rc ) {
        case LDAP_URL_SUCCESS:
+               /* FIXME: the check is pedantic, but I think it's necessary,
+                * because people tend to use things like ldaps:// which
+                * gives the idea SSL is being used.  Maybe we could
+                * accept ldapi:// as well, but the point is that we use
+                * an URL as an easy means to define bits of a search with
+                * little parsing.
+                */
                if ( strcasecmp( ludp->lud_scheme, "ldap" ) != 0 ) {
                        /*
                         * must be ldap:///
@@ -693,7 +700,9 @@ static int slap_authz_regexp( struct berval *in, struct berval *out,
                if ( !BER_BVISNULL( out ) ) {
                        char *val = out->bv_val;
                        ber_str2bv_x( val, 0, 1, out, ctx );
-                       free( val );
+                       if ( val != in->bv_val ) {
+                               free( val );
+                       }
                } else {
                        ber_dupbv_x( out, in, ctx );
                }
@@ -1092,8 +1101,7 @@ void slap_sasl2dn( Operation *opx,
                "converting SASL name %s to a DN\n",
                saslname->bv_val, 0,0 );
 
-       sasldn->bv_val = NULL;
-       sasldn->bv_len = 0;
+       BER_BVZERO( sasldn );
        cb.sc_private = sasldn;
 
        /* Convert the SASL name into a minimal URI */