Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id ACB4DB5D91F for ; Sun, 22 May 2011 11:19:32 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 76395-05 for ; Sun, 22 May 2011 14:19:25 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.piware.de (unknown [213.9.93.70]) by mail.postgresql.org (Postfix) with ESMTP id CA44DB5D80A for ; Sun, 22 May 2011 11:19:24 -0300 (ADT) Received: from localhost.localdomain (p549B5BF3.dip.t-dialin.net [84.155.91.243]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Martin Pitt (ThinkPad)", Issuer "piware CA" (verified OK)) by mail.piware.de (Postfix) with ESMTPS id 877771517A61; Sun, 22 May 2011 16:17:54 +0200 (CEST) Received: by localhost.localdomain (Postfix, from userid 1000) id 9738C3FEEE; Sun, 22 May 2011 16:19:21 +0200 (CEST) Date: Sun, 22 May 2011 16:19:21 +0200 From: Martin Pitt To: PostgreSQL Bugs Cc: Petr Salinger , 612888@bugs.debian.org Subject: [PATCH] ident authentication fails on kFreeBSD/x86-64 due to wrong struct size Message-ID: <20110522141921.GC3123@piware.de> Mail-Followup-To: PostgreSQL Bugs , Petr Salinger , 612888@bugs.debian.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ALfTUftag+2gvp1h" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.107 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RDNS_NONE=0.793 X-Spam-Level: X-Archive-Number: 201105/148 X-Sequence-Number: 30287 --ALfTUftag+2gvp1h Content-Type: multipart/mixed; boundary="oLBj+sq0vYjzfsbl" Content-Disposition: inline --oLBj+sq0vYjzfsbl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello PostgreSQL developers, I got this report in http://bugs.debian.org/612888 about ident failure on the Debian kFreeBSD kernel on 64 bit. The sizeof(struct cmsgcred) is 84 on kfrebsd-amd64, there is no reason for padding it at the end to 8-byte boundary by kernel. However, the process is blocking on receiving those extra 4 bytes, which will never come. Petr Salinger sent a straightforward patch for this, I turned it into a git-formatted patch for your convenience. Thanks, Martin ----- Forwarded message from skull ----- Date: Fri, 11 Feb 2011 11:40:27 +0100 =46rom: skull To: Debian Bug Tracking System Subject: Bug#612888: postgresql: access denied as postgres user after defau= lt install (kFreeBSD specific) X-Spam-Status: No, score=3D0.0 required=3D4.0 tests=3DBAYES_50 autolearn=3D= no version=3D3.2.5 Reply-To: skull , 612888@bugs.debian.org Package: postgresql Version: 8.4.7-0squeeze2 Severity: important After default installation, postgres denies access to postgres user: root@netmon:~# su - postgres postgres@netmon:~$ psql template1 psql: FATAL: Ident authentication failed for user "postgres" This happens on kFreeBSD flavour only (AFAIK) -- System Information: Debian Release: 6.0 APT prefers squeeze-updates APT policy: (500, 'squeeze-updates'), (500, 'stable') Architecture: kfreebsd-amd64 (x86_64) Kernel: kFreeBSD 8.1-1-amd64 Locale: LANG=3Den_US.UTF-8, LC_CTYPE=3Den_US.UTF-8 (charmap=3DUTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages postgresql depends on: ii postgresql-8.4 8.4.7-0squeeze2 object-relational SQL database= , ve postgresql recommends no packages. postgresql suggests no packages. -- no debconf information ----- End forwarded message ----- --=20 Martin Pitt | http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org) --oLBj+sq0vYjzfsbl Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Fix-size-of-struct-cmsgcred.patch" Content-Transfer-Encoding: quoted-printable =46rom e4630822de32ad24888711ae1699e4fb33086af4 Mon Sep 17 00:00:00 2001 =46rom: Petr Salinger Date: Sun, 22 May 2011 15:24:49 +0200 Subject: [PATCH] Fix size of struct cmsgcred The sizeof(struct cmsgcred) is 84 on kfrebsd-amd64, there is no reason for padding it at the end to 8-byte boundary by kernel. However, the process is blocking on receiving those extra 4 bytes, which will never come. This breaks ident authentication on kFreeBSD 64 bit. http://bugs.debian.org/612888 --- src/backend/libpq/auth.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index 618f007..865819b 100644 --- a/src/backend/libpq/auth.c +++ b/src/backend/libpq/auth.c @@ -1897,7 +1897,7 @@ auth_peer(hbaPort *port) Cred *cred; =20 /* Compute size without padding */ - char cmsgmem[ALIGN(sizeof(struct cmsghdr)) + ALIGN(sizeof(Cred))]; /* fo= r NetBSD */ + char cmsgmem[ALIGN(sizeof(struct cmsghdr)) + sizeof(Cred)]; /* for NetBS= D */ =20 /* Point to start of first structure */ struct cmsghdr *cmsg =3D (struct cmsghdr *) cmsgmem; --=20 1.7.5.1 --oLBj+sq0vYjzfsbl-- --ALfTUftag+2gvp1h Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAEBCAAGBQJN2RtpAAoJEPmIJawmtHufpnYQAJ57qmDD9TkteJzwlxOdRH5I rb4uV63znJYjHJ0d5QWBWF3ULHNMRTyPp0GPEsEbN95j2yVCcy5GV6GxMJEDRmXn oGRTJ33sqsivJidEsn0Z3y07yI3oQhRvKkpiEyG53GEEBwDxSMLFgQy/ehJ7zR0+ CKByBLZL1aSlvnmniAcf2/Gb7o4AAYgZTMxtyqh4BKx30B32I2JXPROuzquIm94C wYK0J68axgJ6KI/qBdkp5pCCoOUJmqP+cdj89KpN5X4Vpc4yoCJk2DbW39MgF6KG Wm2f4F+rcjOp2tfx7GEe5kPndrkSs4rU/tCuKKNNLuNQQVcGsfigHsOBs0FE+ZjR at3X7tK5PYmtOPy94RdIrHcup+wqpHQQ/vE3yAFH5i1QQc0IFevrpSEvkqtlkJMo IjaSuO+1F6S7kRt5JJDLWoteQj+JhLQOkvEqWJk+dgfj7TJA/o2SWGYv44qZS9fq 9gqsNnhFMHp4+QVhvJLIhsFQSph0t9E5WU93YLvxm/qTxJIirFhAnSFUbB1Au5Cd snmfv3DnXeTKun5tUFbjQ6z73PQXfiuFbtBrrU4JYqjJ0sy7UODH57vXfvNJLAix xYYevAfQ6dtYl9cR7tdmwsD2N44ZE99xGV+TmaqmBug5Z6XSH+GcLGVb9Vuyhi+N HQoV2EpOI377Po5FaKIn =FvRX -----END PGP SIGNATURE----- --ALfTUftag+2gvp1h--