From patchwork Fri Nov 22 16:22:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "plaisthos (Code Review)" X-Patchwork-Id: 3957 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:23c9:b0:5db:5963:ef83 with SMTP id s9csp444634mah; Fri, 22 Nov 2024 08:23:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXbArIKjogDA1MEdW89SwL/ZpkLbtwx3J8WzPMnSQfTtAXpUkuBJXYTKIfiXnSCBDHrRld+QWxqjlQ=@openvpn.net X-Google-Smtp-Source: AGHT+IH4RFBY1fKnMrBCu4B7lK6NEWT2kTrPan2IMi6pQcGqB0E75ND1d/O8LaAas8BoDlW2lJ1f X-Received: by 2002:a05:6870:9728:b0:296:df1d:917f with SMTP id 586e51a60fabf-297206ead6dmr4049894fac.0.1732292580189; Fri, 22 Nov 2024 08:23:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732292580; cv=none; d=google.com; s=arc-20240605; b=Wj3mkJsOUxjv+DVSgiJpnl3jhkbZfzx2KzA04KYUSJF2eRIwolaTxZ8IPuW/WXMciZ pln55sm4Re2TLbHKyVAVY+cY5bzkvJSwUzZj4ib6QljBR+s8j+KBobj38xV4unkxxPWj R+BT3OdaoLi+y0L53DW3Oa0RghIuapA0w5kMo1CslGmMOS1+em68vBu5nWyOITe8O5dz +bA34Rqlz3YIQqyyr0GZ0tw2C+7e66p7eT6MWrOMsq9LZoyNfZb0B2L2rQwKhsfSb1Rt kFojuuiS7w1q1fX7MZWUBa6+7QUULIv0PStlvtL+y6A/7yLdJcZCUgN2xpGRHFkXXGlc 9G+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=CT1wnBp/yIAJldVK8cDd/rxD7VCmNtUy/Qq1eFNtNC0=; fh=lm0MLPW7DntlrDqRECIiC9JlE1uPxhepE0URYHIf+eE=; b=IQVxGonQ9JrirYxm3meYKQM3cxZMz+gRjd2Hz2DWQb+L4EK/4B3RnqAbWFNBnBRr1u UWiOGZoLPZpDvvewsulmxLKhSXwkOzHIqpRv+d/aldBl7iBdMbHgAojLLispLxaId/op ME47DzJWwhoqKG9BPHPeCY1UV3dRMgBeKCBTvZBFnHFuMmTh+33dW1alHIGCkwgPwro/ N49yXVZdA9ebBNFLt7bat14iHM+s+ktJvKj2mxin0GKZOjrO2Lv8dx/vbksIC0iWbTFG FlIn6yNHy9o0ePIPvYqhIOH411i/w1jxcp11tObaKOi7oCdV66BgX3PK9vr5UuI6gqqG rOkQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="CCuDUq/1"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=AaejmvfI; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=HVNfzNta; 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; dara=fail header.i=@openvpn.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 46e09a7af769-71c0385b612si1548249a34.330.2024.11.22.08.22.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Nov 2024 08:23:00 -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="CCuDUq/1"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=AaejmvfI; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=HVNfzNta; 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; dara=fail header.i=@openvpn.net Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tEWQj-0000PE-Ct; Fri, 22 Nov 2024 16:22:49 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tEWQY-0000P0-Pp for openvpn-devel@lists.sourceforge.net; Fri, 22 Nov 2024 16:22:38 +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=U827bF7+oqKijiWo8698lQHGQ1JOxCEqok7sztsnJlo=; b=CCuDUq/1gsKpzGrhAJ97Y/zvBD ZKe7KBX1rAuQ4C8hrNIoyxpDKSfidO49ffVzcaVq3vJV+7QuHhKFGAelcPZhMOfPiDNeIl5nA3Dgm duqllvBwp9+tFsYCfr8TdSCsUZSfcvppV0Mv3Wjt6TzJVuVJ/nwGyX1PnHEO6rYxvzSY=; 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=U827bF7+oqKijiWo8698lQHGQ1JOxCEqok7sztsnJlo=; b=A aejmvfIyBjekqStxpkdfw2jLU9gtWSdSiCOScv5U7gDpQ21liQU7Shj4wK8NeoPdn7r1KRlVTzwVW XyO1ASUjh5TyLgGKTZy39wC4HxctWK3BYICDgpqXi3nU3UJtF6Ox2YRqwCbN/wzAcgJ1jpxFc+6rf u9+yW+lBLtBogaoA=; Received: from mail-wm1-f47.google.com ([209.85.128.47]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1tEWQX-00007O-RS for openvpn-devel@lists.sourceforge.net; Fri, 22 Nov 2024 16:22:38 +0000 Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-43163667f0eso20322095e9.0 for ; Fri, 22 Nov 2024 08:22:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1732292551; x=1732897351; 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=U827bF7+oqKijiWo8698lQHGQ1JOxCEqok7sztsnJlo=; b=HVNfzNtaWwpSoGCL375aEm/3SlSea1nvGkEwenFPOm8jHKGdM+k9EgJ2naSDaQwx1a b1lTSZjNGUrA3pYnmj3LQYBG8Gl4fIFjgyaKRAwN6Z7e4jL3B2Qxo1o/izhmLnmaNCil 4HmQIMebYloCg6lPm7DeKRX8frI2jE1N5Zjfp3s4J4ecEE2Bg+Dxz5czvS2NFIUvkRl0 pmkY+kDPfWiDWFr95KxCU4mv4P3lLRfGayOBa0PY3wkSbsbw2mIkXk53kdyncU+COLL6 geIdH6pl73+s5KJ05Fg9ecGmnqbLqIBtlgRcgfEhkT4r6bwpuIchxe3CTnKVCuqyPQvY LXyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732292551; x=1732897351; 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=U827bF7+oqKijiWo8698lQHGQ1JOxCEqok7sztsnJlo=; b=bT3CipPXgRcd3PjFHOTkx63brWirtvM1aKYGqN4j+Gm8gV7L8dmwgsDRpGFwBCUhFf Gxidbr5HIs0kDuPa+pOAp9XLv6sxs6Ci/SPdgXe1ZB3jJOTfEWMVol9ceXHaD/s1njqD tAA01PJUxZBiJZJklTbpuo54rHACFjESFUVWAeMlfNI3mia/BOdggJF9IRKKSqXNVTP4 pqoTGjz1wj6xF6Q52h8XCfAYN6im/Y3B7yDh5JfzSlJeOonTxZAXSyWznobxEXUnLk/F pZDiT7/PYLalbs6pV1TrnfEl7QHPPcfFF/gAF42Q7sFn92GrSkeDGrORp4GPE+6XyfRB qOlw== X-Gm-Message-State: AOJu0Yyb1vXuJvp9GPDTeJN9RKoORs4YiuPlcbu6DWBc6IIX9AgDjxE1 l0KwQfZ9pTv+c0sFy+CIo7LOUpmXyPGyVdS436IwjIE1m2yFqTCQ4wktjCVars3WbeHYwcvYnWh f X-Gm-Gg: ASbGncvdsdrH7VKrxLHjrsKSBNIS6i2g68IfT8fvqR37CvV+BVwOuy85WwYOKTksxX8 L+kIwiGjX5A8Fo/5JIPusUPHkHK7qln472ZH6YVJbDwKHvNHYkcyRQFR/tyiN8K5uRv88dQetCL lSnJeIaD8w5QC49FEa/9usap8R1xI7rdDrtLZQ0P4ATM5O5BOzgZAuckPmHJrgvFGWIX+70kArO 4svDR9TCwIJSntFSileYZP34ZUuVXjyyb89m56wuf/z/pW5I5tzfcGMIPluu0L07QcBuKj0VjDg 6/BL1r+1j4FgfLyUG7M0e2W0xOEPISNRzccsfx17vg== X-Received: by 2002:a05:600c:1e23:b0:431:3a6d:b84a with SMTP id 5b1f17b1804b1-433ce41c640mr31969275e9.4.1732292551031; Fri, 22 Nov 2024 08:22:31 -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 5b1f17b1804b1-433cde1107csm33149995e9.15.2024.11.22.08.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 08:22:30 -0800 (PST) From: "plaisthos (Code Review)" X-Google-Original-From: "plaisthos (Code Review)" X-Gerrit-PatchSet: 1 Date: Fri, 22 Nov 2024 16:22:30 +0000 To: flichtenheld Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-Change-Id: Ia0799189d45223e0b987a5a4da5be60404388f1f X-Gerrit-Change-Number: 817 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: b774d2bfcdbb5c5cbce685f7cd7e4f29b3f942be References: Message-ID: <204cb86af4cdc460648615595a782f79db9e142a-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-2.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: flichtenheld. Hello flichtenheld, 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [209.85.128.47 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [209.85.128.47 listed in bl.score.senderscore.com] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.128.47 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.128.47 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 WEIRD_PORT URI: Uses non-standard port number for HTTP 0.0 HTML_MESSAGE BODY: HTML included in message 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.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.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors in HTML X-Headers-End: 1tEWQX-00007O-RS Subject: [Openvpn-devel] [S] Change in openvpn[master]: Add small unit test for buf_chomp 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: arne-openvpn@rfc2549.org, openvpn-devel@lists.sourceforge.net, frank@lichtenheld.com Cc: openvpn-devel Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1816440424425133062?= X-GMAIL-MSGID: =?utf-8?q?1816440424425133062?= X-getmail-filter-classifier: gerrit message type newchange Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/817?usp=email to review the following change. Change subject: Add small unit test for buf_chomp ...................................................................... Add small unit test for buf_chomp Change-Id: Ia0799189d45223e0b987a5a4da5be60404388f1f Signed-off-by: Arne Schwabe --- M tests/unit_tests/openvpn/test_buffer.c 1 file changed, 28 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/17/817/1 diff --git a/tests/unit_tests/openvpn/test_buffer.c b/tests/unit_tests/openvpn/test_buffer.c index 0fb4697..d43d5c1 100644 --- a/tests/unit_tests/openvpn/test_buffer.c +++ b/tests/unit_tests/openvpn/test_buffer.c @@ -426,6 +426,32 @@ #endif } +void +test_buffer_chomp(void **state) +{ + struct gc_arena gc = gc_new(); + struct buffer buf = alloc_buf_gc(1024, &gc); + + const char test1[] = "There is a nice 1234 year old tree!\n\r"; + buf_write(&buf, test1, sizeof(test1)); + buf_chomp(&buf); + /* Check that our own method agrees */ + assert_true(string_check_buf(&buf, CC_PRINT | CC_NULL, CC_CRLF)); + assert_string_equal(BSTR(&buf), "There is a nice 1234 year old tree!"); + + struct buffer buf2 = alloc_buf_gc(1024, &gc); + const char test2[] = "CR_RESPONSE,MTIx\x0a\x00"; + buf_write(&buf2, test2, sizeof(test2)); + buf_chomp(&buf2); + + buf_chomp(&buf2); + /* Check that our own method agrees */ + assert_true(string_check_buf(&buf2, CC_PRINT | CC_NULL, CC_CRLF)); + assert_string_equal(BSTR(&buf2), "CR_RESPONSE,MTIx"); + + gc_free(&gc); +} + int main(void) { @@ -460,7 +486,8 @@ cmocka_unit_test(test_buffer_gc_realloc), cmocka_unit_test(test_character_class), cmocka_unit_test(test_character_string_mod_buf), - cmocka_unit_test(test_snprintf) + cmocka_unit_test(test_snprintf), + cmocka_unit_test(test_buffer_chomp) }; return cmocka_run_group_tests_name("buffer", tests, NULL, NULL);