Re: [INTERFACES] getting "fe_setauthsvc: invalid name" error

From: Sebastian Meyer <meyer(at)mevis(dot)de>
To: Torsten Neuer <tneuer(at)inwise(dot)de>
Cc: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] getting "fe_setauthsvc: invalid name" error
Date: 1998-09-16 08:11:57
Message-ID: Pine.SGI.4.02.9809161001300.18985-100000@forte
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)mevis(dot)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

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Marcio Macedo 1998-09-16 11:31:40 subscribe
Previous Message Sbragion Denis 1998-09-16 07:03:49 Re: [INTERFACES] Problems with queries on small/medium sized tables