select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Unsupported versions: 6.3
Historical version. PostgreSQL 6.3 reached end of support in March 2003. See the current manual for supported releases.
PostgreSQL
Prev Chapter 44. libpq Next

User Authentication Functions

If the user has generated the appropriate authentication credentials (e.g., obtaining Kerberos tickets), the frontend/backend authentication process is handled by PQexec without any further intervention. The following routines may be called by libpq programs to tailor the behavior of the authentication process.

  • fe_getauthname Returns a pointer to static space containing whatever name the user has authenticated. Use of this routine in place of calls to getenv(3) or getpwuid(3) by applications is highly recommended, as it is entirely possible that the authenticated user name is not the same as value of the USER environment variable or the user's entry in /etc/passwd.

    char *fe_getauthname(char* errorMessage)
    
  • fe_setauthsvc Specifies that libpq should use authentication service name rather than its compiled-in default. This value is typically taken from a command-line switch.

    void fe_setauthsvc(char *name,
                       char* errorMessage)
    
    Any error messages from the authentication attempts are returned in the errorMessage argument.

Prev Home Next
libpq Tracing Functions Up BUGS

Report a documentation issue

Read the upstream documentation. For corrections, first check the current manual.