Commit graph

61 commits

Author SHA1 Message Date
Sitaram Chamarty 8a9564f171 some minor rearrangements of code...
why?  now that would be telling!
2012-11-08 19:12:20 +05:30
Sitaram Chamarty a509b208e3 move %GL_REPO and %GL_CREATOR substitution into core
see usage example at the end of src/triggers/upstream
2012-11-07 05:36:28 +05:30
Sitaram Chamarty be61cd2d66 make sure gl-perms exists, even if it is empty...
I expect this to help if we optimise the rule generation by caching.
2012-11-06 09:15:55 +05:30
Sitaram Chamarty 70ad045e08 (minor fixups to some non-code parts) 2012-10-31 06:24:44 +05:30
Sitaram Chamarty f636ce3ba3 (security) fix bug in pattern to detect path traversal
while we're about it, add the same check to some of the internal
routines, so that commands can also be protected.

finally, just to make sure we don't lose it again in some other fashion,
add a few tests for path traversal...
2012-10-05 12:28:20 +05:30
Sitaram Chamarty 0d371ac957 call GROUPLIST_PGM before determining user_roles()...
thanks to Stephane Chazelas [1]

[1]: https://groups.google.com/d/topic/gitolite/gy_ZkrxGSjg
2012-10-04 22:03:19 +05:30
Sitaram Chamarty 2dbaa4d12e (minor) move a small chunk of code out of a loop 2012-09-26 14:58:56 +05:30
Sitaram Chamarty 6328ec2cbe dont auto-vivify empty entries in %repos...
before this, trying to access a wild repo would create an empty hash in
%repos.  This is pretty harmless, but at some later point, memberships()
would try to use that in a pattern, attempting to match the real repo
being access-checked.

Which is still fine if your repo doesn't look like "libstdc++" AND
you're using some recent perl.

However, for perl 5.8.8, and if the repo has a ++ in it, perl barfs.

Here's a test program to check your perl:

    #!/usr/bin/perl

    $base="foo/u1/libstdc++";
    $i="foo/u1/libstdc++";

    if ( $base =~ /^$i$/ ) {
        print 1;
    } else {
        print 2;
    }

On 5.14.2 I get "2".  On 5.8.8 I get:

    Nested quantifiers in regex; marked by <-- HERE in m/^foo/u1/libstdc++ <-- HERE $/ at ./aa.pl line 6.
2012-09-25 19:10:47 +05:30
Sitaram Chamarty 3fe8ecf974 (minor) avoid spurious 'repo missing' messages for repo patterns 2012-09-25 19:05:57 +05:30
Sitaram Chamarty 724c741335 prevent barfage when presetting the rc file 2012-09-20 06:21:44 +05:30
Sitaram Chamarty e59c3ba9f9 (minor docfix) add info on using Easy.pm from elsewhere 2012-09-19 17:47:12 +05:30
Sitaram Chamarty cc9727c42b minor bug in include file handing...
gitolite does indeed try to not load itself twice, but I forgot that by
that time the pwd is ~/.gitolite/conf not ~/.gitolite so it always ended
up reading itself twice in case of a wildcard include.
2012-08-17 22:26:03 +05:30
Sitaram Chamarty 7409635823 (minor) add a 'dd' function to quickly dump stuff to STDERR 2012-08-17 10:04:32 +05:30
Olof Johansson ba67f6f9ca Bailout tests unless envvar $GITOLITE_TEST is 'y'
[committer made some changes to t/README]
2012-08-10 11:31:48 +05:30
Sitaram Chamarty fd0778e6d6 (minor) don't keep adding the same thing to $PATH 2012-07-10 21:10:06 +05:30
Sitaram Chamarty f545bc08f6 minor fixups 2012-07-03 08:06:59 +05:30
Sitaram Chamarty db2cf23379 logical expressions on refexes :-) 2012-06-29 22:19:06 +05:30
Sitaram Chamarty 621815611c (duh!) report rc file syntax errors
the "duh!" is because I should have done this long ago...
2012-06-21 06:49:22 +05:30
Sitaram Chamarty a454111d32 repo-specific umask
manually smoke tested but should be fine
2012-06-21 05:31:15 +05:30
Sitaram Chamarty 56d11deb55 (minor) one more 'internal' message bites the dust 2012-06-19 12:11:27 +05:30
Sitaram Chamarty a171053ab3 (minor) improve SNR of some error messages :) 2012-06-17 09:31:38 +05:30
Sitaram Chamarty fbd745958e PRE_ and POST_CREATE triggers get an extra argument...
...when invoked by single-repo operations like auto-creating a wild
repo, or running perms or fork.
2012-06-14 19:22:12 +05:30
Sitaram Chamarty 4373c5c74c GL_BINDIR2 becomes LOCAL_CODE, allows hook propagation also...
plus a bunch of doc changes
2012-06-14 19:22:12 +05:30
Sitaram Chamarty 3c0f177481 Allow user-specified programs to override system-installed ones
(manually tested)

  - new rc var: GL_BINDIR2; see doc update in this commit

  - added _which() function to search both $GL_BINDIR and $GL_BINDIR2
  - 'gitolite <command>', non-perl triggers, VREFs, and sugar, use this

  - unshifted $GL_BINDIR2/lib into @INC upfront in Rc.pm
  - perl triggers use this
2012-06-09 08:25:51 +05:30
Sitaram Chamarty 5300809103 ACCESS_2 gets 2 more arguments, and gets called for each VREF 2012-06-06 20:33:59 +05:30
Sitaram Chamarty f59ad8cafc (accumulated docfixes) esp a large section on the INPUT trigger 2012-06-05 11:39:18 +05:30
Sitaram Chamarty ad34cf2856 minor backward incompat breakage in 'gitolite query-rc'
'gitolite query-rc' now only queries one variable at a time.  That is,
you cannot do something like this:

    gitolite query-rc UMASK GL_ADMIN_BASE

to query both variables.  I think this is rarely used, plus it is easy
to work-around (just run two separate commands), so it was sacrificed
for the ability to do this:

    gitolite query-rc -q COMMANDS fork

which tells you whether $rc{COMMANDS}{fork} exists or not.
2012-06-03 13:00:38 +05:30
Sitaram Chamarty db70595b87 fixup to pushing wild repos permissions...
- fix docs to explicitly state that mirroring wild repos is a bad idea
    if the authentication data is not the same on the peers.

  - an important check against a malicious peer was missed out.  If
    people heed the warning above this check is not really needed but it
    is good for completeness.

  - warning about redirected pushes removed, thanks to Ronald Ip having
    tested it and reported it working.
2012-06-03 07:44:08 +05:30
Sitaram Chamarty 78866f6f28 (experimental code) push wild repos across a master slave connection
It creates the repo on the remote side (getting the creator name from
the gl-creator file and sending it across), as well as sending gl-perms
on subsequent connections.

This has only been minimally tested.  E.g., complex setups or asymmetric
configs on master and slave, etc. have NOT been tested.

This has also not been tested with redirected pushes.
2012-06-01 17:28:14 +05:30
Sitaram Chamarty d9df70a04f allow getting config settings for non-existant repos also
It's reasonable to want to see config items (for example, mirror
settings) that *would* apply if the repo existed.
2012-06-01 16:01:36 +05:30
Sitaram Chamarty 21dbe53d39 fix minor bug in handling 'desc = "some description"'
repo foo
        desc = "foo"
        RW  =   u1
        ...etc...

The order of the clauses was parsing this like the old 'reponame = "some
description"' and end up creating a repo called 'desc'!

It would also, as a side-effect, change the repo so what you thought
were access rules for 'foo' would become access rules for 'desc'.
2012-05-29 20:55:53 +05:30
Sitaram Chamarty 17841e8208 gitolite setup learns --hooks-only option 2012-05-25 12:54:06 +05:30
Sitaram Chamarty 0f3a09ce60 PRE_ and POST_CREATE should work for normal repos also 2012-05-25 12:47:12 +05:30
Sitaram Chamarty 5298a79cb5 MAJOR BUGFIX: disallow "hooks" directory in admin repo
Although this is not a "hole" that allows a normal user to bypass
controls, I still consider this a hole in the sense that I want to
separate "admin push" rights from "shell access on server" rights.

(I realise that most people don't make this distinction, but I do, and
for me and most sites I consult for it is important).

Thanks to drue on #gitolite who pointed it out excitedly, and apologies
for killing what he thought of as a feature!
2012-05-23 04:33:54 +05:30
Sitaram Chamarty 55d64752ae fix repo alias to work when reponame has leading "/"
as in git@host:repo.git works but ssh://git@host/repo.git doesn't
2012-05-22 11:57:40 +05:30
Sitaram Chamarty b6ce11a19f (minor) permissions fixup -- sugar scripts do not need +x 2012-05-22 07:06:41 +05:30
Sitaram Chamarty d04e79d291 (minor) single quotes around variables in error messages
(plus a couple of other minor fixups)
2012-05-21 17:44:30 +05:30
Sitaram Chamarty 3a59f5aff0 line up regexes for easier review 2012-05-21 15:24:40 +05:30
Sitaram Chamarty 72b6a54e0a test packaging instructions and make required changes 2012-05-20 14:21:23 +05:30
Sitaram Chamarty 07169c37ec allow aliasing a repo to another name
all documentation is inside Alias.pm.
2012-05-19 06:01:05 +05:30
Sitaram Chamarty e76be7ff11 move repo/user validity check deeper
(but change repo check to allow repoPATT instead of just repoNAME)

This is because there are/will be some situations where access() is
called without those two checks being done (i.e., it is not only from
src/commands/access that it is called).
2012-05-06 19:02:42 +05:30
Sitaram Chamarty d8df4a9344 git-config bugfix + backward compat breakage in usage of 'config'
(1) the backward compat breakage: you can't create empty-valued config
    keys anymore.  That is, you can't do the eqvt of the following shell
    command using gitolite

        git config foo.bar ""

(2) fixed a bug where this:

        repo foo
            config foo.bar =

    when queried using

        gitolite git-config -r foo .

    would return even the empty valued ones, which -- remember! -- are
    not supposed to exist anymore.

    Fixing this bug allows situations like this to not show the admin
    repo in gitweb:

        repo [a-z].*
            config gitweb.owner = P-h B

        repo gitolite-admin
            config gitweb.owner =

----

background...

Somewhere in g3 (well actually in 057506b), we lost the ability to
distinguish
    config foo.bar  =   ""
from
    config foo.bar =

I decided that conflating them is more intuitive for most people,
because a survey [1] revealed that no one seemed to want the equivalent
of the following shell command:

----

[1] ...of a (small prime greater than 1) number of people on #git
2012-05-04 17:30:22 +05:30
Sitaram Chamarty c145528849 (minor typo fix) 2012-05-01 14:20:13 +05:30
Sitaram Chamarty 850882c1a6 allow VREF code to print to STDOUT...
Using a g2-style "chained update hook" as a VREF doesn't *quite* work:

  - all STDOUT from the hook is lost
  - worse, all lines get parsed as a ref followed by a message, and if
    the ref doesn't look like a ref it dies

So now we do all this only if the message starts with 'VREF/'.  Any
other output is just printed out as is.
2012-04-30 06:02:17 +05:30
Sitaram Chamarty 48ed4deb8f BSD compat changes
thanks to milki for all the efforts!

Details:

  - partial-copy fell afoul of BSD not having $RANDOM
  - test suite: fix bad GNU sort with good perl sort
  - test suite: fix md5sum dependency (which BSD doesn't have or can't
    easily have or requires extra options or whatever...), by doing it
    in perl.  (Requires Digest::MD5, which is probably available
    anyway, but since this is only for the test suite, meh!)
2012-04-28 22:58:09 +05:30
Sitaram Chamarty 7d6b04605d fix test suite's dependency on time zone
I had not remembered that the 'tc' subcommand in tsh adds *text* that
contains the current time, so commit SHAs were changing.

Thanks to milki for catching this, and in fact being the only person who
ever appears to have attempted to run the test suite at all!
2012-04-28 04:55:49 +05:30
Sitaram Chamarty d74f596e23 make can_write() in Easy.pm more flexible 2012-04-23 17:27:00 +05:30
Sitaram Chamarty 6b65e7853f (minor) add quotes to make repo name stand out in error message 2012-04-22 22:43:45 +05:30
Sitaram Chamarty c3ec518cef fork command, and some core changes to make it work...
- access command allows checking ^C
  - ^C check will fail when the repo exists
2012-04-22 16:56:21 +05:30
Thomas Hager 3a7b547759 replaced /bin/echo with printf, Solaris echo doesn't recognize -n
gitolite setup fails to check admin pubkey, because $text always
contains 2 or more lines after tsh_try() (the key and -n).

[committer adds:
    I wasn't sure if 'printf' would work on cygwin, so I chose what
    looked like a safer option, but apparently it wasn't safe enough and
    fell afoul of Solaris.

    Anyway I managed to check (using a small test program) with someone
    who runs gitolite on cygwin, and it works.

    If you're wondering why I didn't just use echo followed by chomp(),
    that would of course have been the easy way out but I wanted to see
    how you'd do it without a post-processing option.  It became a
    frustrating challenge of sorts because it seems such a trivial thing!
]
2012-04-18 14:19:51 +05:30