|
xsecurelock
1.7.0
XSecureLock is an X11 screen lock utility.
|
#include "auth_child.h"#include <stdlib.h>#include <string.h>#include <unistd.h>#include "env_settings.h"#include "logging.h"#include "wait_pgrp.h"#include "xscreensaver_api.h"Functions | |
| void | KillAuthChildSigHandler (int signo) |
| Kill the auth child. More... | |
| static int | DiscardFirstKeypress () |
| Return whether the wake-up keypress should be discarded and not be sent to the auth child. More... | |
| int | WantAuthChild (int force_auth) |
| Checks whether an auth child should be running. More... | |
| static int | ContainsNonControl (const char *buf) |
| Return whether buf contains exclusively control characters. More... | |
| int | WatchAuthChild (Window w, const char *executable, int force_auth, const char *stdinbuf, int *auth_running) |
| Starts or stops the authentication child process. More... | |
Variables | |
| static pid_t | auth_child_pid = 0 |
| The PID of a currently running saver child, or 0 if none is running. More... | |
| static int | auth_child_fd = 0 |
| If auth_child_pid != 0, the FD which connects to stdin of the auth child. More... | |
|
static |
Return whether buf contains exclusively control characters.
Because there is no portable way of doing this (other than relying on wchar routines that are nowhere else exercised in the main program), I'll just match precisely those that ASCII defines as control codes - 00 to 1f as well as 7f (DEL).
We do this so we do not forward control keys to the auth child when just waking it up (e.g. because the user tried to unlock the screen with ESC or ENTER).
| buf | The string to check. |
|
static |
Return whether the wake-up keypress should be discarded and not be sent to the auth child.
Sending the wake-up keypress to the auth child is usually a bad idea because many people use "any" key, not their password's, to wake up the screen saver. Also, when using a blanking screen saver, one can't easily distinguish a locked screen from a turned-off screen, and may thus accidentally start entering the password into a web browser or similar "bad" place.
However, it was requested by a user, so why not add it. Usage:
XSECURELOCK_DISCARD_FIRST_KEYPRESS=0 xsecurelock
| void KillAuthChildSigHandler | ( | int | signo | ) |
Kill the auth child.
This can be used from a signal handler.
| int WantAuthChild | ( | int | force_auth | ) |
Checks whether an auth child should be running.
| force_auth | If true, assume we want to start a new auth child. |
| int WatchAuthChild | ( | Window | w, |
| const char * | executable, | ||
| int | force_auth, | ||
| const char * | stdinbuf, | ||
| int * | auth_running | ||
| ) |
Starts or stops the authentication child process.
| w | The screen saver window. Will get cleared after auth child execution. |
| executable | What binary to spawn for authentication. No arguments will be passed. |
| force_auth | If true, the auth child will be spawned if not already running. |
| stdinbuf | If non-NULL, this data will be sent to stdin of the auth child. |
| auth_running | Will be set to the status of the current auth child (i.e. true iff it is running). |
|
static |
If auth_child_pid != 0, the FD which connects to stdin of the auth child.
|
static |
The PID of a currently running saver child, or 0 if none is running.
1.8.14