[Cvs-nserver-commits] CVS: cvs-nserver/src acl.c,1.1.2.15,1.1.2.16
Brought to you by:
tyranny
From: Alexey M. <ty...@us...> - 2002-05-30 21:19:09
|
Update of /cvsroot/cvs-nserver/cvs-nserver/src In directory usw-pr-cvs1:/tmp/cvs-serv27458 Modified Files: Tag: NCLI-1-11-1 acl.c Log Message: Audit log ACL operations Index: acl.c =================================================================== RCS file: /cvsroot/cvs-nserver/cvs-nserver/src/Attic/acl.c,v retrieving revision 1.1.2.15 retrieving revision 1.1.2.16 diff -u -d -r1.1.2.15 -r1.1.2.16 --- acl.c 30 May 2002 20:41:05 -0000 1.1.2.15 +++ acl.c 30 May 2002 21:19:07 -0000 1.1.2.16 @@ -241,6 +241,20 @@ if (!store_branch_acls(dir_acl)) error(1, 0, "Error storing branch ACLs: %s", strerror(errno)); + /* log this operation */ + if (audit_log_active()) { + if (!start_audit_log_line("acl")) { + error(1, 0, "Out of memory"); + } + append_audit_log_line("grant"); + append_audit_log_line("branch"); + append_audit_log_line(perm_string); + append_audit_log_line(relative_name); + append_audit_log_line(username); + append_audit_log_line(branch); + log_audit_event(); + } + error(0, 0, "Setting '%s' permissions for '%s' on file %s\n", perm_string, username, relative_name); @@ -256,6 +270,7 @@ struct stringbuf *fulldir; DIR_ACL *dir_acl; int default_len = strlen("default:"); + int using_default_file_acls; fulldir = new_stringbuf(current_parsed_root->directory); if (fulldir == NULL) @@ -268,7 +283,8 @@ if (dir_acl == NULL) return -1; - if (strncmp(perm_string, "default:", default_len) == 0) { + using_default_file_acls = (strncmp(perm_string, "default:", default_len) == 0); + if (using_default_file_acls) { /* set default file permissions */ perm = parse_branch_permissions(perm_string + default_len); if (perm == branch_perm_invalid) @@ -299,6 +315,25 @@ if (store_dir_acl(dir_acl) != 0) error(1, 0, "Error storing permissions on directory %s", relative_name); + + /* log this operation */ + if (audit_log_active()) { + if (!start_audit_log_line("acl")) { + error(1, 0, "Out of memory"); + } + append_audit_log_line("grant"); + if (using_default_file_acls) { + append_audit_log_line("default-file"); + append_audit_log_line(perm_string + default_len); + } else { + append_audit_log_line("dir"); + append_audit_log_line(perm_string); + } + append_audit_log_line(relative_name); + append_audit_log_line(username); + append_audit_log_line(branch); + log_audit_event(); + } return 0; } |