Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[BUG] Issue with libmilter/sm_gethost.c, subroutine freehostent()

10 views
Skip to first unread message

D. Stussy

unread,
Jun 4, 2010, 8:15:44 PM6/4/10
to
I have found that ISC's libbind 6.0 does have this function, but for some
reason, this was not being detected and the dummy sub routine was being
compiled in regardless. Commenting out the stub for freehostent() locally
fixed the problem.

The milter library of Sendmail needs to be fixed to detect the presence of
this (separately from getipnodeby*()) and conditionally compile around
this. The following commented assumption is WRONG:

/*
** Stub routine -- if they don't have getipnodeby*(),
** they probably don't have the free routine either.
*/

Conditionals: #endif /* NEEDSGETIPNODE && NETINET6 */

The conflict shows up in a failed compilation of milters, including
dkim-filter (where I saw the problem), and the older dk-filter, where the
linker complains about a redefintion of the size of the routine (5 bytes
vs. 271 on my system).

I have Sendmail version 8.14.4, compiled from the source. I have not
checked 8.14.5 alpha 0 for the problem. As noted by the conditionals, this
may only appear on IPv6 enabled systems.


Jose-Marcio Martins da Cruz

unread,
Jun 6, 2010, 5:37:02 PM6/6/10
to D. Stussy
D. Stussy wrote:
> I have found that ISC's libbind 6.0 does have this function, but for some
> reason, this was not being detected and the dummy sub routine was being
> compiled in regardless. Commenting out the stub for freehostent() locally
> fixed the problem.

Why are you using ISC's libbind ? Which OS ?

>
> The milter library of Sendmail needs to be fixed to detect the presence of
> this (separately from getipnodeby*()) and conditionally compile around
> this. The following commented assumption is WRONG:
>
> /*
> ** Stub routine -- if they don't have getipnodeby*(),
> ** they probably don't have the free routine either.
> */
>
> Conditionals: #endif /* NEEDSGETIPNODE && NETINET6 */
>
> The conflict shows up in a failed compilation of milters, including
> dkim-filter (where I saw the problem), and the older dk-filter, where the
> linker complains about a redefintion of the size of the routine (5 bytes
> vs. 271 on my system).

Which error messages ?

If you type "man getipnedebyname" or "man getipnodebyaddr", you'll see
that getipnodebyX allocates some memory to return results (thread safe
routine), so it needs some way to free the space allocated, it it will
surely need free...

But as long as you haven't posted error messages nor told which OS are
you using, it's hard to say something.

D. Stussy

unread,
Jun 6, 2010, 7:05:39 PM6/6/10
to
"Jose-Marcio Martins da Cruz" <Jose-Marc...@ensmp.fr> wrote in
message news:4C0C14FE...@ensmp.fr...

> D. Stussy wrote:
> > I have found that ISC's libbind 6.0 does have this function, but for
some
> > reason, this was not being detected and the dummy sub routine was being
> > compiled in regardless. Commenting out the stub for freehostent()
locally
> > fixed the problem.
>
> Why are you using ISC's libbind ? Which OS ?

Why does the use of ISC's libbind matter? All that need be known is that
it is installed and provides the real routine which is being stubbed out in
libmilter because sendmail is NOT detecting that there's a conflict in its
configuration phase. The bug is for NOT DETECTING that the real routine is
available and thus skipping the stub.

The OS is Linux.

> > The milter library of Sendmail needs to be fixed to detect the presence
of
> > this (separately from getipnodeby*()) and conditionally compile around
> > this. The following commented assumption is WRONG:
> >
> > /*
> > ** Stub routine -- if they don't have getipnodeby*(),
> > ** they probably don't have the free routine either.
> > */
> >
> > Conditionals: #endif /* NEEDSGETIPNODE && NETINET6 */
> >
> > The conflict shows up in a failed compilation of milters, including
> > dkim-filter (where I saw the problem), and the older dk-filter, where
the
> > linker complains about a redefintion of the size of the routine (5
bytes
> > vs. 271 on my system).
>
> Which error messages ?

Multiply defined symbol, of course. Read what I said.

> If you type "man getipnedebyname" or "man getipnodebyaddr", you'll see
> that getipnodebyX allocates some memory to return results (thread safe
> routine), so it needs some way to free the space allocated, it it will
> surely need free...

So what is your point?

> But as long as you haven't posted error messages nor told which OS are
> you using, it's hard to say something.

I have laready told you what the error is: Sendmail is building its own
[dummy-stub] version of a library function that already exists in another
library due to a failure to detect the real routine.

Claus Aßmann

unread,
Jun 6, 2010, 8:05:11 PM6/6/10
to
D. Stussy wrote:

> it is installed and provides the real routine which is being stubbed out in
> libmilter because sendmail is NOT detecting that there's a conflict in its
> configuration phase. The bug is for NOT DETECTING that the real routine is

Which "configuration phase" are you talking about?

PS: I'm looking forward to seeing your patch. Thanks.

D. Stussy

unread,
Jun 6, 2010, 9:50:12 PM6/6/10
to
"Claus Aßmann" <ca+sendmail(-no-copies-please)@mine.informatik.uni-kiel.de>
wrote in message news:huhd3n$hic$1...@obelix.informatik.uni-kiel.de...

Not as a diff, but simply the result of the change:

// void
// freehostent(h)
// struct hostent *h;
// {
// /*
// ** Stub routine -- if they don't have getipnodeby*(),
// ** they probably don't have the free routine either.
// */
//
// return;
// }


#endif /* NEEDSGETIPNODE && NETINET6 */


As noted, commenting out the defective stub routine was sufficient to fix
the problem.


Claus Aßmann

unread,
Jun 6, 2010, 11:05:30 PM6/6/10
to
D. Stussy wrote:
> "Claus Aßmann"
> > Which "configuration phase" are you talking about?

Seems this question went unanswered.

> > PS: I'm looking forward to seeing your patch. Thanks.

> Not as a diff, but simply the result of the change:

> // void
> // freehostent(h)

That will work well with a real C compiler and on systems that
actually need freehostent(), which seems to be almost all.

alf

unread,
Jun 7, 2010, 12:10:26 PM6/7/10
to
On Jun 7, 5:05 am, Claus Aßmann <ca+sendmail(-no-copies-

please)@mine.informatik.uni-kiel.de> wrote:
> D. Stussy wrote:
> > "Claus Aßmann"
> > > Which "configuration phase" are you talking about?
>
> Seems this question went unanswered.

That would be ./configure, or its moral equivalent, methinks (as I
hazily remember sendmail did not - at some point - use autoconf)

alf

Claus Aßmann

unread,
Jun 7, 2010, 12:33:08 PM6/7/10
to
alf wrote:
> ca wrote...

> > > > Which "configuration phase" are you talking about?

> > Seems this question went unanswered.

> That would be ./configure, or its moral equivalent, methinks (as I
> hazily remember sendmail did not - at some point - use autoconf)

There is not configure command in the sendmail 8 distribution.
And there is no "moral equivalent" AFAICT. But maybe the OP can
explain what he meant? Maybe editing devtools/Site/*.m4?
Maybe adding
APPENDDEF(`confENVDEF', `-UNEEDSGETIPNODE')
would have solved the problem?

D. Stussy

unread,
Jun 7, 2010, 3:21:39 PM6/7/10
to
"Claus A�mann" <ca+sendmail(-no-copies-please)@mine.informatik.uni-kiel.de>
wrote in message news:huhnlq$m2q$1...@obelix.informatik.uni-kiel.de...
> D. Stussy wrote:
> > "Claus A�mann"

Well, you asked me what I did to fix the problem on my system, and I told
you: I effectively removed the stub from the milter library source, as the
real routine is provided by libbind 6.0 on my system.

I reported this so you can program in a solution for the generic case that
tests to see if the routine is available and thus using conditional
compilation skip the stub. Maybe sendmail should be converted to use
"autoconf" like most other packages do.


D. Stussy

unread,
Jun 17, 2010, 6:00:22 PM6/17/10
to
Re: APPENDDEF(`confENVDEF', `-UNEEDSGETIPNODE')

The strange thing is that there was no conflict detected or missing error
for "getipnodebyname()" to alert me there was a problem that would lead me
to that symbol.

The only documentation on this define is in "sendmail/README", which is not
the main readme file. It says:

"NEEDSGETIPNODE Set this if your system supports IPv6 but doesn't
include
the getipnodeby{name,addr}() functions. Set automatically
for Linux's glibc."

Excuse me, but I run Linux (2.6.34), and this says nothing about REMOVING
the symbol when libbind is present. I do have a system that does include
the function getipnodebyname(). The value appears to be set incorrectly
for my system. I have glibc version 2.3.5 installed (10 Sep 2005).
(Attempts to upgrade glibc to version 2.11.1 from source have not
successfully compiled.) If this were an issue for the milter interface
ONLY (which is what happened to me), I would expect to see something in
"libmilter/README". I note that the function does NOT appear in glibc but
in libbind only.

I have tested the UNDEFINE you suggested and that works (in lieu of my
solution). However, the documentation regarding the issue is clearly wrong
and needs to be revised.


Even if found, the assumption about "freehostent()" is going to be wrong
for glibc - from changelog:

2000-10-26 Ulrich Drepper <dre...@redhat.com>
...
* inet/freehostent.c: Removed.

2000-08-01 Andreas Jaeger <a...@suse.de>
...
* conform/data/netdb.h-data: Remove getipnodebyaddr and friends.
...
* inet/Makefile (routines): Don't build getipnodebyaddr and
friends.

2000-07-31 Andreas Jaeger <a...@suse.de>
* inet/Versions: Remove getipnodebyaddr and friends from GLIBC_2.2.
* resolv/netdb.h: Remove getipnodebyaddr and friends.

Therefore, even if getipnodebyname() wasn't a "friend function" that was
removed, freehostent() certainly was removed from glibc (starting with
version 2.1.96) a decade ago.

0 new messages