PostgreSQL 8.3.6 Documentation
Prev | Fast Backward | Chapter 30. libpq - C Library | Fast Forward | Next

# 30.10. Miscellaneous Functions

As always, there are some functions that just don't fit anywhere.

`PQencryptPassword`

  Prepares the encrypted form of a PostgreSQL password.

             char * PQencryptPassword(const char *passwd, const char *user);

  This function is intended to be used by client applications that wish to send commands like `ALTER USER joe PASSWORD 'pwd'`. It is good practice not to send the original cleartext password in such a command, because it might be exposed in command logs, activity displays, and so on. Instead, use this function to convert the password to encrypted form before it is sent. The arguments are the cleartext password, and the SQL name of the user it is for. The return value is a string allocated by `malloc`, or `NULL` if out of memory. The caller can assume the string doesn't contain any special characters that would require escaping. Use `PQfreemem` to free the result when done with it.

Prev | Home | Next
Control Functions | Up | Notice Processing