Below are some fragments of code (password, hosts, username changed...
kept in context).
Every time I try to connect it fails. I have been running strace on the
back end and front end. Below are snips of that as well.
C snippet:
#define DB_NAME "somedb"
#define DB_HOST "www.somedaysomewhere.com"
#define DB_PORT NULL
#define DB_TTY NULL
#define DB_OPTIONS NULL
#define DB_USER "example" // Not the real user name and password are
both 8 chars or under #define DB_PASS "ejemplo"
void debugprint(PGresult *temp);
int main(int argck, char *argv[])
{
PGconn *database;
PGresult *itemmaster, *languages, *backendinfo, *companyinfo;
database=PQsetdbLogin(DB_HOST, DB_PORT, DB_OPTIONS, DB_TTY,
DB_NAME, DB_USER, DB_PASS);
My program with strace:
read(4, "EUser authentication failed\0", 4096) = 28
open("stdio", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 5
Server with strace:
open("/var/lib/pgsql/pg_hba", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/var/lib/pgsql/pg_hba.conf", O_RDONLY) = 6
fstat(6, {st_mode=0, st_size=0, ...}) = 0
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x40045000
read(6, "#\n# Example PostgreSQL host acc"..., 4096) = 4096
read(6, "address 192.168.0.x to\n# connec"..., 4096) = 1061
read(6, "", 4096) = 0
close(6) = 0
munmap(0x40045000, 4096) = 0
write(2, "User authentication failed\n", 27) = 27
sigprocmask(SIG_SETMASK, [], NULL) = 0
select(6, [3 4], [5], NULL, NULL) = 1 (out [5])
sigprocmask(SIG_BLOCK, [CHLD], []) = 0
write(5, "EUser authentication failed\0", 28) = 28
close(5) = 0
sigprocmask(SIG_SETMASK, [], NULL) = 0
pg_hba.conf entry:
local all trust
host all 127.0.0.1 255.255.255.255 trust
host all 192.168.1.0 255.255.255.227 crypt
I have also tried password passwd. I created that file with the correct
entries. Also, the user is real and the password is right according to
alter user example with password ejemplo as well as the pg_passwd. I
have since erased file passwd. It seemed a waste.
Any help would be supremely appreciated. Please, if you have info on
pg_crypt please send it my way. The man pages say there should be one
for pg_crypt. I have yet to find it.
Please post here as well as directly to me because I am not subscribed
to the list.
Thank you,
Trever Adams
highlander@teleteam.net