git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 4/4] git-daemon support for user-relative paths.

From
Junio C Hamano <junkio@cox.net>
Date
Nov 2, 2005, 00:14 UTC
Message-ID
<7vvezb6h4c.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20051101225921.3E7455BF74@nox.op5.se>
Andreas Ericsson <ae@op5.se> writes:
> +             [--timeout=n] [--init-timeout=n] [--strict-paths] [directory...]
Why not just --strict?
Show 6 quoted lines
> @@ -10,16 +10,18 @@
>  #include "pkt-line.h"
>  #include "cache.h"
>  
> -static int log_syslog;
> +static int log_syslog = 0;
I'd drop this.
Show 28 quoted lines
>  /* If this is set, git-daemon-export-ok is not required */
>  static int export_all_trees = 0;
>  
> @@ -81,69 +83,49 @@ static void loginfo(const char *err, ...
>  	va_end(params);
>  }
>  
> -static int path_ok(const char *dir)
> +static const char *path_ok(const char *dir)
>  {
> +	const char *path = is_git_repo(dir, strict_paths);
> +	/* No such directory or not a git archive */
> +	if(!path) {
> +		logerror("'%s': unable to chdir or not a git archive", dir);
> +		return NULL;
>  	}
>  
>  	if ( ok_paths && *ok_paths ) {
> +		char **pp = NULL;
> +		int dirlen = strlen(path);
>  
>  		for ( pp = ok_paths ; *pp ; pp++ ) {
>  			int len = strlen(*pp);
> +			if ( len <= dirlen && !strncmp(*pp, path, len) ) {
> +				if( path[len] == '\0' || (!strict_paths && path[len] == '/') )
> +					return path;
>  			}
>  		}

Sorry, but I am a bit confused. Does this mean that you need to list all directories under --strict-paths, instead of saying "/pub/scm and everything under it is OK"?

I like the general direction this set is taking, but let's let it simmer for a while.

Previous: Andreas EricssonNext: Andreas Ericsson
Message 2 of 6 in “git-daemon support for user-relative paths.”
  1. 4/4 git-daemon support for user-relative paths.Andreas Ericsson, Nov 1, 2005
  2. Junio C HamanoNov 2, 2005
  3. Andreas EricssonNov 2, 2005
  4. Junio C HamanoNov 2, 2005
  5. Andreas EricssonNov 2, 2005
  6. Andreas EricssonNov 2, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.