pike.git / src / modules / Pipe / pipe.c

version» Context lines:

pike.git/src/modules/Pipe/pipe.c:15: Inside #if defined(HAVE_MMAP)
  #ifdef HAVE_MMAP   /* sys/mman.h is _probably_ there anyway. */   #include <sys/mman.h>   #endif   #endif   #endif      #include <fcntl.h>      #include "global.h" - RCSID("$Id: pipe.c,v 1.12 1997/10/05 03:31:09 per Exp $"); + RCSID("$Id: pipe.c,v 1.13 1997/10/05 17:31:47 grubba Exp $");      #include "threads.h"   #include "stralloc.h"   #include "pike_macros.h"   #include "object.h"   #include "constants.h"   #include "interpret.h"   #include "svalue.h"   #include "error.h"   #include "builtin_functions.h"
pike.git/src/modules/Pipe/pipe.c:620: Inside #if defined(HAVE_MMAP) && defined(HAVE_MUNMAP) and #if defined(HAVE_GETEUID)
  #ifdef HAVE_GETEUID    int ou = 0;   #endif    mmapped += s.st_size;       i->type=I_MMAP;    i->len=s.st_size;    i->u.mmap=m;   #ifdef HAVE_MADVISE    /* Mark the pages as sequential read only access... */ +  +  /* NOTE: +  * +  * Potential race-condition with other threads +  */ +    #ifdef HAVE_GETEUID -  if((ou=geteuid()) && !getuid()) seteuid(0); +  if((ou=geteuid()) && !getuid()) { + #ifdef HAVE_SETEUID +  seteuid(0); + #else /* ! HAVE_SETEUID */ + #ifdef HAVE_SETREUID +  setresuid(-1, 0, -1); + #endif /* HAVE_SETRESUID */ + #endif /* HAVE_SETEUID */ +  }   #endif    madvise(m, s.st_size, MADV_SEQUENTIAL);   #ifdef HAVE_GETEUID -  if(ou) seteuid(ou); +  if(ou) { + #ifdef HAVE_SETEUID +  seteuid(0); + #else /* ! HAVE_SETEUID */ + #ifdef HAVE_SETREUID +  setresuid(-1, ou, -1); + #endif /* HAVE_SETRESUID */ + #endif /* HAVE_SETEUID */ +  }   #endif   #endif    pop_n_elems(args);    push_int(0);    return;    }    }    }   #endif