Username longer than 16 characters

hmp

New Member


Messages: 4

Hello.

I am using Freebsd 7.0 and I need to be able to send mail using sendmail that has a username longer than 16 chars. I don't use databases. I just add a system user (adduser) and send the mail - it isn't spam or something like it. But the problem is that pw doesn't accept usernames longer than 16 chars. I use mail as MUA.

So is there any way to add a user with a username longer than 16 char, or can this be avoided by using some options or doing some configuration of the sendmail/mail?
 

dh

Member

Reaction score: 22
Messages: 96

The limit is due to definitions in sys/params.h (MAXLOGNAME) and utms.h (UT_NAMESIZE). If you change those values you should recompile everything (world, all installed ports, packages etc).
 

Lucian

New Member


Messages: 5

Actually the files you need to edit are:

/usr/src/sys/sys/param.h (change MAXLOGNAME to fit your needs)
/usr/src/include/utmp.h (set UT_NAMESIZE to the value of the above MAXLOGNAME + 1)

Rebuild world (dont know if kernel recompile is needed).
 

novoops

New Member


Messages: 5

What about libpam?

It seems to me that a 32 character limit is fixed in libpam. UT_NAMESIZE and MAXLOGNAME can be updated and rebuilding world does seem to allow usernames longer than even 32 chars (I've tried 64). However, such users do not seem to be able to be authenticated with pam.

Is this something that anyone has tried to fix or work around? Could the pam libraries be rebuilt to use the UT_NAMESIZE constant?
 

vivek

Aspiring Daemon

Reaction score: 197
Messages: 805

Use virtual accounts. No need to provide system accounts for emailing purpose.
 

novoops

New Member


Messages: 5

For email purposes, virtual accounts could be fine, but for ftp (and quotas), an actual user is needed. I have a couple of clients with fairly long domain names, and that is how I discovered that the pam libraries have a fixed limit of 32 characters on login names. Obviously, I can work around this but using alternate usernames for these accounts, but it would be better if there wasn't such a limitation.

IMHO, the source code for pam should use the same constants as the rest of the system, rather a fixed 32 character limit.
 

novoops

New Member


Messages: 5

Lucian said:
/usr/src/sys/sys/param.h (change MAXLOGNAME to fit your needs)
/usr/src/include/utmp.h (set UT_NAMESIZE to the value of the above MAXLOGNAME + 1)

According to the source files...
UT_NAMESIZE should be set the maximum length for login names
MAXLOGNAME should be set to UT_NAMESIZE + 1

So, to allow 32-character login names...
#define UT_NAMESIZE 32
#define MAXLOGNAME 33.
 
Top