From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4997 Path: news.gmane.org!not-for-mail From: John Mudd Newsgroups: gmane.linux.lib.musl.general Subject: gethostbyname and resolv.conf Date: Wed, 30 Apr 2014 12:02:17 -0400 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b3439e463514404f844ad3d X-Trace: ger.gmane.org 1398873776 10185 80.91.229.3 (30 Apr 2014 16:02:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Apr 2014 16:02:56 +0000 (UTC) To: musl Original-X-From: musl-return-5001-gllmg-musl=m.gmane.org@lists.openwall.com Wed Apr 30 18:02:51 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WfWy9-0006Kv-OY for gllmg-musl@plane.gmane.org; Wed, 30 Apr 2014 18:02:49 +0200 Original-Received: (qmail 28168 invoked by uid 550); 30 Apr 2014 16:02:48 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 28160 invoked from network); 30 Apr 2014 16:02:48 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=U7ECaDXfZbfm1Gcf7tcMnqJRBx8EgCJMMUeXVh5QAuY=; b=I8uFYMgLrAoK4JTFF6H4DMW09nTWJ32vY849T9ZbvNwkVTdwhKmyzWkF/lsA2J1odL OFAKz7bP/sY5Dv47R/ULhjgpEJtEIjqM75WG550FpH/oBKz2X2YAHkUhIbUkeqzNNsOo Zi19nc3LSSIsE3kGvvuhl7oBY5FPWwMV5otzblrhiKXLgaWDtQeyhFtE1J1UpLPVVhr1 DO60MxBb5YV8GGLGOesemXzcPWJV8OrvdSPGnL+ohqyhWqkOHhoSczrzpm2YlH6I8RQA Baeq2mY5ZPjZ4NqS0w8PbYJVR3+smjAdAgY0FMPmFRAMmZ3r8K9X7WAWtUye+I4pM+mg Q3tQ== X-Received: by 10.112.131.65 with SMTP id ok1mr1620971lbb.51.1398873757272; Wed, 30 Apr 2014 09:02:37 -0700 (PDT) Xref: news.gmane.org gmane.linux.lib.musl.general:4997 Archived-At: --047d7b3439e463514404f844ad3d Content-Type: text/plain; charset=ISO-8859-1 FYI: Looks like the musl gethostbyname() doesn't use the "search" command in the resolv.conf file. $ cat test_gethostbyname.c #include #include int main(int argc, char *argv[]) { struct hostent *lh = gethostbyname(argv[1]); if (lh) puts(lh->h_name); else herror("gethostbyname"); return 0; } $ $ make test_gethostbyname gcc test_gethostbyname.c -o test_gethostbyname $ test_gethostbyname lifeline.rx30.com lifeline.rx30.com $ test_gethostbyname lifeline lifeline.rx30.com $ $ make test_gethostbyname musl-gcc -fno-stack-protector test_gethostbyname.c -o test_gethostbyname $ test_gethostbyname lifeline.rx30.com lifeline.rx30.com $ test_gethostbyname lifeline gethostbyname: Non-recoverable error $ $ cat /etc/resolv.conf # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 127.0.1.1 search rx30.com $ --047d7b3439e463514404f844ad3d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
FYI: Looks like the musl=A0gethostbyname() doesn't use= the "search" command in the=A0resolv.conf file.=A0


$ cat test_gethostbyname.c
#include <= ;stdio.h>
#include <netdb.h>

int main(int argc, c= har *argv[])
{ =A0=A0
=A0 =A0 struct hostent *lh =3D ge= thostbyname(argv[1]);

=A0 =A0 if (lh)
= =A0 =A0 =A0 =A0 puts(lh->h_name);
=A0 =A0 else
=A0 =A0 =A0 =A0 herror("gethostbyname"= ;);

=A0 =A0 return 0;
}
$


$ make =A0test_gethostbyname
= gcc =A0 =A0 test_gethostbyname.c =A0 -o test_gethostbyname
$ test_gethostbyname lifeline.rx3= 0.com
$ test_gethostbyname lifeline
$


$ make =A0test_gethostbyname=
musl-gcc -fno-stack-protector =A0 =A0test_gethostbyname.c =A0 -o= test_gethostbyname
$ test_gethostbyname lifeline.rx30.com
=
$ test_gethostbyname lifeline
gethostbyname: Non-recoverable= error
$


$ cat /etc/resol= v.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resol= vconf(8)
# =A0 =A0 DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES = WILL BE OVERWRITTEN
nameserver 127.0.1.1
search rx30.com
$

--047d7b3439e463514404f844ad3d--