Automatic/Timed Login broken when used with a script
Submitted by Brian Cameron
Link to original bug (#679011)
Description
You can set the AutomaticLogin or TimedLogin value to a script like this "/usr/bin/autouser|" and then it will use whatever user is returned from the script as the user to login via automatic or timed login.
However, if you call the gdm_slave_get_timed_login_details function with a NULL username, then it never bothers to try and interpret the username. If the username is invalid or "", then it should just turn off automatic/timed login and behave as if it is not turned on.
However, this doesn't work currently since this code in the function gdm_slave_get_timed_login_details causes it to just return enabledp to the setting in the configuration file. The configuration enabled value might be TRUE even if the username returned by the script is invalid.
if (usernamep != NULL) {
*usernamep = gdm_slave_parse_enriched_value (slave,
username);
} else {
g_free (username);
if (enabledp != NULL) {
*enabledp = enabled;
}
if (delayp != NULL) {
*delayp = delay;
}
return TRUE;
}
However, if you always call this function with a valid username pointer, then it actually tries to parse the value and if it is not a valid user, enabledp gets set to the correct value.
So, to fix this bug, it is simply necessary to fix gdm-simple-slave.c so that all calls to gdm_slave_get_timed_login_details always pass in a username pointer and just free it after the call if it is no longer needed.
Or, perhaps another way to fix it would be to fix the gdm_slave_get_timed_login_details so it always calls gdm_slave_parse_enriched_value even if usernamep is NULL and to do the right thing.
Version: 3.5.x