Ignore:
Timestamp:
Sep 23, 2007, 2:41:29 AM (12 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/mondorestore/mondo-rstr-compare.c

    r1630 r1644  
    202202    log_msg(1, tmp_ptr);
    203203    if (retval) {
    204         if (!(fout = fopen("/tmp/changed.txt", "a"))) {
     204        if (!(fout = fopen(MINDI_CACHE"/changed.txt", "a"))) {
    205205            fatal_error("Cannot openout changed.txt");
    206206        }
     
    381381    if (length_of_file(logfile) > 5) {
    382382        sprintf(command,
    383                 "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> /tmp/changed.txt",
     383                "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> "MINDI_CACHE"/changed.txt",
    384384                logfile);
    385385        system(command);
     
    542542    getcwd(new, MAX_STR_LEN - 1);
    543543    insist_on_this_cd_number(bkpinfo, g_current_media_number);
    544     unlink("/tmp/changed.txt");
     544    unlink(MINDI_CACHE"/changed.txt");
    545545
    546546    resA = compare_all_tarballs(bkpinfo);
    547547    resB = compare_all_biggiefiles(bkpinfo);
    548548    chdir(cwd);
    549     noof_changed_files = count_lines_in_file("/tmp/changed.txt");
     549    noof_changed_files = count_lines_in_file(MINDI_CACHE"/changed.txt");
    550550    if (noof_changed_files) {
    551551        sprintf(tmp, "%ld files do not match the backup            ",
     
    553553        //      mvaddstr_and_log_it( g_currentY++, 0, tmp );
    554554        log_to_screen(tmp);
    555         sprintf(command, "cat /tmp/changed.txt >> %s", MONDO_LOGFILE);
     555        sprintf(command, "cat "MINDI_CACHE"/changed.txt >> %s", MONDO_LOGFILE);
    556556        paranoid_system(command);
    557557    } else {
     
    641641    }
    642642
    643     if (count_lines_in_file("/tmp/changed.txt") > 0) {
     643    if (count_lines_in_file(MINDI_CACHE"/changed.txt") > 0) {
    644644        mvaddstr_and_log_it(g_currentY++, 0,
    645645                            "Differences found while files were being compared.");
    646         streamline_changes_file("/tmp/changed.files", "/tmp/changed.txt");
    647         if (count_lines_in_file("/tmp/changed.files") <= 0) {
     646        streamline_changes_file(MINDI_CACHE"/changed.files", MINDI_CACHE"/changed.txt");
     647        if (count_lines_in_file(MINDI_CACHE"/changed.files") <= 0) {
    648648            mvaddstr_and_log_it(g_currentY++, 0,
    649649                                "...but they were logfiles and temporary files. Your archives are fine.");
     
    651651                ("The differences were logfiles and temporary files. Your archives are fine.");
    652652        } else {
    653             q = count_lines_in_file("/tmp/changed.files");
     653            q = count_lines_in_file(MINDI_CACHE"/changed.files");
    654654            sprintf(tmp, "%ld significant difference%s found.", q,
    655655                    (q != 1) ? "s" : "");
     
    666666            chdir(bkpinfo->restore_path);
    667667            getcwd(new, MAX_STR_LEN - 1);
    668             popup_changelist_from_file("/tmp/changed.files");
     668            popup_changelist_from_file(MINDI_CACHE"/changed.files");
    669669            chdir(cwd);
    670670            log_msg(2, "Returning from popup_changelist_from_file()");
     
    723723    res = verify_tape_backups(bkpinfo);
    724724    chdir(dir);
    725     if (length_of_file("/tmp/changed.txt") > 2
    726         && length_of_file("/tmp/changed.files") > 2) {
     725    if (length_of_file(MINDI_CACHE"/changed.txt") > 2
     726        && length_of_file(MINDI_CACHE"/changed.files") > 2) {
    727727        log_msg(0,
    728                 "Type 'less /tmp/changed.files' to see which files don't match the archives");
     728                "Type 'less "MINDI_CACHE"/changed.files' to see which files don't match the archives");
    729729        log_msg(2, "Calling popup_changelist_from_file()");
    730         popup_changelist_from_file("/tmp/changed.files");
     730        popup_changelist_from_file(MINDI_CACHE"/changed.files");
    731731        log_msg(2, "Returned from popup_changelist_from_file()");
    732732    }
Note: See TracChangeset for help on using the changeset viewer.