From patchwork Wed Mar 25 21:50:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Cerrito X-Patchwork-Id: 1050 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id QKA6EulwfF5kFgAAIUCqbw for ; Thu, 26 Mar 2020 05:07:53 -0400 Received: from proxy11.mail.iad3b.rsapps.net ([172.31.255.6]) by director9.mail.ord1d.rsapps.net with LMTP id 0BV0D+lwfF7FUwAAalYnBA ; Thu, 26 Mar 2020 05:07:53 -0400 Received: from smtp4.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy11.mail.iad3b.rsapps.net with LMTP id cGYrCOlwfF5iDwAARNREpw ; Thu, 26 Mar 2020 05:07:53 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp4.gate.iad3b.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: 45b2a606-6f41-11ea-9a63-525400789c6c-1-1 Received: from [216.105.38.7] ([216.105.38.7:46138] helo=lists.sourceforge.net) by smtp4.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 7B/12-09120-8E07C7E5; Thu, 26 Mar 2020 05:07:52 -0400 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.90_1) (envelope-from ) id 1jHOTo-000713-It; Thu, 26 Mar 2020 09:07:12 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jHOTn-00070i-FD for openvpn-devel@lists.sourceforge.net; Thu, 26 Mar 2020 09:07:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=lhzLrjMWnq4Hv+REgIPaeqyJ5Q6yqN9ZafhK4hQiN0w=; b=ZY0cAJ0eHiST1EICFzfRyBs5Rp TyADegkCnuxhJ8zgbjkpxHM1bysfP2N9OFV73+JESETSr027N96jGaOoCu44JE0kPmBNY6duV3dKw bsLc6Lqc3X4IkBS5uALUXu7BfLecnKWNIy008TZdysVxNQaIewtdejMyU+dvD8A0DggI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=lhzLrjMWnq4Hv+REgIPaeqyJ5Q6yqN9ZafhK4hQiN0w=; b=c StKh2ZC0ck+irBpl3CO7I6M/FypMzVmVOa2eEMvGZfdjH0a26R/8TGI6GJ15tMTNy7mfiIK+UTQ/Y /27eoIpNiPuURqt56pQedEmiYPWmoG1LqMYzE/S2u6qmBp9yR59wfx5Xpb+QJzzmNwo3h5gwrTGtj UZUFmCJIN4pmDDr4=; Received: from smtp.uniroma2.it ([160.80.6.16]) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1jHOTl-007zUq-7J for openvpn-devel@lists.sourceforge.net; Thu, 26 Mar 2020 09:07:11 +0000 Received: from wardragon.ccd.uniroma2.it (wardragon-176.ccd.uniroma2.it [160.80.8.176] (may be forged)) by smtp-2015.uniroma2.it (8.14.4/8.14.4/Debian-8) with ESMTP id 02Q8ooZc016323; Thu, 26 Mar 2020 09:50:55 +0100 From: Paolo Cerrito To: openvpn-devel@lists.sourceforge.net Date: Thu, 26 Mar 2020 09:50:45 +0100 Message-Id: <20200326085045.46465-1-wardragon78@gmail.com> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 X-Virus-Status: Clean X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (wardragon78[at]gmail.com) 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [160.80.6.16 listed in wl.mailspike.net] 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (wardragon78[at]gmail.com) 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 1.2 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list 0.0 MAY_BE_FORGED Relay IP's reverse DNS does not resolve to IP 0.0 SPOOFED_FREEMAIL No description available. X-Headers-End: 1jHOTl-007zUq-7J Subject: [Openvpn-devel] [PATCH] PATCH V3 - changed remote lenght and refactored get_env 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: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox --- .gitignore | 1 + src/plugins/auth-pam/auth-pam.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0d68ec4b..3977882f 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,4 @@ nbproject test-driver compile stamp-h2 +outgoing/* diff --git a/src/plugins/auth-pam/auth-pam.c b/src/plugins/auth-pam/auth-pam.c index 9d8dfb95..b55a2ecd 100644 --- a/src/plugins/auth-pam/auth-pam.c +++ b/src/plugins/auth-pam/auth-pam.c @@ -115,7 +115,7 @@ struct user_pass { char password[128]; char common_name[128]; char response[128]; - char remote[128]; + char remote[51]; //51 as ipv6 form n:n:n:n:n:n:d.d.d.d/mask and terminator+1 const struct name_value_list *name_value_list; }; @@ -518,7 +518,11 @@ openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const cha const char *username = get_env("username", envp); const char *password = get_env("password", envp); const char *common_name = get_env("common_name", envp) ? get_env("common_name", envp) : ""; - const char *remote = get_env("untrusted_ip", envp) ? get_env("untrusted_ip", envp) : get_env("untrusted_ip6", envp); + const char *remote = get_env("untrusted_ip6", envp); + + if (remote == NULL){ + remote = get_env("untrusted_ip", envp); //try to take ipv4 if not set ipv6 + } if (username && strlen(username) > 0 && password) {