username more than 16 characters ?

Hello guys,

is there andy possibility, that usernames can be longer than 16 characters ? I know in Linux, it is no problem. For example raphaela.letterman is too long

Code:
pw user add raphaela.letterman
pw: name too long `raphaela.letterman' (max is 16)

In the FreeBSD Handbook, there is no information about this topic

Greets Martin
 
Looks like it's related to UT_NAMESIZE, and uhh, well, I'm already out of my depth now.
For a good time [cmd=""]grep -R UT_NAMESIZE /usr/src/[/cmd]
 
Hi,

what does it mean for me now ?

Code:
grep -R UT_NAMESIZE /usr/src/
/usr/src/bin/pax/gen_subs.c:#ifndef UT_NAMESIZE
[color="Red"]/usr/src/bin/pax/gen_subs.c:#define UT_NAMESIZE 8[/color]
/usr/src/bin/pax/gen_subs.c:            UT_NAMESIZE, name_uid(sbp->st_uid, 1), UT_GRPSIZE,
/usr/src/contrib/lukemftpd/src/logutmp.c:               memset(ut.ut_name, 0, UT_NAMESIZE);
/usr/src/contrib/ntp/libntp/systime.c:   *         char    ut_name[UT_NAMESIZE];
/usr/src/contrib/top/username.c:    char name[UT_NAMESIZE + 1];
/usr/src/contrib/top/username.c:    (void) strncpy(hash_table[hashindex].name, name, UT_NAMESIZE);
/usr/src/include/stdio.h:/* size for cuserid(3); UT_NAMESIZE + 1, see <utmp.h> */
[color="Red"]/usr/src/include/utmp.h:#define UT_NAMESIZE     16      /* see MAXLOGNAME in <sys/param.h>[/color] */
/usr/src/include/utmp.h:        char    ut_name[UT_NAMESIZE];
/usr/src/lib/libc/gen/pwcache.c:                char    name[UT_NAMESIZE + 1];
/usr/src/lib/libc/gen/pwcache.c:                        (void)strncpy(cp->name, pw->pw_name, UT_NAMESIZE);
/usr/src/lib/libc/gen/pwcache.c:                        cp->name[UT_NAMESIZE] = '\0';
/usr/src/lib/libc/gen/pwcache.c:                        (void)snprintf(cp->name, UT_NAMESIZE, "%u", uid);
/usr/src/lib/libc/gen/pwcache.c:                char    name[UT_NAMESIZE + 1];
/usr/src/lib/libc/gen/pwcache.c:                        (void)strncpy(cp->name, gr->gr_name, UT_NAMESIZE);
/usr/src/lib/libc/gen/pwcache.c:                        cp->name[UT_NAMESIZE] = '\0';
/usr/src/lib/libc/gen/pwcache.c:                        (void)snprintf(cp->name, UT_NAMESIZE, "%u", gid);
/usr/src/lib/libc/posix1e/acl_to_text.c:        char             name_buf[UT_NAMESIZE+1];
/usr/src/lib/libc/posix1e/acl_to_text.c:                            UT_NAMESIZE+1, name_buf, flags);
/usr/src/lib/libc/posix1e/acl_to_text.c:                            UT_NAMESIZE+1, name_buf, flags);
/usr/src/lib/libutil/logout.c:          bzero(ut.ut_name, UT_NAMESIZE);
/usr/src/libexec/atrun/atrun.c:#if (MAXLOGNAME-1) > UT_NAMESIZE
/usr/src/libexec/atrun/atrun.c:#define LOGNAMESIZE UT_NAMESIZE
/usr/src/libexec/rpc.rusersd/rusers_proc.c:#ifndef UT_NAMESIZE
/usr/src/libexec/rpc.rusersd/rusers_proc.c:#define UT_NAMESIZE sizeof(((struct utmp *)0)->ut_name)
/usr/src/libexec/rpc.rusersd/rusers_proc.c:typedef char ut_name_t[UT_NAMESIZE+1];
/usr/src/libexec/rpc.rusersd/rusers_proc.c:                        strncpy(name[nusers], usr.ut_name, UT_NAMESIZE);
/usr/src/libexec/rpc.rusersd/rusers_proc.c:                     name[nusers][UT_NAMESIZE] =
/usr/src/release/picobsd/tinyware/login/pico-login.c:           if (strlen(username) > UT_NAMESIZE)
/usr/src/release/picobsd/tinyware/login/pico-login.c:                   username[UT_NAMESIZE] = '\0';
/usr/src/release/picobsd/tinyware/login/pico-login.c:#define    NBUFSIZ         UT_NAMESIZE + 64
/usr/src/share/man/man5/utmp.5:        char    ut_name[UT_NAMESIZE];    /* User's login name */
grep: warning: /usr/src/sys/modules/usb/upgt/@: recursive directory loop
/usr/src/sys/sys/param.h: * MAXLOGNAME should be == UT_NAMESIZE+1 (see <utmp.h>)
/usr/src/usr.bin/finger/finger.c:       char name[UT_NAMESIZE + 1];
/usr/src/usr.bin/finger/finger.c:       name[UT_NAMESIZE] = '\0';
/usr/src/usr.bin/finger/finger.c:                       bcopy(user.ut_name, name, UT_NAMESIZE);
/usr/src/usr.bin/finger/sprint.c:       (void)printf("%-*s %-*s%s %s\n", UT_NAMESIZE, "Login", MAXREALNAME,
/usr/src/usr.bin/finger/sprint.c:                       (void)printf("%-*.*s %-*.*s", UT_NAMESIZE, UT_NAMESIZE,
/usr/src/usr.bin/finger/util.c: char buf[UT_NAMESIZE + 1];
/usr/src/usr.bin/finger/util.c: /* Name may be only UT_NAMESIZE long and not NUL terminated. */
/usr/src/usr.bin/finger/util.c: for (cnt = 0; cnt < UT_NAMESIZE && *name; ++name, ++cnt)
/usr/src/usr.bin/last/last.c:           crmsg = strncmp(bp->ut_name, "shutdown", UT_NAMESIZE) ?
/usr/src/usr.bin/last/last.c:       UT_NAMESIZE, UT_NAMESIZE, bp->ut_name,
/usr/src/usr.bin/last/last.c:                   if (!strncmp(step->name, bp->ut_name, UT_NAMESIZE))
/usr/src/usr.bin/lastcomm/lastcomm.c:                        UT_NAMESIZE, user_from_uid(ab.ac_uid, 0),
/usr/src/usr.bin/rwho/rwho.c:              UT_NAMESIZE, sizeof(mp->myutmp.out_name),
/usr/src/usr.bin/users/users.c:typedef char   namebuf[UT_NAMESIZE];
/usr/src/usr.bin/users/users.c:                 (void)strncpy(names[ncnt], utmp.ut_name, UT_NAMESIZE);
/usr/src/usr.bin/users/users.c:         qsort(names, ncnt, UT_NAMESIZE, scmp);
/usr/src/usr.bin/users/users.c:         (void)printf("%.*s", UT_NAMESIZE, names[0]);
/usr/src/usr.bin/users/users.c:                 if (strncmp(names[cnt], names[cnt - 1], UT_NAMESIZE))
/usr/src/usr.bin/users/users.c:                         (void)printf(" %.*s", UT_NAMESIZE, names[cnt]);
/usr/src/usr.bin/users/users.c: return(strncmp(p, q, UT_NAMESIZE));
/usr/src/usr.bin/w/w.c:                         if (!strncmp(utmp.ut_name, *user, UT_NAMESIZE))
/usr/src/usr.bin/w/w.c:#define WUSED  (UT_NAMESIZE + UT_LINESIZE + W_DISPHOSTSIZE + \
/usr/src/usr.bin/w/w.c:                         UT_NAMESIZE, UT_NAMESIZE, HEADER_USER,
/usr/src/usr.bin/w/w.c:             UT_NAMESIZE, UT_NAMESIZE, ep->utmp.ut_name,
/usr/src/usr.bin/who/who.c:     printf("%-*s ", UT_NAMESIZE, "NAME");
/usr/src/usr.bin/who/who.c:     printf("%-*.*s ", UT_NAMESIZE, UT_NAMESIZE, ut->ut_name);
/usr/src/usr.bin/who/who.c:             printf("%-*.*s", UT_NAMESIZE, UT_NAMESIZE, ut.ut_name);
/usr/src/usr.bin/who/who.c:             if (++col < ncols / (UT_NAMESIZE + 1))
/usr/src/usr.bin/who/who.c:     strncpy(ut.ut_name, name, UT_NAMESIZE);
/usr/src/usr.sbin/ac/ac.c:      char    name[UT_NAMESIZE+1];
/usr/src/usr.sbin/ac/ac.c:              if (strncmp(up->name, name, UT_NAMESIZE) == 0) {
/usr/src/usr.sbin/ac/ac.c:      static char str_result[40+UT_LINESIZE+UT_NAMESIZE];
/usr/src/usr.sbin/ac/ac.c:              maxcopy = strlen(str_result) + UT_NAMESIZE + 1;
/usr/src/usr.sbin/ac/ac.c:      (void)printf("\t%-*s %8.2f\n", UT_NAMESIZE, name,
/usr/src/usr.sbin/adduser/adduser.8:.Dv UT_NAMESIZE
/usr/src/usr.sbin/lastlogin/lastlogin.c:                UT_NAMESIZE, UT_NAMESIZE, p->pw_name,
/usr/src/usr.sbin/pw/pw_user.c:#if (MAXLOGNAME-1) > UT_NAMESIZE
/usr/src/usr.sbin/pw/pw_user.c:#define LOGNAMESIZE UT_NAMESIZE
/usr/src/usr.sbin/repquota/repquota.c:          max(UT_NAMESIZE,10), " ");
/usr/src/usr.sbin/repquota/repquota.c:          type == USRQUOTA ? "User " : "Group", max(UT_NAMESIZE,10), " ");
/usr/src/usr.sbin/repquota/repquota.c:          printf("%-*s ", max(UT_NAMESIZE,10), fup->fu_name);
/usr/src/usr.sbin/sysinstall/user.c:    uname[UT_NAMESIZE + 1],
/usr/src/usr.sbin/sysinstall/user.c:    { 2, 6, UT_NAMESIZE, UT_NAMESIZE + 1,
/usr/src/usr.sbin/syslogd/syslogd.c:            char    f_uname[MAXUNAMES][UT_NAMESIZE+1];
/usr/src/usr.sbin/syslogd/syslogd.c:                        UT_NAMESIZE)) {
/usr/src/usr.sbin/syslogd/syslogd.c:                    (void)strncpy(f->f_un.f_uname[i], p, UT_NAMESIZE);
/usr/src/usr.sbin/syslogd/syslogd.c:                    if ((q - p) > UT_NAMESIZE)
/usr/src/usr.sbin/syslogd/syslogd.c:                            f->f_un.f_uname[i][UT_NAMESIZE] = '\0';

that the two red lines should be patched by me ? And then build a new kernel ?

greets
 
You'd have to build a new world & kernel. Also the /usr/src/bin/pax/gen_subs.c lines don't appear to have any effect outside of pax(1).

That's all assuming changing it to 32 (64, 128, 6442450944) didn't totally bØrk nfsv4(4) (or nis/yp, or everything for that matter).


Ad: installing your potentially bØrken world into a jail(8) might save you difficulties or pain or being eaten by a Grue.

AdII: perhaps just changing MAXLOGNAME in /usr/src/sys/sys/param.h?
 
How about getting used to putting the user's real name into the passwd's gecos field, where it belongs?

On a sidenote, passwd(5) states, that:
Code:
     The login name must never begin with a hyphen (`-'); also, it is strongly
     suggested that neither upper-case characters or dots (`.') be part of the
     name, as this tends to confuse mailers.  No field may contain a colon
     (`:') as this has been used historically to separate the fields in the
     user database.
 
Back
Top