--- backend/libpq/password.c.orig Sat Sep 13 07:20:14 1997 +++ backend/libpq/password.c Sat Jan 31 17:02:42 1998 @@ -24,7 +24,7 @@ char *p, *test_user, *test_pw; - char salt[3]; + char salt[10]; find_hba_entry(DataDir, port->raddr.sin_addr, database, &host_ok, &userauth, pw_file_name, true); @@ -90,7 +90,14 @@ if (test_pw[strlen(test_pw) - 1] == '\n') test_pw[strlen(test_pw) - 1] = '\0'; - strNcpy(salt, test_pw, 2); + if (strncmp(test_pw, "$1$", 3)) { + /* DES */ + strNcpy(salt, test_pw, 2); + } + else { + /* MD5 */ + strncpy(salt, test_pw, 9); + } if (strcmp(user, test_user) == 0) {