From patchwork Mon Jan 29 10:53:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 3597 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7001:10:b0:550:f63e:f504 with SMTP id rm16csp1338886mab; Mon, 29 Jan 2024 02:54:35 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWtbDMARzHq2NG2NlMjMwCWyVx3wKH6MnbhIrT95NRjapLOd55e4laAyj3tgmKyyrzMtRvyN3NfnA/pqYyOnzAm0pPEKkY= X-Google-Smtp-Source: AGHT+IFoYh50JPn3XwhynTCwP726tk53S+x7XjLRjDt3oz/xXlevh8piuqPhw2QZeRRD7IRhJODd X-Received: by 2002:a05:6a21:a59a:b0:19c:aba7:ab26 with SMTP id gd26-20020a056a21a59a00b0019caba7ab26mr2758218pzc.6.1706525675285; Mon, 29 Jan 2024 02:54:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706525675; cv=none; d=google.com; s=arc-20160816; b=oxiIEZJNY8v8OfKB6SfnFNVfVOy0N0lgODU3obc97TY7U024Jzccas2P15S/cOUvRv GZ1Geuz+3Zu2tQWx4mZGP1lArfidEVDQxEYO43Rsst9i3Esvun4saDyRrXzDeWnc8Ngp dXRo9SXlP1mMhsGJ8DYYmyTePwVuTSHxdz+3meLSdFRzBNNjA3BxBmTFbm1a52VKkgwn 4bETBRr+SkFOwRMp7qM3OfjUegtx4plLR/NTqd6NvfEmJlFYSGSGPjHdRqhtiPrXmkcQ jGQLndMmLeTk+7SEEjO3pLkOgAJ7GaKr24btlDRHTvCinvQBgAyLK5Odv7JYElGK3Hlb Z/bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature; bh=ffjQ1DU4Ph3+DHuiEyefJOFFKy6UA/b1rCnAT/KASgs=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=ptHxcJFhK4kIoleD8Whh6FpHA/q0en5zEa8RI8sGabX7NFEO3HRyVRJm7jgsBZqy5j rbDpMZm+3Z55AeVLVu+srtvei+QZB5V44LDpdoI7wYZzwZhF7dzC9OxDCTuM1RHsonOh ev/NE2bTkl58u2ttotMMmy5xJTqJ0J5cd8Vg5SywJMwn5SYtsIeUAg5iXwwgRjox18Mo wi0cHqVk1XTPQu6cy3jKMo3gZO86pVTiD1ufYPHjpuT4jsxnFDYEy1LveHPHts1m3CEj DNCWcKR84ZExGh191almd/NXzcHlFAgRENpBDHQGbWJTWXAhthGKYXlhihs7VkJE6lLV 2pCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=HBhpEyX6; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="Y/TKiwkA"; 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=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id l3-20020a170902f68300b001d5f009098bsi5652123plg.408.2024.01.29.02.54.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jan 2024 02:54:35 -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=HBhpEyX6; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="Y/TKiwkA"; 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=muc.de 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 1rUPHG-0004Tg-F2; Mon, 29 Jan 2024 10:54:11 +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 1rUPHF-0004Ta-DN for openvpn-devel@lists.sourceforge.net; Mon, 29 Jan 2024 10:54:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=oL8EKiDJWvFM0q8s8fK7qqnbC0IhbuLCR+ZVX6E5HfQ=; b=HBhpEyX6gsTZKi1R4EPCGPGtVC y/+JsLlCy6HOTM8d0gOd2p9OgfqWHXrUnYLuJ/R0W7cs7rThrLHYPYBgn1B2kQciHtFr5eu4fHHYj VbVFpA+V2KcZ6zvgDHocf5wogMYet2SEW468hw+nDae1JELBPL2+2NB9hSzd11JGmPdA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=oL8EKiDJWvFM0q8s8fK7qqnbC0IhbuLCR+ZVX6E5HfQ=; b=Y/TKiwkAV+KlHI2Yk4gQZFM5ut TStNdvMheOlEBeFRmo+/Zni2RO4WlN9KzK8SsJ5oJFawkdiPrEB/5ZUFI1mlHu2lL2o6pYAYt2+a0 KVlIKs3uc3cm8E4W45EgOTHUkLaD9aXvSXlRPeXx8fEP65nsBgICgfTr9bdVfsRD7pUM=; Received: from dhcp-174.greenie.muc.de ([193.149.48.174] helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rUPHC-0007Ml-4N for openvpn-devel@lists.sourceforge.net; Mon, 29 Jan 2024 10:54:10 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.17.1.9/8.17.1.9) with ESMTP id 40TArxmZ011171 for ; Mon, 29 Jan 2024 11:53:59 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 40TArxjp011170 for openvpn-devel@lists.sourceforge.net; Mon, 29 Jan 2024 11:53:59 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Mon, 29 Jan 2024 11:53:57 +0100 Message-ID: <20240129105358.11161-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: -0.0 (/) 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: From: Frank Lichtenheld 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 Acked-by: Arne Schwabe Acked-by: Gert Doering List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1789421866611255380?= X-GMAIL-MSGID: =?utf-8?q?1789421866611255380?= From: Frank Lichtenheld 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 Acked-by: Arne Schwabe Acked-by: Gert Doering --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/473 This mail reflects revision 6 of this Change. Acked-by according to Gerrit (reflected above): Arne Schwabe Gert Doering diff --git a/tests/unit_tests/openvpn/test_user_pass.c b/tests/unit_tests/openvpn/test_user_pass.c index ab4dfe4..277cb1d 100644 --- a/tests/unit_tests/openvpn/test_user_pass.c +++ b/tests/unit_tests/openvpn/test_user_pass.c @@ -141,6 +141,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);