X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=repo_shell.c;h=f5ec2680fdcf9e2f408a860cfc5eddff30a0365a;hb=bcc0e47c0c7bebbcc6abc30390894fa2ca93f5c8;hp=2785b848a85f89af063f280c57a9003f8c7ac928;hpb=d044b519a1b2faebcd1654c8fb0df4741f241dfa;p=repo_shell.git diff --git a/repo_shell.c b/repo_shell.c index 2785b84..f5ec268 100644 --- a/repo_shell.c +++ b/repo_shell.c @@ -16,6 +16,7 @@ #define CFG_FILE "/etc/repo_shell.conf" #define SHELL "/bin/bash" +#define GIT_ACL_FILE ".gitacls" typedef struct { char *user; @@ -34,7 +35,7 @@ static void change_user(char *user) struct passwd *pw = getpwnam(user); if (!pw) - die("invalid user %s", pw->pw_name); + die("invalid user %s", user); setuid(pw->pw_uid); } @@ -53,9 +54,9 @@ static char *dequote(char *arg) return narg; } -static char *add_prefix(char *prefix, char* arg) +static char *add_prefix(const char *prefix, const char* arg) { - char *narg = arg; + char *narg; int i; if (arg && prefix && (i = strlen(prefix))) { @@ -145,12 +146,11 @@ static int ini_handler(void* user, const char* section, const char* name, if (!strcmp(name, "svn_root")) pconfig->svn_root = xstrdup(value); - else if (!strcmp(name, "git_root")) + else if (!strcmp(name, "git_root")) { pconfig->git_root = xstrdup(value); - else if (!strcmp(name, "owner")) + pconfig->git_acl_file = add_prefix(value, GIT_ACL_FILE); + } else if (!strcmp(name, "owner")) pconfig->owner = xstrdup(value); - else if (!strcmp(name, "git_acl_file")) - pconfig->git_acl_file = xstrdup(value); else if (!strcmp(name, "allow_interactive")) pconfig->allow_interactive = str_has_word(value, pconfig->user); else