|
37 | 37 | * |
38 | 38 | * |
39 | 39 | * IDENTIFICATION |
40 | | - * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.565 2008/09/23 20:35:38 momjian Exp $ |
| 40 | + * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.566 2008/10/28 12:10:43 mha Exp $ |
41 | 41 | * |
42 | 42 | * NOTES |
43 | 43 | * |
@@ -323,7 +323,7 @@ static intinitMasks(fd_set *rmask); |
323 | 323 | staticvoidreport_fork_failure_to_client(Port*port,interrnum); |
324 | 324 | staticenumCAC_statecanAcceptConnections(void); |
325 | 325 | staticlongPostmasterRandom(void); |
326 | | -staticvoidRandomSalt(char*cryptSalt,char*md5Salt); |
| 326 | +staticvoidRandomSalt(char*md5Salt); |
327 | 327 | staticvoidsignal_child(pid_tpid,intsignal); |
328 | 328 | staticvoidSignalSomeChildren(intsignal,boolonly_autovac); |
329 | 329 |
|
@@ -1808,7 +1808,7 @@ ConnCreate(int serverFd) |
1808 | 1808 | * fork, not after. Else the postmaster's random sequence won't get |
1809 | 1809 | * advanced, and all backends would end up using the same salt... |
1810 | 1810 | */ |
1811 | | -RandomSalt(port->cryptSalt,port->md5Salt); |
| 1811 | +RandomSalt(port->md5Salt); |
1812 | 1812 | } |
1813 | 1813 |
|
1814 | 1814 | /* |
@@ -3910,49 +3910,20 @@ dummy_handler(SIGNAL_ARGS) |
3910 | 3910 | { |
3911 | 3911 | } |
3912 | 3912 |
|
3913 | | - |
3914 | | -/* |
3915 | | - * CharRemap: given an int in range 0..61, produce textual encoding of it |
3916 | | - * per crypt(3) conventions. |
3917 | | - */ |
3918 | | -staticchar |
3919 | | -CharRemap(longch) |
3920 | | -{ |
3921 | | -if (ch<0) |
3922 | | -ch=-ch; |
3923 | | -ch=ch %62; |
3924 | | - |
3925 | | -if (ch<26) |
3926 | | -return'A'+ch; |
3927 | | - |
3928 | | -ch-=26; |
3929 | | -if (ch<26) |
3930 | | -return'a'+ch; |
3931 | | - |
3932 | | -ch-=26; |
3933 | | -return'0'+ch; |
3934 | | -} |
3935 | | - |
3936 | 3913 | /* |
3937 | 3914 | * RandomSalt |
3938 | 3915 | */ |
3939 | 3916 | staticvoid |
3940 | | -RandomSalt(char*cryptSalt,char*md5Salt) |
| 3917 | +RandomSalt(char*md5Salt) |
3941 | 3918 | { |
3942 | | -longrand=PostmasterRandom(); |
3943 | | - |
3944 | | -cryptSalt[0]=CharRemap(rand %62); |
3945 | | -cryptSalt[1]=CharRemap(rand /62); |
| 3919 | +longrand; |
3946 | 3920 |
|
3947 | 3921 | /* |
3948 | | - * It's okay to reuse the first random value for one of the MD5 salt |
3949 | | - * bytes, since only one of the two salts will be sent to the client. |
3950 | | - * After that we need to compute more random bits. |
3951 | | - * |
3952 | 3922 | * We use % 255, sacrificing one possible byte value, so as to ensure that |
3953 | 3923 | * all bits of the random() value participate in the result. While at it, |
3954 | 3924 | * add one to avoid generating any null bytes. |
3955 | 3925 | */ |
| 3926 | +rand=PostmasterRandom(); |
3956 | 3927 | md5Salt[0]= (rand %255)+1; |
3957 | 3928 | rand=PostmasterRandom(); |
3958 | 3929 | md5Salt[1]= (rand %255)+1; |
|