X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fupdate_image.c;h=5a5ae69066f590f119fed933296a410c545be2bc;hb=335e7f84a6ea46ea13e333c7294be0594fc859ca;hp=bd8702e2ef397041b13a139580d45ff59063f231;hpb=1fc939b7bd0b37900d974b1cd5b11df128df71f5;p=wimlib diff --git a/src/update_image.c b/src/update_image.c index bd8702e2..5a5ae690 100644 --- a/src/update_image.c +++ b/src/update_image.c @@ -235,8 +235,8 @@ execute_add_command(WIMStruct *wim, goto out_destroy_inode_table; INIT_LIST_HEAD(&unhashed_streams); - wim->lookup_table->unhashed_streams = &unhashed_streams; params.lookup_table = wim->lookup_table; + params.unhashed_streams = &unhashed_streams; params.config = config; params.add_flags = add_flags; params.extra_arg = extra_arg; @@ -262,7 +262,7 @@ execute_add_command(WIMStruct *wim, * the root of each branch from a capture * source. (This will also set the root dentry * of the entire image to be unnamed.) */ - ret = set_dentry_name(branch, + ret = dentry_set_name(branch, path_basename(wim_target_path)); if (ret) goto out_ntfs_umount; @@ -465,6 +465,21 @@ check_add_command(struct wimlib_update_command *cmd, { int add_flags = cmd->add.add_flags; + if (add_flags & ~(WIMLIB_ADD_FLAG_NTFS | + WIMLIB_ADD_FLAG_DEREFERENCE | + WIMLIB_ADD_FLAG_VERBOSE | + /* BOOT doesn't make sense for wimlib_update_image() */ + /*WIMLIB_ADD_FLAG_BOOT |*/ + WIMLIB_ADD_FLAG_UNIX_DATA | + WIMLIB_ADD_FLAG_NO_ACLS | + WIMLIB_ADD_FLAG_STRICT_ACLS | + WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE | + WIMLIB_ADD_FLAG_RPFIX | + WIMLIB_ADD_FLAG_NORPFIX | + WIMLIB_ADD_FLAG_NO_UNSUPPORTED_EXCLUDE | + WIMLIB_ADD_FLAG_WINCONFIG)) + return WIMLIB_ERR_INVALID_PARAM; + /* Are we adding the entire image or not? An empty wim_target_path * indicates that the tree we're adding is to be placed in the root of * the image. We consider this to be capturing the entire image, @@ -534,6 +549,23 @@ check_add_command(struct wimlib_update_command *cmd, return 0; } +static int +check_delete_command(const struct wimlib_update_command *cmd) +{ + if (cmd->delete_.delete_flags & ~(WIMLIB_DELETE_FLAG_FORCE | + WIMLIB_DELETE_FLAG_RECURSIVE)) + return WIMLIB_ERR_INVALID_PARAM; + return 0; +} + +static int +check_rename_command(const struct wimlib_update_command *cmd) +{ + if (cmd->rename.rename_flags != 0) + return WIMLIB_ERR_INVALID_PARAM; + return 0; +} + static int check_update_command(struct wimlib_update_command *cmd, const struct wim_header *hdr) @@ -542,8 +574,9 @@ check_update_command(struct wimlib_update_command *cmd, case WIMLIB_UPDATE_OP_ADD: return check_add_command(cmd, hdr); case WIMLIB_UPDATE_OP_DELETE: + return check_delete_command(cmd); case WIMLIB_UPDATE_OP_RENAME: - break; + return check_rename_command(cmd); } return 0; } @@ -667,6 +700,9 @@ wimlib_update_image(WIMStruct *wim, struct wimlib_update_command *cmds_copy; bool deletion_requested = false; + if (update_flags & ~WIMLIB_UPDATE_FLAG_SEND_PROGRESS) + return WIMLIB_ERR_INVALID_PARAM; + DEBUG("Updating image %d with %zu commands", image, num_cmds); for (size_t i = 0; i < num_cmds; i++)