Re: [INTERFACES] getting "fe_setauthsvc: invalid name" error - Mailing list pgsql-interfaces

From Sebastian Meyer
Subject Re: [INTERFACES] getting "fe_setauthsvc: invalid name" error
Date
Msg-id Pine.SGI.4.02.9809161001300.18985-100000@forte
Whole thread Raw
In response to Re: [INTERFACES] getting "fe_setauthsvc: invalid name" error  (Torsten Neuer <tneuer@inwise.de>)
Responses Re: [INTERFACES] getting "fe_setauthsvc: invalid name" error
List pgsql-interfaces
On Wed, 16 Sep 1998, Torsten Neuer wrote:

> Clint wrote:
> >
> >I think you're right, Tom.  If I run the program on my Linux box as a
> >different user, I get the same error.  Now, how do I set the username
> >from C/C++??  I can't figure it out from the docs ...
>
> At the first glance I would suggest you either do a chown(1) on
> the program binary so that is executes as the correct user or you
> have a set*id(2) call somewhere in the program source.
> However, you should take care with that as this can result in a
> security leak in your system.

Its in http://www.PostgreSQL.ORG/docs/postgres/libpq9374.htm
Read the section on "PQsetdbLogin - Makes a new connection to a backend"

PGconn *PQsetdbLogin(const char *pghost,
                const char *pgport,
                const char *pgoptions,
                const char *pgtty,
                const char *dbName,
                const char *login,
                const char *pwd);
       If any argument is NULL, then the corresponding environment
       variable is checked. If the environment variable is also not set,
       then hardwired defaults are used. PQsetdbLogin always returns a
       valid PGconn pointer. The PQstatus (see below) command should be
       called to ensure that a connection was properly made before
       queries are sent via the connection.

It's so easy... If you should want to set environment variables anyway:
environ(5), getenv(3) and putenv(3) tell you how.

Finally: Don't deal with set*id() calls unless absolutely neccessary AND
you really know what you do.The first condition returns FALSE here.

sebastian
--
    __o     Sebastian Meyer  Tel: (0421)218-7702 | "Everything should be
  _ \<,_    meyer@mevis.de   http://www.mevis.de | made as simple as possible,
 (_)/ (_)   MeVis an der Universität Bremen      | but not simpler."
~~~~~~~~~~~ Universitätsallee 29, D-28359 Bremen | - Albert Einstein


pgsql-interfaces by date:

Previous
From: Sbragion Denis
Date:
Subject: Re: [INTERFACES] Problems with queries on small/medium sized tables
Next
From: "Life"
Date:
Subject: ...