#!/usr/bin/perl -w # # $FreeBSD$ # # Access control lists for CVS. dgg@ksr.com (David G. Grubbs) # # ==== FORMAT OF THE avail FILE: # # The avail file determines whether you may commit files. It contains lines # read from top to bottom, keeping track of a single "bit". The "bit" # defaults to "on". It can be turned "off" by "unavail" lines and "on" by # "avail" lines. ==> Last one counts. # # Any line not beginning with "avail" or "unavail" is ignored. # # Lines beginning with "avail" or "unavail" are assumed to be '|'-separated # triples: (All spaces and tabs are ignored in a line.) # # {avail.*,unavail.*} [| user,user,... [| repos,repos,...]] # # 1. String starting with "avail" or "unavail". # 2. Optional, comma-separated list of usernames. # 3. Optional, comma-separated list of repository pathnames. # These are pathnames relative to $CVSROOT. They can be directories or # filenames. A directory name allows access to all files and # directories below it. # # Example: (Text from the ';;' rightward may not appear in the file.) # # unavail ;; Make whole repository unavailable. # avail|dgg ;; Except for user "dgg". # avail|fred, john|bin/ls ;; Except when "fred" or "john" commit to # ;; the module whose repository is "bin/ls" # # PROGRAM LOGIC: # # CVS passes to @ARGV an absolute directory pathname (the repository # appended to your $CVSROOT variable), followed by a list of filenames # within that directory. # # We walk through the avail file looking for a line that matches both # the username and repository. # # A username match is simply the user's name appearing in the second # column of the avail line in a space-or-comma separate list. # # A repository match is either: # - One element of the third column matches $ARGV[0], or some # parent directory of $ARGV[0]. # - Otherwise *all* file arguments ($ARGV[1..$#ARGV]) must be # in the file list in one avail line. # - In other words, using directory names in the third column of # the avail file allows committing of any file (or group of # files in a single commit) in the tree below that directory. # - If individual file names are used in the third column of # the avail file, then files must be committed individually or # all files specified in a single commit must all appear in # third column of a single avail line. # # Additional (2001/11/16): I've added a group function for labelling # groups of users. To define a group add a line in the avail file of # the form: # group|grpname1|joe,fred,bob # group|grpname2|pete,:grpname1,simon # group|grpname2|sid,:grpname2,mike # group|anothergroup|!filename/containing/listofusers # # The group name can be used in any place a user name could be used in # an avail or unavail line. Just precede the group name with a ':' # character. In the example above you'll note that you can define a # group more than once. Each definition overrides the previous one, # but can include itself to add to it. # # In place of a username in any of the above rules, you can specify # a group name preceeded with a ':' character, or a filename preceeded # with a '!' character. In the case of a file it is assumed relative to # $CVSROOT/CVSROOT/ unless it started witha leading '/'. All blank lines # and comments are ignored, and the remaining lines are treated as one # username per line. use strict; use lib $ENV{CVSROOT}; use CVSROOT::cfg; my $CVSROOT = $ENV{'CVSROOT'} || die "Can't determine \$CVSROOT!"; my $debug = $cfg::DEBUG; my %GROUPS; # List of committer groups my $exit_val = 0; # Good Exit value my $universal_off = 0; my $BASE_FN = "$cfg::TMPDIR/$cfg::FILE_PREFIX"; my $FILES_FILE = "$BASE_FN.files"; ####################################### # process any variable=value switches ####################################### my $die = ''; eval "print STDERR \$die='Unknown parameter $1\n' if !defined \$$1; \$$1=\$';" while ($ARGV[0] =~ /^(\w+)=/ && shift(@ARGV)); exit 255 if $die; ####################################### # Work out where in the repo we're at. ####################################### my $repos = shift; $repos =~ s:^$CVSROOT/::; grep($_ = $repos . '/' . $_, @ARGV); print "$$ Repos: $repos\n","$$ ==== ",join("\n$$ ==== ",@ARGV),"\n" if $debug; ####################################### # Find Tag/Branch. ####################################### my $tag = "HEAD"; if (-r "CVS/Tag") { open(TAG, "); close(TAG); if ($tmp =~ m/^T(.*)/) { $tag = $1; } } print "$$ Tag: $tag\n" if $debug; print "$$ Avail: $cfg::AVAIL_FILE\n" if $debug; if (open(FILES, ">$FILES_FILE")) { foreach (@ARGV) { print FILES "$tag\t$_\n"; } close(FILES); } else { print "$$ Cannot open $FILES_FILE ($!)\n"; } ####################################### # Check that the user has permission. ####################################### # It is ok for the avail file not to exist. exit 0 unless -e $cfg::AVAIL_FILE; # Suck in a list of committer groups from the avail file. open (AVAIL, $cfg::AVAIL_FILE) || die "open $cfg::AVAIL_FILE: $!\n"; while () { next unless /^group\|/; chomp; my ($keywrd, $gname, $members) = split /\|/, $_; $GROUPS{$gname} = expand_users($members); } close(AVAIL); open (AVAIL, $cfg::AVAIL_FILE) || die "open $cfg::AVAIL_FILE: $!\n"; while () { chomp; next if /^\s*\#/; next if /^\s*$/; next if /^group\|/; print "--------------------\n" if $debug; my $rule = $_; my ($flagstr, $u, $m) = split(/[\s,]*\|[\s,]*/, $rule); # Skip anything not starting with "avail" or "unavail" and complain. if ($flagstr !~ /^avail/ && $flagstr !~ /^unavail/) { print "Bad avail line: $rule\n"; next; } # Set which bit we are playing with. ('0' is OK == Available). my $flag = (($& eq "avail") ? 0 : 1); # If we find a "universal off" flag (i.e. a simple "unavail") # remember it my $universal_off = 1 if ($flag && !$u && !$m); # Expand any group names into a full user list. my $users = expand_users($u); # $cfg::COMMITTER considered "in user list" if actually in list # or is NULL my $in_user = (!$u || grep ($_ eq $cfg::COMMITTER, split(/[\s,]+/, $users))); print "$$ \$cfg::COMMITTER ($cfg::COMMITTER) in user list: $rule\n" if $debug && $in_user; # Module matches if it is a NULL module list in the avail line. # If module list is not null, we check every argument combination. my $in_repo = (!$m || 0); unless ($in_repo) { my @tmp = split(/[\s,]+/, $m); for my $j (@tmp) { # If the repos from avail is a parent(or equal) # dir of $repos, OK if ($repos eq $j || $repos =~ /^$j\//) { $in_repo = 1; last; } } unless ($in_repo) { #$in_repo = 1; for my $j (@ARGV) { last unless $in_repo = grep ($_ eq $j, @tmp); } } } print "$$ \$repos($repos) in repository list: $rule\n" if $debug && $in_repo; print "$$ Expanded user list: $users\n" if $debug; $exit_val = $flag if ($in_user && $in_repo); print "$$ ==== \$exit_val = $exit_val\n$$ ==== \$flag = $flag\n" if $debug; } close(AVAIL); print "$$ ==== \$exit_val = $exit_val\n" if $debug; print "**** Access denied: Insufficient Karma ($cfg::COMMITTER|$repos)\n" if $exit_val; print "**** Access allowed: Personal Karma exceeds Environmental Karma.\n" if $debug && $universal_off && !$exit_val; exit($exit_val); # Expand a user specification containing group names and deltas into # a definitive list of users. sub expand_users { my $user_list = shift || ""; # Parse the members. my @members = split /,/, $user_list; my %members; foreach my $m (@members) { if ($m =~ s/^://) { if (!defined($GROUPS{$m})) { warn "Group '$m' not defined before use in " . "$cfg::AVAIL_FILE.\n"; next; } # Add the specified group to the membership. foreach (split /,/, $GROUPS{$m}) { $members{$_} = 1; } } elsif ($m =~ s/\!//) { $m = "$CVSROOT/CVSROOT/$m" if $m !~ /^\//; if (open USERLIST, $m) { while () { chomp; s/\s*(#.*)?$//; next if /^$/; $members{$_} = 1; } close USERLIST; } else { warn "Can't open user file $m " . "defined in $cfg::AVAIL_FILE.\n"; } } else { $members{$m} = 1; } } return join("," , sort keys %members); } ensitive actions after startMatthew Barnes2009-09-012-2/+2 * Bug 593613 - Doesn't differentiate an appointment and meeting button clickMatthew Barnes2009-09-011-0/+3 * Get EConfig and EEvent hooks working again.Matthew Barnes2009-09-0113-44/+100 * Bug #494531 - Use quoted-printable encoding when necessaryDavid Liang2009-08-311-1/+2 * Bug #593648 - mail-to-task used full path in .eplug fileMilan Crha2009-08-311-1/+1 * Fix for few compiler warningsMilan Crha2009-08-313-15/+5 * Updated breton translationDenis Arnaud2009-08-311-1403/+996 * Fix widget include paths in public header files.Matthew Barnes2009-08-314-5/+5 * Fix distcheck errors.Matthew Barnes2009-08-305-1424/+9 * Merge commit 'origin/kill-bonobo'Matthew Barnes2009-08-30983-90082/+105972 |\ | * Coding style and whitespace cleanup.Matthew Barnes2009-08-3017-37/+36 | * Drop libbonoboui from configure.ac and pkg-config files.Matthew Barnes2009-08-303-26/+11 | * Drop obsolete Bonobo-based importer documentation.Matthew Barnes2009-08-3011-526/+0 | * Simplify EPlugin loading at startup.Matthew Barnes2009-08-3094-2723/+2608 | * Re-enable more calendar code.Matthew Barnes2009-08-289-31/+14 | * Update NEWS for 2.27.91 release.Matthew Barnes2009-08-281-0/+31 | * Build with -Wl,--no-undefined and fix linker errors.Matthew Barnes2009-08-283-4/+11 | * Whitespace cleanup in configure.ac.Matthew Barnes2009-08-281-14/+14 | * Fix distcheck error.Matthew Barnes2009-08-281-0/+1 | * Fix calendar pane positioning.Matthew Barnes2009-08-282-8/+8 | * Add vertical view to Contacts.Matthew Barnes2009-08-285-33/+195 | * Remove redundant "vertical view" functions.Matthew Barnes2009-08-285-130/+98 | * Add vertical view to Memos and Tasks.Matthew Barnes2009-08-2814-95/+419 | * Add EPaned widget to generalize vertical view.Matthew Barnes2009-08-285-145/+441 | * Fix preview pane size persistance.Matthew Barnes2009-08-282-22/+127 | * Nit pick.Matthew Barnes2009-08-281-2/+2 | * Fix return types to match the type of functionKjartan Maraas2009-08-271-2/+2 | * Fix return typesKjartan Maraas2009-08-271-3/+3 | * Fix discrepancy wrt what's actually in the UIKjartan Maraas2009-08-271-1/+1 | * More panel resizing goodness.Matthew Barnes2009-08-272-4/+4 | * Fix resize behavior of main window panes.Matthew Barnes2009-08-275-9/+9 | * Switch between classic and vertical view using GtkOrientable.Matthew Barnes2009-08-261-18/+9 | * Deal with untracked files in git.Matthew Barnes2009-08-264-1/+14 | * Add menu item ellipsis according to bug #324492.Matthew Barnes2009-08-253-3/+3 | * Bug 488409 - Remember size of filter/vfolder editor windowsMatthew Barnes2009-08-256-177/+296 | * Bug 592335 - Submit bug-report doesn't workMatthew Barnes2009-08-251-1/+1 | * Bug 511769 - Poor indication of when network is unavailableMatthew Barnes2009-08-252-6/+40 | * Bug 359909 - "New" Button too smallMatthew Barnes2009-08-251-0/+25 | * Exit if no command-line URIs are handled.Matthew Barnes2009-08-255-21/+28 | * Remember position of main window.Matthew Barnes2009-08-252-1/+23 | * Handle calendar URIs from the command line.Matthew Barnes2009-08-255-48/+151 | * Updated Swedish translationDaniel Nylander2009-08-241-1048/+1302 | * Updated German translationChristian Kirbach2009-08-241-3541/+4154 | * Bump version to match gnome-2-28 branch.Matthew Barnes2009-08-241-1/+1 | * Updated Bulgarian translationAlexander Shopov2009-08-241-5610/+6215 | * Added Norwegian bokmål translation.Kjartan Maraas2009-08-241-861/+1011 | * Updated Irish translationSeán de Búrca2009-08-241-140/+122 | * Updated Galician TranslationAntón Méixome2009-08-241-297/+228 | * Updated Irish translationSeán de Búrca2009-08-241-68/+52 | * Updated Irish translationSeán de Búrca2009-08-241-384/+242 | * Updated Irish translationSeán de Búrca2009-08-241-392/+301 | * Updated Hebrew translationMark Krapivner2009-08-241-3052/+3383 | * Updated Irish translationSeán de Búrca2009-08-241-739/+424 | * Updated Bengali translationJamil Ahmed2009-08-241-9454/+11827 | * Updated Marathi TranslationsSandeep Shedmake2009-08-241-3959/+21364 | * Updated Marathi TranslationsSandeep Shedmake2009-08-241-22604/+3954 | * Fix distcheck error.Matthew Barnes2009-08-231-1/+0 | * Stop killing evolution-data-server services.Matthew Barnes2009-08-234-91/+1 | * Cleanup mail-notification configuration page.Matthew Barnes2009-08-231-217/+190 | * Bug 571488 - Migrate from deprecated gnome_sound to libcanberraH.Habighorst2009-08-2311-56/+113 | * Fix Gtk-Doc build break.Matthew Barnes2009-08-231-1/+0 | * Fix migration errors.Matthew Barnes2009-08-233-6/+3 | * Bug 592680 - Remove deprecated Encoding key from desktop fileFrederic Peters2009-08-231-1/+0 | * Kill EPopup.Matthew Barnes2009-08-237-1264/+0 | * Kill ECalPopup.Matthew Barnes2009-08-235-720/+2 | * Remove the popup menu from EMeetingListView.Matthew Barnes2009-08-232-197/+0 | * More GnomeCalendar cleanup.Matthew Barnes2009-08-194-131/+73 | * Trim more fat off the GnomeCalendar API.Matthew Barnes2009-08-198-329/+306 | * Re-enable more calendar bits.Matthew Barnes2009-08-193-12/+1 | * Remove obsolete Bonobo IDs from killev.Matthew Barnes2009-08-191-9/+0 | * Fix a distcheck error.Matthew Barnes2009-08-191-1/+0 | * Centralize week-start-day tracking in calendar views.Matthew Barnes2009-08-198-275/+146 | * ECalModel cleanup.Matthew Barnes2009-08-181-94/+152 | * Remove duplicate handlers for date navigator signals.Matthew Barnes2009-08-183-57/+24 | * Remove an unnecessary libgnomeui include.Matthew Barnes2009-08-181-1/+0 | * Bug 567260 - Migrate from GnomeDruid to GtkAssistantMilan Crha2009-08-1817-523/+526 | * Bug 591829 - Dragging mails to folder tree does not workMatthew Barnes2009-08-182-140/+7 | * Bug 591830 - Inline attachments no longer shownMatthew Barnes2009-08-181-148/+6 | * Disable Anjal hack until it can be reworked.Matthew Barnes2009-08-181-0/+3 | * Bug 592032 - Marks message as read when preview is offMatthew Barnes2009-08-186-24/+38 | * Fix a duplicate mnemonic.Matthew Barnes2009-08-181-1/+1 | * Bug 592034 - Reply to List doesn't workMatthew Barnes2009-08-182-27/+22 | * Bug 591755 - Gtk-Doc build failure when NM support disabledH.Habighorst2009-08-171-1/+5 | * Chip away at GSEAL compliance.Matthew Barnes2009-08-178-31/+68 | * Fix compiler warnings and deprecated GTK+ API usage.Matthew Barnes2009-08-1643-102/+105 | * Don't stomp on the warning flags.Matthew Barnes2009-08-161-0/+1 | * Get the calendar view popup menu working.Matthew Barnes2009-08-1612-691/+816 | * Bug 567260 – Migrate from GnomeDruid to GtkAssistantMilan Crha2009-08-145-306/+162 | * Bug 591377 – Fails to detect krb5 in configure with -as-neededH.Habighorst2009-08-141-13/+12 | * Bug 591321 – Cosmetic changes and fixes in configure.acH.Habighorst2009-08-141-70/+149 | * Update GConf when the online/offline button is clicked.Matthew Barnes2009-08-142-0/+20 | * Track the timezone in one place: ECalModelMatthew Barnes2009-08-135-103/+119 | * Add new preferences missed during the 2.27.90 merge.Matthew Barnes2009-08-137-9/+145 | * Make switching between calendar views work.Matthew Barnes2009-08-13