/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1999-2007 The OpenLDAP Foundation.
+ * Copyright 1999-2009 The OpenLDAP Foundation.
* Portions Copyright 1999-2003 Kurt D. Zeilenga.
* All rights reserved.
*
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;
}
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;
}