Bug 199

Summary: lecture file left open
Product: Sudo Reporter: Jerry Brown <gerald.brown>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: normal    
Version: 1.6.8   
Hardware: All   
OS: All   

Description Jerry Brown 2005-11-10 19:18:54 MST
The optional lecture file is left open and passed to the target program, at
least in the case of "sudo su" on HP-UX 11.00. This is a problem if lecture is
on a file system I later need to unmount without disturbing the program launched
by sudo. Looks like check.c needs an fclose after line 131 (1.6.8p12).

    if (def_lecture_file && (fp = fopen(def_lecture_file, "r")) != NULL) {
        while ((nread = fread(buf, sizeof(char), sizeof(buf), fp)) != 0)
            fwrite(buf, nread, 1, stderr);
# next line is proposed addition
        fclose(fp);
    } else {
Comment 1 Todd C. Miller 2005-11-11 09:24:23 MST
Thanks, I've fixed this in the sudo cvs tree