git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: git-daemon --inetd
Date: Fri, 16 Sep 2005 00:51:39 -0700	[thread overview]
Message-ID: <7vbr2tqwl0.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.58.0509150829090.26803@g5.osdl.org> (Linus Torvalds's message of "Thu, 15 Sep 2005 09:03:31 -0700 (PDT)")

Linus Torvalds <torvalds@osdl.org> writes:

> Hmm.. That should work fine. You can already just run it that way by just 
> wrapping it in "chroot", but if you don't want that for some reason, how 
> about a patch like this?

Later exchanges between you and HPA appeared to me that we would
need a chroot environment which has "enough stuff" and that this
patch may not help him very much.  Am I mistaken?

If not, then...

> +		if (!strncmp(arg, "--chroot=", 9)) {
> +			if (chroot(arg+9) < 0)
> +				die("unable to chroot to '%s': %s", arg+9, strerror(errno));
> +			if (chdir("/") < 0)
> +				die("unable to chdir to new root");
> +
> +			user = user ? user : "nobody";
> +			group = group ? group : "nobody";
> +			continue;
> +		}
> +
> +		if (!strncmp(arg, "--user=", 7)) {
> +			user = arg+7;
> +			continue;
> +		}

I think resolving user and group to numeric before you do
chroot() might make the setting up of chrooted environment a
little simpler; no need for supporting getpwnam and getgrnam
there.  On the other hand it may not matter -- you can always
give numeric uid/gid to begin with.

  parent reply	other threads:[~2005-09-16  7:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-15  6:04 git-daemon --inetd H. Peter Anvin
2005-09-15 16:03 ` Linus Torvalds
2005-09-15 18:30   ` H. Peter Anvin
2005-09-15 18:47     ` Linus Torvalds
2005-09-15 19:19       ` H. Peter Anvin
2005-09-15 19:40         ` Linus Torvalds
2005-09-15 21:44           ` Martin Langhoff
2005-10-22 13:45             ` Jon Seymour
2005-10-22 21:05               ` Linus Torvalds
2005-09-15 19:57         ` Junio C Hamano
2005-09-16  6:23     ` Junio C Hamano
2005-09-16  7:51   ` Junio C Hamano [this message]
2005-09-16 16:54     ` H. Peter Anvin
2005-09-16 17:30     ` Linus Torvalds
2005-09-16 18:23       ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vbr2tqwl0.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).