Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 94162 - sys-libs/pwdb <= 0.62 insecure temporary file creation
Summary: sys-libs/pwdb <= 0.62 insecure temporary file creation
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Auditing (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Gentoo Security
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-27 04:28 UTC by Romang
Modified: 2006-12-27 01:18 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Romang 2005-05-27 04:28:13 UTC
Hello,

What did you think about this :

------------------------------------

include/pwdb/_pwdb_macros.h

/*
 * This is for debugging purposes ONLY. DO NOT use on live systems !!!
 * You have been warned :-) - CG
 *
 * to get automated debugging to the log file, it must be created manually.
 * _PWDB_LOGFILE must exist, mode 666
 */

#ifndef _PWDB_LOGFILE
#define _PWDB_LOGFILE "/tmp/pwdb-debug.log"
#endif

static void _pwdb_output_debug_info(const char *file, const char *fn
                                   , const int line)
{
    FILE *logfile;
    int must_close = 1;
    
    if (!(logfile = fopen(_PWDB_LOGFILE,"a"))) {
        logfile = stderr;
        must_close = 0;
    }
    fprintf(logfile,"[%s:%s(%d)] ",file, fn, line);
    if (must_close) {
        fflush(logfile);
        fclose(logfile);
    }
}

Many times in this script, but also in

libpwdb/_pwdb_macros.h

The developer warn in the source code, but no way to see this message
when using the librairy.

Regards.
Comment 1 Tavis Ormandy (RETIRED) gentoo-dev 2005-05-27 10:46:08 UTC
I think this can be considered safe, there's a big warning there about using it. 

In general, it's up to developers to use library functions safely (ie, in this 
case defining _PWDB_LOGFILE if he wants to use the debugging stuff).

He's wrong about fopen() failing if the file doesnt exist though, append will 
still create it, if that's what he meant.