New option -setfacl, -setfacl_r, new -find action setfacl

This commit is contained in:
2009-01-25 14:11:37 +00:00
parent 40d4330bcc
commit 02f2954bd5
6 changed files with 396 additions and 27 deletions

View File

@ -6397,11 +6397,11 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
gid_t group= 0;
time_t date= 0;
mode_t mode_or= 0, mode_and= ~1;
char *target, sfe[5*SfileadrL], *iso_prefix;
char *target, *text_2, sfe[5*SfileadrL], *iso_prefix;
struct FindjoB *subjob;
struct stat dir_stbuf;
action= Findjob_get_action_parms(job, &target, &user, &group,
action= Findjob_get_action_parms(job, &target, &text_2, &user, &group,
&mode_and, &mode_or, &type, &date, &subjob, 0);
if(action<0)
action= 0;
@ -6455,7 +6455,12 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
} else if(action == 23) {
ret= Findjob_set_found_path(job, show_path, 0);
} else if(action == 24) {
ret = Xorriso_getfacl(xorriso, (void *) node, show_path, NULL, 0);
ret= Xorriso_getfacl(xorriso, (void *) node, show_path, NULL, 0);
} else if(action == 25) {
if(target == NULL || target[0])
ret= Xorriso_setfacl(xorriso, (void *) node, show_path, target, 0);
if(ret > 0 && (text_2 == NULL || text_2[0]))
ret= Xorriso_setfacl(xorriso, (void *) node, show_path, text_2, 1);
} else { /* includes : 15 in_iso */
sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0));
Xorriso_result(xorriso, 0);
@ -8799,11 +8804,12 @@ int Xorriso_getfacl(struct XorrisO *xorriso, void *in_node, char *path,
ret= 0;
#endif
if(ret < 0) {
strcpy(xorriso->info_text, "Error with obtaining ACL of ");
Text_shellsafe(path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
if(path != NULL && path[0] != 0) {
strcpy(xorriso->info_text, "Error with obtaining ACL of ");
Text_shellsafe(path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
}
ret= 0; goto ex;
}
if(flag & 2) {
@ -8882,3 +8888,45 @@ int Xorriso_set_ignore_aclea(struct XorrisO *xorriso, int flag)
return(1);
}
/* @param node Opaque handle to IsoNode which is to be manipulated
instead of path if it is not NULL.
@param path is used as address if node is NULL.
@param acl_text ACL in long text form
@param flag bit0=set "default" ACL rather than "access" ACL
@return >0 success , <=0 failure
*/
int Xorriso_setfacl(struct XorrisO *xorriso, void *in_node, char *path,
char *acl_text, int flag)
{
int ret;
IsoNode *node;
node= (IsoNode *) in_node;
if(node == NULL) {
ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0);
if(ret<=0)
goto ex;
}
#ifdef Xorriso_with_aaiP
ret= iso_node_set_acl_text(node, acl_text, flag & 1);
#else
ret= 0;
#endif
if(ret <= 0) {
if(path != NULL && path[0] != 0) {
strcpy(xorriso->info_text, "Error with setting ACL of ");
Text_shellsafe(path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
}
ret= 0; goto ex;
}
xorriso->volset_change_pending= 1;
ret= 1;
ex:;
Xorriso_process_msg_queues(xorriso,0);
return(ret);
}