Bug 162976 - [libc] cron fails unnecessarily via setlogin(2) with sufficiently long usernames
Summary: [libc] cron fails unnecessarily via setlogin(2) with sufficiently long usernames
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2011-11-30 20:40 UTC by Enji Cooper
Modified: 2018-05-20 23:49 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer 2011-11-30 20:40:11 UTC
One can use active directory usernames in crontab like so and most of
the system is happy working with these long usernames:

*       *       *       *       *       STOUT\administrator     PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin true >/dev/null 2>&1

The problem is that cron gets unhappy when trying to run setlogin(2),
which ends up spewing out errors in syslog and cron exits:

Nov 30 07:44:00 truenas cron[25967]: setlogin(STOUT\administrator): Invalid argument

This limitation appears to still be present in 10-CURRENT though.


The only fix (which would be invasive) would be to honor (and exceed)
the limits set by other operating systems so that setlogin(2) wouldn't
fail. According to this KB article via MS, the username limit is 104
characters (although the recommend not going over 64 characters).

Other infrastructure pieces might need to be taught to honor this limit
(like utmp*).
How-To-Repeat: 1. Hook machine into AD/LDAP realm (the above example uses the STOUT AD
2. Create something like the following entry:

*       *       *       *       *       STOUT\administrator     PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin true >/dev/null 2>&1
Comment 1 Erin Clark 2016-03-30 00:19:32 UTC
This appears to not be a problem anymore in 10.3 rc3
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:49:56 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

- Set Status to "Open"