<div>Right so I just have to call set-uid once on the first start request, because serve/servlet hangs. Is there a slicker way to have serve/servlet call some given initialization function once after doing it's work and before receiving any requests? I don't see anything for that in the documentation, but maybe I missed it. Anyway, what I have works at least. Exactly how unsafe is it? Is it just unportable?</div>
<div><br></div><div>And thanks, Eli, but I'm less scared of hard-coding my known ruid than having a piece of data floating around with a pointer to my passwd. (even if it's hashed)<br clear="all"><br>Jeremy<br>
<br><br><div class="gmail_quote">On Fri, Sep 16, 2011 at 1:26 PM, John Clements <span dir="ltr"><<a href="mailto:clements@brinckerhoff.org">clements@brinckerhoff.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
On Sep 16, 2011, at 11:03 AM, Jay McCarthy wrote:<br>
<br>
> I think you can use ffi-lib with #f because it is already attached.<br>
<br>
</div>Yeah, okay, looks like this works:<br>
<br>
#lang racket<br>
<br>
(require ffi/unsafe)<br>
<br>
;; return type is "gid_t". Safe to use int?<br>
(define setuid<br>
(get-ffi-obj "setuid" (ffi-lib #f)<br>
(_fun _int -> _int)))<br>
<br>
(setuid 0)<br>
<br>
<br>
... naturally, the setuid 0 fails, you'd have to start as root and go down. Also, you'd need to do that *after* the listen on port 80.<br>
<font color="#888888"><br>
John<br>
<br>
</font></blockquote></div><br></div>