[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Postgresql deying access



2011/2/11 Petr Salinger <Petr.Salinger@seznam.cz>:

>>>> 2011-02-11 12:12:50 CET LOG:  could not get peer credentials:
>>>> Interrupted system call
>
> The problem seems be in postgresql package.
> 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.
> But postgresql want these extra 4 bytes to receive.

> --- src/backend/libpq/auth.c
> +++ src/backend/libpq/auth.c
> @@ -1764,7 +1764,7 @@
>        Cred       *cred;
>
>        /* Compute size without padding */
> -       char            cmsgmem[ALIGN(sizeof(struct cmsghdr)) +
> ALIGN(sizeof(Cred))];   /* for NetBSD */
> +       char            cmsgmem[ALIGN(sizeof(struct cmsghdr)) +
> (sizeof(Cred))];        /* for NetBSD */
>
>        /* Point to start of first structure */
>        struct cmsghdr *cmsg = (struct cmsghdr *) cmsgmem;

I'm not sure how to test your patch with the Debian package, but I
tried it successfully with a freshly compiled PostgreSQL 9.1alpha3
(the latest alpha as of this moment). Results (kfreebsd-amd64 @ KVM):

Without your patch the following gets logged (note that the errno
seems to be different from what Emanuele and me get with the Debian
packaged 8.4.7 version, but in both cases the identification fails):

LOG:  could not get peer credentials: No such file or directory
FATAL:  Ident authentication failed for user "itsme"

[ Warning: I manually copied (typed) this from a KVM console. ]

While with your patch nothing gets logged, the identification just works.

Nicolas


Reply to: