]> git.sur5r.net Git - openldap/commitdiff
do not use lutil_atoix() (ITS#6654)
authorPierangelo Masarati <ando@openldap.org>
Tue, 21 Sep 2010 00:10:44 +0000 (00:10 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 21 Sep 2010 00:10:44 +0000 (00:10 +0000)
libraries/libldap/ldifutil.c

index 407c276d4e37a991b00c805d9d9c4c1ad43391d4..ea78a0c78effd115d16c9150329c1c68e92c8b18 100644 (file)
@@ -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 );