Bug 501405 - modify_internal_pb fails to insert pwp control into pb
Summary: modify_internal_pb fails to insert pwp control into pb
Alias: None
Product: 389
Classification: Retired
Component: Security - Password Policy
Version: 1.2.0
Hardware: All
OS: All
Target Milestone: ---
Assignee: Rich Megginson
QA Contact: Viktor Ashirov
Depends On:
Blocks: 389_1.2.1 639035
TreeView+ depends on / blocked
Reported: 2009-05-18 23:52 UTC by Ulf Weltman
Modified: 2015-12-07 17:12 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2015-12-07 17:12:25 UTC

Attachments (Terms of Use)

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@redhat.com>
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
    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)
    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!)

Note You need to log in before you can comment on or make changes to this bug.