Changeset 3667

Show
Ignore:
Timestamp:
09/30/08 01:29:28 (2 months ago)
Author:
paule
Message:

Wrap call to mkstemp with umask to improve temp file security. Patch courtesy of Erik Hovland <erik at hovland org>

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • plugins/opie-sync/src/opie_comms.c

    r3251 r3667  
    3636 
    3737#include <curl/curl.h> 
    38 #include <curl/types.h> 
    3938#include <curl/easy.h> 
    4039 
     
    9594        TempFile *tmpfile = g_malloc(sizeof(TempFile)); 
    9695        char *template = g_strdup("/tmp/opie-sync.XXXXXX"); 
     96        mode_t current_mode = umask(S_IRWXG | S_IRWXO); 
    9797        tmpfile->fd = mkstemp(template); 
     98        umask(current_mode); 
    9899        if(tmpfile->fd == -1) { 
    99100                osync_trace( TRACE_EXIT_ERROR, "failed to create temporary file" );