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-devices.c

    r1575 r1644  
    855855    }
    856856
    857     sprintf(mountpoint, "/tmp/cd.%d", (int) (random() % 32767));
     857    sprintf(mountpoint, "%s/cd.mnt", bkpinfo->tmpdir);
    858858    make_hole_for_dir(mountpoint);
    859859
     
    17321732            run_program_and_log_output("umount " MNT_CDROM, 5);
    17331733        }
    1734         system("mkdir -p /tmp/isodir &> /dev/null");
     1734        sprintf(tmp, "mkdir -p %s/isodir &> /dev/null", bkpinfo->tmpdir);
     1735        system(tmp);
    17351736        sprintf(tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir,
    17361737                bkpinfo->nfs_remote_dir, bkpinfo->prefix,
    17371738                cd_number_i_want);
    17381739        if (!does_file_exist(tmp)) {
    1739             sprintf(tmp, "/tmp/isodir/%s/%s-%d.iso",
     1740            sprintf(tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir,
    17401741                    bkpinfo->nfs_remote_dir, bkpinfo->prefix,
    17411742                    cd_number_i_want);
    17421743            if (does_file_exist(tmp)) {
    17431744                log_msg(1,
    1744                         "FIXME - hacking bkpinfo->isodir from '%s' to /tmp/isodir",
    1745                         bkpinfo->isodir);
    1746                 strcpy(bkpinfo->isodir, "/tmp/isodir");
     1745                        "FIXME - hacking bkpinfo->isodir from '%s' to %s/isodir",
     1746                        bkpinfo->isodir, bkpinfo->tmpdir);
     1747                sprintf(bkpinfo->isodir, "%s/isodir", bkpinfo->tmpdir);
    17471748            }
    17481749        }
     
    21172118        }
    21182119        if (bkpinfo->disaster_recovery) {
    2119             system("umount /tmp/isodir 2> /dev/null");
     2120            sprintf(command ,"umount %s/isodir 2> /dev/null", bkpinfo->tmpdir);
     2121            system(command);
    21202122            if (!popup_and_get_string
    21212123                ("NFS share", "Which remote NFS share should I mount?",
     
    21262128        }
    21272129        if (!is_this_device_mounted(bkpinfo->nfs_mount)) {
    2128             sprintf(bkpinfo->isodir, "/tmp/isodir.mondo.%d",
    2129                     (int) (random() % 32768));
     2130            sprintf(bkpinfo->isodir, "%s/nfsdir", bkpinfo->tmpdir);
    21302131            sprintf(command, "mkdir -p %s", bkpinfo->isodir);
    21312132            run_program_and_log_output(command, 5);
Note: See TracChangeset for help on using the changeset viewer.