Ignore:
Timestamp:
Sep 23, 2007, 2:41:29 AM (13 years ago)
Author:
Bruno Cornec
Message:

Apply patch from Andree Leidenfrost, modified a bit to use bkpinfo->tmpdir instead of /tmp
or MINDI_CACHE when appropriate. Fix security issues in mondo
Thanks al ot Andree for catching all those issues.
Will not compile needs more work as bkpinfo->tmpdir isn't available everywhere
Should become a global in 3.x when only containing pointers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mondo/src/mondoarchive/main.c

    r1437 r1644  
    506506    }
    507507
    508 
    509     if (length_of_file("/tmp/changed.files") > 2) {
     508    if (length_of_file(MINDI_CACHE"/changed.files") > 2) {
    510509        if (g_text_mode) {
    511             log_to_screen
    512                 ("Type 'less /tmp/changed.files' to see which files don't match the archives");
    513         } else {
    514             log_msg(1,
    515                     "Type 'less /tmp/changed.files' to see which files don't match the archives");
     510            log_to_screen("Type 'less "MINDI_CACHE"/changed.files' to see which files don't match the archives");
     511        } else {
     512            log_msg(1, "Type 'less "MINDI_CACHE"/changed.files' to see which files don't match the archives");
    516513            log_msg(2, "Calling popup_changelist_from_file()");
    517             popup_changelist_from_file("/tmp/changed.files");
     514            popup_changelist_from_file(MINDI_CACHE"/changed.files");
    518515            log_msg(2, "Returned from popup_changelist_from_file()");
    519516        }
    520517    } else {
    521         unlink("/tmp/changed.files");
     518        unlink(MINDI_CACHE"/changed.files");
    522519    }
    523520    log_to_screen(say_at_end);
     
    529526
    530527    system("rm -f /var/cache/mondo-archive/last-backup.aborted");
    531     system("rm -Rf /tmp.mondo.* /mondo.scratch.*");
    532528    if (!retval) {
    533529        printf("Mondoarchive ran OK.\n");
     
    540536    chdir("/tmp");              // just in case there's something wrong with g_erase_tmpdir_and_scratchdir
    541537    system(g_erase_tmpdir_and_scratchdir);
     538
     539    /* assemble comand string for deletion of Mondo's tmp directory */
     540    sprintf(tmp, "rm -Rf %s", bkpinfo->tmpdir);
     541   
    542542    free_libmondo_global_strings();
    543543    paranoid_free(say_at_end);
    544     paranoid_free(tmp);
    545544    paranoid_free(bkpinfo);
    546 
    547     unlink("/tmp/filelist.full");
    548     unlink("/tmp/filelist.full.gz");
    549545
    550546    if (!g_cdrom_drive_is_here) {
     
    557553    /* finalize log file with time stamp */
    558554    log_msg(0, "Time finished: %s", mr_date());
     555
     556    /* remove Mondo's tmp directory */
     557    system(tmp);
     558    paranoid_free(tmp);
    559559
    560560    if (!g_text_mode) {
Note: See TracChangeset for help on using the changeset viewer.