From patchwork Fri Dec 8 16:29:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "plaisthos (Code Review)" X-Patchwork-Id: 3512 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:8d12:b0:fc:24ac:f0cb with SMTP id i18csp3710020dys; Fri, 8 Dec 2023 08:30:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4Sj/ECcTt3INdoDvijeteeee6GGoEM69JvyiIboks+IkVd6FJk1ty9cqoFmhP6Bu8zRpV X-Received: by 2002:a17:902:e9cc:b0:1d0:76c2:e34b with SMTP id 12-20020a170902e9cc00b001d076c2e34bmr583646plk.2.1702053058398; Fri, 08 Dec 2023 08:30:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702053058; cv=none; d=google.com; s=arc-20160816; b=nNxb+vZQeVKZd89e+BJe++mc+P7BHeqTfPHNkmJr6YRhlGDAAhPB4xF72czFNvz0O7 Auc9WeWZsvhTxrIhuHgt74ndJ4htY1E9q63+QK6CBCU8/cBpxEApExKjc+dnTFuAheQw GAHnqrQGd/MqsCcymZLt+lo9HWYn75iu8qiQTZ23O858KXSd40cpW6zsDFnLeCOoopHy /sMPj2WRwEmN2Uef/ORVllNIFsHmeNzaL/4k1jMK8w5q/w61jrIrdmnEXBB/5iItAYic P+DjgENNjU9quHU4BtXL8ZzKRQCUv7gtlcNP1z5oYY6Je6gp75SbpLdRMOgLWBlBtuFw B3pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:cc:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:user-agent :mime-version:message-id:references:auto-submitted:to:date:from :dkim-signature:dkim-signature:dkim-signature; bh=k2GVqI7cb8Qts/3v0gOymBuRSyOJgb+5Z5lGNfmiAIk=; fh=GFP4qDxgyJ2WEPo/oeLZg3Mj4NqvY1j2nTvTt7psNwg=; b=CjlZyggH6fCkMIFWp7spCmmeJJyc0noBonhC/3CAtuZ8du2OEjJ+TEsTUu6pdgUnw1 DV2O0e11i2vWKtyw3kepwBYEltV9W0fguz+29h9vJU8XdwVf6YaMDnB3nsVDSOlGcX0l 7Br6b3G6G+flSd8CVsKx/AdCgjp6Uvp2U4bMlkYOM6ChQTzZG2sqWkRgb0tvP1/yydcB OxO2jtWAG3Nc4Y/xZ/hq5RrUXpugblXewLXaJ1TXJAcYymW5ohEyVR0OgxcTY7hAtOFq BB9TtIe6f3XPd8UDlCmJ9gvxy4w7Cw9EuRpSbXSxRB3RtMYPyzERGvmLFKs2/PE66BtC FXSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=XN2yoKHB; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Nlv4GZB1; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b="GoGw/+lo"; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvpn.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id c7-20020a170903234700b001d1cbbf8ec3si1848276plh.467.2023.12.08.08.30.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Dec 2023 08:30:58 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=XN2yoKHB; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Nlv4GZB1; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b="GoGw/+lo"; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvpn.net Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rBdjt-00007H-02; Fri, 08 Dec 2023 16:30:09 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rBdjr-00007A-HJ for openvpn-devel@lists.sourceforge.net; Fri, 08 Dec 2023 16:30:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :Message-ID:Reply-To:References:Subject:List-Unsubscribe:List-Id:Cc:To:Date: From:Sender:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help: List-Subscribe:List-Post:List-Owner:List-Archive; bh=DglX7r12uA6+UMG8HlL/LteKKpxJBGszWpmExaGu4nQ=; b=XN2yoKHB6FtNwcsjc0d0uLriKN v6ZQUwVwuRFfDcN41XyvO/z865kyGWgVN7YJixG2VlJq1iEsrYPcVdEk/j0xX4/inskll7196UJBZ OKN5rFXN4Ua7NEYCgQ9UId+0fbDkFG4D98TY7fsPrlMBBs5mfCK2Gwiz3ncajbqoLXSA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Reply-To: References:Subject:List-Unsubscribe:List-Id:Cc:To:Date:From:Sender:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help:List-Subscribe:List-Post: List-Owner:List-Archive; bh=DglX7r12uA6+UMG8HlL/LteKKpxJBGszWpmExaGu4nQ=; b=N lv4GZB1wbEq4DtEBda5rhxpA5uZAd71zprbMBmmY5SPW9FWr7eNtPOi3JyzLoxph40aIuo+dVwlaJ YTebtL3yVtyYe0wvR25I73+2b/tpSlycjUlUeUafceKlyNl1e/zbdjUD0D4FRAvindjjbgcnmR1/O b17txJRFZgC9sxu8=; Received: from mail-wm1-f50.google.com ([209.85.128.50]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1rBdjn-0007lb-KV for openvpn-devel@lists.sourceforge.net; Fri, 08 Dec 2023 16:30:04 +0000 Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-40c09f4bea8so24344635e9.1 for ; Fri, 08 Dec 2023 08:30:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1702052992; x=1702657792; darn=lists.sourceforge.net; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from:from:to:cc :subject:date:message-id:reply-to; bh=DglX7r12uA6+UMG8HlL/LteKKpxJBGszWpmExaGu4nQ=; b=GoGw/+loKgfP2wkGzDQe/9kNCgsQiR4iUsW/Sdc2/JdweE+QzTGpXVixlfAwH8/kOF UjCy+clhoWkrTryOeZBjcu0jfJ8tqYk6F3zntCTakFfnqDKujGZs43Xx+2eFjlT1Jnjc jwpdL8cxCm/tbLSXAMrAXVDvHTG97eqhlR1ncFnMTbYPPHoYN3NkTZKLYmcFW6J+TCl1 iEN7JgwPpXEJjlRWQpc7waMXFwcXP9+4rEf75j/LlimnxaJCyHeyMJGa+j5yLP3DDD1V 5zfAwAEHNma5h6XYS4mK4xr5rYFCOSlM/U2zV6iNVyApO8ClhgoCEut0LO5nSTYgHdkq dMlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702052992; x=1702657792; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DglX7r12uA6+UMG8HlL/LteKKpxJBGszWpmExaGu4nQ=; b=rzFSgFLgq5xn3j4qC97rxEAVe9JO1J8fL7ohP9yGTHRda62mV48gpzqqJQKByzbYcb v5+ipTK7W66GqbckwIYqghTrikS2TCK8bBQbfNnBFO6oM/XkosuHLQH71/GDwBMLTH8l cuRdVXNbHfEv5EbgoEbBSzs6Tsz1aBnCIIsIs/iAXwVbcT9DiwV4jRNZia9NwWXa9Ba9 pXVuXzadLQKYFHlHkDvggzSOfMIJQJlNU6wk3duR2siXC5A8KYJZUSSGq5lkUa8FIR2c fv95SzxS7AdAvQI+kRJQX3iSo45NpxeuQqI40N6f0oKneY5/g3ACWX2t/Hw8k6kAB6FS XXqw== X-Gm-Message-State: AOJu0Yxm12hf/13iGA9A/ovcAd+39paVmhPUvdBlHUQEA5lkdCkHalM5 UL8CF8nR56y09m1JdDuEFqOlGcHWdU3yFEqJylY= X-Received: by 2002:a1c:7c03:0:b0:40c:31e6:cada with SMTP id x3-20020a1c7c03000000b0040c31e6cadamr125404wmc.176.1702052992223; Fri, 08 Dec 2023 08:29:52 -0800 (PST) Received: from gerrit.openvpn.in (ec2-18-159-0-78.eu-central-1.compute.amazonaws.com. [18.159.0.78]) by smtp.gmail.com with ESMTPSA id bd21-20020a05600c1f1500b0040c25abd724sm5725966wmb.9.2023.12.08.08.29.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 08:29:51 -0800 (PST) From: "flichtenheld (Code Review)" X-Google-Original-From: "flichtenheld (Code Review)" X-Gerrit-PatchSet: 1 Date: Fri, 8 Dec 2023 16:29:50 +0000 To: plaisthos Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-Change-Id: Ie8d2d5f6f58679baaf5eb817a7e2ca1afcb8c4db X-Gerrit-Change-Number: 473 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: e8c7c528ed567f4e4d8d504db541873bc8a9d0ed References: Message-ID: <5273d762fe8bd0e65e019fa603bca948818672d1-HTML@gerrit.openvpn.net> MIME-Version: 1.0 User-Agent: Gerrit/3.8.2 X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.128.50 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.128.50 listed in list.dnswl.org] 0.0 WEIRD_PORT URI: Uses non-standard port number for HTTP 0.0 HTML_MESSAGE BODY: HTML included in message -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 T_SCC_BODY_TEXT_LINE No description available. 0.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors in HTML X-Headers-End: 1rBdjn-0007lb-KV Subject: [Openvpn-devel] [S] Change in openvpn[master]: test_user_pass: Add UTs for character filtering X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: frank@lichtenheld.com, arne-openvpn@rfc2549.org, openvpn-devel@lists.sourceforge.net Cc: openvpn-devel Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1784731987505242537?= X-GMAIL-MSGID: =?utf-8?q?1784731987505242537?= X-getmail-filter-classifier: gerrit message type newchange Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/473?usp=email to review the following change. Change subject: test_user_pass: Add UTs for character filtering ...................................................................... test_user_pass: Add UTs for character filtering For simplicity I implemented them only with the inline method, but they actually apply to all methods. Change-Id: Ie8d2d5f6f58679baaf5eb817a7e2ca1afcb8c4db Signed-off-by: Frank Lichtenheld --- M tests/unit_tests/openvpn/test_user_pass.c 1 file changed, 23 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/73/473/1 diff --git a/tests/unit_tests/openvpn/test_user_pass.c b/tests/unit_tests/openvpn/test_user_pass.c index edd566a..e468d3f 100644 --- a/tests/unit_tests/openvpn/test_user_pass.c +++ b/tests/unit_tests/openvpn/test_user_pass.c @@ -149,6 +149,29 @@ reset_user_pass(&up); + /* Test various valid characters */ + /*FIXME: query_user_exec() called even though nothing queued */ + will_return(query_user_exec_builtin, true); + /* FIXME? content after first two lines just ignored */ + assert_true(get_user_pass_cr(&up, "#iuser and 커뮤니티\n//ipasswörd!\nsome other content\nnot relevant", "UT", flags, NULL)); + assert_true(up.defined); + assert_string_equal(up.username, "#iuser and 커뮤니티"); + assert_string_equal(up.password, "//ipasswörd!"); + + reset_user_pass(&up); + + /* Test various invalid characters */ + /*FIXME: query_user_exec() called even though nothing queued */ + will_return(query_user_exec_builtin, true); + /*FIXME? allows arbitrary crap if c > 127 */ + /*FIXME? silently removes control characters */ + assert_true(get_user_pass_cr(&up, "\tiuser\r\nipass\xffwo\x1erd", "UT", flags, NULL)); + assert_true(up.defined); + assert_string_equal(up.username, "iuser"); + assert_string_equal(up.password, "ipass\xffword"); + + reset_user_pass(&up); + expect_string(query_user_exec_builtin, query_user[i].prompt, "Enter UT Password:"); will_return(query_user_exec_builtin, "cpassword"); will_return(query_user_exec_builtin, true);