]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Enhance SQLITE_ALLOW_URI_AUTHORITITY to elide //localhost/ and to deal
authordrh <drh@noemail.net>
Tue, 3 Mar 2015 16:58:56 +0000 (16:58 +0000)
committerdrh <drh@noemail.net>
Tue, 3 Mar 2015 16:58:56 +0000 (16:58 +0000)
with dodgy URIs that contain too many "/" characters.

FossilOrigin-Name: 39b566a2d0916c57f3fac756c6d6af149b44781d

manifest
manifest.uuid
src/main.c

index 6d76167d2106c8c8961292d2ccdef010d23c9607..97357b8491444216d9127b7fe3ea282581f6a8c6 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sover-length\ssource\scode\slines\sin\sthe\smain.c\ssource\sfile.
-D 2015-03-03T14:00:11.869
+C Enhance\sSQLITE_ALLOW_URI_AUTHORITITY\sto\selide\s//localhost/\sand\sto\sdeal\nwith\sdodgy\sURIs\sthat\scontain\stoo\smany\s"/"\scharacters.
+D 2015-03-03T16:58:56.782
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 2f643d6968dfc0b82d2e546a0525a39079f9e928
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -195,7 +195,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
 F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e
 F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770
 F src/loadext.c 86bd4e2fccd520b748cba52492ab60c4a770f660
-F src/main.c 998d6a92f07d7cf55303031f96c5d666a30eb8a5
+F src/main.c 6facbb3214a492d09022ac8414dc83d07d5d5f41
 F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab
 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
 F src/mem1.c abe6ee469b6c5a35c7f22bfeb9c9bac664a1c987
@@ -1240,7 +1240,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 7d92f1f11ee69b0ba7d5a48f0611016d77d41c78
-R 29e1839ec3d428ac80725ec179628136
+P debba6f161090bf9db1458fb3767d80d8362a73f
+R c0b7adf9c28144985d9fdda7fbb149ba
 U drh
-Z 6030eba2316c60662ec49bc896566222
+Z 3f9b4ad7f0949adf7d85c9b9b903f5a0
index 941f9b8ce5310d5ff91907abdffcf437c71da8eb..c40b4682a150517d13d3febf3a96927b89e66b50 100644 (file)
@@ -1 +1 @@
-debba6f161090bf9db1458fb3767d80d8362a73f
\ No newline at end of file
+39b566a2d0916c57f3fac756c6d6af149b44781d
\ No newline at end of file
index a0bb86a116d185f26f216eb886ac0235cdfa0d60..c90a95ab80aceb824e0a2b2c6f102fbe23bd9486 100644 (file)
@@ -2423,7 +2423,19 @@ int sqlite3ParseUri(
     if( !zFile ) return SQLITE_NOMEM;
 
     iIn = 5;
-#ifndef SQLITE_ALLOW_URI_AUTHORITY
+#ifdef SQLITE_ALLOW_URI_AUTHORITY
+    if( strncmp(zUri+5, "///", 3)==0 ){
+      iIn = 7;
+      /* The following condition causes URIs with five leading / characters
+      ** like file://///host/path to be converted into UNCs like //host/path.
+      ** The correct URI for that UNC has only two or four leading / characters
+      ** file://host/path or file:////host/path.  But 5 leading slashes is a 
+      ** common error, we are told, so we handle it as a special case. */
+      if( strncmp(zUri+7, "///", 3)==0 ){ iIn++; }
+    }else if( strncmp(zUri+5, "//localhost/", 12)==0 ){
+      iIn = 16;
+    }
+#else
     /* Discard the scheme and authority segments of the URI. */
     if( zUri[5]=='/' && zUri[6]=='/' ){
       iIn = 7;