Bug 501405

Summary: modify_internal_pb fails to insert pwp control into pb
Product: [Retired] 389 Reporter: Ulf Weltman <ulf.weltman>
Component: Security - Password PolicyAssignee: Rich Megginson <rmeggins>
Status: CLOSED CURRENTRELEASE QA Contact: Viktor Ashirov <vashirov>
Severity: medium Docs Contact:
Priority: low    
Version: 1.2.0CC: nkinder
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-07 17:12:25 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: 517385, 639035    

Description Ulf Weltman 2009-05-18 23:52:08 UTC
I noticed this compile error:
Warning 942: "../ldap/servers/slapd/modify.c", line 461 # Types 'ldapcontrol *'
and 'int' are not assignment-compatible.
            pwpolicy_ctrl = slapi_control_present( controls,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The function slapi_control_present() returns 0 or 1, not an LDAPControl *.

This function from LDAP SDK might do the trick (ldap-extension.h):
LDAP_API(LDAPControl *) LDAP_CALL ldap_find_control( const char *oid, LDAPControl **ctrls );

Comment 1 Rich Megginson 2009-05-19 19:44:02 UTC
I just submitted a fix for this, along with several other compiler warning fixes, to 389-devel

Comment 2 Ulf Weltman 2009-05-19 19:54:40 UTC
Aha, it was supposed to be an int flag, not the actual control structure, I misread the use of that pblock field.

Comment 3 Rich Megginson 2009-05-19 20:15:36 UTC
commit f9db3ac14855eb07e49f2f5797cbb7d338bb614b
Author: Rich Megginson <rmeggins>
Date:   Tue May 19 13:17:11 2009 -0600

    Fix various compiler warnings
    1) Make sure we use "const" consistently
    2) Make sure we use "unsigned char" consistently
    for some reason (unsigned char)*p did not compare to '\xHH' literals unless 
the literal was also cast to (unsigned char)
    3) added some missing function prototypes
    4) removed some unused variables/functions, or commented out for use when de
bugging
    5) various other compiler warnings
    
    With all of these, the code compiles cleanly on RHEL5 x86_64 using
    gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44)
    and
    CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-prot
ector --param=ssp-buffer-size=4 -m64 -mtune=generic"
    
    The only warning now is the spurious message about %llu or %lld having the w
rong format argument.

    Reviewed by: nhosoi (Thanks!)