--- libraries/libldap/ldifutil.c 2010/04/13 05:38:00 1.2 +++ libraries/libldap/ldifutil.c 2010/09/20 22:10:44 1.3 @@ -1,4 +1,4 @@ -/* $OpenLDAP: pkg/ldap/libraries/libldap/ldifutil.c,v 1.1 2010/04/12 00:01:55 ando Exp $ */ +/* $OpenLDAP: pkg/ldap/libraries/libldap/ldifutil.c,v 1.2 2010/04/13 05:38:00 ando Exp $ */ /* This work is part of OpenLDAP Software . * * Copyright 1998-2010 The OpenLDAP Foundation. @@ -164,8 +164,16 @@ ldap_parse_ldif_record_x( if ( dn == NULL ) { if ( linenum+i == 1 && BV_CASEMATCH( lr->lr_btype+i, &BV_VERSION )) { + /* lutil_atoi() introduces a dependence of libldap + * on liblutil; we only allow version 1 by now (ITS#6654) + */ +#if 0 int v; - if( lr->lr_vals[i].bv_len == 0 || lutil_atoi( &v, lr->lr_vals[i].bv_val) != 0 || v != 1 ) { + if( lr->lr_vals[i].bv_len == 0 || lutil_atoi( &v, lr->lr_vals[i].bv_val) != 0 || v != 1 ) +#endif + static const struct berval version1 = { 1, "1" }; + if ( lr->lr_vals[i].bv_len != version1.bv_len || strncmp( lr->lr_vals[i].bv_val, version1.bv_val, version1.bv_len ) != 0 ) + { fprintf( stderr, _("%s: invalid version %s, line %d (ignored)\n"), errstr, lr->lr_vals[i].bv_val, linenum );