X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Fliblutil%2Ffetch.c;h=a56806e0c01f79e2140ee2194760bdec8e0a4369;hb=34249c08a5c15ebf15f78570ca61e6acad94dc22;hp=6535dd20b6ec6b4cb358ce8097779d5dcce4c04c;hpb=cb27c610109c818a160339938d8e58c3f0f73c49;p=openldap diff --git a/libraries/liblutil/fetch.c b/libraries/liblutil/fetch.c index 6535dd20b6..a56806e0c0 100644 --- a/libraries/liblutil/fetch.c +++ b/libraries/liblutil/fetch.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1999-2007 The OpenLDAP Foundation. + * Copyright 1999-2010 The OpenLDAP Foundation. * Portions Copyright 1999-2003 Kurt D. Zeilenga. * All rights reserved. * @@ -43,10 +43,7 @@ ldif_open_url( LDAP_CONST char *urlstr ) { FILE *url; -#ifdef HAVE_FETCH - url = fetchGetURL( (char*) urlstr, "" ); -#else if( strncasecmp( "file:", urlstr, sizeof("file:")-1 ) == 0 ) { char *p; urlstr += sizeof("file:")-1; @@ -60,15 +57,26 @@ ldif_open_url( } p = ber_strdup( urlstr ); + + /* But we should convert to LDAP_DIRSEP before use */ + if ( LDAP_DIRSEP[0] != '/' ) { + char *s = p; + while (( s = strchr( s, '/' ))) + *s++ = LDAP_DIRSEP[0]; + } + ldap_pvt_hex_unescape( p ); url = fopen( p, "rb" ); ber_memfree( p ); } else { - return NULL; - } +#ifdef HAVE_FETCH + url = fetchGetURL( (char*) urlstr, "" ); +#else + url = NULL; #endif + } return url; }