Issue 7271 - Don't clobber SASL_NOCANON in clients/tools/common.c
Summary: Don't clobber SASL_NOCANON in clients/tools/common.c
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-13 01:15 UTC by wking@tremily.us
Modified: 2014-08-01 21:04 UTC (History)
0 users

See Also:


Attachments
tool-nocanon.patch (796 bytes, text/plain)
2012-05-30 15:25 UTC, wking@tremily.us
Details
tool-nocanon.patch (1.39 KB, text/plain)
2012-05-13 01:27 UTC, wking@tremily.us
Details

Note You need to log in before you can comment on or make changes to this issue.
Description wking@tremily.us 2012-05-13 01:15:29 UTC
Full_Name: W. Trevor King
Version: git commit 22bf5188
OS: Gentoo
URL: http://blog.tremily.us/posts/LDAP/tool-nocanon.patch
Submission from: (NULL) (72.68.88.202)


The ldap.conf SASL_NOCANON configuration option (or LDAPSASL_NOCANON environment
variable) should set the default behaviour for OpenLDAP tools such as
ldapwhoami.  This configuration option should allow users to use the tools
without having to use the matching command line option (-N).  Unfortunately, the
current code sets the option to true/false after only querying the command line
option.

I'm linking to a patch that looks at the current value of the option first, and
if it's true, skips processing the command line option (which would either be a
redundant -N keeping the option true, or an absence of -N which implies the user
wants to use the configured value (true)).

Another approach would be to set the initial value of nocanon to UNINITIALIZED
(-1?).  Command line arguments could set nocanon to 1 (true, -N) or false (0,
--canon?).  Then we would only call ldap_set_option if nocanon was not
UNINITIALIZED.

I can work up a patch using this second approach if people prefer.  If so, let
me know if you want me to define UNINITIALIZED, or to just use -1.

I didn't check, but I would not be surprised if this same clobbering occurred
for other command line options.
Comment 1 wking@tremily.us 2012-05-13 01:27:48 UTC
I forgot to add the notice to the patch I just submitted.  Here's the
notice:


The attached patch file is derived from OpenLDAP Software. All of the
modifications to OpenLDAP Software represented in the following
patch(es) were developed by W. Trevor King wking@tremily.us. I have
not assigned rights and/or interest in this work to any party.

I, W. Trevor King, hereby place the following modifications to
OpenLDAP Software (and only these modifications) into the public
domain. Hence, these modifications may be freely used and/or
redistributed for any purpose with or without attribution and/or other
notice.


I've attached the patch again, since that matches the language in the
notice.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
Comment 2 Howard Chu 2012-05-30 13:14:38 UTC
wking@tremily.us wrote:
> Full_Name: W. Trevor King
> Version: git commit 22bf5188
> OS: Gentoo
> URL: http://blog.tremily.us/posts/LDAP/tool-nocanon.patch
> Submission from: (NULL) (72.68.88.202)
>
>
> The ldap.conf SASL_NOCANON configuration option (or LDAPSASL_NOCANON environment
> variable) should set the default behaviour for OpenLDAP tools such as
> ldapwhoami.  This configuration option should allow users to use the tools
> without having to use the matching command line option (-N).  Unfortunately, the
> current code sets the option to true/false after only querying the command line
> option.
>
> I'm linking to a patch that looks at the current value of the option first, and
> if it's true, skips processing the command line option (which would either be a
> redundant -N keeping the option true, or an absence of -N which implies the user
> wants to use the configured value (true)).
>
> Another approach would be to set the initial value of nocanon to UNINITIALIZED
> (-1?).  Command line arguments could set nocanon to 1 (true, -N) or false (0,
> --canon?).  Then we would only call ldap_set_option if nocanon was not
> UNINITIALIZED.
>
> I can work up a patch using this second approach if people prefer.  If so, let
> me know if you want me to define UNINITIALIZED, or to just use -1.
>
> I didn't check, but I would not be surprised if this same clobbering occurred
> for other command line options.

The only other boolean command line option is referrals, which is deprecated 
and has been undocumented for years. Not worth bothering over.

Ideally the command line option should have been able to set this explicitly 
to both true and false, to allow complete control over the option. But I'm not 
particularly concerned either way. Since the option currently can only be set 
to true, it would be sufficient to just check for nocanon != 0 before calling 
ldap_set_option.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/


Comment 3 Howard Chu 2012-05-30 13:15:24 UTC
changed state Open to Feedback
Comment 4 wking@tremily.us 2012-05-30 15:25:26 UTC
On Wed, May 30, 2012 at 06:14:38AM -0700, Howard Chu wrote:
> Ideally the command line option should have been able to set this
> explicitly to both true and false, to allow complete control over
> the option. But I'm not particularly concerned either way. Since the
> option currently can only be set to true, it would be sufficient to
> just check for nocanon != 0 before calling ldap_set_option.

My personal goal here is to not need to bother with command line
options, so I'm fine with this less general solution.  Another patch
(only set the option with an explicit `-N`) attached.

---
The attached patch file is derived from OpenLDAP Software. All of the
modifications to OpenLDAP Software represented in the following
patch(es) were developed by W. Trevor King wking@tremily.us. I have
not assigned rights and/or interest in this work to any party.

I, W. Trevor King, hereby place the following modifications to
OpenLDAP Software (and only these modifications) into the public
domain. Hence, these modifications may be freely used and/or
redistributed for any purpose with or without attribution and/or other
notice.

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
Comment 5 Howard Chu 2012-05-30 16:41:07 UTC
W. Trevor King wrote:
> On Wed, May 30, 2012 at 06:14:38AM -0700, Howard Chu wrote:
>> Ideally the command line option should have been able to set this
>> explicitly to both true and false, to allow complete control over
>> the option. But I'm not particularly concerned either way. Since the
>> option currently can only be set to true, it would be sufficient to
>> just check for nocanon != 0 before calling ldap_set_option.
>
> My personal goal here is to not need to bother with command line
> options, so I'm fine with this less general solution.  Another patch
> (only set the option with an explicit `-N`) attached.
>
> ---
> The attached patch file is derived from OpenLDAP Software. All of the
> modifications to OpenLDAP Software represented in the following
> patch(es) were developed by W. Trevor King wking@tremily.us. I have
> not assigned rights and/or interest in this work to any party.
>
> I, W. Trevor King, hereby place the following modifications to
> OpenLDAP Software (and only these modifications) into the public
> domain. Hence, these modifications may be freely used and/or
> redistributed for any purpose with or without attribution and/or other
> notice.
>
Thanks, added to master.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/


Comment 6 Howard Chu 2012-05-30 16:41:52 UTC
changed notes
changed state Feedback to Test
moved from Incoming to Software Bugs
Comment 7 Quanah Gibson-Mount 2012-05-30 20:40:11 UTC
changed notes
changed state Test to Release
Comment 8 Quanah Gibson-Mount 2012-08-17 01:36:54 UTC
changed notes
changed state Release to Closed
Comment 9 OpenLDAP project 2014-08-01 21:04:42 UTC
fixed in master
fixed in RE24