From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Filipp Gunbin Newsgroups: gmane.emacs.devel Subject: Re: Fix eudc-get-attribute-list: please review Date: Thu, 14 Apr 2022 16:57:01 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6348"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin) Cc: emacs-devel@gnu.org To: Thomas Fitzsimmons Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 14 16:04:09 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nf04s-0001Dc-Bb for ged-emacs-devel@m.gmane-mx.org; Thu, 14 Apr 2022 16:04:07 +0200 Original-Received: from localhost ([::1]:33970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nf04r-0002cf-9Q for ged-emacs-devel@m.gmane-mx.org; Thu, 14 Apr 2022 10:04:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nezy8-0004NL-Ub for emacs-devel@gnu.org; Thu, 14 Apr 2022 09:57:09 -0400 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]:59707) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nezy6-0006SA-2E for emacs-devel@gnu.org; Thu, 14 Apr 2022 09:57:08 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 3573B5C0203; Thu, 14 Apr 2022 09:57:05 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 14 Apr 2022 09:57:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1649944625; x=1650031025; bh=ELCPuXLC7C ykdtw16h0YnL1KtdR1mkcdWzN8/tOLw9k=; b=ssEo7vVl/1thLapNvTVLX8di2T b0gzX/GKJ4Vqm/6o4BxgRE0qd8fMR/025phaFOvCV0d7ASvNOFPfmt8MAhL1ns8S 22GVPdVBrJXovUMv98G5hJB0wb4LtpzgLjoFP3inMGlRVXO65BdedET1HmHHdtTX zodo2IA9TGSKhX7j2IQUB/p2B0IQMseW9AOgwb/H8z5wtNLBIrg3muFxLQNLSRRd L5iI5IP9XmnPBbuzMpfgpgml543rFmCMoCr/DMl92SXp+RwIaiu/Ve42RrWwM7IB qoMeY6LVW+kCGCvR3TBXP9MFNxMVm8FFnuXPzWkq+cdkVUAueW3nFQ8x9hNQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1649944625; x= 1650031025; bh=ELCPuXLC7Cykdtw16h0YnL1KtdR1mkcdWzN8/tOLw9k=; b=o ecSIHsqCJzArfO/S6r59MFqVKZz21qcpBI2YVTK7M5yMdIizg7wfuoidtOUibXbP 9FQQrCMLnAyhQvjWC0Tep7F+3wf1uVukwMnxIRt7VSIu9slwnyLnaW3RXuK3TO+5 Fr8hVifi80rDKs1YR0MMXcCL5c8Em7UDkqgQIv5eFxZwU1HBo7mikxIsPS0CB/Ut fyfmEXUoXoYwfrVK+/GXoMcZz6Cwb0USMcgfIQrNSVdc/Q55Cu+9FjTmJmVz4BmJ zq9Uw2WpdsaBHuhs2vBv7O2VeovFcYq8sOytf7zmm/jeFVo2Pg1+uhwsEOsauK8A DfxRDPxMiPBbzdO0OuT3Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudelfedgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufgjfhgffffkgggtsehttdertddtredtnecuhfhrohhmpefhihhlihhp phcuifhunhgsihhnuceofhhguhhnsghinhesfhgrshhtmhgrihhlrdhfmheqnecuggftrf grthhtvghrnhepvdevkeffvdeuvefhuddtjeehkedvueefveettddtveduudfgieffieev ieevhfdtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epfhhguhhnsghinhesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 14 Apr 2022 09:57:04 -0400 (EDT) In-Reply-To: (Thomas Fitzsimmons's message of "Wed, 13 Apr 2022 22:02:08 -0400") Mail-Followup-To: Thomas Fitzsimmons , emacs-devel@gnu.org Received-SPF: pass client-ip=66.111.4.29; envelope-from=fgunbin@fastmail.fm; helo=out5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:288392 Archived-At: Hi Thomas, On 13/04/2022 22:02 -0400, Thomas Fitzsimmons wrote: > Hi Filipp, > > Filipp Gunbin writes: > >> Here's the patch which fixes several bugs preventing >> eudc-get-attribute-list from working, please review. >> >> TIA, >> Filipp >> >> >> commit 17c59e12adca5386ffe7d107dc6e3fa2dcf8b8d6 >> Author: Filipp Gunbin >> Date: Wed Apr 13 23:10:35 2022 +0300 >> >> Fix eudc-get-attribute-list >> >> * lisp/net/eudc-vars.el (eudc-ldap-no-wildcard-attributes): New >> defcustom. >> * doc/misc/eudc.texi (LDAP Configuration): Mention it. >> * lisp/net/eudcb-ldap.el (eudc-ldap-format-query-as-rfc1558): Use it. >> (eudc-ldap-get-field-list): Set scope and sizelimit, instead of >> overriding the whole ldap-host-parameters-alist. >> * lisp/net/ldap.el (ldap-search-internal): Allow "size limit exceeded" >> exit code. Allow empty attribute values. > > Looks good, and works for me. Please go ahead and push this to the > master branch. Thank you for the reply, now pushed. > One question: what does the addition of the question > mark to the regexp fix? This is what ldapsearch returns with -A: --8<---------------cut here---------------start------------->8--- Enter LDAP Password: version: 1 dn:: .... objectClass: cn: sn: --8<---------------cut here---------------end--------------->8--- So we should accept empty values. I've also pushed this additional cleanup commit: commit 3bd20fc696cdfb072b56c38a0669f95c5febfa2f Author: Filipp Gunbin Date: Thu Apr 14 16:47:32 2022 +0300 ldap-search-internal cleanup * lisp/net/ldap.el (ldap-ldapsearch-args): Change -LL to -LLL to suppress ldif version output. (ldap-search-internal): Remove skipping of version output. Remove redundand ws skipping. diff --git a/lisp/net/ldap.el b/lisp/net/ldap.el index 9463282135..da45457891 100644 --- a/lisp/net/ldap.el +++ b/lisp/net/ldap.el @@ -148,7 +148,7 @@ ldap-ldapsearch-prog "The name of the ldapsearch command line program." :type '(string :tag "`ldapsearch' Program")) -(defcustom ldap-ldapsearch-args '("-LL" "-tt") +(defcustom ldap-ldapsearch-args '("-LLL" "-tt") "A list of additional arguments to pass to `ldapsearch'." :type '(repeat :tag "`ldapsearch' Arguments" (string :tag "Argument"))) @@ -682,7 +682,7 @@ ldap-search-internal (while (re-search-forward (concat "[\t\n\f]+ \\|" ldap-ldapsearch-password-prompt-regexp) nil t) - (replace-match "" nil nil)) + (replace-match "")) (goto-char (point-min)) (if (looking-at "usage") @@ -691,7 +691,6 @@ ldap-search-internal ;; Skip error message when retrieving attribute list (if (looking-at "Size limit exceeded") (forward-line 1)) - (if (looking-at "version:") (forward-line 1)) ;bug#12724. (while (progn (skip-chars-forward " \t\n") (not (eobp))) @@ -724,7 +723,6 @@ ldap-search-internal (record (push (nreverse record) result))) (setq record nil) - (skip-chars-forward " \t\n") (message "Parsing results... %d" numres) (setq numres (1+ numres))) (message "Parsing results... done") Here, it's cleaner to use -LLL to omit ldif version than to skip it. This option is available since OpenLDAP 2.0 (released in 2000), and ldap-ldapsearch-args is anyway a defcustom. skip-chars-forward at the end of while body is not needed because we do that in the while's test. Thanks. Filipp