2010-01-30 Paweł Hajdan, Jr. <phajdan.jr@gentoo.org>
* NEWS: Add support for TCB. * lib/tcbfuncs.h, lib/tcbfuncs.c, lib/Makefile.am: New library to support TCB. * lib/prototypes, libmisc/copydir.c (remove_tree): Add boolean parameter remove_root. * configure.in: Add conditional WITH_TCB. * src/userdel.c, src/usermod.c: Add support for TCB. Update call to remove_tree(). * src/pwconv.c, src/pwunconv.c: Should not be used with TCB enabled. * src/vipw.c: Add support for TCB. Update call to remove_tree(). * src/useradd.c: Add support for TCB. Open the shadow file outside of open_files(). * src/chage.c: Add support for TCB. * src/Makefile.am: Install passwd sgid shadow when TCB is enabled. * lib/getdefs.c, man/vipw.8.xml, man/login.defs.5.xml, man/login.defs/TCB_AUTH_GROUP.xml, man/login.defs/USE_TCB.xml, man/login.defs/TCB_SYMLINKS.xml, man/generate_mans.mak, man/generate_mans.deps, man/Makefile.am: New configuration parameters: TCB_AUTH_GROUP, TCB_SYMLINKS, USE_TCB. * lib/shadowio.c, lib/commonio.c: Add support for TCB.
This commit is contained in:
@ -48,6 +48,9 @@
|
||||
#ifdef WITH_SELINUX
|
||||
#include <selinux/selinux.h>
|
||||
#endif
|
||||
#ifdef WITH_TCB
|
||||
#include <tcb.h>
|
||||
#endif
|
||||
#include "prototypes.h"
|
||||
#include "commonio.h"
|
||||
|
||||
@ -533,6 +536,7 @@ int commonio_open (struct commonio_db *db, int mode)
|
||||
void *eptr = NULL;
|
||||
int flags = mode;
|
||||
size_t buflen;
|
||||
int fd;
|
||||
int saved_errno;
|
||||
|
||||
mode &= ~O_CREAT;
|
||||
@ -553,7 +557,24 @@ int commonio_open (struct commonio_db *db, int mode)
|
||||
db->cursor = NULL;
|
||||
db->changed = false;
|
||||
|
||||
db->fp = fopen (db->filename, db->readonly ? "r" : "r+");
|
||||
fd = open(db->filename, (db->readonly ? O_RDONLY : O_RDWR) |
|
||||
O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
|
||||
saved_errno = errno;
|
||||
db->fp = NULL;
|
||||
if (fd >= 0) {
|
||||
#ifdef WITH_TCB
|
||||
if (tcb_is_suspect(fd)) {
|
||||
close(fd);
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
db->fp = fdopen(fd, db->readonly ? "r" : "r+");
|
||||
saved_errno = errno;
|
||||
if (!db->fp)
|
||||
close(fd);
|
||||
}
|
||||
errno = saved_errno;
|
||||
|
||||
/*
|
||||
* If O_CREAT was specified and the file didn't exist, it will be
|
||||
|
Reference in New Issue
Block a user