diff options
Diffstat (limited to 'tools/idevicebackup.c')
-rw-r--r-- | tools/idevicebackup.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c index 2856fda..1684666 100644 --- a/tools/idevicebackup.c +++ b/tools/idevicebackup.c | |||
@@ -57,6 +57,7 @@ | |||
57 | #include <libimobiledevice/notification_proxy.h> | 57 | #include <libimobiledevice/notification_proxy.h> |
58 | #include <libimobiledevice/afc.h> | 58 | #include <libimobiledevice/afc.h> |
59 | #include <libimobiledevice-glue/utils.h> | 59 | #include <libimobiledevice-glue/utils.h> |
60 | #include <plist/plist.h> | ||
60 | 61 | ||
61 | #define MOBILEBACKUP_SERVICE_NAME "com.apple.mobilebackup" | 62 | #define MOBILEBACKUP_SERVICE_NAME "com.apple.mobilebackup" |
62 | #define NP_SERVICE_NAME "com.apple.mobile.notification_proxy" | 63 | #define NP_SERVICE_NAME "com.apple.mobile.notification_proxy" |
@@ -317,7 +318,7 @@ static void mobilebackup_write_status(const char *path, int status) | |||
317 | if (stat(file_path, &st) == 0) | 318 | if (stat(file_path, &st) == 0) |
318 | remove(file_path); | 319 | remove(file_path); |
319 | 320 | ||
320 | plist_write_to_filename(status_plist, file_path, PLIST_FORMAT_XML); | 321 | plist_write_to_file(status_plist, file_path, PLIST_FORMAT_XML, 0); |
321 | 322 | ||
322 | plist_free(status_plist); | 323 | plist_free(status_plist); |
323 | status_plist = NULL; | 324 | status_plist = NULL; |
@@ -331,7 +332,7 @@ static int mobilebackup_read_status(const char *path) | |||
331 | plist_t status_plist = NULL; | 332 | plist_t status_plist = NULL; |
332 | char *file_path = mobilebackup_build_path(path, "Status", ".plist"); | 333 | char *file_path = mobilebackup_build_path(path, "Status", ".plist"); |
333 | 334 | ||
334 | plist_read_from_filename(&status_plist, file_path); | 335 | plist_read_from_file(file_path, &status_plist, NULL); |
335 | free(file_path); | 336 | free(file_path); |
336 | if (!status_plist) { | 337 | if (!status_plist) { |
337 | printf("Could not read Status.plist!\n"); | 338 | printf("Could not read Status.plist!\n"); |
@@ -454,7 +455,7 @@ static int mobilebackup_check_file_integrity(const char *backup_directory, const | |||
454 | } | 455 | } |
455 | 456 | ||
456 | infopath = mobilebackup_build_path(backup_directory, hash, ".mdinfo"); | 457 | infopath = mobilebackup_build_path(backup_directory, hash, ".mdinfo"); |
457 | plist_read_from_filename(&mdinfo, infopath); | 458 | plist_read_from_file(infopath, &mdinfo, NULL); |
458 | free(infopath); | 459 | free(infopath); |
459 | if (!mdinfo) { | 460 | if (!mdinfo) { |
460 | printf("\r\n"); | 461 | printf("\r\n"); |
@@ -882,7 +883,7 @@ int main(int argc, char *argv[]) | |||
882 | /* verify existing Info.plist */ | 883 | /* verify existing Info.plist */ |
883 | if (stat(info_path, &st) == 0) { | 884 | if (stat(info_path, &st) == 0) { |
884 | printf("Reading Info.plist from backup.\n"); | 885 | printf("Reading Info.plist from backup.\n"); |
885 | plist_read_from_filename(&info_plist, info_path); | 886 | plist_read_from_file(info_path, &info_plist, NULL); |
886 | 887 | ||
887 | if (!info_plist) { | 888 | if (!info_plist) { |
888 | printf("Could not read Info.plist\n"); | 889 | printf("Could not read Info.plist\n"); |
@@ -893,7 +894,7 @@ int main(int argc, char *argv[]) | |||
893 | /* update the last backup time within Info.plist */ | 894 | /* update the last backup time within Info.plist */ |
894 | mobilebackup_info_update_last_backup_date(info_plist); | 895 | mobilebackup_info_update_last_backup_date(info_plist); |
895 | remove(info_path); | 896 | remove(info_path); |
896 | plist_write_to_filename(info_plist, info_path, PLIST_FORMAT_XML); | 897 | plist_write_to_file(info_plist, info_path, PLIST_FORMAT_XML, 0); |
897 | } else { | 898 | } else { |
898 | printf("Aborting backup. Backup is not compatible with the current device.\n"); | 899 | printf("Aborting backup. Backup is not compatible with the current device.\n"); |
899 | cmd = CMD_LEAVE; | 900 | cmd = CMD_LEAVE; |
@@ -959,7 +960,7 @@ int main(int argc, char *argv[]) | |||
959 | /* read the last Manifest.plist */ | 960 | /* read the last Manifest.plist */ |
960 | if (!is_full_backup) { | 961 | if (!is_full_backup) { |
961 | printf("Reading existing Manifest.\n"); | 962 | printf("Reading existing Manifest.\n"); |
962 | plist_read_from_filename(&manifest_plist, manifest_path); | 963 | plist_read_from_file(manifest_path, &manifest_plist, NULL); |
963 | if (!manifest_plist) { | 964 | if (!manifest_plist) { |
964 | printf("Could not read Manifest.plist, switching to full backup mode.\n"); | 965 | printf("Could not read Manifest.plist, switching to full backup mode.\n"); |
965 | is_full_backup = 1; | 966 | is_full_backup = 1; |
@@ -977,7 +978,7 @@ int main(int argc, char *argv[]) | |||
977 | remove(info_path); | 978 | remove(info_path); |
978 | printf("Creating Info.plist for new backup.\n"); | 979 | printf("Creating Info.plist for new backup.\n"); |
979 | info_plist = mobilebackup_factory_info_plist_new(udid); | 980 | info_plist = mobilebackup_factory_info_plist_new(udid); |
980 | plist_write_to_filename(info_plist, info_path, PLIST_FORMAT_XML); | 981 | plist_write_to_file(info_plist, info_path, PLIST_FORMAT_XML, 0); |
981 | } | 982 | } |
982 | free(info_path); | 983 | free(info_path); |
983 | 984 | ||
@@ -1116,7 +1117,7 @@ int main(int argc, char *argv[]) | |||
1116 | remove(filename_mdinfo); | 1117 | remove(filename_mdinfo); |
1117 | 1118 | ||
1118 | node = plist_dict_get_item(node_tmp, "BackupFileInfo"); | 1119 | node = plist_dict_get_item(node_tmp, "BackupFileInfo"); |
1119 | plist_write_to_filename(node, filename_mdinfo, PLIST_FORMAT_BINARY); | 1120 | plist_write_to_file(node, filename_mdinfo, PLIST_FORMAT_BINARY, 0); |
1120 | 1121 | ||
1121 | free(filename_mdinfo); | 1122 | free(filename_mdinfo); |
1122 | } | 1123 | } |
@@ -1228,7 +1229,7 @@ files_out: | |||
1228 | if (manifest_plist) { | 1229 | if (manifest_plist) { |
1229 | remove(manifest_path); | 1230 | remove(manifest_path); |
1230 | printf("Storing Manifest.plist...\n"); | 1231 | printf("Storing Manifest.plist...\n"); |
1231 | plist_write_to_filename(manifest_plist, manifest_path, PLIST_FORMAT_XML); | 1232 | plist_write_to_file(manifest_plist, manifest_path, PLIST_FORMAT_XML, 0); |
1232 | } | 1233 | } |
1233 | 1234 | ||
1234 | backup_ok = 1; | 1235 | backup_ok = 1; |
@@ -1259,7 +1260,7 @@ files_out: | |||
1259 | } | 1260 | } |
1260 | /* now make sure backup integrity is ok! verify all files */ | 1261 | /* now make sure backup integrity is ok! verify all files */ |
1261 | printf("Reading existing Manifest.\n"); | 1262 | printf("Reading existing Manifest.\n"); |
1262 | plist_read_from_filename(&manifest_plist, manifest_path); | 1263 | plist_read_from_file(manifest_path, &manifest_plist, NULL); |
1263 | if (!manifest_plist) { | 1264 | if (!manifest_plist) { |
1264 | printf("Could not read Manifest.plist. Aborting.\n"); | 1265 | printf("Could not read Manifest.plist. Aborting.\n"); |
1265 | break; | 1266 | break; |
@@ -1386,7 +1387,7 @@ files_out: | |||
1386 | while (node) { | 1387 | while (node) { |
1387 | /* TODO: read mddata/mdinfo files and send to device using DLSendFile */ | 1388 | /* TODO: read mddata/mdinfo files and send to device using DLSendFile */ |
1388 | file_info_path = mobilebackup_build_path(backup_directory, hash, ".mdinfo"); | 1389 | file_info_path = mobilebackup_build_path(backup_directory, hash, ".mdinfo"); |
1389 | plist_read_from_filename(&file_info, file_info_path); | 1390 | plist_read_from_file(file_info_path, &file_info, NULL); |
1390 | 1391 | ||
1391 | /* get encryption state */ | 1392 | /* get encryption state */ |
1392 | tmp_node = plist_dict_get_item(file_info, "IsEncrypted"); | 1393 | tmp_node = plist_dict_get_item(file_info, "IsEncrypted"); |