Ignore:
Timestamp:
Sep 23, 2007, 2:41:29 AM (17 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/common/libmondo-verify.c

    r1316 r1644  
    395395                            bkpinfo->restore_path,
    396396                            biggiestruct.filename);
    397                 asprintf(&tmp, "echo \"%s/%s not found\" >> /tmp/biggies.changed",
     397                asprintf(&tmp, "echo \"%s/%s not found\" >> %s/biggies.changed",
    398398                            bkpinfo->restore_path,
    399                             biggiestruct.filename);
     399                            biggiestruct.filename,
     400                            bkpinfo->tmpdir);
    400401                system(tmp);
    401402                paranoid_free(tmp);
     
    786787                    biggie_fname);
    787788            log_to_screen(tmp);
    788             sprintf(tmp, "echo \"%s\" >> /tmp/biggies.changed",
    789                     biggie_fname);
     789            sprintf(tmp, "echo \"%s\" >> %s/biggies.changed",
     790                    biggie_fname, bkpinfo->tmpdir);
    790791            system(tmp);
    791792        }
     
    11811182/* close tape; exit */
    11821183//  fclose(g_tape_stream); <-- not needed; is handled by closein_tape()
    1183     paranoid_system
    1184         ("rm -f /tmp/biggies.changed /tmp/changed.files.[0-9]* 2> /dev/null");
    1185     sprintf(changed_files_fname, "/tmp/changed.files.%d",
    1186             (int) (random() % 32767));
     1184    sprintf(tmp, "rm -f %s/biggies.changed %s/changed.files 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir);
     1185    paranoid_system(tmp);
     1186    sprintf(changed_files_fname, "%s/changed.files", bkpinfo->tmpdir);
    11871187    sprintf(tmp,
    11881188            "grep -E '^%s:.*$' %s | cut -d'\"' -f2 | sort -u | awk '{print \"/\"$0;};' | tr -s '/' '/' | grep -v \"(total of\" | grep -v \"incheckentry.*xwait\" | grep -vE '^/afio:.*$' | grep -vE '^dev/.*$'  > %s",
     
    12011201        }
    12021202    }
    1203     sprintf(tmp, "cat /tmp/biggies.changed >> %s", changed_files_fname);
     1203    sprintf(tmp, "cat %s/biggies.changed >> %s", bkpinfo->tmpdir, changed_files_fname);
    12041204    paranoid_system(tmp);
    12051205
    12061206    diffs = count_lines_in_file(changed_files_fname);
    12071207    if (diffs > 0) {
    1208         sprintf(tmp, "cp -f %s %s", changed_files_fname,
    1209                 "/tmp/changed.files");
     1208        sprintf(tmp, "cp -f %s %s/changed.files", changed_files_fname,
     1209                MINDI_CACHE);
    12101210        run_program_and_log_output(tmp, FALSE);
    12111211        sprintf(tmp,
    1212                 "%ld files differed from live filesystem; type less %s or less %s to see",
    1213                 diffs, changed_files_fname, "/tmp/changed.files");
     1212                "%ld files differed from live filesystem; type less %s or less %s/changed.files to see",
     1213                diffs, changed_files_fname, MINDI_CACHE);
    12141214        log_msg(0, tmp);
    1215         log_to_screen
    1216             ("See /tmp/changed.files for a list of nonmatching files.");
    1217         log_to_screen
    1218             ("The files probably changed on filesystem, not on backup media.");
     1215        log_to_screen("See "MINDI_CACHE"/changed.files for a list of nonmatching files.");
     1216        log_to_screen("The files probably changed on filesystem, not on backup media.");
    12191217        //      retval++;
    12201218    }
Note: See TracChangeset for help on using the changeset viewer.