From patchwork Thu Dec 10 15:47:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1414306 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=uVjWdJOw; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CsJJW5DwRz9s0b for ; Fri, 11 Dec 2020 02:49:47 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=t9eWSfUVAntx714M82gzQ9sRXT1Vj752im5fAg5L1Mw=; b=uVjWdJOwFq6zhVvDMHVg5UD8e V9RTnlXKNlcflNliC59RBc/Bhh3g1ieiPgPFmo7d6d+2QKbzO4YWyQBAsSxNoe4atxr5H92HHteQU YwbhfHd3itdMh6nk2r8YqfgtXatHr9JBz+7GfVzfcSPfmEU4Lx1pS5TpLac8HYn/mgdaxG5Deyy9c lU5aEz2ItYu7SB522yvuwnD+jJ/Fi6ZEq/4P4avffA9jYQqu46faK6UCY2KMxwI9nYHzsSNy4134s ihwHzAHzC6Ji902ykmlrgdi5Uibo/GI6uZGCi9Lw2rJMeYYkndQXFdWbWHoPAgywPtpM+zg72ugV4 kooOMZaUg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOAq-0001rs-C7; Thu, 10 Dec 2020 15:48:08 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOAn-0001qB-DG for openwrt-devel@lists.openwrt.org; Thu, 10 Dec 2020 15:48:06 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 0057218F40; Thu, 10 Dec 2020 16:48:03 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id c9e37bf3; Thu, 10 Dec 2020 16:47:46 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH uclient 01/12] cmake: fix building out of the tree Date: Thu, 10 Dec 2020 16:47:48 +0100 Message-Id: <20201210154759.1114-2-ynezz@true.cz> In-Reply-To: <20201210154759.1114-1-ynezz@true.cz> References: <20201210154759.1114-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201210_104805_667720_FB2C53A5 X-CRM114-Status: GOOD ( 14.46 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org When building out of the tree, linker is unable to find the ubox library so fix it by using find_library CMake command. Signed-off-by: Petr Štetiar --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 072afef92479..841bc0f8f17c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,14 @@ SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") FIND_PATH(ubox_include_dir libubox/ustream-ssl.h) INCLUDE_DIRECTORIES(${ubox_include_dir}) +IF(BUILD_STATIC) + FIND_LIBRARY(ubox_library NAMES ubox.a) +ELSE(BUILD_STATIC) + FIND_LIBRARY(ubox_library NAMES ubox) +ENDIF(BUILD_STATIC) + ADD_LIBRARY(uclient SHARED uclient.c uclient-http.c uclient-utils.c) -TARGET_LINK_LIBRARIES(uclient ubox dl) +TARGET_LINK_LIBRARIES(uclient ${ubox_library} dl) ADD_EXECUTABLE(uclient-fetch uclient-fetch.c progress.c) TARGET_LINK_LIBRARIES(uclient-fetch uclient) From patchwork Thu Dec 10 15:47:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1414313 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=jRg3EjBK; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CsJJp3q9kz9s0b for ; Fri, 11 Dec 2020 02:50:02 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6lrXMvbej4OvVnkMWor9Udu9vrog8l39LP44ygbp3os=; b=jRg3EjBKRi9FhbwHvnSuwwN9v lDhushNrUfWxAfUA646Gnfp7IjlMLR77fG+Kv1s8EVFQ4F4TLqTjBdsGGr4LIrzXT6hWqrPilT+Tr VsEGwE+BzL+X81Lvz8djY9TaGKsDNP0LKfYrJupdw2hc3aIWoC+PYN+vEkbIG9R7/ugCzeu0Su8Tq KRmCCmssbVPo5Y6ILHhpzo2ZhfqR4XBUf0c2mldYL3SKRl803RrVxmpVlHoKTm/jFdHzJswqRSvPy ocPilo1Xxfhv686EnBruIv5ezO0x6eZ8YsKtC3bXa4qtSTOUI1fK43PtHpfmoxEVz/DrYu/ztjf+J I+67ZCfGA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOBO-000284-JX; Thu, 10 Dec 2020 15:48:42 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOAo-0001qF-0s for openwrt-devel@lists.openwrt.org; Thu, 10 Dec 2020 15:48:13 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 1D4AD18F41; Thu, 10 Dec 2020 16:48:05 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id aca388f1; Thu, 10 Dec 2020 16:47:47 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH uclient 02/12] Add basic cram based unit tests Date: Thu, 10 Dec 2020 16:47:49 +0100 Message-Id: <20201210154759.1114-3-ynezz@true.cz> In-Reply-To: <20201210154759.1114-1-ynezz@true.cz> References: <20201210154759.1114-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201210_104806_411963_AD49F3AE X-CRM114-Status: GOOD ( 19.21 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 NUMERIC_HTTP_ADDR URI: Uses a numeric IP address in URL 0.0 WEIRD_PORT URI: Uses non-standard port number for HTTP X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org For the start just basic uclient-fetch functionality coverage. Signed-off-by: Petr Štetiar --- CMakeLists.txt | 24 ++++++++- tests/CMakeLists.txt | 1 + tests/cram/CMakeLists.txt | 38 ++++++++++++++ tests/cram/server/lorem | 64 +++++++++++++++++++++++ tests/cram/test-san_uclient-fetch.t | 78 +++++++++++++++++++++++++++++ tests/cram/test_uclient-fetch.t | 77 ++++++++++++++++++++++++++++ 6 files changed, 280 insertions(+), 2 deletions(-) create mode 100644 tests/CMakeLists.txt create mode 100644 tests/cram/CMakeLists.txt create mode 100644 tests/cram/server/lorem create mode 100644 tests/cram/test-san_uclient-fetch.t create mode 100644 tests/cram/test_uclient-fetch.t diff --git a/CMakeLists.txt b/CMakeLists.txt index 841bc0f8f17c..c2f1fdb2f662 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,12 +16,32 @@ ELSE(BUILD_STATIC) FIND_LIBRARY(ubox_library NAMES ubox) ENDIF(BUILD_STATIC) -ADD_LIBRARY(uclient SHARED uclient.c uclient-http.c uclient-utils.c) +SET(LIB_SOURCES uclient.c uclient-http.c uclient-utils.c) +ADD_LIBRARY(uclient SHARED ${LIB_SOURCES}) TARGET_LINK_LIBRARIES(uclient ${ubox_library} dl) -ADD_EXECUTABLE(uclient-fetch uclient-fetch.c progress.c) +SET(CLI_SOURCES uclient-fetch.c progress.c) +ADD_EXECUTABLE(uclient-fetch ${CLI_SOURCES}) TARGET_LINK_LIBRARIES(uclient-fetch uclient) +IF(UNIT_TESTING) + ADD_DEFINITIONS(-DUNIT_TESTING) + ENABLE_TESTING() + ADD_SUBDIRECTORY(tests) + + IF(CMAKE_C_COMPILER_ID STREQUAL "Clang") + ADD_LIBRARY(uclient-san SHARED ${LIB_SOURCES}) + TARGET_COMPILE_OPTIONS(uclient-san PRIVATE -g -fno-omit-frame-pointer -fsanitize=undefined,address,leak -fno-sanitize-recover=all) + TARGET_LINK_OPTIONS(uclient-san PRIVATE -fsanitize=undefined,address,leak) + TARGET_LINK_LIBRARIES(uclient-san ${ubox_library} dl) + + ADD_EXECUTABLE(uclient-fetch-san ${CLI_SOURCES}) + TARGET_COMPILE_OPTIONS(uclient-fetch-san PRIVATE -g -fno-omit-frame-pointer -fsanitize=undefined,address,leak -fno-sanitize-recover=all) + TARGET_LINK_OPTIONS(uclient-fetch-san PRIVATE -fsanitize=undefined,address,leak) + TARGET_LINK_LIBRARIES(uclient-fetch-san uclient-san ${ubox_library} dl) + ENDIF() +ENDIF() + INSTALL(FILES uclient.h uclient-utils.h DESTINATION include/libubox ) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 000000000000..3d339b1ebc53 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1 @@ +ADD_SUBDIRECTORY(cram) diff --git a/tests/cram/CMakeLists.txt b/tests/cram/CMakeLists.txt new file mode 100644 index 000000000000..ba75802ae21c --- /dev/null +++ b/tests/cram/CMakeLists.txt @@ -0,0 +1,38 @@ +FIND_PACKAGE(PythonInterp 3 REQUIRED) +FILE(GLOB test_cases "test_*.t") + +IF(CMAKE_C_COMPILER_ID STREQUAL "Clang") + FILE(GLOB test_cases_san "test-san_*.t") +ENDIF() + +SET(PYTHON_VENV_DIR "${CMAKE_CURRENT_BINARY_DIR}/.venv") +SET(PYTHON_VENV_PIP "${PYTHON_VENV_DIR}/bin/pip") +SET(PYTHON_VENV_CRAM "${PYTHON_VENV_DIR}/bin/cram") + +ADD_CUSTOM_COMMAND( + OUTPUT ${PYTHON_VENV_CRAM} + COMMAND ${PYTHON_EXECUTABLE} -m venv ${PYTHON_VENV_DIR} + COMMAND ${PYTHON_VENV_PIP} install cram +) +ADD_CUSTOM_TARGET(prepare-cram-venv ALL DEPENDS ${PYTHON_VENV_CRAM}) + +ADD_CUSTOM_TARGET( + http-server-kill ALL + COMMAND pkill --full -9 "${PYTHON_VENV_DIR}/bin/python3 -m http.server 1922 --bind 127.0.0.1" > /dev/null 2>&1 || true + DEPENDS ${PYTHON_VENV_CRAM} +) + +ADD_CUSTOM_TARGET( + http-server ALL + COMMAND ${PYTHON_VENV_DIR}/bin/python3 -m http.server 1922 --bind 127.0.0.1 > /dev/null 2>&1 & + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/server + DEPENDS http-server-kill +) + +ADD_TEST( + NAME cram + COMMAND ${PYTHON_VENV_CRAM} ${test_cases} ${test_cases_san} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +SET_PROPERTY(TEST cram APPEND PROPERTY ENVIRONMENT "BUILD_BIN_DIR=$") diff --git a/tests/cram/server/lorem b/tests/cram/server/lorem new file mode 100644 index 000000000000..133af11d18f8 --- /dev/null +++ b/tests/cram/server/lorem @@ -0,0 +1,64 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas accumsan dui +diam, sit amet vehicula nisl tincidunt non. Duis orci urna, luctus porttitor +viverra non, interdum id erat. Vivamus in tortor eu augue dignissim imperdiet +vitae ut ligula. Nunc luctus arcu viverra dolor commodo, et pellentesque +lectus convallis. Donec molestie gravida venenatis. Curabitur vitae nulla at +nisi ullamcorper sagittis vitae eget arcu. Sed elementum neque metus, in +sollicitudin lorem vestibulum sed. Etiam non leo id eros ultrices hendrerit. + +Etiam sed luctus lacus. Fusce congue quam varius, cursus enim id, varius +tellus. Suspendisse at mauris blandit, tempor urna non, pharetra tortor. In +laoreet turpis a sollicitudin auctor. Duis semper diam mi, at mollis dolor +tristique a. Sed sed mauris diam. Curabitur vel eleifend lorem. Quisque vel +erat ac nulla vestibulum elementum. Curabitur euismod mauris lorem, at +vestibulum justo accumsan eget. Proin pharetra scelerisque est, eget lobortis +nulla. Ut sit amet tellus pellentesque, fermentum erat vitae, euismod risus. +Vivamus sed nibh ut neque efficitur lacinia hendrerit accumsan leo. +Suspendisse feugiat molestie suscipit. + +Sed mattis elit non nibh interdum, eu volutpat sem euismod. Nullam eu nibh id +ligula semper molestie quis at nisi. Nulla vulputate, risus vitae vulputate +dapibus, ligula erat volutpat dui, in condimentum tortor sapien et eros. Cras +sed est consectetur, iaculis est a, ultricies felis. Phasellus dignissim neque +quis urna aliquam, at consequat turpis rutrum. Ut gravida dolor nisi, et +aliquam massa fermentum sit amet. In eu odio vel libero suscipit dignissim et +ac justo. Morbi quis sollicitudin elit. Etiam varius vel odio ac dapibus. Sed +ut lorem auctor, scelerisque lacus sit amet, ultrices lorem. Mauris dui +mauris, sagittis id fermentum vitae, tincidunt vel sem. Morbi viverra erat +nulla, et pharetra mauris condimentum maximus. Nam orci ex, semper nec rutrum +sed, gravida lobortis nisl. + +Vivamus eleifend ligula leo, a sodales augue blandit eget. Sed varius molestie +neque vel placerat. Nam volutpat sodales metus, et blandit ipsum vulputate et. +Quisque eget quam sit amet nisl blandit varius in ac neque. Pellentesque +habitant morbi tristique senectus et netus et malesuada fames ac turpis +egestas. Donec ultricies mattis porta. Pellentesque in sollicitudin lacus. + +Duis quis dui consequat lacus ullamcorper pretium at eget justo. Mauris +placerat dui vel augue rutrum luctus. Fusce mi purus, faucibus nec euismod sit +amet, condimentum sed sem. Ut dictum arcu et eros volutpat, et gravida erat +ultricies. Nam auctor, augue vitae cursus tempor, nisi lacus hendrerit massa, +a varius mauris est sit amet sapien. Cras ac varius turpis. Ut vitae ligula +neque. Cras nec felis ut orci accumsan maximus. Maecenas sed tempus magna. + +Sed metus risus, eleifend vitae viverra nec, volutpat vitae velit. Vivamus +sodales porttitor urna, quis hendrerit est tempus nec. Mauris ligula ex, +commodo vitae odio vel, volutpat lacinia libero. Nulla facilisis, ex sit amet +rhoncus cursus, purus turpis condimentum mi, ac euismod tellus elit eu felis. +Sed ultrices dolor pulvinar, laoreet lacus in, viverra arcu. Pellentesque a +turpis felis. Morbi ornare nunc a hendrerit elementum. + +Sed laoreet dictum consequat. Maecenas et scelerisque justo, et vulputate +diam. Vivamus nec erat quis nunc rutrum consectetur. Sed venenatis orci +ligula, nec luctus massa tristique non. Etiam porta, nunc scelerisque bibendum +tincidunt, mauris libero consequat odio, eu tempus neque augue eget massa. +Nulla eu risus fermentum, ornare ipsum a, blandit nulla. Mauris in tempus +quam, eu rutrum risus. Nunc maximus fringilla ante, et suscipit mi dictum +laoreet. In sed ligula dictum, maximus neque ut, tincidunt mauris. Sed +ultricies mauris in neque semper, eu congue nisl ullamcorper. Aliquam ac +aliquam arcu. + +Nulla ante sapien, egestas at mattis vel, vehicula vitae urna. In tempus at +nibh consequat scelerisque. Etiam interdum placerat erat ut finibus. Sed +fermentum dignissim ligula, quis vehicula nulla faucibus aliquam. Cras elit +lacus, porta ut vehicula eget orci aliquam. diff --git a/tests/cram/test-san_uclient-fetch.t b/tests/cram/test-san_uclient-fetch.t new file mode 100644 index 000000000000..09a0f62b13fb --- /dev/null +++ b/tests/cram/test-san_uclient-fetch.t @@ -0,0 +1,78 @@ +check uclient-fetch usage: + + $ [ -n "$BUILD_BIN_DIR" ] && export PATH="$BUILD_BIN_DIR:$PATH" + $ alias uc='uclient-fetch-san' + + $ uc + Usage: uclient-fetch-san [options] + Options: + \t-4\t\t\t\tUse IPv4 only (esc) + \t-6\t\t\t\tUse IPv6 only (esc) + \t-q\t\t\t\tTurn off status messages (esc) + \t-O \t\t\tRedirect output to file (use "-" for stdout) (esc) + \t-P \t\t\tSet directory for output files (esc) + \t--user=\t\t\tHTTP authentication username (esc) + \t--password=\t\tHTTP authentication password (esc) + \t--user-agent|-U \t\tSet HTTP user agent (esc) + \t--post-data=STRING\t\tuse the POST method; send STRING as the data (esc) + \t--post-file=FILE\t\tuse the POST method; send FILE as the data (esc) + \t--spider|-s\t\t\tSpider mode - only check file existence (esc) + \t--timeout=N|-T N\t\tSet connect/request timeout to N seconds (esc) + \t--proxy=on|off|-Y on|off\tEnable/disable env var configured proxy (esc) + + HTTPS options: + \t--ca-certificate=\t\tLoad CA certificates from file (esc) + \t--no-check-certificate\t\tdon't validate the server's certificate (esc) + \t--ciphers=\t\tSet the cipher list string (esc) + + [1] + +download lorem ipsum verbose: + + $ uc -O lorem http://127.0.0.1:1922/lorem + Downloading 'http://127.0.0.1:1922/lorem' + Connecting to 127.0.0.1:1922 + Writing to 'lorem' + \r (no-eol) (esc) + lorem 100% |*******************************| 4111 0:00:00 ETA + Download completed (4111 bytes) + + $ md5sum lorem + 887943f7c25bd6cec4570c405241b425 lorem + +download lorem ipsum quiet: + + $ uc -q -O lorem http://127.0.0.1:1922/lorem + + $ md5sum lorem + 887943f7c25bd6cec4570c405241b425 lorem + +check that HTTP 404 errors are handled properly: + + $ uc http://127.0.0.1:1922/does-not-exist + Downloading 'http://127.0.0.1:1922/does-not-exist' + Connecting to 127.0.0.1:1922 + HTTP error 404 + [8] + + $ uc -q http://127.0.0.1:1922/does-not-exist + [8] + +check handling of certificate issues: + + $ uc -O /dev/null 'https://self-signed.badssl.com/' 2>&1 | grep error + Connection error: Invalid SSL certificate + + $ uc -O /dev/null 'https://untrusted-root.badssl.com/' 2>&1 | grep error + Connection error: Invalid SSL certificate + + $ uc -O /dev/null 'https://expired.badssl.com/' 2>&1 | grep error + Connection error: Invalid SSL certificate + +check that certificate issues can be disabled: + + $ uc --no-check-certificate -q -O /dev/null 'https://self-signed.badssl.com/' + + $ uc --no-check-certificate -q -O /dev/null 'https://untrusted-root.badssl.com/' + + $ uc --no-check-certificate -q -O /dev/null 'https://expired.badssl.com/' diff --git a/tests/cram/test_uclient-fetch.t b/tests/cram/test_uclient-fetch.t new file mode 100644 index 000000000000..aa07c31a1619 --- /dev/null +++ b/tests/cram/test_uclient-fetch.t @@ -0,0 +1,77 @@ +check uclient-fetch usage: + + $ [ -n "$BUILD_BIN_DIR" ] && export PATH="$BUILD_BIN_DIR:$PATH" + $ alias uc='valgrind --quiet --leak-check=full uclient-fetch' + + $ uc + Usage: uclient-fetch [options] + Options: + \t-4\t\t\t\tUse IPv4 only (esc) + \t-6\t\t\t\tUse IPv6 only (esc) + \t-q\t\t\t\tTurn off status messages (esc) + \t-O \t\t\tRedirect output to file (use "-" for stdout) (esc) + \t-P \t\t\tSet directory for output files (esc) + \t--user=\t\t\tHTTP authentication username (esc) + \t--password=\t\tHTTP authentication password (esc) + \t--user-agent|-U \t\tSet HTTP user agent (esc) + \t--post-data=STRING\t\tuse the POST method; send STRING as the data (esc) + \t--post-file=FILE\t\tuse the POST method; send FILE as the data (esc) + \t--spider|-s\t\t\tSpider mode - only check file existence (esc) + \t--timeout=N|-T N\t\tSet connect/request timeout to N seconds (esc) + \t--proxy=on|off|-Y on|off\tEnable/disable env var configured proxy (esc) + + HTTPS options: + \t--ca-certificate=\t\tLoad CA certificates from file (esc) + \t--no-check-certificate\t\tdon't validate the server's certificate (esc) + \t--ciphers=\t\tSet the cipher list string (esc) + + [1] + +download lorem ipsum verbose: + + $ uc -O lorem http://127.0.0.1:1922/lorem + Downloading 'http://127.0.0.1:1922/lorem' + Connecting to 127.0.0.1:1922 + Writing to 'lorem' + \r (no-eol) (esc) + lorem 100% |*******************************| 4111 0:00:00 ETA + Download completed (4111 bytes) + $ md5sum lorem + 887943f7c25bd6cec4570c405241b425 lorem + +download lorem ipsum quiet: + + $ uc -q -O lorem http://127.0.0.1:1922/lorem + + $ md5sum lorem + 887943f7c25bd6cec4570c405241b425 lorem + +check that HTTP 404 errors are handled properly: + + $ uc http://127.0.0.1:1922/does-not-exist + Downloading 'http://127.0.0.1:1922/does-not-exist' + Connecting to 127.0.0.1:1922 + HTTP error 404 + [8] + + $ uc -q http://127.0.0.1:1922/does-not-exist + [8] + +check handling of certificate issues: + + $ uc -O /dev/null 'https://self-signed.badssl.com/' 2>&1 | grep error + Connection error: Invalid SSL certificate + + $ uc -O /dev/null 'https://untrusted-root.badssl.com/' 2>&1 | grep error + Connection error: Invalid SSL certificate + + $ uc -O /dev/null 'https://expired.badssl.com/' 2>&1 | grep error + Connection error: Invalid SSL certificate + +check that certificate issues can be disabled: + + $ uc --no-check-certificate -q -O /dev/null 'https://self-signed.badssl.com/' + + $ uc --no-check-certificate -q -O /dev/null 'https://untrusted-root.badssl.com/' + + $ uc --no-check-certificate -q -O /dev/null 'https://expired.badssl.com/' From patchwork Thu Dec 10 15:47:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1414311 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=JVHjm/wM; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CsJJb36N6z9s0b for ; Fri, 11 Dec 2020 02:49:51 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Fi0V++vBpuVpfVa7jaY/HJrVD7dAUBPOxmebDoTRkZU=; b=JVHjm/wME3hWNfX6bwR5bVOOV yA5Ml+LVgdZAvng9D64a5i/N7fgn1+B2VUuyn7LqAXv+mcSbJnSqua9GB9aoU4MnOT3ZpS78S+Z0E GBOChdRm9zgl5HLK/Ie/SDwW1w26z5bjBF2zX0XATXv6CmgdkCUsKTZn8rL0m8H2C037HT4SbncUA AVsbfUuAZ735d/J9CQnTaLy8mRSaR0zd35AtT1hPS+VOYOvm+w15u1I3O7EGmAS4nlYG2si4VPvlv +gFqqgLnFuQx1nrCk7Ys69o4MoO4ds8NAR2VQ57ulLj83eQx8aQRSpywZ+3ubENhZWV1DVDj9HWNT 1s3nOO4kw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOB7-00020Y-4i; Thu, 10 Dec 2020 15:48:25 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOAo-0001qG-4V for openwrt-devel@lists.openwrt.org; Thu, 10 Dec 2020 15:48:08 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 3F99B18F42; Thu, 10 Dec 2020 16:48:05 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id dda30af9; Thu, 10 Dec 2020 16:47:47 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH uclient 03/12] Fix extra compiler warnings Date: Thu, 10 Dec 2020 16:47:50 +0100 Message-Id: <20201210154759.1114-4-ynezz@true.cz> In-Reply-To: <20201210154759.1114-1-ynezz@true.cz> References: <20201210154759.1114-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201210_104806_405315_C9ACE12D X-CRM114-Status: GOOD ( 20.14 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Fixes following -Wextra compiler warnings: uclient.c:195:16: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] for (i = 0; i < ARRAY_SIZE(backends); i++) { ~ ^ ~~~~~~~~~~~~~~~~~~~~ uclient-http.c:619:2: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] blobmsg_for_each_attr(cur, uh->headers.head, rem) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ uclient-http.c:619:2: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] blobmsg_for_each_attr(cur, uh->headers.head, rem) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ uclient-http.c:993:16: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] for (i = 0; i < ARRAY_SIZE(request_types); i++) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ uclient.c:195:16: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] for (i = 0; i < ARRAY_SIZE(backends); i++) { ~ ^ ~~~~~~~~~~~~~~~~~~~~ uclient-http.c:619:2: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] blobmsg_for_each_attr(cur, uh->headers.head, rem) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ uclient-http.c:619:2: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] blobmsg_for_each_attr(cur, uh->headers.head, rem) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ uclient-http.c:993:16: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] for (i = 0; i < ARRAY_SIZE(request_types); i++) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ uclient-fetch.c:551:67: error: missing field 'flag' initializer [-Werror,-Wmissing-field-initializers] [L_NO_CHECK_CERTIFICATE] = { "no-check-certificate", no_argument }, Signed-off-by: Petr Štetiar --- uclient-fetch.c | 30 +++++++++++++++--------------- uclient-http.c | 5 +++-- uclient.c | 2 +- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/uclient-fetch.c b/uclient-fetch.c index 061f0fd4f808..5f7ac6200bb8 100644 --- a/uclient-fetch.c +++ b/uclient-fetch.c @@ -497,7 +497,7 @@ static int usage(const char *progname) static void init_ca_cert(void) { glob_t gl; - int i; + unsigned int i; glob("/etc/ssl/certs/*.crt", 0, NULL, &gl); for (i = 0; i < gl.gl_pathc; i++) @@ -548,20 +548,20 @@ enum { }; static const struct option longopts[] = { - [L_NO_CHECK_CERTIFICATE] = { "no-check-certificate", no_argument }, - [L_CA_CERTIFICATE] = { "ca-certificate", required_argument }, - [L_CIPHERS] = { "ciphers", required_argument }, - [L_USER] = { "user", required_argument }, - [L_PASSWORD] = { "password", required_argument }, - [L_USER_AGENT] = { "user-agent", required_argument }, - [L_POST_DATA] = { "post-data", required_argument }, - [L_POST_FILE] = { "post-file", required_argument }, - [L_SPIDER] = { "spider", no_argument }, - [L_TIMEOUT] = { "timeout", required_argument }, - [L_CONTINUE] = { "continue", no_argument }, - [L_PROXY] = { "proxy", required_argument }, - [L_NO_PROXY] = { "no-proxy", no_argument }, - [L_QUIET] = { "quiet", no_argument }, + [L_NO_CHECK_CERTIFICATE] = { "no-check-certificate", no_argument, NULL, 0 }, + [L_CA_CERTIFICATE] = { "ca-certificate", required_argument, NULL, 0 }, + [L_CIPHERS] = { "ciphers", required_argument, NULL, 0 }, + [L_USER] = { "user", required_argument, NULL, 0 }, + [L_PASSWORD] = { "password", required_argument, NULL, 0 }, + [L_USER_AGENT] = { "user-agent", required_argument, NULL, 0 }, + [L_POST_DATA] = { "post-data", required_argument, NULL, 0 }, + [L_POST_FILE] = { "post-file", required_argument, NULL, 0 }, + [L_SPIDER] = { "spider", no_argument, NULL, 0 }, + [L_TIMEOUT] = { "timeout", required_argument, NULL, 0 }, + [L_CONTINUE] = { "continue", no_argument, NULL, 0 }, + [L_PROXY] = { "proxy", required_argument, NULL, 0 }, + [L_NO_PROXY] = { "no-proxy", no_argument, NULL, 0 }, + [L_QUIET] = { "quiet", no_argument, NULL, 0 }, {} }; diff --git a/uclient-http.c b/uclient-http.c index c1f722878df7..279669620ebe 100644 --- a/uclient-http.c +++ b/uclient-http.c @@ -596,7 +596,8 @@ uclient_http_send_headers(struct uclient_http *uh) struct blob_attr *cur; enum request_type req_type = uh->req_type; bool literal_ipv6; - int err, rem; + int err; + size_t rem; if (uh->state >= HTTP_STATE_HEADERS_SENT) return 0; @@ -982,7 +983,7 @@ int uclient_http_set_request_type(struct uclient *cl, const char *type) { struct uclient_http *uh = container_of(cl, struct uclient_http, uc); - int i; + unsigned int i; if (cl->backend != &uclient_backend_http) return -1; diff --git a/uclient.c b/uclient.c index 9f98cbca167f..95e4585a61cf 100644 --- a/uclient.c +++ b/uclient.c @@ -190,7 +190,7 @@ uclient_get_url(const char *url_str, const char *auth_str) struct uclient_url *url; const char *location; int host_len; - int i; + unsigned int i; for (i = 0; i < ARRAY_SIZE(backends); i++) { int prefix_len = 0; From patchwork Thu Dec 10 15:47:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1414308 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=G69DIZ31; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CsJJY62Sdz9s0b for ; Fri, 11 Dec 2020 02:49:49 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Uei/yt/X7WDVPTHHsfFdWGnLtIcSkgPhZf2fCnLgH2I=; b=G69DIZ31hSIMUA8rYyenVdCyp t7Pw2WkMynmbrzpSiPyNkM7+PZIW7iLBL9pu4xO8ckc0qm/QNaGdiHd0nHo61vg8kv4V5uu/fTIPn Hw1Y5eyc8cXZJmk25sV4kuhUx4H+dpGWEQqJkH5MHbAWVF/JWEjuTDH/NRbVU/WLeysi71UiIsRpe ooAjRO45G73jOhAsf87EfvQVLyGdaWsT0wIe3d2lhqqZpLo0EjHsIrSrse7RiVD0HtDkLEKOku4bh umSaWuDTCrwMqHtBmd2n8mCbvinMbOpSQ620xoqLKw26KMWgfy2NkpoeklMWdeWkWTixhvtBa89hM xFTvWTUyg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOB5-0001zu-3v; Thu, 10 Dec 2020 15:48:23 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOAo-0001qQ-B6 for openwrt-devel@lists.openwrt.org; Thu, 10 Dec 2020 15:48:08 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 5D03D18F43; Thu, 10 Dec 2020 16:48:05 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id e3cd8064; Thu, 10 Dec 2020 16:47:48 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH uclient 04/12] uclient-http: fix freeing of stack allocated memory Date: Thu, 10 Dec 2020 16:47:51 +0100 Message-Id: <20201210154759.1114-5-ynezz@true.cz> In-Reply-To: <20201210154759.1114-1-ynezz@true.cz> References: <20201210154759.1114-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201210_104806_550098_6CEAAC4D X-CRM114-Status: GOOD ( 16.92 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Fixes following issue reported by clang-12 static analyzer: uclient-http.c:568:2: warning: Memory allocated by alloca() should not be deallocated [unix.Malloc] free(buf_orig); ^~~~~~~~~~~~~~ Signed-off-by: Petr Štetiar --- uclient-http.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/uclient-http.c b/uclient-http.c index 279669620ebe..7eb469221d7f 100644 --- a/uclient-http.c +++ b/uclient-http.c @@ -441,7 +441,7 @@ uclient_http_add_auth_digest(struct uclient_http *uh) struct uclient_url *url = uh->uc.url; const char *realm = NULL, *opaque = NULL; const char *user, *password; - char *buf, *next, *buf_orig; + char *buf, *next; int len, ofs; int err = 0; @@ -471,7 +471,7 @@ uclient_http_add_auth_digest(struct uclient_http *uh) strcpy(buf, uh->auth_str); /* skip auth type */ - buf_orig = strsep(&buf, " "); + strsep(&buf, " "); next = buf; while (*next) { @@ -507,7 +507,7 @@ uclient_http_add_auth_digest(struct uclient_http *uh) if (!realm || !data.qop || !data.nonce) { err = -EINVAL; - goto fail_buf; + goto fail; } sprintf(nc_str, "%08x", uh->nc++); @@ -524,13 +524,13 @@ uclient_http_add_auth_digest(struct uclient_http *uh) len = password - url->auth; if (len > 256) { err = -EINVAL; - goto fail_buf; + goto fail; } user_buf = alloca(len + 1); if (!user_buf) { err = -ENOMEM; - goto fail_buf; + goto fail; } strncpy(user_buf, url->auth, len); @@ -564,8 +564,6 @@ uclient_http_add_auth_digest(struct uclient_http *uh) return 0; -fail_buf: - free(buf_orig); fail: return err; } From patchwork Thu Dec 10 15:47:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1414309 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=dO3nRAqn; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CsJJb1k0Bz9sW1 for ; Fri, 11 Dec 2020 02:49:51 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cysBg1s0Ly+SqRVVz115YhLTnbz1I9CrY19I5dt2f9Y=; b=dO3nRAqnbawG9FeKB/HW8LrhD 6B7ZjXT2cpgacMFJnQBC2xSt3PrapZ422a6jcxbCr8WSBm/I5NGwig2UXHpR9vkR6ituCI0LEfYsU u8tHW8TXOMVzf4+23GwP+Ujf++AsJyduJqlFvcmurOp8UiDqyk/+jJ9Tpjyt0tlxjjX4EoUSQyhu5 cWOOY0H3Rg17kQwSwyJJD6vlgl1RTMpedYpUVV1ckkh+m8kBZ2ISOecjCEO01J/TSey52PReFOQDh Tcxk4KqBUqftKipjY/E+J5KXWm2DWU+iJJatbwyo2TitcGx0qEmQBmnjipjhi7St4gPDwkMD4QSpf Im8MZltnQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOB9-00021k-RL; Thu, 10 Dec 2020 15:48:27 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOAp-0001rg-FF for openwrt-devel@lists.openwrt.org; Thu, 10 Dec 2020 15:48:09 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 7A81018F44; Thu, 10 Dec 2020 16:48:05 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id a2fb2c30; Thu, 10 Dec 2020 16:47:48 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH uclient 05/12] uclient-fetch: fix statement may fallt hrough Date: Thu, 10 Dec 2020 16:47:52 +0100 Message-Id: <20201210154759.1114-6-ynezz@true.cz> In-Reply-To: <20201210154759.1114-1-ynezz@true.cz> References: <20201210154759.1114-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201210_104807_716565_0179669A X-CRM114-Status: GOOD ( 15.63 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Fixes following issue reported by clang-12 static analyzer: uclient-fetch.c:228:6: error: this statement may fall through [-Werror=implicit-fallthrough=] if (sscanf(blobmsg_get_string(tb[H_RANGE]), ^ uclient-fetch.c:236:2: note: here case 204: ^~~~ Signed-off-by: Petr Štetiar --- uclient-fetch.c | 1 + 1 file changed, 1 insertion(+) diff --git a/uclient-fetch.c b/uclient-fetch.c index 5f7ac6200bb8..0c7a1232f256 100644 --- a/uclient-fetch.c +++ b/uclient-fetch.c @@ -233,6 +233,7 @@ static void header_done_cb(struct uclient *cl) error_ret = 8; break; } + /* fall through */ case 204: case 200: if (no_output) From patchwork Thu Dec 10 15:47:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1414304 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=yf7C+U6w; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CsJJN57P1z9s0b for ; Fri, 11 Dec 2020 02:49:40 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dz1cI3OXBGf+NDNYL5I8Dkc/IiRTPL2U0ze33UCWcwk=; b=yf7C+U6w6BKUZs03GOaQNwN+U v0LPRqhCtu2FItD2BmNRjKWNNK2/HYW62UFKI6XyJTrTNY9g6Ysn7bPPx9EBdD3vy29SQvE3TOFvg h1NZ0AWhKU/DIjlTmqTZauydtnBelqS6Oo3r6PcuSJWP84Ofh2BoH4PproTdadwLqnt0GWz65FPyz eyo9/qG8MT+NDZxITmPiE7tkILblwXE5nDs35ehMqzoOfYjD6egOriDRXBFVhA+3WoeSZQ6bL98aO p8j1oQLiaih1rY+OJqCnLAEICZ5yu3YIZXqdrqC9O9IwHSLDk03EyDKrW+HMAuhFj6gvJDPFAtsjU 7NZiyUhKw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOBC-00022k-Ej; Thu, 10 Dec 2020 15:48:30 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOAp-0001rl-KW for openwrt-devel@lists.openwrt.org; Thu, 10 Dec 2020 15:48:10 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id B4B1518F45; Thu, 10 Dec 2020 16:48:06 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 7ef08b8a; Thu, 10 Dec 2020 16:47:49 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH uclient 06/12] uclient: fix initialized but never read variable Date: Thu, 10 Dec 2020 16:47:53 +0100 Message-Id: <20201210154759.1114-7-ynezz@true.cz> In-Reply-To: <20201210154759.1114-1-ynezz@true.cz> References: <20201210154759.1114-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201210_104807_825589_60DF5027 X-CRM114-Status: GOOD ( 17.32 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Fixes following issue reported by clang-12 static analyzer: uclient.c:290:22: warning: Value stored to 'url' during its initialization is never read [deadcode.DeadStores] struct uclient_url *url = cl->url; ^~~ ~~~~~~~ Signed-off-by: Petr Štetiar --- uclient.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uclient.c b/uclient.c index 95e4585a61cf..a372d4a9dcbf 100644 --- a/uclient.c +++ b/uclient.c @@ -287,7 +287,7 @@ int uclient_set_proxy_url(struct uclient *cl, const char *url_str, const char *a int uclient_set_url(struct uclient *cl, const char *url_str, const char *auth_str) { const struct uclient_backend *backend = cl->backend; - struct uclient_url *url = cl->url; + struct uclient_url *url; url = uclient_get_url(url_str, auth_str); if (!url) From patchwork Thu Dec 10 15:47:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1414310 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=DISkbj8d; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CsJJc2n29z9sTg for ; Fri, 11 Dec 2020 02:49:52 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZHDRUxFN9nNkQsYjxpoWRPZfrD5nrwvdSzSjpa0lITY=; b=DISkbj8dcippv1TMtPu7/DAei 0O1BjNPBTNAxOocBNll/RllxSg2s1jQUxeBJRurYHNNK1rsuk0ScdsqE8pFgDfIsj87j6lnYFEFsD gsm9b5q4VGZCN388W/K76iGmV8o6PIbKFfj+TW2dRkvtT6qFZb6oXi/GC2F/0775KUowl1+EiBxy5 bixBJM6V34FVKN38k+1/oPiy0bX/wj1dcutp8nhKdgL+0p76jX2vyvXtCeuBvLF3GDSZVdYBNfJWc bHTo1rsiNP9alxvdxBeNGNxsQkbWFYS7HPw6iXt4FDNGx/F5O87ti+wLPY2sXhDFgETDcA1PkWacs 1W044gedw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOBI-00024m-0n; Thu, 10 Dec 2020 15:48:36 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOAp-0001rm-Pw for openwrt-devel@lists.openwrt.org; Thu, 10 Dec 2020 15:48:10 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id D235318F46; Thu, 10 Dec 2020 16:48:06 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 1b885617; Thu, 10 Dec 2020 16:47:49 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH uclient 07/12] uclient-fetch: fix potential memory leaks Date: Thu, 10 Dec 2020 16:47:54 +0100 Message-Id: <20201210154759.1114-8-ynezz@true.cz> In-Reply-To: <20201210154759.1114-1-ynezz@true.cz> References: <20201210154759.1114-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201210_104808_010519_AD46F971 X-CRM114-Status: GOOD ( 16.49 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Fixes following issue reported by clang-12 static analyzer: uclient-fetch.c:612:25: warning: Potential leak of memory pointed to by 'username' [unix.Malloc] memset(optarg, '*', strlen(optarg)); ^~~~~~~~~~~~~~ uclient-fetch.c:618:25: warning: Potential leak of memory pointed to by 'password' [unix.Malloc] memset(optarg, '*', strlen(optarg)); ^~~~~~~~~~~~~~ Signed-off-by: Petr Štetiar --- uclient-fetch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uclient-fetch.c b/uclient-fetch.c index 0c7a1232f256..1c66ac6d33ae 100644 --- a/uclient-fetch.c +++ b/uclient-fetch.c @@ -608,13 +608,13 @@ int main(int argc, char **argv) case L_USER: if (!strlen(optarg)) break; - username = strdup(optarg); + username = strdupa(optarg); memset(optarg, '*', strlen(optarg)); break; case L_PASSWORD: if (!strlen(optarg)) break; - password = strdup(optarg); + password = strdupa(optarg); memset(optarg, '*', strlen(optarg)); break; case L_USER_AGENT: From patchwork Thu Dec 10 15:47:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1414307 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=USTYfh4u; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CsJJZ0cKYz9sTg for ; Fri, 11 Dec 2020 02:49:50 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TYbFYwYdAQVCbzkqs/PrvccM+osDrMNOn0W/dTwzOmo=; b=USTYfh4ulNbinFzhYH46sGROk K57yco+kc6CwIwqtj3qEH8lyVNz7b8Z56si7QFB+BAke5dAUnxVrSrvDFJ16Nos9BDxmKvm7L9J0m iaCMl6XzoscUK0VgTX6IkN6expwiM2pW0YwOh6jkaowKpPFwdXAwIFWDiDFfpcmwiiiWL8lCsqeBS xSwACQtQ8OCAtxaLIlNDBRbBLb43vNSRuVKjRU19BRhlVavuy55/fo/tx/2UC1PxHEv4v8zs+0k3z oGpdzdjo9PqH+hutZHz6r+nQh96nb2nMy08pOm+u9gY9ZotsjBoeyWQ0VC+bsU+SDAl4vTNkMpy+T 1BDxKnqTw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOBL-00026d-D0; Thu, 10 Dec 2020 15:48:40 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOAp-0001rp-Tc for openwrt-devel@lists.openwrt.org; Thu, 10 Dec 2020 15:48:11 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id EF60118F47; Thu, 10 Dec 2020 16:48:06 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id d19bc441; Thu, 10 Dec 2020 16:47:49 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH uclient 08/12] uclient-http: fix extra compiler warnings on mips_24kc and cortex-a9+neon Date: Thu, 10 Dec 2020 16:47:55 +0100 Message-Id: <20201210154759.1114-9-ynezz@true.cz> In-Reply-To: <20201210154759.1114-1-ynezz@true.cz> References: <20201210154759.1114-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201210_104808_204056_77FA20A5 X-CRM114-Status: GOOD ( 16.90 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Fixes following warnings as reported on 32-bit platforms toolchain-mips_24kc_gcc-8.4.0_musl and toolchain-arm_cortex-a9+neon_gcc-8.4.0_musl_eabi: uclient-http.c:1111:10: error: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Werror=sign-compare] if (len > data_end - data) ^ uclient-http.c:1115:11: error: comparison of integer expressions of different signedness: 'unsigned int' and 'long int' [-Werror=sign-compare] if (len > uh->read_chunked) ^ uclient-http.c:1120:11: error: comparison of integer expressions of different signedness: 'unsigned int' and 'long int' [-Werror=sign-compare] if (len > uh->content_length) ^ References: https://gitlab.com/ynezz/openwrt-uclient/-/pipelines/226912126 Signed-off-by: Petr Štetiar --- uclient-http.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/uclient-http.c b/uclient-http.c index 7eb469221d7f..349e69cdd4ae 100644 --- a/uclient-http.c +++ b/uclient-http.c @@ -1108,16 +1108,17 @@ uclient_http_read(struct uclient *cl, char *buf, unsigned int len) } } - if (len > data_end - data) - len = data_end - data; + unsigned int diff = data_end - data; + if (len > diff) + len = diff; if (uh->read_chunked >= 0) { - if (len > uh->read_chunked) + if (len > (unsigned long) uh->read_chunked) len = uh->read_chunked; uh->read_chunked -= len; } else if (uh->content_length >= 0) { - if (len > uh->content_length) + if (len > (unsigned long) uh->content_length) len = uh->content_length; uh->content_length -= len; From patchwork Thu Dec 10 15:47:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1414312 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=pcUsF9kK; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CsJJm56gWz9sTg for ; Fri, 11 Dec 2020 02:50:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SzR2uh35SeyjDefZklpTc1wYWSlXOR3W4cCxOZL832g=; b=pcUsF9kKstUUvXq+ecubcydWV 1SJpxLveq6WcUzhckYK0eOFktl3wSoGnF4QRka763WbGqizGqBij3anoCZ1ZUKOksa34bKievvbqD oecZ8nmrcw3q6gicmWq41wSyI8/8xVXXQF32Kg+NbHooo5NXu29RfiFSXr5HirtlgqRUV+2LAUVmt GeU6MzxNdNHVvkv9RnudR8ed80PFLrafzud3lE+6eycknjG0ySKw0f1OMUOaWCGM7Kh2BeIlEn0TR 0DlsRIaTUz1VCBnGaeY0oZEDCgjnJm0wVHeFHSUuhLKSWj+/MNGZPlwKqbcRRKVav7Mx5BEB0C14V Og4lYgmAQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOBR-00029c-MD; Thu, 10 Dec 2020 15:48:45 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOAr-0001t8-FS for openwrt-devel@lists.openwrt.org; Thu, 10 Dec 2020 15:48:13 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 1852C18F48; Thu, 10 Dec 2020 16:48:07 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 0f589351; Thu, 10 Dec 2020 16:47:50 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH uclient 09/12] cmake: enable extra compiler checks Date: Thu, 10 Dec 2020 16:47:56 +0100 Message-Id: <20201210154759.1114-10-ynezz@true.cz> In-Reply-To: <20201210154759.1114-1-ynezz@true.cz> References: <20201210154759.1114-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201210_104809_724563_446B510A X-CRM114-Status: GOOD ( 14.87 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Let's enforce additional automatic checks enforced by the compiler in order to catch possible errors during compilation. Signed-off-by: Petr Štetiar --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2f1fdb2f662..74031bb8ef57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,12 @@ cmake_minimum_required(VERSION 2.6) INCLUDE(CheckIncludeFiles) PROJECT(uclient C) -ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations) +ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3) +IF(CMAKE_C_COMPILER_VERSION VERSION_GREATER 6) + ADD_DEFINITIONS(-Wextra -Werror=implicit-function-declaration) + ADD_DEFINITIONS(-Wformat -Werror=format-security -Werror=format-nonliteral) +ENDIF() +ADD_DEFINITIONS(-Wno-unused-parameter -Wmissing-declarations) SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") From patchwork Thu Dec 10 15:47:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1414316 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=qfJIzbtl; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CsJKB5LLrz9s0b for ; Fri, 11 Dec 2020 02:50:22 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KK3YKDO3KhuMv5oDjqrb55KQZCJ+IMKagxtJu+9JYOs=; b=qfJIzbtlEW2paSRgDRPIF9tV4 d+PSq0xxFUCez060a8wcdIXJ5TFmPmtdlfsTLm8Qq8EqD1vz9vclB1XNbnB7YBzJfBoeMAcbJEm4/ 7JljZe4oLRbS+VSlL0wfd3boFxUosjufH2840Fjwv6kl72rAjeceqvMIhULxNP/YqEFezkjq0jYQI fkqujo1azBej0sfaqQmK+rTQ8do839m7kjpYfdu9jJ9KljA3C7GviP+8b4uWV1JnJRk38SbS6aVkP XxJ3som2nZrNwTEbyArktKqGGNE0bJp+GxeopLsTG5kgPOHwah1A7+Kqp4d5KnWspXl4eKTn2FZzi RGZFDxFBg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOBV-0002Bh-Nf; Thu, 10 Dec 2020 15:48:49 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOAr-0001t9-Fm for openwrt-devel@lists.openwrt.org; Thu, 10 Dec 2020 15:48:13 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 37F7218F49; Thu, 10 Dec 2020 16:48:08 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 81b0a78d; Thu, 10 Dec 2020 16:47:50 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH uclient 10/12] uclient-fetch: init_ca_cert: fix memory leak Date: Thu, 10 Dec 2020 16:47:57 +0100 Message-Id: <20201210154759.1114-11-ynezz@true.cz> In-Reply-To: <20201210154759.1114-1-ynezz@true.cz> References: <20201210154759.1114-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201210_104809_740489_CAD34A3C X-CRM114-Status: GOOD ( 16.10 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 NUMERIC_HTTP_ADDR URI: Uses a numeric IP address in URL 0.0 WEIRD_PORT URI: Uses non-standard port number for HTTP X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Fixes following memory leak: $ valgrind --quiet --leak-check=full uclient-fetch -q http://127.0.0.1:1922/does-not-exist 51 (16 direct, 35 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 9 at 0x4C31A3F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4C33D84: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x553C7DF: glob_in_dir (glob.c:1410) by 0x553D5E8: glob@@GLIBC_2.27 (glob.c:1097) by 0x401D62: init_ca_cert (uclient-fetch.c:503) by 0x401D62: main (uclient-fetch.c:741) Signed-off-by: Petr Štetiar --- uclient-fetch.c | 1 + 1 file changed, 1 insertion(+) diff --git a/uclient-fetch.c b/uclient-fetch.c index 1c66ac6d33ae..bbf5eec58d71 100644 --- a/uclient-fetch.c +++ b/uclient-fetch.c @@ -503,6 +503,7 @@ static void init_ca_cert(void) glob("/etc/ssl/certs/*.crt", 0, NULL, &gl); for (i = 0; i < gl.gl_pathc; i++) ssl_ops->context_add_ca_crt_file(ssl_ctx, gl.gl_pathv[i]); + globfree(&gl); } static void init_ustream_ssl(void) From patchwork Thu Dec 10 15:47:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1414315 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=a65TQuPQ; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CsJK25Bkpz9s0b for ; Fri, 11 Dec 2020 02:50:14 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=muCZIrajLlPWVjS5WdqfFA/ctdewfpdNUeH/igyDDLM=; b=a65TQuPQ/7pdu1BIHV4qWDvhF i/J3F+Fi6Zq4+nVBqYFKtDTNaBX9lE0dlp4xF5UJm4eAKdTo3xYJYTQ72OPR1QgQIl2bRczZZlk9a 5hD9t9y12oZeUm9NraTmbTxIaZM8rVv7CXWKfaxXpyQfmdkRBqiGCUobpaNIsxju94gWv59di6Xea gq5T4fscmasUlu//2eBheoyi40gJZRGSVAWFkfRqV7IzvBzpKgSFUBzQsUF0McQ1Vr397jVMLTu1r 0Yn6iKOLRT/Cp2REjLj4ye5JFuTYsuqAQvpMlSyieHT9LFRtbkSJHU6FopmwprihdtFIEuQ4q6ZmF WWSebHRmA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOBi-0002Hx-6C; Thu, 10 Dec 2020 15:49:02 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOAr-0001tK-TZ for openwrt-devel@lists.openwrt.org; Thu, 10 Dec 2020 15:48:15 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 5590F18F4A; Thu, 10 Dec 2020 16:48:08 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 050f2a5d; Thu, 10 Dec 2020 16:47:51 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH uclient 11/12] uclient-fetch: wolfSSL: fix certificate validation Date: Thu, 10 Dec 2020 16:47:58 +0100 Message-Id: <20201210154759.1114-12-ynezz@true.cz> In-Reply-To: <20201210154759.1114-1-ynezz@true.cz> References: <20201210154759.1114-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201210_104810_172023_DD58C720 X-CRM114-Status: GOOD ( 17.54 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Currently wolfSSL doesn't validate any certificates, quoting from README: wolfSSL takes a different approach to certificate verification than OpenSSL does. The default policy for the client is to verify the server, this means that if you don't load CAs to verify the server you'll get a connect error, no signer error to confirm failure (-188). If you want to mimic OpenSSL behavior of having SSL_connect succeed even if verifying the server fails and reducing security you can do this by calling: wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); before calling wolfSSL_new();. Though it's not recommended. wolfSSL simply behaves differently then OpenSSL so once you set SSL_VERIFY_NONE wolfSSL doesn't care about the certificates anymore so every call to SSL_get_verify_result() is going to succeed (returns X509_V_OK) even for invalid certificates and current OpenSSL based post connection verification logic thus doesn't work. So in order to get the validation working we need to use SSL_VERIFY_PEER for wolfSSL by default and allow disabling it explicitly by new `context_set_require_validation()` call. Fixes: FS#3465 Signed-off-by: Petr Štetiar --- uclient-fetch.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/uclient-fetch.c b/uclient-fetch.c index bbf5eec58d71..958f75618194 100644 --- a/uclient-fetch.c +++ b/uclient-fetch.c @@ -591,6 +591,8 @@ int main(int argc, char **argv) switch (longopt_idx) { case L_NO_CHECK_CERTIFICATE: verify = false; + if (ssl_ctx) + ssl_ops->context_set_require_validation(ssl_ctx, verify); break; case L_CA_CERTIFICATE: has_cert = true; From patchwork Thu Dec 10 15:47:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1414314 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=BQk3QXXF; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CsJJw59TFz9s0b for ; Fri, 11 Dec 2020 02:50:08 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jCju53vChKzq52OhvspvEt80q+Dg6738SKZcP+d7yF0=; b=BQk3QXXFHdr2u1RjpLS0xjmLM pCD7H69hFhktkQ7brsTaRXdBpxtsAaymobzEjdxbuui2BcUvOyyQjzOgtFzm10PIKr6oY12D618Ew 4ugV3vQshrZQZ9YSnJPzQS3z9TzwvpS2KA8bfyZWHBClysV7Wr2OCe9UoLUpGoTl8rp8M6xPBV+ou 2VSVLLbHPtj7U58n6BpSlJlbMl5AhL8r7zu5vhngnsiZ8QjbPEBYanbE0iNnUQJYQkQLAYY6ttTE+ r+nCr29LCHu75kY4VJlVCwRHwqZVHw5vxbwsW7NvJYJxWyYt9s/4qVuiTkLkirJlqvOW6/Kd1uESy oNSxYif+Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOBc-0002Fk-Ms; Thu, 10 Dec 2020 15:48:56 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knOAr-0001tL-TO for openwrt-devel@lists.openwrt.org; Thu, 10 Dec 2020 15:48:14 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 72E3B18F4B; Thu, 10 Dec 2020 16:48:08 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id c9f0fadc; Thu, 10 Dec 2020 16:47:51 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH uclient 12/12] Add initial GitLab CI support Date: Thu, 10 Dec 2020 16:47:59 +0100 Message-Id: <20201210154759.1114-13-ynezz@true.cz> In-Reply-To: <20201210154759.1114-1-ynezz@true.cz> References: <20201210154759.1114-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201210_104810_125669_391ECC20 X-CRM114-Status: GOOD ( 18.28 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Uses currently proof-of-concept openwrt-ci[1] in order to: * improve the quality of the codebase in various areas * decrease code review time and help merging contributions faster * get automagic feedback loop on various platforms and tools - out of tree build with OpenWrt SDK on following targets: * ath79-generic * imx6-generic * malta-be * mvebu-cortexa53 - out of tree native build on x86/64 with GCC (versions 8, 9, 10) and Clang 10 - out of tree native x86/64 static code analysis with cppcheck and scan-build from Clang 10 1. https://gitlab.com/ynezz/openwrt-ci/ Signed-off-by: Petr Štetiar --- .gitlab-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000000..94befcee491e --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,7 @@ +variables: + CI_ENABLE_UNIT_TESTING: 1 + CI_TARGET_BUILD_DEPENDS: uclient + +include: + - remote: https://gitlab.com/ynezz/openwrt-ci/raw/master/openwrt-ci/gitlab/main.yml + - remote: https://gitlab.com/ynezz/openwrt-ci/raw/master/openwrt-ci/gitlab/pipeline.yml