Merge branch 'maint-1.6.0' into maint
authorJunio C Hamano <gitster@pobox.com>
Sat, 18 Apr 2009 20:39:52 +0000 (13:39 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 18 Apr 2009 20:39:52 +0000 (13:39 -0700)
* maint-1.6.0:
doc/git-daemon: add missing arguments to options
init: Do not segfault on big GIT_TEMPLATE_DIR environment variable

1  2 
Documentation/git-daemon.txt
builtin-init-db.c
index 36f00aed6798d543b2ee8f7315e447726fa100e5,2172e1fedccc99a6494d85feb9f99735af32267d..d5596672a5493062afbbd3b57f94a3673f9de659
@@@ -9,9 -9,8 +9,9 @@@ SYNOPSI
  --------
  [verse]
  'git daemon' [--verbose] [--syslog] [--export-all]
 -           [--timeout=n] [--init-timeout=n] [--strict-paths]
 -           [--base-path=path] [--user-path | --user-path=path]
 +           [--timeout=n] [--init-timeout=n] [--max-connections=n]
 +           [--strict-paths] [--base-path=path] [--base-path-relaxed]
 +           [--user-path | --user-path=path]
             [--interpolated-path=pathtemplate]
             [--reuseaddr] [--detach] [--pid-file=file]
             [--enable=service] [--disable=service]
@@@ -48,7 -47,7 +48,7 @@@ OPTION
        'git-daemon' will refuse to start when this option is enabled and no
        whitelist is specified.
  
- --base-path::
+ --base-path=path::
        Remap all the path requests as relative to the given path.
        This is sort of "GIT root" - if you run 'git-daemon' with
        '--base-path=/srv/git' on example.com, then if you later try to pull
@@@ -81,8 -80,8 +81,8 @@@
        Incompatible with --port, --listen, --user and --group options.
  
  --listen=host_or_ipaddr::
-       Listen on an a specific IP address or hostname.  IP addresses can
-       be either an IPv4 address or an IPV6 address if supported.  If IPv6
+       Listen on a specific IP address or hostname.  IP addresses can
+       be either an IPv4 address or an IPv6 address if supported.  If IPv6
        is not supported, then --listen=hostname is also not supported and
        --listen must be given an IPv4 address.
        Incompatible with '--inetd' option.
  --port=n::
        Listen on an alternative port.  Incompatible with '--inetd' option.
  
- --init-timeout::
+ --init-timeout=n::
        Timeout between the moment the connection is established and the
        client request is received (typically a rather low value, since
        that should be basically immediate).
  
- --timeout::
+ --timeout=n::
        Timeout for specific client sub-requests. This includes the time
-       it takes for the server to process the sub-request and time spent
-       waiting for next client's request.
+       it takes for the server to process the sub-request and the time spent
+       waiting for the next client's request.
  
 +--max-connections::
 +      Maximum number of concurrent clients, defaults to 32.  Set it to
 +      zero for no limit.
 +
  --syslog::
        Log to syslog instead of stderr. Note that this option does not imply
        --verbose, thus by default only error conditions will be logged.
  
  --user-path::
  --user-path=path::
 -      Allow ~user notation to be used in requests.  When
 +      Allow {tilde}user notation to be used in requests.  When
        specified with no parameter, requests to
 -      git://host/~alice/foo is taken as a request to access
 +      git://host/{tilde}alice/foo is taken as a request to access
        'foo' repository in the home directory of user `alice`.
        If `--user-path=path` is specified, the same request is
        taken as a request to access `path/foo` repository in
@@@ -150,7 -145,7 +150,7 @@@ the facility of inet daemon to achieve 
        Enable/disable the service site-wide per default.  Note
        that a service disabled site-wide can still be enabled
        per repository if it is marked overridable and the
-       repository enables the service with an configuration
+       repository enables the service with a configuration
        item.
  
  --allow-override=service::
@@@ -270,15 -265,6 +270,15 @@@ selectively enable/disable services pe
  ----------------------------------------------------------------
  
  
 +ENVIRONMENT
 +-----------
 +'git-daemon' will set REMOTE_ADDR to the IP address of the client
 +that connected to it, if the IP address is available. REMOTE_ADDR will
 +be available in the environment of hooks called when
 +services are performed.
 +
 +
 +
  Author
  ------
  Written by Linus Torvalds <torvalds@osdl.org>, YOSHIFUJI Hideaki
diff --combined builtin-init-db.c
index 8199e5d4d5168859363b7a644535fd0cb01a1441,6cc945d5075b03727f93194cd67122e6bff49764..bfdfc7b411fb463f06ba98f58c07f5e707813310
@@@ -29,7 -29,7 +29,7 @@@ static void safe_create_dir(const char 
                }
        }
        else if (share && adjust_shared_perm(dir))
 -              die("Could not make %s writable by group\n", dir);
 +              die("Could not make %s writable by group", dir);
  }
  
  static void copy_templates_1(char *path, int baselen,
@@@ -122,8 -122,10 +122,10 @@@ static void copy_templates(const char *
                template_dir = system_path(DEFAULT_GIT_TEMPLATE_DIR);
        if (!template_dir[0])
                return;
+       template_len = strlen(template_dir);
+       if (PATH_MAX <= (template_len+strlen("/config")))
+               die("insanely long template path %s", template_dir);
        strcpy(template_path, template_dir);
-       template_len = strlen(template_path);
        if (template_path[template_len-1] != '/') {
                template_path[template_len++] = '/';
                template_path[template_len] = 0;
@@@ -195,8 -197,6 +197,8 @@@ static int create_default_files(const c
  
        git_config(git_default_config, NULL);
        is_bare_repository_cfg = init_is_bare_repository;
 +
 +      /* reading existing config may have overwrote it */
        if (init_shared_repository != -1)
                shared_repository = init_shared_repository;
  
@@@ -315,15 -315,12 +317,15 @@@ int init_db(const char *template_dir, u
                 * and compatibility values for PERM_GROUP and
                 * PERM_EVERYBODY.
                 */
 -              if (shared_repository == PERM_GROUP)
 +              if (shared_repository < 0)
 +                      /* force to the mode value */
 +                      sprintf(buf, "0%o", -shared_repository);
 +              else if (shared_repository == PERM_GROUP)
                        sprintf(buf, "%d", OLD_PERM_GROUP);
                else if (shared_repository == PERM_EVERYBODY)
                        sprintf(buf, "%d", OLD_PERM_EVERYBODY);
                else
 -                      sprintf(buf, "0%o", shared_repository);
 +                      die("oops");
                git_config_set("core.sharedrepository", buf);
                git_config_set("receive.denyNonFastforwards", "true");
        }
@@@ -403,9 -400,6 +405,9 @@@ int cmd_init_db(int argc, const char **
                        usage(init_db_usage);
        }
  
 +      if (init_shared_repository != -1)
 +              shared_repository = init_shared_repository;
 +
        /*
         * GIT_WORK_TREE makes sense only in conjunction with GIT_DIR
         * without --bare.  Catch the error early.