From 8079f3be00865ee7c41be7c1f3d00a017a98af54 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sun, 12 Jan 2014 10:29:38 +0100 Subject: [PATCH 01/57] Remove warning about 1.6.0 not being released. --- share/doc/src/whatsnew/1.6.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/share/doc/src/whatsnew/1.6.rst b/share/doc/src/whatsnew/1.6.rst index 7d93ff64d9e..91eb66cae01 100644 --- a/share/doc/src/whatsnew/1.6.rst +++ b/share/doc/src/whatsnew/1.6.rst @@ -39,10 +39,6 @@ in case if you had used such handler. Version 1.6.0 ============= -.. warning:: - - This version is not released yet. - * Fauxton: many improvements in our experimental new user interface, including switching the code editor from CodeMirror to Ace as well as better support for various browsers. From d4cb60495c0b82ba25f7eaa22ef8446186bf7e61 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Mon, 13 Jan 2014 20:25:45 +0100 Subject: [PATCH 02/57] blank files might sink ships --- .../priv/default.d/my_first_couchdb_plugin.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/my-first-couchdb-plugin/priv/default.d/my_first_couchdb_plugin.ini b/src/my-first-couchdb-plugin/priv/default.d/my_first_couchdb_plugin.ini index e69de29bb2d..fbc2d981fd6 100644 --- a/src/my-first-couchdb-plugin/priv/default.d/my_first_couchdb_plugin.ini +++ b/src/my-first-couchdb-plugin/priv/default.d/my_first_couchdb_plugin.ini @@ -0,0 +1,3 @@ +;per-plugin configuration goes here +;[plugin-name] +;config=value From f042538352bb9aeec17fae39094bf8705741fed9 Mon Sep 17 00:00:00 2001 From: benoitc Date: Sun, 5 Jan 2014 10:22:05 +0100 Subject: [PATCH 03/57] use POSIX tar to support files length > 99 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 6c5ef5b632e..57a4268a405 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([src/snappy/google-snappy/config.h]) -AM_INIT_AUTOMAKE([1.6.3 foreign]) +AM_INIT_AUTOMAKE([1.6.3 foreign tar-ustar]) AC_USE_SYSTEM_EXTENSIONS AC_ENABLE_SHARED From 79094acbf4113382c7dd28d024bb9d393632d871 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Fri, 17 Jan 2014 14:47:36 +0100 Subject: [PATCH 04/57] Empty build tags for release. --- acinclude.m4.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/acinclude.m4.in b/acinclude.m4.in index db2f1496084..9f0b3f44d78 100644 --- a/acinclude.m4.in +++ b/acinclude.m4.in @@ -19,8 +19,8 @@ m4_define([LOCAL_BUG_URI], [https://issues.apache.org/jira/browse/COUCHDB]) m4_define([LOCAL_VERSION_MAJOR], [1]) m4_define([LOCAL_VERSION_MINOR], [6]) m4_define([LOCAL_VERSION_REVISION], [0]) -m4_define([LOCAL_VERSION_STAGE], [+build]) -m4_define([LOCAL_VERSION_RELEASE], [.%revision%]) +m4_define([LOCAL_VERSION_STAGE], []) +m4_define([LOCAL_VERSION_RELEASE], []) m4_define([LOCAL_VERSION_PRIMARY], [LOCAL_VERSION_MAJOR.LOCAL_VERSION_MINOR.LOCAL_VERSION_REVISION]) m4_define([LOCAL_VERSION_SECONDARY], From 89c9bd0e169ee1d3428e485c30c811aaf8e611ac Mon Sep 17 00:00:00 2001 From: suelockwood Date: Mon, 20 Jan 2014 11:01:57 -0500 Subject: [PATCH 05/57] Fixing release makefile to include all fauxton files. --- src/Makefile.am | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Makefile.am b/src/Makefile.am index 12c4fe30c8a..0093ebdde94 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -59,9 +59,18 @@ FAUXTON_FILES = \ fauxton/app/addons/auth/templates/nav_dropdown.html \ fauxton/app/addons/auth/templates/nav_link_title.html \ fauxton/app/addons/auth/templates/noAccess.html \ + fauxton/app/addons/compaction/base.js \ + fauxton/app/addons/compaction/resources.js \ + fauxton/app/addons/compaction/routes.js \ + fauxton/app/addons/compaction/views.js \ + fauxton/app/addons/compaction/assets/less/compaction.less \ + fauxton/app/addons/compaction/templates/compact_view.html \ + fauxton/app/addons/compaction/templates/layout.html \ fauxton/app/addons/config/base.js \ fauxton/app/addons/config/resources.js \ fauxton/app/addons/config/routes.js \ + fauxton/app/addons/config/views.js \ + fauxton/app/addons/config/assets/less/config.less \ fauxton/app/addons/config/templates/dashboard.html \ fauxton/app/addons/config/templates/item.html \ fauxton/app/addons/contribute/base.js \ @@ -105,6 +114,12 @@ FAUXTON_FILES = \ fauxton/app/addons/stats/templates/stats.html \ fauxton/app/addons/stats/templates/statselect.html \ fauxton/app/addons/stats/views.js \ + fauxton/app/addons/verifyinstall/base.js \ + fauxton/app/addons/verifyinstall/resources.js \ + fauxton/app/addons/verifyinstall/routes.js \ + fauxton/app/addons/verifyinstall/views.js \ + fauxton/app/addons/verifyinstall/assets/less/verifyinstall.less \ + fauxton/app/addons/verifyinstall/templates/main.html \ fauxton/app/api.js \ fauxton/app/app.js \ fauxton/app/config.js \ @@ -135,7 +150,11 @@ FAUXTON_FILES = \ fauxton/app/templates/databases/newdatabase.html \ fauxton/app/templates/documents/all_docs_item.html \ fauxton/app/templates/documents/all_docs_list.html \ + fauxton/app/templates/documents/all_docs_layout.html \ + fauxton/app/templates/documents/all_docs_number.html \ + fauxton/app/templates/documents/advanced_options.html \ fauxton/app/templates/documents/changes.html \ + fauxton/app/templates/documents/design_doc_selector.html \ fauxton/app/templates/documents/ddoc_info.html \ fauxton/app/templates/documents/doc.html \ fauxton/app/templates/documents/doc_field_editor.html \ @@ -160,6 +179,7 @@ FAUXTON_FILES = \ fauxton/app/templates/fauxton/pagination.html \ fauxton/app/templates/layouts/one_pane.html \ fauxton/app/templates/layouts/two_pane.html \ + fauxton/app/templates/layouts/one_pane_notabs.html fauxton/app/templates/layouts/with_right_sidebar.html \ fauxton/app/templates/layouts/with_sidebar.html \ fauxton/app/templates/layouts/with_tabs.html \ @@ -312,3 +332,4 @@ FAUXTON_FILES = \ fauxton/test/test.config.underscore \ fauxton/TODO.md \ fauxton/writing_addons.md + fauxton/extensions.md From 1e0a1b3a76c88334a6ae6fdc877a6f2a048d09cc Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Tue, 21 Jan 2014 14:11:36 +0100 Subject: [PATCH 06/57] Add some line continuations missed in 89c9bd0e --- src/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 0093ebdde94..c78e6190c12 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -179,7 +179,7 @@ FAUXTON_FILES = \ fauxton/app/templates/fauxton/pagination.html \ fauxton/app/templates/layouts/one_pane.html \ fauxton/app/templates/layouts/two_pane.html \ - fauxton/app/templates/layouts/one_pane_notabs.html + fauxton/app/templates/layouts/one_pane_notabs.html \ fauxton/app/templates/layouts/with_right_sidebar.html \ fauxton/app/templates/layouts/with_sidebar.html \ fauxton/app/templates/layouts/with_tabs.html \ @@ -331,5 +331,5 @@ FAUXTON_FILES = \ fauxton/test/runner.html \ fauxton/test/test.config.underscore \ fauxton/TODO.md \ - fauxton/writing_addons.md + fauxton/writing_addons.md \ fauxton/extensions.md From 5060ac7c4b1d9269cbb33f9c3c521267c9f1c5dd Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Tue, 21 Jan 2014 16:06:34 +0100 Subject: [PATCH 07/57] Remove reference to file that doesn't exist on the branch --- src/Makefile.am | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index c78e6190c12..2292ccf96f4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -69,7 +69,6 @@ FAUXTON_FILES = \ fauxton/app/addons/config/base.js \ fauxton/app/addons/config/resources.js \ fauxton/app/addons/config/routes.js \ - fauxton/app/addons/config/views.js \ fauxton/app/addons/config/assets/less/config.less \ fauxton/app/addons/config/templates/dashboard.html \ fauxton/app/addons/config/templates/item.html \ From af196a4725ddc1f8172422f0e0ebd5a6cefa21cc Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Tue, 21 Jan 2014 16:58:28 +0100 Subject: [PATCH 08/57] Update copyright notice --- NOTICE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NOTICE b/NOTICE index 0fa5d8d86c8..30e299dde74 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,5 @@ Apache CouchDB -Copyright 2009-2013 The Apache Software Foundation +Copyright 2009-2014 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). From ce3e89dc9fef25aa0e038e5a621a1e7c732e66e2 Mon Sep 17 00:00:00 2001 From: NickNorth Date: Tue, 3 Dec 2013 20:58:53 +0000 Subject: [PATCH 09/57] Speed up and move couch_httpd:find_in_binary. See https://issues.apache.org/jira/browse/COUCHDB-1953 (cherry picked from commit 824869c3c059d887da0dbe1cd04eb244c931c27b) --- src/couchdb/couch_httpd.erl | 30 +-------------- src/couchdb/couch_util.erl | 32 ++++++++++++++++ test/etap/043-find-in-binary.t | 69 ++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 29 deletions(-) create mode 100755 test/etap/043-find-in-binary.t diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl index 465bc7a41ee..9245f4b20cd 100644 --- a/src/couchdb/couch_httpd.erl +++ b/src/couchdb/couch_httpd.erl @@ -1003,7 +1003,7 @@ split_header(Line) -> mochiweb_util:parse_header(Value)}]. read_until(#mp{data_fun=DataFun, buffer=Buffer}=Mp, Pattern, Callback) -> - case find_in_binary(Pattern, Buffer) of + case couch_util:find_in_binary(Pattern, Buffer) of not_found -> Callback2 = Callback(Buffer), {Buffer2, DataFun2} = DataFun(), @@ -1079,34 +1079,6 @@ check_for_last(#mp{buffer=Buffer, data_fun=DataFun}=Mp) -> data_fun = DataFun2}) end. -find_in_binary(_B, <<>>) -> - not_found; - -find_in_binary(B, Data) -> - case binary:match(Data, [B], []) of - nomatch -> - partial_find(binary:part(B, {0, byte_size(B) - 1}), - binary:part(Data, {byte_size(Data), -byte_size(Data) + 1}), 1); - {Pos, _Len} -> - {exact, Pos} - end. - -partial_find(<<>>, _Data, _Pos) -> - not_found; - -partial_find(B, Data, N) when byte_size(Data) > 0 -> - case binary:match(Data, [B], []) of - nomatch -> - partial_find(binary:part(B, {0, byte_size(B) - 1}), - binary:part(Data, {byte_size(Data), -byte_size(Data) + 1}), N + 1); - {Pos, _Len} -> - {partial, N + Pos} - end; - -partial_find(_B, _Data, _N) -> - not_found. - - validate_bind_address(Address) -> case inet_parse:address(Address) of {ok, _} -> ok; diff --git a/src/couchdb/couch_util.erl b/src/couchdb/couch_util.erl index afe3528a6c2..2509bef929f 100644 --- a/src/couchdb/couch_util.erl +++ b/src/couchdb/couch_util.erl @@ -29,6 +29,7 @@ -export([encode_doc_id/1]). -export([with_db/2]). -export([rfc1123_date/0, rfc1123_date/1]). +-export([find_in_binary/2]). -include("couch_db.hrl"). @@ -487,3 +488,34 @@ month(9) -> "Sep"; month(10) -> "Oct"; month(11) -> "Nov"; month(12) -> "Dec". + + +find_in_binary(_B, <<>>) -> + not_found; + +find_in_binary(B, Data) -> + case binary:match(Data, [B], []) of + nomatch -> + MatchLength = erlang:min(byte_size(B), byte_size(Data)), + match_prefix_at_end(binary:part(B, {0, MatchLength}), + binary:part(Data, {byte_size(Data), -MatchLength}), + MatchLength, byte_size(Data) - MatchLength); + {Pos, _Len} -> + {exact, Pos} + end. + +match_prefix_at_end(Prefix, Data, PrefixLength, N) -> + FirstCharMatches = binary:matches(Data, [binary:part(Prefix, {0, 1})], []), + match_rest_of_prefix(FirstCharMatches, Prefix, Data, PrefixLength, N). + +match_rest_of_prefix([], _Prefix, _Data, _PrefixLength, _N) -> + not_found; + +match_rest_of_prefix([{Pos, _Len} | Rest], Prefix, Data, PrefixLength, N) -> + case binary:match(binary:part(Data, {PrefixLength, Pos - PrefixLength}), + [binary:part(Prefix, {0, PrefixLength - Pos})], []) of + nomatch -> + match_rest_of_prefix(Rest, Prefix, Data, PrefixLength, N); + {_Pos, _Len1} -> + {partial, N + Pos} + end. diff --git a/test/etap/043-find-in-binary.t b/test/etap/043-find-in-binary.t new file mode 100755 index 00000000000..d29aa8a5742 --- /dev/null +++ b/test/etap/043-find-in-binary.t @@ -0,0 +1,69 @@ +#!/usr/bin/env escript +%%! -pa ./deps/*/ebin -pa ./apps/*/ebin -pa ./test/etap +%% -*- erlang -*- + +% Licensed under the Apache License, Version 2.0 (the "License"); you may not +% use this file except in compliance with the License. You may obtain a copy of +% the License at +% +% http://www.apache.org/licenses/LICENSE-2.0 +% +% Unless required by applicable law or agreed to in writing, software +% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +% License for the specific language governing permissions and limitations under +% the License. + +main(_) -> + test_util:init_code_path(), + + etap:plan(length(cases())), + case (catch test()) of + ok -> + etap:end_tests(); + Other -> + etap:diag(io_lib:format("Test died abnormally: ~p", [Other])), + etap:bail(Other) + end, + ok. + + +test() -> + lists:foreach(fun({Needle, Haystack, Result}) -> + try + Msg = io_lib:format("Looking for ~s in ~s", [Needle, Haystack]), + etap:is(couch_util:find_in_binary(Needle, Haystack), Result, Msg) + catch _T:_R -> + etap:diag("~p", [{_T, _R}]) + end + end, cases()), + ok. + + +cases() -> + [ + {<<"foo">>, <<"foobar">>, {exact, 0}}, + {<<"foo">>, <<"foofoo">>, {exact, 0}}, + {<<"foo">>, <<"barfoo">>, {exact, 3}}, + {<<"foo">>, <<"barfo">>, {partial, 3}}, + {<<"f">>, <<"fobarfff">>, {exact, 0}}, + {<<"f">>, <<"obarfff">>, {exact, 4}}, + {<<"f">>, <<"obarggf">>, {exact, 6}}, + {<<"f">>, <<"f">>, {exact, 0}}, + {<<"f">>, <<"g">>, not_found}, + {<<"foo">>, <<"f">>, {partial, 0}}, + {<<"foo">>, <<"g">>, not_found}, + {<<"foo">>, <<"">>, not_found}, + {<<"fofo">>, <<"foofo">>, {partial, 3}}, + {<<"foo">>, <<"gfobarfo">>, {partial, 6}}, + {<<"foo">>, <<"gfobarf">>, {partial, 6}}, + {<<"foo">>, <<"gfobar">>, not_found}, + {<<"fog">>, <<"gbarfogquiz">>, {exact, 4}}, + {<<"ggg">>, <<"ggg">>, {exact, 0}}, + {<<"ggg">>, <<"ggggg">>, {exact, 0}}, + {<<"ggg">>, <<"bggg">>, {exact, 1}}, + {<<"ggg">>, <<"bbgg">>, {partial, 2}}, + {<<"ggg">>, <<"bbbg">>, {partial, 3}}, + {<<"ggg">>, <<"bgbggbggg">>, {exact, 6}}, + {<<"ggg">>, <<"bgbggb">>, not_found} + ]. From 79035f8dbe15bf5eefce2b5acb48f36acc94f001 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 10 Apr 2014 10:22:59 +0200 Subject: [PATCH 10/57] Update what's new for 1.6.0 with recently merged changes --- share/doc/src/whatsnew/1.6.rst | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/share/doc/src/whatsnew/1.6.rst b/share/doc/src/whatsnew/1.6.rst index 91eb66cae01..248ae329dc5 100644 --- a/share/doc/src/whatsnew/1.6.rst +++ b/share/doc/src/whatsnew/1.6.rst @@ -33,7 +33,6 @@ as deprecated and will be removed in future releases. It's strongly recommended to update :config:option:`httpd/authentication_handlers` option with new value in case if you had used such handler. - .. _release/1.6.0: Version 1.6.0 @@ -42,9 +41,12 @@ Version 1.6.0 * Fauxton: many improvements in our experimental new user interface, including switching the code editor from CodeMirror to Ace as well as better support for various browsers. +* :issue:`1986`: increase socket buffer size to improve replication speed + for large documents and attachments, and fix tests on BSD-like systems. + :commit:`9a0e561b` +* :issue:`1953`: improve performance of multipart/related requests. + :commit:`ce3e89dc` * :issue:`1922`: fix CORS exposed headers. :commit:`4f619833` -* Rename ``proxy_authentification_handler`` to ``proxy_authentication_handler``. - :commit:`c66ac4a8` * :issue:`1795`: ensure the startup script clears the pid file on termination. :commit:`818ef4f9` * :issue:`1962`: replication can now be performed without having write access @@ -57,7 +59,22 @@ Version 1.6.0 * :issue:`1923`: add support for `attachments` and `att_encoding_info` options (formerly only available on the documents API) to the view API. :commit:`ca41964b` +* :issue:`1780`: upgrade password hashes from SHA-1 to PBKDF2 scheme on + successful authentication. :commit:`34888938` +* :issue:`2059`: allow run-time configuration of maximum URL length. + :commit:`f7ca266b` +* :issue:`2054`: accept gzipped JSON request bodies. :commit:`4d893387` +* Rename ``proxy_authentification_handler`` to ``proxy_authentication_handler``. + :commit:`c66ac4a8` * :issue:`1647`: for failed replications originating from a document in the `_replicator` database, store the failure reason in the document. :commit:`08cac68b` -* A number of improvements for the documentation. +* :issue:`2053`: send better error messages when both `key` and `keys` + parameters are specified in view requests. :commit:`2bc07840` +* :issue:`2040`: send better error messages when incorrect checksums + are encountered during compaction. :commit:`e7fdc16a` +* :issue:`2028`: allow intermedia certificates when using SSL/TLS. + :commit:`2d080449` +* :issue:`2031`: fix rewriting of paths with query string parameters. + :commit:`37c84596` +* Numerous improvements to the documentation. From 54e43a106bb1116ae5e1b6877423f4e00e0e1ed9 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Fri, 11 Apr 2014 21:13:35 +0200 Subject: [PATCH 11/57] Add note about CVE-2014-2668 to 1.6.0 what's new --- share/doc/src/whatsnew/1.6.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/share/doc/src/whatsnew/1.6.rst b/share/doc/src/whatsnew/1.6.rst index 248ae329dc5..2f5faec9c36 100644 --- a/share/doc/src/whatsnew/1.6.rst +++ b/share/doc/src/whatsnew/1.6.rst @@ -33,6 +33,9 @@ as deprecated and will be removed in future releases. It's strongly recommended to update :config:option:`httpd/authentication_handlers` option with new value in case if you had used such handler. +Note that this release also contains the security fix for CVE-2014-2668 that +was first fixed in :ref:`release/1.5.1`. + .. _release/1.6.0: Version 1.6.0 From 6529f7779584599dcd6106b7a34d0648f6318d96 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Fri, 11 Apr 2014 21:14:43 +0200 Subject: [PATCH 12/57] Update what's new for 1.6.0 for latest merge --- share/doc/src/whatsnew/1.6.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/doc/src/whatsnew/1.6.rst b/share/doc/src/whatsnew/1.6.rst index 2f5faec9c36..8ddbea1a701 100644 --- a/share/doc/src/whatsnew/1.6.rst +++ b/share/doc/src/whatsnew/1.6.rst @@ -49,6 +49,8 @@ Version 1.6.0 :commit:`9a0e561b` * :issue:`1953`: improve performance of multipart/related requests. :commit:`ce3e89dc` +* :issue:`2221`: verify that authentication-related configuration settings + are well-formed. :commit:`dbe769c6` * :issue:`1922`: fix CORS exposed headers. :commit:`4f619833` * :issue:`1795`: ensure the startup script clears the pid file on termination. :commit:`818ef4f9` From 12f745c434947dbfde3e08b1418cec566cfeca9e Mon Sep 17 00:00:00 2001 From: Alexander Shorin Date: Sun, 13 Apr 2014 05:39:00 +0400 Subject: [PATCH 13/57] Add license header for tracking.html --- share/doc/templates/tracking.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/share/doc/templates/tracking.html b/share/doc/templates/tracking.html index e6d4037bddd..b80e3c2c58c 100644 --- a/share/doc/templates/tracking.html +++ b/share/doc/templates/tracking.html @@ -1,3 +1,18 @@ + + {% if not local %} - +