Changeset 2224 in MondoRescue for branches/2.2.9/mondo/src
- Timestamp:
- Jun 17, 2009, 4:43:35 AM (16 years ago)
- Location:
- branches/2.2.9/mondo/src/common
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mondo/src/common/libmondo-cli.c
r2223 r2224 988 988 strncpy(bkpinfo->nfs_remote_dir, "/", MAX_STR_LEN); 989 989 } 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 } 990 1002 sprintf(tmp, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", 991 1003 bkpinfo->nfs_mount); … … 1136 1148 { 1137 1149 // 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()); 1139 1151 if (bkpinfo->exclude_paths[0]) { 1140 1152 strncat(bkpinfo->exclude_paths, " ", 4*MAX_STR_LEN); … … 1228 1240 if ((flag_set['n']) && (! bkpinfo->restore_data)) { 1229 1241 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 } 1231 1247 if (run_program_and_log_output(tmp, 2)) { 1232 1248 retval++; -
branches/2.2.9/mondo/src/common/libmondo-devices.c
r2220 r2224 1283 1283 make_hole_for_dir(mountpoint); 1284 1284 1285 #if ndef __FreeBSD__1285 #ifdef __FreeBSD__ 1286 1286 char *dev = NULL; 1287 #else 1287 1288 char *options = NULL; 1288 1289 mr_asprintf(&options, "ro"); … … 1469 1470 { 1470 1471 char *tmp = NULL; 1471 char *tmp1 = NULL;1472 1472 char *sz_size; 1473 1473 char *command; … … 2053 2053 log_it("isodir = %s", bkpinfo->isodir); 2054 2054 log_it("nfs_mount = '%s'", bkpinfo->nfs_mount); 2055 if (bkpinfo->nfs_user != NULL) { 2056 log_it("nfs_user = '%s'", bkpinfo->nfs_user); 2057 } 2055 2058 #endif 2056 2059 … … 2101 2104 static char result_sz[1024]; 2102 2105 2103 mr_asprintf( exclude_these_directories,"%s",list_of_NFS_mounts_only());2104 mr_asprintf( exclude_these_devices,"%s",2106 mr_asprintf(&exclude_these_directories,"%s",list_of_NFS_mounts_only()); 2107 mr_asprintf(&exclude_these_devices,"%s", 2105 2108 call_program_and_get_last_line_of_output 2106 2109 ("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'")); 2107 snprintf(result_sz, "%s %s", exclude_these_directories, 2108 exclude_these_devices, 1023); 2110 snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices); 2109 2111 mr_free(exclude_these_devices); 2110 2112 mr_free(exclude_these_directories); … … 2129 2131 call_program_and_get_last_line_of_output 2130 2132 ("mount -t coda,ncpfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'")); 2131 snprintf(result_sz, "%s", exclude_these_directories, 511);2133 snprintf(result_sz, 511, "%s", exclude_these_directories); 2132 2134 mr_free(exclude_these_directories); 2133 2135 return (result_sz); -
branches/2.2.9/mondo/src/common/libmondo-fork.c
r2178 r2224 7 7 8 8 #include "my-stuff.h" 9 #include "mr_mem.h" 9 10 #include "mondostructures.h" 10 11 #include "libmondo-fork.h" … … 103 104 *old_stderr, *cd_number_str; 104 105 char *p; 106 char *tmp1 = NULL; 105 107 106 108 /*@*********** End Variables ***************************************/ … … 131 133 old_stderr[0] = '\0'; 132 134 135 if (bkpinfo->nfs_user != NULL) { 136 mr_asprintf(&tmp1, "sudo -u %s %s", bkpinfo->nfs_user, basic_call); 137 } else { 138 mr_asprintf(&tmp1, "%s", basic_call); 139 } 140 133 141 sprintf(cd_number_str, "%d", cd_no); 134 resolve_naff_tokens(midway_call, basic_call, isofile, "_ISO_");142 resolve_naff_tokens(midway_call, tmp1, isofile, "_ISO_"); 135 143 resolve_naff_tokens(tmp, midway_call, cd_number_str, "_CD#_"); 136 144 resolve_naff_tokens(ultimate_call, tmp, MONDO_LOGFILE, "_ERR_"); 137 log_msg(4, "basic call = '%s'", basic_call);145 log_msg(4, "basic call = '%s'", tmp1); 138 146 log_msg(4, "midway_call = '%s'", midway_call); 139 147 log_msg(4, "tmp = '%s'", tmp); … … 169 177 } 170 178 if (retval) { 171 log_msg(2, "Basic call '%s' returned an error.", basic_call);179 log_msg(2, "Basic call '%s' returned an error.", tmp1); 172 180 popup_and_OK("Press ENTER to continue."); 173 181 popup_and_OK … … 184 192 } 185 193 194 mr_free(tmp1); 186 195 paranoid_free(midway_call); 187 196 paranoid_free(ultimate_call); -
branches/2.2.9/mondo/src/common/libmondo-tools.c
r2211 r2224 857 857 bkpinfo->kernel_path[0] = '\0'; 858 858 bkpinfo->nfs_mount[0] = '\0'; 859 bkpinfo->nfs_user[0] = '\0'; 859 860 bkpinfo->nfs_remote_dir[0] = '\0'; 860 861 bkpinfo->postnuke_tarball[0] = '\0'; -
branches/2.2.9/mondo/src/common/mondostructures.h
r2188 r2224 570 570 */ 571 571 char nfs_remote_dir[MAX_STR_LEN]; 572 573 /** 574 * The potential user to use for NFS backup 575 */ 576 char nfs_user[MAX_STR_LEN/4]; 572 577 573 578 /**
Note:
See TracChangeset
for help on using the changeset viewer.