[plt-scheme] anyone written a web-server app that drops privileges on Unix?

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Feb 16 21:48:10 EST 2010

On Feb 16, Jay McCarthy wrote:
> It is also very easy to use the ffi to call setuid. Call it after
> calling serve.

Here's an example (which I think is used in Arc):

  > (require scheme/system)
  > (system "whoami")
  root
  #t
  > (require scheme/foreign)
  > (unsafe!)
  > (define setuid (get-ffi-obj 'setuid #f (_fun _int -> _int)))
  > (setuid 500)
  0
  > (system "whoami")
  eli
  #t

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.