int chacl_fileproc(void *callerdat, struct file_info *finfo) { CXmlNodePtr acl; /* If someone has specified 'chacl foo' and foo is a directory, you'll get a dirent plus every file in the directory. We only want to set the directory in this case */ if(acl_directory_set && !strcmp(finfo->repository, acl_directory_set)) return 0; Vers_TS *vers = Version_TS (finfo, NULL, NULL, NULL, 0, 0, 0); if(!vers->vn_user && !vers->vn_rcs) { if (!really_quiet) error (0, 0, "nothing known about %s", fn_root(finfo->fullname)); freevers_ts(&vers); return 0; } freevers_ts(&vers); if(!quiet) printf("%sing ACL for file %s\n",parms.del?"delet":"sett",finfo->file); acl = fileattr_getroot(); acl->xpathVariable("name",finfo->file); if(!acl->Lookup("file[cvs:filename(@name,$name)]") || !acl->XPathResultNext()) { acl = fileattr_getroot(); acl->NewNode("file"); acl->NewAttribute("name",finfo->file); } set_acl(acl); return 0; }
int lsacl_fileproc(void *callerdat, struct file_info *finfo) { CXmlNodePtr acl; acl = fileattr_getroot(); acl->xpathVariable("name",finfo->file); if(acl->Lookup("file[cvs:filename(@name,$name)]/acl") && acl->XPathResultNext()) { printf("File: %s\n",finfo->file); show_acl(acl); } return 0; }
static Dtype chacl_dirproc (void *callerdat, char *dir, char *repos, char *update_dir, List *entries, const char *virtual_repository, Dtype hint) { CXmlNodePtr curdir; if(hint!=R_PROCESS) return hint; if(!quiet) printf("%sing ACL for directory %s\n",parms.del?"delet":"sett",update_dir); curdir = fileattr_getroot(); if(!curdir->GetChild("directory")) curdir->NewNode("directory"); set_acl(curdir); xfree(acl_directory_set); acl_directory_set = xstrdup(repos); return R_PROCESS; }