N + 1); (gdb) 128 if (!pg_md5_encrypt(password, role, strlen(role), (gdb) s pg_md5_encrypt (passwd=0x99c3b4c "123456", salt=0x99c3b3c "yzs", salt_len=3, buf=0x9a0d984 "") at md5.c:326 326 size_t passwd_len = strlen(passwd); (gdb) n 329 char *crypt_buf = malloc(passwd_len + salt_len + 1); (gdb) 332 if (!crypt_buf) (gdb) 339 memcpy(crypt_buf, passwd, passwd_len); (gdb) 340 memcpy(crypt_buf + passwd_len, salt, salt_len); (gdb) p crypt_buf $1 = 0x9979e68 "123456A" (gdb) n 342 strcpy(buf, "md5"); (gdb) p crypt_buf $2 = 0x9979e68 "123456yzs?\tQ" (gdb) n 343 ret = pg_md5_hash(crypt_buf, passwd_len + salt_len, buf + 3); (gdb) p crypt_buf $3 = 0x9979e68 "123456yzs?\tQ" (gdb) n 345 free(crypt_buf); (gdb) p crypt_buf $4 = 0x9979e68 "123456yzs?\tQ" (gdb) n 347 return ret; (gdb) 348 } (gdb) p ret $5 = 1 '\001' (gdb) n encrypt_password (target_type=PASSWORD_TYPE_MD5, role=0x99c3b3c "yzs", password=0x99c3b4c "123456") at crypt.c:131 131 return encrypted_password; (gdb) 146 } (gdb) CreateRole (pstate=0x9a0d804, stmt=0x99c3bbc) at user.c:415 415 CStringGetTextDatum(shadow_pass); (gdb) p shadow_pass $6 = 0x9a0d984 "md5aed8080c314507e15542d5e9519723a8"
3、从pg_authid表中观察该用户经过md5加过密的密码值,可以看出和堆栈信息中看到的一样
postgres=# select *from pg_authid where rolname='yzs'; rolname | rolsuper | rolinherit | rolcreaterole | rolcreatedb | rolcanlogin | rolreplication | rolbypa***ls | rolconnlimit | rolpassword | rolvaliduntil ---------+----------+------------+---------------+-------------+-------------+----------------+--------------+--------------+-------------------------------------+--------------- yzs | f | t | f | f | t | f | f | -1 | md5aed8080c314507e15542d5e9519723a8 | (1 row)
|