X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=servers%2Fslapd%2Froot_dse.c;h=195b52cfb9560a9123b3128db741cfdb90359dc8;hb=3c7bbd05cf91687913147b617ee36226e6e7ebf2;hp=73ced7fd15975ab627eee47a10dbd31ad0467e9f;hpb=d13d15c37a6d07b6a1cad00cf952c55d596aacda;p=openldap diff --git a/servers/slapd/root_dse.c b/servers/slapd/root_dse.c index 73ced7fd15..195b52cfb9 100644 --- a/servers/slapd/root_dse.c +++ b/servers/slapd/root_dse.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1999-2007 The OpenLDAP Foundation. + * Copyright 1999-2013 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -277,8 +277,7 @@ fail: } for ( j = 0; be->be_suffix[j].bv_val != NULL; j++ ) { if( attr_merge_one( e, ad_namingContexts, - &be->be_suffix[j], - &be->be_nsuffix[0] ) ) + &be->be_suffix[j], NULL ) ) { goto fail; } @@ -402,7 +401,8 @@ int root_dse_read_file( const char *fname ) { struct LDIFFP *fp; - int rc = 0, lineno = 0, lmax = 0; + int rc = 0, lmax = 0, ldifrc; + unsigned long lineno = 0; char *buf = NULL; if ( (fp = ldif_open( fname, "r" )) == NULL ) { @@ -422,15 +422,15 @@ root_dse_read_file( const char *fname ) } usr_attr->e_attrs = NULL; - while( ldif_read_record( fp, &lineno, &buf, &lmax ) ) { + while(( ldifrc = ldif_read_record( fp, &lineno, &buf, &lmax )) > 0 ) { Entry *e = str2entry( buf ); Attribute *a; if( e == NULL ) { Debug( LDAP_DEBUG_ANY, "root_dse_read_file: " - "could not parse entry (file=\"%s\" line=%d)\n", + "could not parse entry (file=\"%s\" line=%lu)\n", fname, lineno, 0 ); - rc = EXIT_FAILURE; + rc = LDAP_OTHER; break; } @@ -438,10 +438,10 @@ root_dse_read_file( const char *fname ) if( e->e_nname.bv_len ) { Debug( LDAP_DEBUG_ANY, "root_dse_read_file: invalid rootDSE " - "- dn=\"%s\" (file=\"%s\" line=%d)\n", + "- dn=\"%s\" (file=\"%s\" line=%lu)\n", e->e_dn, fname, lineno ); entry_free( e ); - rc = EXIT_FAILURE; + rc = LDAP_OTHER; break; } @@ -464,6 +464,9 @@ root_dse_read_file( const char *fname ) if (rc) break; } + if ( ldifrc < 0 ) + rc = LDAP_OTHER; + if (rc) { entry_free( usr_attr ); usr_attr = NULL;