]> git.sur5r.net Git - openldap/commitdiff
allow file: URLs without authority spec
authorQuanah Gibson-Mount <quanah@openldap.org>
Sat, 16 Dec 2006 01:40:39 +0000 (01:40 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Sat, 16 Dec 2006 01:40:39 +0000 (01:40 +0000)
URL with authority spec must use absolute path

libraries/liblutil/fetch.c

index 661bc1e75b164b45cc9be39466a2d942ca1a2fe8..08ed885c02e315246e9ac6f2f132fd24c1f5a556 100644 (file)
@@ -48,16 +48,15 @@ ldif_open_url(
        url = fetchGetURL( (char*) urlstr, "" );
 
 #else
-       if( strncasecmp( "file://", urlstr, sizeof("file://")-1 ) == 0 ) {
-               p = strchr( &urlstr[sizeof("file://")-1], '/' );
-               if( p == NULL ) {
-                       return NULL;
-               }
+       if( strncasecmp( "file:", urlstr, sizeof("file:")-1 ) == 0 ) {
+               p = urlstr + sizeof("file:")-1;
 
                /* we don't check for LDAP_DIRSEP since URLs should contain '/' */
-               if( p[1] == '.' && ( p[2] == '/' || ( p[2] == '.' && p[3] == '/' ))) {
-                       /* skip over false root */
-                       p++;
+               if ( p[0] == '/' && p[1] == '/' ) {
+                       p += 2;
+                       /* path must be absolute if authority is present */
+                       if ( p[0] != '/' )
+                               return NULL;
                }
 
                p = ber_strdup( p );