Обсуждение: User names
Hi, I came across an anomaly yesterday which I would like clarified. I am using 6.5.3 but I don't know whether this is version specific. I created a new db user with a name that was 14 characters long, I allowed createuser to also create a dbase of the dame name. So far so good. There is no corresponding unix user so everything seemed fine. I then tried to add this user to an existing pg_passwd file. I didn't get an error, but it didn't add it either. What pg_passwd did do was to truncate the name to 8 characters, it then found an existing user as the root of my long name is an existing unix/postgres user and changed the password for that entry. This isn't what I wanted to happen. After some experimentation I found that I could add a user xxx to the file with pg_passwd and then edit the file and change the xxx to the correct 14 character name. Is there a defined max length for postgreSQL user names ? If there is and it is 8, then createuser should enforce it. If the length is > 8 then pg_passwd needs fixing so that it doesn't truncate. In either case, a message should have been given rather than the silent truncation, as it had me foxed for a while as to why my new user couldn't use the database and the existing user couldn't either. -- Glen and Rosanne Eustace, GodZone Internet Services, a division of AGRE Enterprises Ltd., P.O. Box 8020, Palmerston North, New Zealand Ph: +64 6 357 8168, Mobile: +64 21 424 015
"Glen and Rosanne Eustace" <agree@godzone.net.nz> writes: > Is there a defined max length for postgreSQL user names ? > If there is and it is 8, then createuser should enforce it. > If the length is > 8 then pg_passwd needs fixing so that it doesn't > truncate. A quick look in the pg_passwd sources indeed shows some hardwired limits on both username and password length. This is bogus. Anyone want to contribute a patch? For the record, the max username length should be NAMEDATALEN-1, and the password field in pg_shadow is 'text', so it should be happy to take any password that you're willing to type ;-). However, crypt password processing depends on crypt(3), which more than likely ignores characters beyond the eighth on most platforms. regards, tom lane
On Thu, Dec 14, 2000 at 12:41:34AM -0500, Tom Lane wrote: > For the record, the max username length should be NAMEDATALEN-1, and > the password field in pg_shadow is 'text', so it should be happy to > take any password that you're willing to type ;-). However, crypt > password processing depends on crypt(3), which more than likely ignores > characters beyond the eighth on most platforms. also be aware that as of FreeBSD 4.1 or so, the crypt() function on freebsd is actually doing some kinda MD5 thingy unless you specifically use crypt_set_format(). -- [ Jim Mercer jim@pneumonoultramicroscopicsilicovolcanoconiosis.ca ] [ Reptilian Research -- Longer Life through Colder Blood ] [ aka jim@reptiles.org +1 416 410-5633 ]
Can someone comment on this? > "Glen and Rosanne Eustace" <agree@godzone.net.nz> writes: > > Is there a defined max length for postgreSQL user names ? > > If there is and it is 8, then createuser should enforce it. > > If the length is > 8 then pg_passwd needs fixing so that it doesn't > > truncate. > > A quick look in the pg_passwd sources indeed shows some hardwired limits > on both username and password length. This is bogus. Anyone want to > contribute a patch? > > For the record, the max username length should be NAMEDATALEN-1, and > the password field in pg_shadow is 'text', so it should be happy to > take any password that you're willing to type ;-). However, crypt > password processing depends on crypt(3), which more than likely ignores > characters beyond the eighth on most platforms. > > regards, tom lane > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026