Bug 457260

Summary: dnaFilter configuration attribute is not used properly
Product: [Retired] 389 Reporter: Nathan Kinder <nkinder>
Component: Server - DNA Plug-inAssignee: Nathan Kinder <nkinder>
Status: CLOSED CURRENTRELEASE QA Contact: Chandrasekar Kannan <ckannan>
Severity: low Docs Contact:
Priority: low    
Version: 1.1.1CC: benl, jgalipea, ssorce
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 8.1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-04-29 23:05:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 249650, 452721    
Attachments:
Description Flags
DNA config entries
none
CVS Diffs none

Description Nathan Kinder 2008-07-30 15:40:26 UTC
The dnaFilter configuration setting is supposed to be applied against an entry
to determine if a particular managed range applies to the entry.  I have found
that it is not used properly.  Here's what I have observed:

  - Configure two managed ranges.  One is for the uidNumber for 
    "objectclass=posixAccount" entries.  The second is for the gidNumber for 
    "objectclass=posixGroup" entries.

  - Add a new "posixAccount" entry without specifying a "uidNumber" or 
    "gidNumber" attribute value.

The user will be successfully added, and both "uidNumber" and "gidNumber" values
will be generated for the new entry, even though the configuration states that
only the "uidNumber" should be generated.

Comment 1 Nathan Kinder 2008-07-30 15:40:27 UTC
Created attachment 313008 [details]
DNA config entries

Comment 2 Nathan Kinder 2008-07-30 16:07:53 UTC
This compiler warning seems to point to the root cause of this problem:

  ../ldapserver/ldap/servers/plugins/dna/dna.c: In function 'parseConfigEntry':
  ../ldapserver/ldap/servers/plugins/dna/dna.c:542: warning: assignment from 
  incompatible pointer type

The problem is related to the way we load the dnaFilter value from the
configuration entries.  Our cached configuration entries in the DNA plug-in
contain a string representation of the filter in addition to a Slapi_Filter
based off of that string.  The problem is that we call slapi_str2filter() to
create the Slapi_Filter, but we store the pointer to it in our char * pointer
that is supposed to be the filter string.

Comment 3 Nathan Kinder 2008-07-30 16:24:15 UTC
Created attachment 313010 [details]
CVS Diffs

This fix simply stores the Slapi_Filter in the proper member of the configEntry
struct.  With this fix, the test in comment#1 properly rejects adding a new
"posixAccount" with no "gidNumber" attribute specified.  If one explicitly
specifies a "gidNumber" when adding the entry, the entry is added successfully,
and the "uidNumber" value is generated by the DNA plug-in.

Comment 4 Nathan Kinder 2008-07-30 17:44:23 UTC
Checked into ldapserver (HEAD).  Thanks to Noriko for her review!

Checking in ldap/servers/plugins/dna/dna.c;
/cvs/dirsec/ldapserver/ldap/servers/plugins/dna/dna.c,v  <--  dna.c
new revision: 1.5; previous revision: 1.4
done

Comment 5 Jenny Severance 2009-04-07 16:23:01 UTC
fix verified DS 8.1 - All supported OSes- scenarios where DNA is configured for both uidNumber and gidNumber being tested by DNA automated acceptance tests.

*  dnaScope - non overlapping - both managed values with the same range
   o Add and modify both users and groups from both servers 
* dnaScope - overlapping - managed values with different ranges
   o Add and modify both users and groups from both servers

Comment 6 Chandrasekar Kannan 2009-04-29 23:05:22 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-0455.html