path: root/pseudo_util.c
AgeCommit message (Collapse)AuthorFilesLines
2010-06-29Fix suffix handling so the right thing happens when usingPeter Seebach1-31/+99
2010-06-28Remove PSEUDO_SUFFIX from sourcePeter Seebach1-1/+1
The PSEUDO_SUFFIX thing is an installation quirk to allow our build system to tag libpseudo.so with a checksum of the host libc. However, we reuse a prebuilt pseudo server with the new pseudo libraries; this means that encoding the suffix in the environment hackery is a Bad Idea. Update version number to 0.3, since this seems to wrap up a hunk of development effort.
2010-04-30Improve PSEUDO_DEBUG_FILE.Peter Seebach1-0/+94
The PSEUDO_DEBUG_FILE feature is enhanced, and is now also used by the pseudo server.
2010-04-30Miscellaneous cleanup.Peter Seebach1-5/+3
Address a couple of compiler warnings, add a couple of signals to the list of caught signals, etcetera.
2010-04-26Handle execve() betterPeter Seebach1-54/+146
You can't use setenv() to modify the environment that will be passed to a child process through execve()... Also, fix the setupenv() to use PSEUDO_SUFFIX if defined. Use execve() to spawn child processes, so we can use setupenv() and dropenv().
2010-04-26Miscellaneous fixes:Peter Seebach1-2/+10
* Add lckpwdf/ulckpwdf to guts/README * Remove arguments from function pointer arguments. While in theory the compar function pointer has always taken "const struct dirent **", some systems (many) have declared it instead as taking "const void *". For now, just omit the types; a pointer to function taking unknown arguments is a compatible type, and we never call the functions, we just pass them to something else. * Handle readlinkat() on systems without *at functions * Fix pseudo_etc_file (spotted by "fortify") When O_CREAT can be a flag, 0600 mode is needed. While we're at it, remove a bogus dummy open. * Fix mkdtemp() Was returning the address of the internal buffer rather than the user-provided buffer. Also fixed a typo in an error message. * Don't call fgetgrent_r() with a null FILE *. * A couple of other typo-type fixes.
2010-04-26Add lckpwdf()/ulckpwdf().Peter Seebach1-3/+8
It's not enough to rely on the usual chroot() stuff affecting the file open, not least because these use the glibc-internal __open which is not currently intercepted, but also because we want to use the PSEUDO_PASSWD path when that's set but there's no chroot(). There's some extra magic in pseudo_etc_file to support these operations, since they can legitimately create a file rather than opening an existing one.
2010-04-05Make glob work.Peter Seebach1-0/+1
Moved readlink fixup into a general-purpose function for removing chroot prefixes.
2010-03-30Fix up group/password file handling and file opens.Peter Seebach1-21/+27
Spotted some glibc extensions to file modes, altered fopen logic. Fix handling for the case where the underlying pseudo_pwd_fd or pseudo_grp_fd are closed.
2010-03-29Add password/group call emulation.Peter Seebach1-0/+44
This is a first pass at handling password/group calls, allowing the use of custom password/group files. In particular, when chroot()ed to a particular directory, pseudo picks files in that directory by default, to improve support for the typical use case where pseudo uses chroot() only to jump into a virtual target filesystem.
2010-03-26Add support for intercepting execve()Peter Seebach1-0/+4
This allows us to track execution, although the tracking for it requires some additional thought -- the basic assumption is that we don't want to canonicalize names into the chroot() directory, but since all the filename canonicalization assumes that we want this, that will take some sneaking. It's a little useful as is, though, so I'm running with it.
2010-03-26Track file open flagsPeter Seebach1-0/+30
This patch adds support for checking whether a file was opened for reading, writing, or both, as well as tracking append flags. It is not very well tested. This is preparation for improved host contamination checking.
2010-03-26Updates: Enable additional warnings, fix a number of things.Peter Seebach1-2/+2
None of them seem to have been genuine problems, but it's prettier now, and some were questionable.
2010-03-25initial chroot() supportPeter Seebach1-31/+45
Add chroot() and a large number of things needed to make it work. The list of intercepted calls is large but not exhaustive.
2010-03-24Prep for chroot handling:Peter Seebach1-12/+70
* Improve makewrappers handling of function pointer arguments. * Regenerate wrappers when makewrappers is touched. * Move path resolution from pseudo_client_op into wrapper functions. * Eliminate dependency on PATH_MAX. * Related cleanup, such as tracking CWD better, and using the tracked value for getcwd().
2010-03-16Update: Fix some missing error checking (thanks to Laszlo Ersek forPeter Seebach1-7/+18
spotting these.) Check for failed calls to pseudo_prefix_path in a couple of places, handle failed open of pid file, and make pseudo_prefix_path robust in the case of a zero-length PSEUDO_PREFIX. Also, don't try to overwrite the contents of an environment variable anymore. (The amazing part? None of these have ever caused a failure.)
2010-03-16initial public releasePeter Seebach1-0/+499