Exemple #1
0
static int do_generic_cmd(const char *me, char *arg)
{
    cmd_type_t ct;
    char user[256];
    char cmd[1024];

    /*setup_path();*/
    if (!arg) die("bad argument: NULL");

    if (!(arg = sq_dequote(arg))) die("bad argument");
    if (prefixcmp(me, "git-")) die("bad command");
    if (*arg == '/') ++arg;
    switch ((ct = check_access(arg, user, sizeof(user)))) {
    case ct_gitshell:
	fprintf(stderr, "%s %s %s\n", GIT_COMMAND, me + 4, arg);
	return execl(GIT_COMMAND, GIT_COMMAND, me + 4, arg, NULL);
    case ct_gitolite:
	snprintf(cmd, sizeof(cmd), "git-%s '%s'", me + 4, arg);
	setenv("SSH_ORIGINAL_COMMAND", cmd, !0);
	setenv("GITOLITE_HTTP_HOME", GITOLITE_HTTP_HOME, !0);
	fprintf(stderr, "gitolite: user = [%s] cmd = [%s]\n", user, cmd);
	return execl(PERL_COMMAND, PERL_COMMAND, GL_AUTH_COMMAND, user, NULL);
    }
    die("Unknown command type: %u", ct);
    return -1;
}
Exemple #2
0
static int do_generic_cmd(const char *me, char *arg)
{
	const char *my_argv[4];

	setup_path();
	if (!arg || !(arg = sq_dequote(arg)))
		die("bad argument");
	if (prefixcmp(me, "git-"))
		die("bad command");

	my_argv[0] = me + 4;
	my_argv[1] = arg;
	my_argv[2] = NULL;

	return execv_git_cmd(my_argv);
}