Pseudo blessing "none" to revoke any HFS+ blessing of a node

This commit is contained in:
Thomas Schmitt 2012-06-18 18:11:09 +00:00
parent aa02b0a09b
commit 08ecc2bdb5
5 changed files with 106 additions and 63 deletions

View File

@ -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);
}

View File

@ -1916,6 +1916,11 @@ No file object can bear more than one blessing.
.br
E.g.: \-find /my/blessed/directory \-exec set_hfs_bless p
.br
Further there is blessing "none" or "n" which revokes any blessing from
the found files. This \-find run will not stop when the first match is reached.
.br
E.g.: \-find / \-has_hfs_bless any \-exec set_hfs_bless none
.br
\fBget_hfs_bless\fR
prints the HFS+ blessing role and the iso_rr_path, if the file is blessed
at all.

View File

@ -1708,6 +1708,10 @@ File: xorriso.info, Node: CmdFind, Next: Filter, Prev: Manip, Up: Options
the blessing will lose it then. No file object can bear more
than one blessing.
E.g.: -find /my/blessed/directory -exec set_hfs_bless p
Further there is blessing "none" or "n" which revokes any
blessing from the found files. This -find run will not stop
when the first match is reached.
E.g.: -find / -has_hfs_bless any -exec set_hfs_bless none
get_hfs_bless
prints the HFS+ blessing role and the iso_rr_path, if the
file is blessed at all.
@ -4993,43 +4997,43 @@ Node: Insert45897
Node: SetInsert55813
Node: Manip64389
Node: CmdFind73212
Node: Filter87319
Node: Writing91874
Node: SetWrite100838
Node: Bootable118671
Node: Jigdo133372
Node: Charset137618
Node: Exception140379
Node: DialogCtl146498
Node: Inquiry149095
Node: Navigate153961
Node: Verify162258
Node: Restore171224
Node: Emulation178133
Node: Scripting187944
Node: Frontend195104
Node: Examples196404
Node: ExDevices197581
Node: ExCreate198240
Node: ExDialog199525
Node: ExGrowing200790
Node: ExModifying201595
Node: ExBootable202099
Node: ExCharset202651
Node: ExPseudo203472
Node: ExCdrecord204370
Node: ExMkisofs204687
Node: ExGrowisofs206027
Node: ExException207162
Node: ExTime207616
Node: ExIncBackup208075
Node: ExRestore212066
Node: ExRecovery213026
Node: Files213596
Node: Seealso214895
Node: Bugreport215618
Node: Legal216199
Node: CommandIdx217210
Node: ConceptIdx233009
Node: Filter87568
Node: Writing92123
Node: SetWrite101087
Node: Bootable118920
Node: Jigdo133621
Node: Charset137867
Node: Exception140628
Node: DialogCtl146747
Node: Inquiry149344
Node: Navigate154210
Node: Verify162507
Node: Restore171473
Node: Emulation178382
Node: Scripting188193
Node: Frontend195353
Node: Examples196653
Node: ExDevices197830
Node: ExCreate198489
Node: ExDialog199774
Node: ExGrowing201039
Node: ExModifying201844
Node: ExBootable202348
Node: ExCharset202900
Node: ExPseudo203721
Node: ExCdrecord204619
Node: ExMkisofs204936
Node: ExGrowisofs206276
Node: ExException207411
Node: ExTime207865
Node: ExIncBackup208324
Node: ExRestore212315
Node: ExRecovery213275
Node: Files213845
Node: Seealso215144
Node: Bugreport215867
Node: Legal216448
Node: CommandIdx217459
Node: ConceptIdx233258

End Tag Table

View File

@ -2307,6 +2307,11 @@ No file object can bear more than one blessing.
@*
E.g.: -find /my/blessed/directory -exec set_hfs_bless p
@*
Further there is blessing "none" or "n" which revokes any blessing from
the found files. This -find run will not stop when the first match is reached.
@*
E.g.: -find / -has_hfs_bless any -exec set_hfs_bless none
@*
@item get_hfs_bless
prints the HFS+ blessing role and the iso_rr_path, if the file is blessed
at all.

View File

@ -1 +1 @@
#define Xorriso_timestamP "2012.06.18.112125"
#define Xorriso_timestamP "2012.06.18.181204"