/* $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.
*
#include <ac/stdarg.h>
#include <ac/ctype.h>
#include <ac/unistd.h>
+#include <lutil.h>
#include <slap.h>
#include <slapi.h>
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' )
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;
}
int slapi_attr_value_find( const Slapi_Attr *a, struct berval *v )
{
int rc;
- int ret;
if ( a ->a_vals == NULL ) {
return -1;
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;
int rc;
size = sizeof("ldap:///");
- if ( secure )
+ if ( secure ) {
size++;
+ }
size += strlen( ldaphost );
- if ( ldapport != 0 )
+ if ( ldapport != 0 ) {
size += 32;
+ }
url = slapi_ch_malloc( size );
if ( ldapport != 0 ) {
- sprintf( url, "ldap%s://%s:%d/", ( secure ? "s" : "" ), ldaphost, ldapport );
+ rc = snprintf( url, size, "ldap%s://%s:%d/", ( secure ? "s" : "" ), ldaphost, ldapport );
} else {
- sprintf( url, "ldap%s://%s/", ( secure ? "s" : "" ), ldaphost );
+ rc = snprintf( url, size, "ldap%s://%s/", ( secure ? "s" : "" ), ldaphost );
}
- rc = ldap_initialize( &ld, url );
+ if ( rc > 0 && (size_t) rc < size ) {
+ rc = ldap_initialize( &ld, url );
+ } else {
+ ld = NULL;
+ }
slapi_ch_free_string( &url );