* [gentoo-commits] CVSROOT commit in /: checkgroup.pl
@ 2008-09-17 21:34 Robin H. Johnson (robbat2)
0 siblings, 0 replies; 6+ messages in thread
From: Robin H. Johnson (robbat2) @ 2008-09-17 21:34 UTC (permalink / raw
To: gentoo-commits
robbat2 08/09/17 21:34:40
Modified: checkgroup.pl
Log:
Add debug code.
Revision Changes Path
1.2 checkgroup.pl
file : http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?rev=1.2&view=markup
plain: http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?rev=1.2&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?r1=1.1&r2=1.2
Index: checkgroup.pl
===================================================================
RCS file: /var/cvsroot/CVSROOT/checkgroup.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -p -w -b -B -u -u -r1.1 -r1.2
--- checkgroup.pl 17 Sep 2008 21:30:36 -0000 1.1
+++ checkgroup.pl 17 Sep 2008 21:34:40 -0000 1.2
@@ -2,6 +2,7 @@
use strict;
use warnings;
use File::Spec;
+use File::stat;
my $cvsroot = shift @ARGV;
my $repo = shift @ARGV;
@@ -10,4 +11,9 @@ my $path = shift @ARGV;
foreach(@ARGV) {
my $filepath = File::Spec->catfile($cvsroot, $repo, $path, $_);
print STDERR $filepath."\n";
+ -f $filepath or die "$filepath does not exist.";
+ my $sb = stat($filepath);
+ printf "File is %s, size is %s, perm %04o, mtime %s, gid %s\n",
+ $filepath, $sb->size, $sb->mode & 07777,
+ scalar localtime $sb->mtime, $sb->gid;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [gentoo-commits] CVSROOT commit in /: checkgroup.pl
@ 2008-09-17 21:35 Robin H. Johnson (robbat2)
0 siblings, 0 replies; 6+ messages in thread
From: Robin H. Johnson (robbat2) @ 2008-09-17 21:35 UTC (permalink / raw
To: gentoo-commits
robbat2 08/09/17 21:35:51
Modified: checkgroup.pl
Log:
Add group name.
Revision Changes Path
1.3 checkgroup.pl
file : http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?rev=1.3&view=markup
plain: http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?rev=1.3&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?r1=1.2&r2=1.3
Index: checkgroup.pl
===================================================================
RCS file: /var/cvsroot/CVSROOT/checkgroup.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -p -w -b -B -u -u -r1.2 -r1.3
--- checkgroup.pl 17 Sep 2008 21:34:40 -0000 1.2
+++ checkgroup.pl 17 Sep 2008 21:35:50 -0000 1.3
@@ -13,7 +13,8 @@ foreach(@ARGV) {
print STDERR $filepath."\n";
-f $filepath or die "$filepath does not exist.";
my $sb = stat($filepath);
- printf "File is %s, size is %s, perm %04o, mtime %s, gid %s\n",
+ my $group = getgrgid($sb->gid);
+ printf "File is %s, size is %s, perm %04o, mtime %s, group %s\n",
$filepath, $sb->size, $sb->mode & 07777,
- scalar localtime $sb->mtime, $sb->gid;
+ scalar localtime $sb->mtime, $group;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [gentoo-commits] CVSROOT commit in /: checkgroup.pl
@ 2008-09-17 22:00 Robin H. Johnson (robbat2)
0 siblings, 0 replies; 6+ messages in thread
From: Robin H. Johnson (robbat2) @ 2008-09-17 22:00 UTC (permalink / raw
To: gentoo-commits
robbat2 08/09/17 22:00:20
Modified: checkgroup.pl
Log:
Implement a commit checker that uses the existing group ownership of a file to validate the commit.
Revision Changes Path
1.4 checkgroup.pl
file : http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?rev=1.4&view=markup
plain: http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?rev=1.4&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?r1=1.3&r2=1.4
Index: checkgroup.pl
===================================================================
RCS file: /var/cvsroot/CVSROOT/checkgroup.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -p -w -b -B -u -u -r1.3 -r1.4
--- checkgroup.pl 17 Sep 2008 21:35:50 -0000 1.3
+++ checkgroup.pl 17 Sep 2008 22:00:20 -0000 1.4
@@ -7,14 +7,31 @@ use File::stat;
my $cvsroot = shift @ARGV;
my $repo = shift @ARGV;
my $path = shift @ARGV;
+my $user = $ENV{USER};
+
+my $ret = 0;
foreach(@ARGV) {
- my $filepath = File::Spec->catfile($cvsroot, $repo, $path, $_);
- print STDERR $filepath."\n";
- -f $filepath or die "$filepath does not exist.";
+ my $localfilepath = File::Spec->catfile($repo, $path, $_);
+ my $filepath = File::Spec->catfile($cvsroot, $localfilepath);
+ #print STDERR $filepath."\n";
+ #-f $filepath or die "$filepath does not exist.";
+ -f $filepath or next;
my $sb = stat($filepath);
- my $group = getgrgid($sb->gid);
- printf "File is %s, size is %s, perm %04o, mtime %s, group %s\n",
- $filepath, $sb->size, $sb->mode & 07777,
- scalar localtime $sb->mtime, $group;
+ my ($groupname,$grouppasswd,$groupgid,$groupmembers) = getgrgid($sb->gid);
+ my @groupmembers = split /,/,$groupmembers;
+ #print 'groupmembers ('.join(',', @groupmembers).")\n";
+ my @valid = grep /^$user$/, @groupmembers;
+ #print '@valid ('.join(',', @valid).")\n";
+ my $valid = (scalar @valid) > 0;
+ #print 'array ('.join(',', @valid).") $valid\n";
+ if($valid) { $valid = $valid[0] eq $user; }
+ #printf "File is %s, size is %s, perm %04o, mtime %s, group %s, valid for $user %d\n",
+ # $filepath, $sb->size, $sb->mode & 07777,
+ # scalar localtime $sb->mtime, $groupname, $valid;
+ if(!$valid) {
+ printf STDERR "You do not have permissions to commit to %s\n", $localfilepath;
+ $ret = 1;
+ }
}
+exit $ret;
^ permalink raw reply [flat|nested] 6+ messages in thread
* [gentoo-commits] CVSROOT commit in /: checkgroup.pl
@ 2008-09-17 22:04 Robin H. Johnson (robbat2)
0 siblings, 0 replies; 6+ messages in thread
From: Robin H. Johnson (robbat2) @ 2008-09-17 22:04 UTC (permalink / raw
To: gentoo-commits
robbat2 08/09/17 22:04:52
Modified: checkgroup.pl
Log:
Add Debug support.
Revision Changes Path
1.5 checkgroup.pl
file : http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?rev=1.5&view=markup
plain: http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?rev=1.5&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?r1=1.4&r2=1.5
Index: checkgroup.pl
===================================================================
RCS file: /var/cvsroot/CVSROOT/checkgroup.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -p -w -b -B -u -u -r1.4 -r1.5
--- checkgroup.pl 17 Sep 2008 22:00:20 -0000 1.4
+++ checkgroup.pl 17 Sep 2008 22:04:51 -0000 1.5
@@ -8,27 +8,28 @@ my $cvsroot = shift @ARGV;
my $repo = shift @ARGV;
my $path = shift @ARGV;
my $user = $ENV{USER};
+my $DEBUG = (exists $ENV{DEBUG});
my $ret = 0;
foreach(@ARGV) {
my $localfilepath = File::Spec->catfile($repo, $path, $_);
my $filepath = File::Spec->catfile($cvsroot, $localfilepath);
- #print STDERR $filepath."\n";
+ print STDERR $filepath."\n" if $DEBUG;
#-f $filepath or die "$filepath does not exist.";
-f $filepath or next;
my $sb = stat($filepath);
my ($groupname,$grouppasswd,$groupgid,$groupmembers) = getgrgid($sb->gid);
my @groupmembers = split /,/,$groupmembers;
- #print 'groupmembers ('.join(',', @groupmembers).")\n";
+ print 'groupmembers ('.join(',', @groupmembers).")\n" if $DEBUG;
my @valid = grep /^$user$/, @groupmembers;
- #print '@valid ('.join(',', @valid).")\n";
+ print '@valid ('.join(',', @valid).")\n" if $DEBUG;
my $valid = (scalar @valid) > 0;
- #print 'array ('.join(',', @valid).") $valid\n";
+ print 'array ('.join(',', @valid).") $valid\n" if $DEBUG;
if($valid) { $valid = $valid[0] eq $user; }
- #printf "File is %s, size is %s, perm %04o, mtime %s, group %s, valid for $user %d\n",
- # $filepath, $sb->size, $sb->mode & 07777,
- # scalar localtime $sb->mtime, $groupname, $valid;
+ printf "File is %s, size is %s, perm %04o, mtime %s, group %s, valid for $user %d\n",
+ $filepath, $sb->size, $sb->mode & 07777,
+ scalar localtime $sb->mtime, $groupname, $valid if $DEBUG;
if(!$valid) {
printf STDERR "You do not have permissions to commit to %s\n", $localfilepath;
$ret = 1;
^ permalink raw reply [flat|nested] 6+ messages in thread
* [gentoo-commits] CVSROOT commit in /: checkgroup.pl
@ 2008-09-17 22:05 Robin H. Johnson (robbat2)
0 siblings, 0 replies; 6+ messages in thread
From: Robin H. Johnson (robbat2) @ 2008-09-17 22:05 UTC (permalink / raw
To: gentoo-commits
robbat2 08/09/17 22:05:33
Modified: checkgroup.pl
Log:
Use both seperators for group members.
Revision Changes Path
1.6 checkgroup.pl
file : http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?rev=1.6&view=markup
plain: http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?rev=1.6&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?r1=1.5&r2=1.6
Index: checkgroup.pl
===================================================================
RCS file: /var/cvsroot/CVSROOT/checkgroup.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -p -w -b -B -u -u -r1.5 -r1.6
--- checkgroup.pl 17 Sep 2008 22:04:51 -0000 1.5
+++ checkgroup.pl 17 Sep 2008 22:05:32 -0000 1.6
@@ -20,7 +20,7 @@ foreach(@ARGV) {
-f $filepath or next;
my $sb = stat($filepath);
my ($groupname,$grouppasswd,$groupgid,$groupmembers) = getgrgid($sb->gid);
- my @groupmembers = split /,/,$groupmembers;
+ my @groupmembers = split /[, ]/,$groupmembers;
print 'groupmembers ('.join(',', @groupmembers).")\n" if $DEBUG;
my @valid = grep /^$user$/, @groupmembers;
print '@valid ('.join(',', @valid).")\n" if $DEBUG;
^ permalink raw reply [flat|nested] 6+ messages in thread
* [gentoo-commits] CVSROOT commit in /: checkgroup.pl
@ 2008-09-17 22:23 Robin H. Johnson (robbat2)
0 siblings, 0 replies; 6+ messages in thread
From: Robin H. Johnson (robbat2) @ 2008-09-17 22:23 UTC (permalink / raw
To: gentoo-commits
robbat2 08/09/17 22:23:28
Modified: checkgroup.pl
Log:
Last fixup and enable for script.
Revision Changes Path
1.7 checkgroup.pl
file : http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?rev=1.7&view=markup
plain: http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?rev=1.7&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/CVSROOT/checkgroup.pl?r1=1.6&r2=1.7
Index: checkgroup.pl
===================================================================
RCS file: /var/cvsroot/CVSROOT/checkgroup.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -p -w -b -B -u -u -r1.6 -r1.7
--- checkgroup.pl 17 Sep 2008 22:05:32 -0000 1.6
+++ checkgroup.pl 17 Sep 2008 22:23:27 -0000 1.7
@@ -4,7 +4,6 @@ use warnings;
use File::Spec;
use File::stat;
-my $cvsroot = shift @ARGV;
my $repo = shift @ARGV;
my $path = shift @ARGV;
my $user = $ENV{USER};
@@ -13,21 +12,21 @@ my $DEBUG = (exists $ENV{DEBUG});
my $ret = 0;
foreach(@ARGV) {
- my $localfilepath = File::Spec->catfile($repo, $path, $_);
- my $filepath = File::Spec->catfile($cvsroot, $localfilepath);
- print STDERR $filepath."\n" if $DEBUG;
+ my $localfilepath = File::Spec->catfile($path, $_);
+ my $filepath = File::Spec->catfile($repo, $localfilepath).',v';
+ print STDERR "repo=$repo path=$path file=$_\n" if $DEBUG;
#-f $filepath or die "$filepath does not exist.";
-f $filepath or next;
my $sb = stat($filepath);
my ($groupname,$grouppasswd,$groupgid,$groupmembers) = getgrgid($sb->gid);
my @groupmembers = split /[, ]/,$groupmembers;
- print 'groupmembers ('.join(',', @groupmembers).")\n" if $DEBUG;
+ print STDERR 'groupmembers ('.join(',', @groupmembers).")\n" if $DEBUG;
my @valid = grep /^$user$/, @groupmembers;
- print '@valid ('.join(',', @valid).")\n" if $DEBUG;
+ print STDERR '@valid ('.join(',', @valid).")\n" if $DEBUG;
my $valid = (scalar @valid) > 0;
- print 'array ('.join(',', @valid).") $valid\n" if $DEBUG;
+ print STDERR 'array ('.join(',', @valid).") $valid\n" if $DEBUG;
if($valid) { $valid = $valid[0] eq $user; }
- printf "File is %s, size is %s, perm %04o, mtime %s, group %s, valid for $user %d\n",
+ printf STDERR "File is %s, size is %s, perm %04o, mtime %s, group %s, valid for $user %d\n",
$filepath, $sb->size, $sb->mode & 07777,
scalar localtime $sb->mtime, $groupname, $valid if $DEBUG;
if(!$valid) {
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-09-17 22:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-17 22:23 [gentoo-commits] CVSROOT commit in /: checkgroup.pl Robin H. Johnson (robbat2)
-- strict thread matches above, loose matches on Subject: below --
2008-09-17 22:05 Robin H. Johnson (robbat2)
2008-09-17 22:04 Robin H. Johnson (robbat2)
2008-09-17 22:00 Robin H. Johnson (robbat2)
2008-09-17 21:35 Robin H. Johnson (robbat2)
2008-09-17 21:34 Robin H. Johnson (robbat2)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox