Ignore:
Timestamp:
Jun 17, 2009, 4:43:35 AM (15 years ago)
Author:
Bruno Cornec
Message:
  • Add support of user for NFS write and fixes #316
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mondo/src/common/libmondo-cli.c

    r2223 r2224  
    988988            strncpy(bkpinfo->nfs_remote_dir, "/", MAX_STR_LEN);
    989989        }
     990        /* test if we specified a user for the NFS dialog */
     991        p = strchr(bkpinfo->nfs_mount, '@');
     992        if (p != NULL) {
     993            /* User found. Store the 2 values */
     994            p++;
     995            /* new NFS mount */
     996            strcpy(tmp,p);
     997            p--;
     998            *p = '\0';
     999            strcpy(bkpinfo->nfs_user,bkpinfo->nfs_mount);
     1000            strcpy(bkpinfo->nfs_mount,tmp);
     1001        }
    9901002        sprintf(tmp, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3",
    9911003                bkpinfo->nfs_mount);
     
    11361148    {
    11371149//      strncpy(psz, list_of_NFS_devices_and_mounts(), MAX_STR_LEN);
    1138         asprintf(&psz, "%s", list_of_NFS_mounts_only());
     1150        mr_asprintf(&psz, "%s", list_of_NFS_mounts_only());
    11391151        if (bkpinfo->exclude_paths[0]) {
    11401152            strncat(bkpinfo->exclude_paths, " ", 4*MAX_STR_LEN);
     
    12281240    if ((flag_set['n']) && (! bkpinfo->restore_data)) {
    12291241        mr_asprintf(&tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->nfs_remote_dir);
    1230         sprintf(tmp, "echo hi > %s", tmp1);
     1242        if (bkpinfo->nfs_user) {
     1243            sprintf(tmp, "sudo -u %s echo hi > %s", bkpinfo->nfs_user, tmp1);
     1244        } else {
     1245            sprintf(tmp, "echo hi > %s", tmp1);
     1246        }
    12311247        if (run_program_and_log_output(tmp, 2)) {
    12321248            retval++;
Note: See TracChangeset for help on using the changeset viewer.