Username longer than 16 characters

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?
 
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).
 
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).
 
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?
 
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.
 
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.
 
Back
Top