[Cvs-nserver-commits] CVS: cvs-nserver/src annotate.c,1.1.1.1.4.4,1.1.1.1.4.5 commit.c,1.1.1.6.4.4,1
Brought to you by:
tyranny
From: Alexey M. <ty...@us...> - 2002-05-25 21:07:34
|
Update of /cvsroot/cvs-nserver/cvs-nserver/src In directory usw-pr-cvs1:/tmp/cvs-serv7562 Modified Files: Tag: NCLI-1-11-1 annotate.c commit.c diff.c patch.c update.c Log Message: Preliminary support for logging of file operations; switch to branch_for_revision(), thus bringing back all-numeric revisions under ACL control Index: annotate.c =================================================================== RCS file: /cvsroot/cvs-nserver/cvs-nserver/src/annotate.c,v retrieving revision 1.1.1.1.4.4 retrieving revision 1.1.1.1.4.5 diff -u -d -r1.1.1.1.4.4 -r1.1.1.1.4.5 --- annotate.c 25 Nov 2001 20:45:30 -0000 1.1.1.1.4.4 +++ annotate.c 25 May 2002 21:07:31 -0000 1.1.1.1.4.5 @@ -14,6 +14,7 @@ #include "cvs.h" #include "acl.h" +#include "audit.h" #include "recurse.h" /* Options from the command line. */ @@ -255,14 +256,6 @@ { char *version; -/* printf("annotate_fileproc: tag == '%s'\n", tag); */ - -#ifdef SERVER_SUPPORT - if (!grant_file_permission(finfo->repository, tag, finfo->file, - branch_perm_checkout, "annotate")) - return 0; -#endif - if (finfo->rcs == NULL) return (1); @@ -273,6 +266,18 @@ (int *) NULL); if (version == NULL) return 0; + +#ifdef SERVER_SUPPORT + if (server_active) { + char* branch = branch_for_revision(finfo->rcs, tag); + + if (!grant_file_permission(finfo->repository, branch, finfo->file, + branch_perm_checkout, "annotate")) { + return 0; + } + operation_audit_log("annotate", finfo, branch, version); + } +#endif /* Distinguish output for various files if we are processing several files. */ Index: commit.c =================================================================== RCS file: /cvsroot/cvs-nserver/cvs-nserver/src/commit.c,v retrieving revision 1.1.1.6.4.4 retrieving revision 1.1.1.6.4.5 diff -u -d -r1.1.1.6.4.4 -r1.1.1.6.4.5 --- commit.c 25 Nov 2001 20:45:30 -0000 1.1.1.6.4.4 +++ commit.c 25 May 2002 21:07:31 -0000 1.1.1.6.4.5 @@ -18,6 +18,7 @@ #include "cvs.h" #include "acl.h" +#include "audit.h" #include "getline.h" #include "edit.h" #include "fileattr.h" @@ -809,9 +810,20 @@ status = classify_file_internal (finfo, &vers); #ifdef SERVER_SUPPORT - if (!grant_file_permission(finfo->repository, vers->tag, finfo->file, - branch_perm_checkin, "checkin")) - goto out; + if (server_active) { + char* branch; + + if (saved_tag) + branch = branch_for_revision(finfo->rcs, saved_tag); + else + branch = branch_for_revision(finfo->rcs, vers->tag); + + if (!grant_file_permission(finfo->repository, branch, finfo->file, + branch_perm_checkin, "checkin")) + goto out; + + operation_audit_log("checkin", finfo, branch, vers->tag); + } #endif /* Index: diff.c =================================================================== RCS file: /cvsroot/cvs-nserver/cvs-nserver/src/diff.c,v retrieving revision 1.1.1.3.4.3 retrieving revision 1.1.1.3.4.4 diff -u -d -r1.1.1.3.4.3 -r1.1.1.3.4.4 --- diff.c 25 Nov 2001 20:45:30 -0000 1.1.1.3.4.3 +++ diff.c 25 May 2002 21:07:31 -0000 1.1.1.3.4.4 @@ -17,6 +17,7 @@ #include "cvs.h" #include "acl.h" +#include "audit.h" #include "recurse.h" enum diff_file @@ -400,26 +401,15 @@ int status, err = 2; /* 2 == trouble, like rcsdiff */ Vers_TS *vers; enum diff_file empty_file = DIFF_DIFFERENT; - char *tmp; + char *tmp = NULL; char *tocvsPath; - char *fname; + char *fname = NULL; char *label1; char *label2; - /* Initialize these solely to avoid warnings from gcc -Wall about - variables that might be used uninitialized. */ - tmp = NULL; - fname = NULL; - user_file_rev = 0; vers = Version_TS (finfo, NULL, NULL, NULL, 1, 0); -#ifdef SERVER_SUPPORT - if (!grant_file_permission(finfo->repository, vers->tag, finfo->file, - branch_perm_checkout, "diff")) - return 0; -#endif - if (diff_rev2 != NULL || diff_date2 != NULL) { /* Skip all the following checks regarding the user file; we're @@ -646,6 +636,25 @@ label2 = make_file_label (finfo->fullname, use_rev2, vers ? vers->srcfile : NULL); } + +#ifdef SERVER_SUPPORT + if (server_active) { + char* branch1 = branch_for_revision(vers->srcfile, use_rev1); + char* branch2 = branch_for_revision(vers->srcfile, use_rev2); + /* check that first revision could be accessed */ + if (!grant_file_permission(finfo->repository, branch1, finfo->file, + branch_perm_checkout, "diff")) + return 0; + + /* check that second revision could be accessed */ + if (!grant_file_permission(finfo->repository, branch2, finfo->file, + branch_perm_checkout, "diff")) + return 0; + + operation_audit_log("diff-from", finfo, branch1, use_rev1); + operation_audit_log("diff-to", finfo, branch2, use_rev2); + } +#endif /* SERVER_SUPPORT */ if (empty_file == DIFF_ADDED || empty_file == DIFF_REMOVED) { Index: patch.c =================================================================== RCS file: /cvsroot/cvs-nserver/cvs-nserver/src/patch.c,v retrieving revision 1.1.1.3.4.4 retrieving revision 1.1.1.3.4.5 diff -u -d -r1.1.1.3.4.4 -r1.1.1.3.4.5 --- patch.c 25 Nov 2001 20:45:30 -0000 1.1.1.3.4.4 +++ patch.c 25 May 2002 21:07:31 -0000 1.1.1.3.4.5 @@ -17,6 +17,7 @@ #include "cvs.h" #include "acl.h" +#include "audit.h" #include "getline.h" #include "recurse.h" @@ -407,9 +408,16 @@ } #ifdef SERVER_SUPPORT - if (!grant_file_permission(finfo->repository, rcsfile->branch, finfo->file, - branch_perm_checkout, "patch")) - return 0; + if (server_active) { + char* branch = branch_for_revision(finfo->rcs, rcsfile->branch); + + if (!grant_file_permission(finfo->repository, branch, finfo->file, + branch_perm_checkout, "patch")) { + return 0; + } + + operation_audit_log("patch", finfo, branch, rcsfile->branch); + } #endif if ((rcsfile->flags & VALID) && (rcsfile->flags & INATTIC)) Index: update.c =================================================================== RCS file: /cvsroot/cvs-nserver/cvs-nserver/src/update.c,v retrieving revision 1.1.1.6.4.6 retrieving revision 1.1.1.6.4.7 diff -u -d -r1.1.1.6.4.6 -r1.1.1.6.4.7 --- update.c 25 May 2002 15:58:36 -0000 1.1.1.6.4.6 +++ update.c 25 May 2002 21:07:31 -0000 1.1.1.6.4.7 @@ -39,7 +39,7 @@ #include "md5.h" #endif #include "acl.h" -#include "audit-log.h" +#include "audit.h" #include "watch.h" #include "fileattr.h" #include "edit.h" @@ -599,23 +599,17 @@ aflag, &vers, pipeout); #ifdef SERVER_SUPPORT - if (!grant_file_permission(finfo->repository, vers->tag, finfo->file, - branch_perm_checkout, "update")) - return 0; + if (server_active) { + char* branch = branch_for_revision(finfo->rcs, vers->tag); - /* log this action */ - if (!start_audit_log_line("update")) { - error(1, 0, "Out of memory"); + if (!grant_file_permission(finfo->repository, branch, finfo->file, + branch_perm_checkout, "update")) { + return 0; + } + + operation_audit_log("update", finfo, branch, vers->vn_rcs); } - append_audit_log_line(finfo->repository + Pserver_Repos_len + 1); - append_audit_log_line(finfo->file); - if (vers->tag == NULL) - append_audit_log_line(""); - else - append_audit_log_line(vers->tag); - append_audit_log_line(vers->vn_rcs); - log_audit_event(); - + #endif /* Keep track of whether TAG is a branch tag. |