Comment 4 for bug 387262

Revision history for this message
Loïc Minier (lool) wrote : Re: pam_env's and localechooser's usage of quotes for /etc/default/locale conflicts

Sorry for wrongly assuming this was pam_env; this lead me to think that the fix would be intrusive in pam_env and a change in localechooser had to be considered, but that's not the case, it's just sudo not using the same algorithm:
/*
 * Read in /etc/environment ala AIX and Linux.
 * Lines are in the form of NAME=VALUE
 * Invalid lines, blank lines, or lines consisting solely of a comment
 * character are skipped.
 */
void
read_env_file(path, replace)
    const char *path;
    int replace;
{
    FILE *fp;
    char *cp;

    if ((fp = fopen(path, "r")) == NULL)
        return;

    /* Make sure we are operating on the current environment. */
    if (env.envp != environ)
        sync_env();

    while ((cp = sudo_parseln(fp)) != NULL) {
        /* Skip blank or comment lines */
        if (*cp == '\0')
            continue;

        /* Must be of the form name=value */
        if (strchr(cp, '=') == NULL)
            continue;

        insert_env(estrdup(cp), replace ? TRUE : -1, TRUE);
    }
    fclose(fp);
}