From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noah Lavine Newsgroups: gmane.emacs.bugs Subject: bug#12724: ldap.el Problem and Solution Date: Wed, 24 Oct 2012 14:33:06 -0400 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT X-Trace: ger.gmane.org 1351103650 10595 80.91.229.3 (24 Oct 2012 18:34:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 24 Oct 2012 18:34:10 +0000 (UTC) To: 12724@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 24 20:34:18 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TR5mQ-0002vu-O1 for geb-bug-gnu-emacs@m.gmane.org; Wed, 24 Oct 2012 20:34:14 +0200 Original-Received: from localhost ([::1]:34523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TR5mJ-0005qb-3l for geb-bug-gnu-emacs@m.gmane.org; Wed, 24 Oct 2012 14:34:07 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TR5mH-0005q4-3B for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2012 14:34:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TR5mF-0000Ih-Pj for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2012 14:34:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49727) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TR5mF-0000IA-Ni for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2012 14:34:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TR5oA-00089p-7p for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2012 14:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noah Lavine Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Oct 2012 18:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12724 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.135110374131328 (code B ref -1); Wed, 24 Oct 2012 18:36:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Oct 2012 18:35:41 +0000 Original-Received: from localhost ([127.0.0.1]:59978 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TR5no-00089F-ID for submit@debbugs.gnu.org; Wed, 24 Oct 2012 14:35:41 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41765) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TR5nl-000892-G6 for submit@debbugs.gnu.org; Wed, 24 Oct 2012 14:35:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TR5lk-0008S7-H3 for submit@debbugs.gnu.org; Wed, 24 Oct 2012 14:33:33 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:43854) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TR5lk-0008S3-Du for submit@debbugs.gnu.org; Wed, 24 Oct 2012 14:33:32 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TR5le-0005fQ-Gd for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2012 14:33:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TR5la-0008QN-EF for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2012 14:33:26 -0400 Original-Received: from relais.videotron.ca ([24.201.245.36]:56721) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TR5la-0008QD-Bi for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2012 14:33:22 -0400 Original-Received: from ceviche.home ([96.21.127.30]) by VL-VM-MR004.ip.videotron.ca (Oracle Communications Messaging Exchange Server 7u4-22.01 64bit (built Apr 21 2011)) with ESMTP id <0MCE008T7U7JJ880@VL-VM-MR004.ip.videotron.ca> for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2012 14:33:20 -0400 (EDT) Original-Received: by ceviche.home (Postfix, from userid 20848) id BB39B661F0; Wed, 24 Oct 2012 14:33:06 -0400 (EDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:65995 Archived-At: Hello, I recently hit a problem in which ldap-search (in ldap.el) would return a list of records where the first record would always be nil. As far as I can tell, the rest of the list was correct; it just had an extra nil in the beginning. After some debugging, I think the issue is that my ldapsearch program (from OpenLDAP) doesn't quite use the output format ldap.el expects. The expected format is dn: .......... : : .... more attributes here ...... This is the ldif format, which seems to be standardized. But tragically, my ldapsearch program prints a header, which makes the results look like this: version: 1 dn: ......... : .... more attributes ..... This confuses the ldap.el parsing. I can tell this is the problem because when I step through in the debugger, the "dn" variable is set to "version: 1", instead of the obviously correct value. Then when it attempts to parse its results it finds an empty record, and so pushes 'nil onto its results list, which is what causes the problem. The solution is to insert this after line 579 of ldap.el: (if (looking-at "version:") (forward-line 1)) I have tested this, and it seems to work for me. The other option is to make the ldapsearch program not print its version header, but looking at its man page, I don't see a way to do that. If this solution doesn't seem good, I am happy to try a different approach, but it seems like the easiest solution to me. I have already signed copyright papers, although for a change as small as this they might not even be needed. Thanks, Noah Lavine