Bug 243488 - Use mozldap6 ldif_parse_line API
Use mozldap6 ldif_parse_line API
Status: CLOSED CURRENTRELEASE
Product: 389
Classification: Community
Component: Unknown (Show other bugs)
1.0.4
All Linux
low Severity low
: ---
: ---
Assigned To: Noriko Hosoi
Viktor Ashirov
:
Depends On:
Blocks: 152373 240316 FDS1.1.0
  Show dependency treegraph
 
Reported: 2007-06-08 19:59 EDT by Noriko Hosoi
Modified: 2015-12-07 11:58 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-12-07 11:58:14 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
cvs diffs (12.54 KB, patch)
2007-06-08 20:19 EDT, Noriko Hosoi
no flags Details | Diff
cvs commit message (1.92 KB, text/plain)
2007-06-11 13:26 EDT, Noriko Hosoi
no flags Details

  None (edit)
Description Noriko Hosoi 2007-06-08 19:59:05 EDT
Noriko Hosoi wrote:
> Do you happen to know the status of ldif_parse_line?  It used to be in the DS
code ldap/libraries/libldif/line64.c, which has been moved to the LDAP C SDK. 
The problem is the APIs are different.  And even though the file line64.c does
not exist in the DS tree, ldif.h with the old API is.
>  ldapserver/ldap/include/ldif.h:int ldif_parse_line( char *line, char **type,
char **value, int *vlen, char **errcode);
>  /usr/include/mozldap6/ldif.h:int ldif_parse_line( char *line, char **type,
char **value, int *vlen);
>
> With the ldif.h file, the build goes fine.  But once I remove
ldapserver/ldap/include/ldif.h from the tree, the build fails as expected.
>
> gcc -DHAVE_CONFIG_H -I. -I../ldapserver -I. -DBUILD_NUM=\"2007.159.224\"
-I../ldapserver/ldap/include -I../ldapserver/ldap/servers/slapd
-I../ldapserver/include -I. -DLOCALSTATEDIR=\"/export/servers/ds72/var\"
-DSYSCONFDIR=\"/export/servers/ds72/etc\" -DLIBDIR=\"/export/servers/ds72/lib\"
-DBINDIR=\"/export/servers/ds72/bin\" -DDATADIR=\"/export/servers/ds72/share\"
-DDOCDIR=\"\" -DSBINDIR=\"/export/servers/ds72/sbin\"
-DPLUGINDIR=\"/export/servers/ds72/lib/fedora-ds/plugins\"
-I/usr/include/mozldap6 -I/usr/include/dirsec/nspr4 -I/usr/include/dirsec/nss3
-I/usr/include/dirsec/nss3 -I/usr/include/dirsec/nspr4 -I/usr/include
-I/usr/include/dirsec/nspr4 -I/usr/include/dirsec/nss3 -g -MT
ldap/servers/slapd/libslapd_la-entry.lo -MD -MP -MF
ldap/servers/slapd/.deps/libslapd_la-entry.Tpo -c
../ldapserver/ldap/servers/slapd/entry.c  -fPIC -DPIC -o
ldap/servers/slapd/.libs/libslapd_la-entry.o
> ../ldapserver/ldap/servers/slapd/entry.c: In function `str2entry_fast':
> ../ldapserver/ldap/servers/slapd/entry.c:212: error: too many arguments to
function `ldif_parse_line'
> ../ldapserver/ldap/servers/slapd/entry.c: In function `str2entry_dupcheck':
> ../ldapserver/ldap/servers/slapd/entry.c:620: error: too many arguments to
function `ldif_parse_line'
> gmake[1]: *** [ldap/servers/slapd/libslapd_la-entry.lo] Error 1
> gmake[1]: Leaving directory `/export/src/ds72/ldapserver/built'
> gmake: *** [all] Error 2
>
> Is it okay to eliminate the 5-th arg errmsg from the following lines?
> $ find . -name "*.c" | xargs egrep ldif_parse_line
> ./ldap/servers/plugins/replication/replutil.c:                  rc =
ldif_parse_line(line, &type, &value, &vlen, &errmsg);
> ./ldap/servers/plugins/replication/cl5_api.c:           rc =
ldif_parse_line(line, &type, &value, &vlen, &errmsg);
> ./ldap/servers/slapd/back-ldbm/import-threads.c:        if ( (retmalloc =
ldif_parse_line( s, &type, &valuecharptr, &valuelen, &errmsg )) >= 0 ) {
> ./ldap/servers/slapd/entry.c:           if ( (retmalloc = ldif_parse_line( s,
&type, &valuecharptr, &valuelen, &errmsg )) < 0 ) {
> ./ldap/servers/slapd/entry.c:           if ( (retmalloc = ldif_parse_line( s,
&type, &valuecharptr, &valuelen, &errmsg )) < 0 ) {
> ./ldap/servers/slapd/fedse.c:           if ( (retmalloc =
ldif_parse_line(copy, &type, &value, &vlen, &errmsg)) < 0 ) {
> ./ldap/admin/lib/dsalib_confs.c:                rc = ldif_parse_line(line,
&type, &value, &vlen, &errmsg);
> ./ldap/admin/lib/dsalib_confs.c:                     * Use ldif_parse_line()
so continuation markers are
> ./ldap/admin/lib/dsalib_confs.c:                    ldif_rc = ldif_parse_line(
tmpline, &type, &tmpvalue,
>
> BTW, the usage of the 5-th arg errmsg is very limited in the old line64.c code
in the DS.  It returns an error message for the url case "We only support
file:// URLs for now."

Richard Megginson wrote:
So, it was compiling using the prototype from the ldapserver version of ldif.h,
but at runtime using the function from libldif from mozldap?  If so, then yes,
please eliminate the 5-th arg from the ldapserver code.
Comment 1 Noriko Hosoi 2007-06-08 20:19:28 EDT
Created attachment 156632 [details]
cvs diffs

Modified Files:
 ldap/admin/lib/dsalib_confs.c
 ldap/servers/plugins/replication/cl5_api.c
 ldap/servers/plugins/replication/replutil.c
 ldap/servers/slapd/entry.c
 ldap/servers/slapd/fedse.c
 ldap/servers/slapd/back-ldbm/import-threads.c

Deleted File:
 ldap/include/ldif.h

Change description:
1) Removed ldif.h from the DS tree.
2) Eliminated the 5-th arg of ldif_parse_line (errmsg) and the errmsg related
code.
Comment 2 Noriko Hosoi 2007-06-11 13:26:19 EDT
Created attachment 156742 [details]
cvs commit message

Reviewed by Rich (Thank you!)

Checked in into HEAD.
Comment 3 Noriko Hosoi 2007-11-29 12:45:44 EST
$ pwd
/share/dev4/ds/ds80/builds/20071129.1/earthquake_rhel4/ldapserver

$ find . -name "*.c" | xargs egrep ldif_parse_line
./ldap/servers/plugins/replication/cl5_api.c:           rc =
ldif_parse_line(line, &type, &value, &vlen);
./ldap/servers/plugins/replication/replutil.c:                  rc =
ldif_parse_line(line, &type, &value, &vlen);
./ldap/servers/slapd/back-ldbm/import-threads.c:        if ( (retmalloc =
ldif_parse_line( s, &type, &valuecharptr, &valuelen )) >= 0 ) {
./ldap/servers/slapd/entry.c:           if ( (retmalloc = ldif_parse_line( s,
&type, &valuecharptr, &valuelen )) < 0 ) {
./ldap/servers/slapd/entry.c:           if ( (retmalloc = ldif_parse_line( s,
&type, &valuecharptr, &valuelen )) < 0 ) {
./ldap/servers/slapd/fedse.c:           if ( (retmalloc = ldif_parse_line(copy,
&type, &value, &vlen)) < 0 ) {
./ldap/servers/snmp/main.c:               
ldif_parse_line(ldif_getline(&entryp), &attr, &val, &vlen);
./ldap/servers/snmp/main.c:                        ldif_parse_line(dse_line,
&attr, &val, &vlen);

$ du -a | egrep ldif.h | egrep -v back-ldif.h
$

$ egrep ldif_parse_line /usr/include/mozldap6/ldif.h
int ldif_parse_line( char *line, char **type, char **value, int *vlen);

1) There is no ldif.h in the ldapsearch source tree any more.
2) ldapsearch sources call ldif_parse_line in the way declared in mozldap ldif.h.
3) Brew build/Nightly build has no problem.

That said, this bug is verified.

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