|
|
|
@ -2405,6 +2405,7 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
|
|
|
|
|
IsoNode *node, int depth, int flag)
|
|
|
|
|
{
|
|
|
|
|
int ret= 0, type, action= 0, hflag, deleted= 0, no_dive= 0, i, bless_idx;
|
|
|
|
|
int unbless= 0;
|
|
|
|
|
uid_t user= 0;
|
|
|
|
|
gid_t group= 0;
|
|
|
|
|
time_t date= 0;
|
|
|
|
@ -2578,14 +2579,29 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
|
|
|
|
|
}
|
|
|
|
|
ret= 1;
|
|
|
|
|
} else if(action == 47) { /* set_hfs_bless */
|
|
|
|
|
if(strcmp(target, "none") == 0 ||
|
|
|
|
|
strcmp(target, "n") == 0 || strcmp(target, "N") == 0) {
|
|
|
|
|
ret= Xorriso_get_blessing(xorriso, node, &bless_idx, bless_code, 0);
|
|
|
|
|
if(ret < 0)
|
|
|
|
|
return(ret);
|
|
|
|
|
if(ret == 0)
|
|
|
|
|
return(1);
|
|
|
|
|
unbless= 1;
|
|
|
|
|
}
|
|
|
|
|
ret= Xorriso_hfsplus_bless(xorriso, show_path, (void *) node, target, 0);
|
|
|
|
|
/* If successful, end -find run gracefully */
|
|
|
|
|
if(ret > 0) {
|
|
|
|
|
sprintf(xorriso->info_text, "HFS blessing '%s' issued to ", target);
|
|
|
|
|
if(unbless) {
|
|
|
|
|
sprintf(xorriso->info_text, "HFS blessing '%s' revoked from ",
|
|
|
|
|
bless_code);
|
|
|
|
|
} else {
|
|
|
|
|
sprintf(xorriso->info_text, "HFS blessing '%s' issued to ", target);
|
|
|
|
|
}
|
|
|
|
|
Text_shellsafe(show_path, xorriso->info_text, 1);
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
|
|
|
|
}
|
|
|
|
|
return(4);
|
|
|
|
|
if(!unbless)
|
|
|
|
|
return(4);
|
|
|
|
|
} else if(action == 48) { /* get_hfs_bless */
|
|
|
|
|
ret= Xorriso_get_blessing(xorriso, node, &bless_idx, bless_code, 0);
|
|
|
|
|
if (ret > 0) {
|
|
|
|
@ -3726,10 +3742,12 @@ int Xorriso_hfsplus_file_creator_type(struct XorrisO *xorriso, char *path,
|
|
|
|
|
Bitfield for control purposes.
|
|
|
|
|
bit0= Revoke blessing if node != NULL bears it.
|
|
|
|
|
bit1= Revoke any blessing of the node, regardless of parameter
|
|
|
|
|
blessing. If node is NULL, then revoke all blessings in opts.
|
|
|
|
|
blessing. If node is NULL, then revoke all blessings.
|
|
|
|
|
bit2= Only check parameter blessing.
|
|
|
|
|
Return blessing index + 1 instead of issueing the blessing.
|
|
|
|
|
bit3= Allow blessing "any" and map to index ISO_HFSPLUS_BLESS_MAX
|
|
|
|
|
bit3= With bit2:
|
|
|
|
|
Allow blessing "any" and map to index ISO_HFSPLUS_BLESS_MAX.
|
|
|
|
|
Elsewise, blessing "none" is mapped to ISO_HFSPLUS_BLESS_MAX.
|
|
|
|
|
*/
|
|
|
|
|
int Xorriso_hfsplus_bless(struct XorrisO *xorriso, char *path,
|
|
|
|
|
void *in_node, char *blessing, int flag)
|
|
|
|
@ -3762,6 +3780,10 @@ int Xorriso_hfsplus_bless(struct XorrisO *xorriso, char *path,
|
|
|
|
|
strcmp(blessing, "x") == 0 || strcmp(blessing, "X") == 0) {
|
|
|
|
|
bless_code= ISO_HFSPLUS_BLESS_OSX_FOLDER;
|
|
|
|
|
hb= "x";
|
|
|
|
|
} else if((!(flag & 8)) && (strcmp(blessing, "none") == 0 ||
|
|
|
|
|
strcmp(blessing, "n") == 0 || strcmp(blessing, "N") == 0)) {
|
|
|
|
|
bless_code= ISO_HFSPLUS_BLESS_MAX;
|
|
|
|
|
flag |= 2;
|
|
|
|
|
} else if((flag & 8) && (flag & 4) &&
|
|
|
|
|
(strcmp(blessing, "any") == 0 ||
|
|
|
|
|
strcmp(blessing, "a") == 0 || strcmp(blessing, "A") == 0)) {
|
|
|
|
@ -3785,24 +3807,27 @@ int Xorriso_hfsplus_bless(struct XorrisO *xorriso, char *path,
|
|
|
|
|
if(ret <= 0)
|
|
|
|
|
return(ret);
|
|
|
|
|
|
|
|
|
|
/* Remove persistent bless mark from current bearer */
|
|
|
|
|
ret= iso_image_hfsplus_get_blessed(volume, &blessed_nodes, &bless_max, 0);
|
|
|
|
|
Xorriso_process_msg_queues(xorriso, 0);
|
|
|
|
|
if(ret < 0) {
|
|
|
|
|
Xorriso_report_iso_error(xorriso, "", ret,
|
|
|
|
|
"Error when trying to bless a file",
|
|
|
|
|
0, "FAILURE", 1);
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
if((int) bless_code < bless_max) {
|
|
|
|
|
if(blessed_nodes[(int) bless_code] != NULL) {
|
|
|
|
|
ret= Xorriso_setfattr(xorriso, node, path,
|
|
|
|
|
(size_t) 1, &name, &l, &hb, 4 | 8);
|
|
|
|
|
if(ret <= 0)
|
|
|
|
|
return(ret);
|
|
|
|
|
if(!(flag & 2)) {
|
|
|
|
|
/* Remove persistent bless mark from current bearer */
|
|
|
|
|
ret= iso_image_hfsplus_get_blessed(volume, &blessed_nodes, &bless_max, 0);
|
|
|
|
|
Xorriso_process_msg_queues(xorriso, 0);
|
|
|
|
|
if(ret < 0) {
|
|
|
|
|
Xorriso_report_iso_error(xorriso, "", ret,
|
|
|
|
|
"Error when trying to bless a file",
|
|
|
|
|
0, "FAILURE", 1);
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
if((int) bless_code < bless_max) {
|
|
|
|
|
if(blessed_nodes[(int) bless_code] != NULL) {
|
|
|
|
|
ret= Xorriso_setfattr(xorriso, blessed_nodes[(int) bless_code], "",
|
|
|
|
|
(size_t) 1, &name, &l, &hb, 4 | 8);
|
|
|
|
|
if(ret <= 0)
|
|
|
|
|
return(ret);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Bless node */
|
|
|
|
|
ret= iso_image_hfsplus_bless(volume, bless_code, node, flag & 3);
|
|
|
|
|
Xorriso_process_msg_queues(xorriso, 0);
|
|
|
|
|
if(ret == 0 && path[0]) {
|
|
|
|
@ -3826,11 +3851,15 @@ int Xorriso_hfsplus_bless(struct XorrisO *xorriso, char *path,
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Attach persistent bless mark to node */
|
|
|
|
|
l= 1;
|
|
|
|
|
ret= Xorriso_setfattr(xorriso, node, path, (size_t) 1, &name, &l, &hb, 2 | 8);
|
|
|
|
|
if(ret <= 0)
|
|
|
|
|
return(ret);
|
|
|
|
|
/* Attach persistent AAIP bless mark to node */
|
|
|
|
|
if(!(flag & 3)) {
|
|
|
|
|
l= 1;
|
|
|
|
|
ret= Xorriso_setfattr(xorriso, node, path, (size_t) 1, &name, &l, &hb,
|
|
|
|
|
2 | 8);
|
|
|
|
|
if(ret <= 0)
|
|
|
|
|
return(ret);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Xorriso_set_change_pending(xorriso, 0);
|
|
|
|
|
return(1);
|
|
|
|
|
}
|
|
|
|
|