--- libptytty/README 2011/12/21 00:48:52 1.7 +++ libptytty/README 2016/02/25 20:21:49 1.8 @@ -96,6 +96,8 @@ completely, so the actual program runs without setuid/setgid privileges. + On failure, this method terminates the process. + ptytty::use_helper () Tries to start a helper process that retains privileges even when the calling process does not. This is usually called from @@ -109,20 +111,25 @@ same helper process can usually be used both from the process starting it and all its fork'ed (not exec'ed) children. + On failure, this method terminates the process. + ptytty::drop_privileges () Drops privileges completely, i.e. sets real, effective and saved - user id to the real user id. Also aborts if this cannot be achieved. - Useful to make sure that the process doesn't run with special - privileges. + user id to the real user id. Useful to make sure that the process + doesn't run with special privileges. + + On failure, this method terminates the process. ptytty::sanitise_stdfd () Checks whether file descriptors 0, 1 and 2 (stdin, stdout and stderr) are valid (open) and, if not, connects them to /dev/tty or - /dev/null if possible (and aborts otherwise). This is necessary - because libptytty might want to output error messages to those - descriptors, which at the time of outputting the error message, - might be connected to something unsuitable opened by the - unsuspecting program itself (this can be a security issue). + /dev/null if possible. This is necessary because libptytty might + want to output error messages to those descriptors, which at the + time of outputting the error message, might be connected to + something unsuitable opened by the unsuspecting program itself (this + can be a security issue). + + On failure, this method terminates the process. bool success = ptytty::send_fd (int socket, int fd) Utility method to send a file descriptor over a unix domain socket. @@ -147,13 +154,16 @@ int pty_fd = pty->pty int tty_fd = pty->tty These members contain the pty and tty file descriptors, - respectively. They initially contain -1 until a successful to + respectively. They initially contain -1 until a successful call to "ptytty::get". bool success = pty->get () Tries to find, allocate and initialise a new pty/tty pair. Returns "true" when successful. + If the helper process is running and there is a protocol error, this + method terminates the process. + pty->login (int cmd_pid, bool login_shell, const char *hostname) Creates an entry in the systems session database(s) (utmp, wtmp, lastlog). "cmd_pid" must be the pid of the process representing the