www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Wolter <j...@wwnet.net>
Subject mod_auth-any/5951: Header/Library Mismatch in mod_auth_dbm
Date Sun, 02 Apr 2000 04:48:31 GMT

>Number:         5951
>Category:       mod_auth-any
>Synopsis:       Header/Library Mismatch in mod_auth_dbm
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Sat Apr 01 20:50:00 PST 2000
>Originator:     janc@wwnet.net
>Release:        1.3.12
Redhat 6.1
As far as I'm able to tell, Redhat 6.1 comes with 3 distinct implementations of
the 'ndbm' library, each in a different .so library file,  each with a different
header file.  I think Apache 1.3.12 uses a mismatched pair.

The three installed dbm libraries are:

  GDBM emulation of NDBM:
    Library: -lgdbm
      #include <gdbm/ndbm.h>

  Berkeley DB Version 1 emulation of NDBM:
    Library:  -ldb1
      #include <db1/ndbm.h>

  Berkeley DB Version 2 emulation of NDBM:
    Library:  -ldb or -lndbm  (/usr/lib/libndbm.so is link to /usr/lib/libdb.so)
      #define DB_DBM_HSEARCH 1
      #include <db.h>
    (See http://www.sleepycat.com/docs/api_c/dbm.html)

Of course, none of these three agree with the traditional setup, in which
the library is -ldbm and the header is just <ndbm.h>.

When I use APACI to build Apache, it links the program with -lndbm (which is
just an alias for Berkeley DB version 2), while the code in mod_auth_dbm.c
appears to include the db1/ndbm.h header, which comes from Berkeley DB version
I don't think this actually causes any problems either at run time or compile
time, but I could be wrong.  It's potentially a source of subtle bugs.
Minimal fix would be to modify mod_auth_dbm.c by replacing
  #include <db1/ndbm.h>
  #define DB_DBM_HSEARCH 1
  #include <db.h>

This would handle glibc 2.1, but probably there are lots of non-glibc systems
that have Berkeley DB 2 or 3 installed.  The #if statement in mod_auth_dbm.c
only tests for glibc 2.1.  The use of the name -lndbm instead of -ldb is also
less standard (I think).

Ideally, I think the logic that selects header files should be coupled to the
logic that selects link libraries.  This is a bother.

On the other hand, maybe none of the Berkeley DB versions should be supported
by mod_auth_dbm, after all, mod_auth_db supports them all.  Just support GDBM
and traditional NDBM with mod_auth_dbm.
 [In order for any reply to be added to the PR database, you need]
 [to include <apbugs@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]

View raw message