]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slapi/slapi_utils.c
Fix compare op
[openldap] / servers / slapd / slapi / slapi_utils.c
index d24be09b8205e285ae874b71cd69a6b5544f8b80..e6613e4d1259d76f2c51b1f8ee7df560a74dce8d 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2002-2007 The OpenLDAP Foundation.
+ * Copyright 2002-2009 The OpenLDAP Foundation.
  * Portions Copyright 1997,2002-2003 IBM Corporation.
  * All rights reserved.
  *
@@ -26,6 +26,7 @@
 #include <ac/stdarg.h>
 #include <ac/ctype.h>
 #include <ac/unistd.h>
+#include <lutil.h>
 
 #include <slap.h>
 #include <slapi.h>
@@ -52,7 +53,7 @@ struct slapi_condvar {
 
 static int checkBVString(const struct berval *bv)
 {
-       int i;
+       ber_len_t i;
 
        for ( i = 0; i < bv->bv_len; i++ ) {
                if ( bv->bv_val[i] == '\0' )
@@ -1820,9 +1821,16 @@ slapi_pw_find(
        struct berval   **vals, 
        struct berval   *v ) 
 {
-       /*
-        * FIXME: what's the point?
-        */
+       int i;
+
+       if( ( vals == NULL ) || ( v == NULL ) )
+               return 1;
+
+       for ( i = 0; vals[i] != NULL; i++ ) {
+               if ( !lutil_passwd( vals[i], v, NULL, NULL ) )
+                       return 0;
+       }
+
        return 1;
 }
 
@@ -2153,7 +2161,6 @@ int slapi_attr_value_cmp( const Slapi_Attr *a, const struct berval *v1, const st
 int slapi_attr_value_find( const Slapi_Attr *a, struct berval *v )
 {
        int rc;
-       int ret;
 
        if ( a ->a_vals == NULL ) {
                return -1;
@@ -3110,7 +3117,7 @@ int slapi_entry_schema_check( Slapi_PBlock *pb, Slapi_Entry *e )
 
        pb->pb_op->o_bd = select_backend( &e->e_nname, 0 );
        if ( pb->pb_op->o_bd != NULL ) {
-               rc = entry_schema_check( pb->pb_op, e, NULL, 0, 0,
+               rc = entry_schema_check( pb->pb_op, e, NULL, 0, 0, NULL,
                        &text, textbuf, textlen );
        }
        pb->pb_op->o_bd = be_orig;
@@ -3232,8 +3239,10 @@ LDAP *slapi_ldap_init( char *ldaphost, int ldapport, int secure, int shared )
                rc = snprintf( url, size, "ldap%s://%s/", ( secure ? "s" : "" ), ldaphost );
        }
 
-       if ( rc > 0 && rc < size ) {
+       if ( rc > 0 && (size_t) rc < size ) {
                rc = ldap_initialize( &ld, url );
+       } else {
+               ld = NULL;
        }
 
        slapi_ch_free_string( &url );