delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/01/12/11:51:56

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=Rz41Rve6YX6I+j9eS05KL/uSG5ohn88Bk3E6ULqByGXs6C1xxUfAn
QDyQdCt7Dtycf0evdStGEJOCvzbXG8xByuyvgyHHoUGXXEKU6knqiJfzWO51lZkC
OrWYXB61vLJO+/uBRVtLp2JPt8+b8Inu+Ny9XBM+p+wtrQYoToBzmI=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=th+L7TbH0YyROUBlHjyMp7Lhc4c=; b=crIvUSDSY/F920TgajKYy8qSsy+1
QvPx3T9/r0Xh42VK1853umewBQZkVLtovXeySmH/xScllf9bo7cNUlGY//O6pRTz
jne/2XHkwKJuLbp7eT5t6/sdJQbJ7wRl8vp2gvKRzKB8MOYR1OMhdLjmMS/jZ6YK
AECXSCsyV4v3igY=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL,BAYES_50 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Mon, 12 Jan 2015 17:51:30 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Resolving localhost on Windows 7 (for exim)
Message-ID: <20150112165130.GP15791@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <0NHP009ITJ361TD0 AT vms173009 DOT mailsrvcs DOT net> <20150108132353 DOT GN4190 AT calimero DOT vinschen DOT de> <003d01d02e83$1aaaf7b0$5000e710$@ieee.org>
MIME-Version: 1.0
In-Reply-To: <003d01d02e83$1aaaf7b0$5000e710$@ieee.org>
User-Agent: Mutt/1.5.23 (2014-03-12)

--CD/aTaZybdUisKIc
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Pierre,

On Jan 12 11:16, Pierre A. Humblet wrote:
> cvs diff -up minires-os-if.c
> Index: minires-os-if.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /cvs/src/src/winsup/cygwin/libc/minires-os-if.c,v
> retrieving revision 1.15
> diff -u -p -r1.15 minires-os-if.c
> --- minires-os-if.c     23 Apr 2013 09:44:35 -0000      1.15
> +++ minires-os-if.c     12 Jan 2015 03:39:27 -0000
> @@ -249,6 +249,13 @@ static int cygwin_query(res_state statp,
>     rr =3D pQueryResultsSet;
>     section =3D 0;
>     while (rr) {
> +    /* Some Windows versions return questions when providing locally
> +       generated answers, for example for "localhost" or for the compute=
r name */
> +    if (((rr->Flags.DW & 0x3) =3D=3D DnsSectionQuestion) &&
> +       (rr->wDataLength > 0)) {
> +      DPRINTF(debug, "Changing record below from question to answer\n");
> +      rr->Flags.DW ^=3D DnsSectionQuestion ^ DnsSectionAnswer;
> +    }
>       if (!counts[0] && (rr->Flags.DW & 0x3)) {
>         /* No question. Adopt the first name as the name in the question =
*/
>         if ((len =3D dn_comp(rr->pName, ptr, AnsLength - 4,

Thanks, patch applied.  Somehow the indentation was totally broken in
your patch, though.

> Now the bad news:  the exim daemon crashes.
>=20
> The reason is this:
> $ getent passwd exim
> NT SERVICE+exim:*:376394:376394:U-NT SERVICE\exim,S-1-5-80-3213360373-407=
2665756-2198108471-1641386292-839958090:/:/sbin/nologin
>=20
> So even though I am requesting just "exim" I am getting an entry for "NT =
SERVICE+exim"

That's definitely a bug and I can easily reproduce it.  I'm not sure yet
how this happens, but this is really not ok.  I'll have a look ASAP.

> Talk about aliasing.
> The way the exim code works, when an "exim" user exists (per getpwnam)
> the daemon setuids to it.
> Here it's trying to setuid to a service.=20
> This would break every exim installation.

Nevertheless, quite apart from the above, your code should be able to
live with a prefixed user account.  If the exim account is a local
account, and if the machine is an AD member, the account will be named
"MACHINE+exim".  But still, when calling getpwnam("exim"), it won't
return the entry for "MACHINE+exim".  Rather you should call cygwin_internal
as OpenSSH and postfix do now, kind of like this:

  char exim_username[DNLEN + UNLEN + 2];

  if (cygwin_internal (CW_CYGNAME_FROM_WINNAME, "exim", exim_username,
		       sizeof exim_username) !=3D 0)
      strcpy (cyg_privsep_user, "exim");
  /* Call getpwnam */
  struct passwd *pw =3D getpwnam (exim_username);


Thanks,
Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--CD/aTaZybdUisKIc
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJUs/uSAAoJEPU2Bp2uRE+ggsAP/iXKQdtrUK73CShsbp1dgOPr
i9ffN2ignW7D+qDSOek83034kkxB3+rL7S/ZxT4Rbo3jnOz1bg4iX5pjPvUTrvio
7nB4bcV+PekI8sr5oaSOyUoItBWnald9wHHmeifhRFHtZ4+NhbBrN9yoxxiSprfq
od3EPnwOLAhMzbT+eqJOT1FlcXYbk96Mq0JsADxJD8z4NU6zFSQzdGso4+s2kxLN
NHpOYP5cLZS6mdoU9SPYj+Vg1J/Bs70eL56L6dYJDgPDCFB9QG8Q5ZJQQohXNzYH
fJL42aOuQCYi5V+tQHBapMVvOu9uinZBsJCvgpLGYbRdlUSs7SjUiwOHqLm/b8vP
x0tjNGscLNfza7aCUdUcuu4YM2Mbk330vUH3xTUowU+BEg8p35AqqMyXMPOB+BEF
BsUOk5rB67Fx0dwxYvJWd/SNA3vQGXXbPmta0a0MvwnQUNFIMHSlA7aqpgcqikh3
F/OnDE0WyQTy/uixL7PSyLeg2Vlo1+khDJaKQaGaJ/8RzWQVMVeDBFlmaatQX8H8
N9LaoCY8iXpOAbbbQqbo7MaSAnqGY72lIYtWxfcGbBnUX8EP6zp6tQRFnMhnon41
eDZUazEFI0MZUGLgi4qGB7i1aPP/6afoQcWkNEH+3t66TcIWfPTeaTXkR1Sxgod3
+JrRgVGUlSW9+dYYayJH
=uHK5
-----END PGP SIGNATURE-----

--CD/aTaZybdUisKIc--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019