Security fix.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14004 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-07-02 14:20:32 +00:00
parent 1ef6e3b9e8
commit 20d4059a05
2 changed files with 21 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2002-07-02 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/gdomap.c: Don't write to pidfile until *after* setuid away
from root. Bug reported by James Kehl <mkehl@gil.com.au>
2002-07-01 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSMime.m: Correct test for multipart content when

View file

@ -4466,7 +4466,7 @@ printf(
}
}
if (pidfile) {
if (pidfile)
{
FILE *fptr = fopen(pidfile, "at");
@ -4479,7 +4479,6 @@ printf(
fprintf(fptr, "%d\n", (int) getpid());
fclose(fptr);
}
}
/*
* Ensure we don't have any open file descriptors which may refer
@ -4574,6 +4573,21 @@ printf(
setuid (uid);
}
#endif /* __MINGW__ */
if (pidfile)
{
FILE *fptr = fopen(pidfile, "at");
if (fptr == 0)
{
sprintf(ebuf, "Unable to open pid file - '%s'", pidfile);
gdomap_log(LOG_CRIT);
exit(1);
}
fprintf(fptr, "%d\n", (int) getpid());
fclose(fptr);
}
#if !defined(__svr4__)
/*
* As another level of paranoia - restrict this process to /tmp