From: Howard Chu Date: Mon, 19 Oct 2015 07:52:28 +0000 (+0100) Subject: ITS#8273 Windows file:// URL fixup X-Git-Tag: OPENLDAP_REL_ENG_2_4_43~37 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d9065342d281996f682bb50be8d10875ffbde4f7;hp=7bcbe6a6c9a229ce20ae342c403e41ee007f3e1b;p=openldap ITS#8273 Windows file:// URL fixup --- diff --git a/libraries/libldap/fetch.c b/libraries/libldap/fetch.c index 1d68fda0c4..6c65d82f14 100644 --- a/libraries/libldap/fetch.c +++ b/libraries/libldap/fetch.c @@ -50,9 +50,22 @@ ldif_open_url( /* we don't check for LDAP_DIRSEP since URLs should contain '/' */ if ( urlstr[0] == '/' && urlstr[1] == '/' ) { urlstr += 2; - /* path must be absolute if authority is present */ - if ( urlstr[0] != '/' ) + /* path must be absolute if authority is present + * technically, file://hostname/path is also legal but we don't + * accept a non-empty hostname + */ + if ( urlstr[0] != '/' ) { +#ifdef _WIN32 + /* An absolute path in improper file://C:/foo/bar format */ + if ( urlstr[1] != ':' ) +#endif return NULL; + } +#ifdef _WIN32 + /* An absolute path in proper file:///C:/foo/bar format */ + if ( urlstr[2] == ':' ) + urlstr++; +#endif } p = ber_strdup( urlstr );