xsecurelock  1.7.0
XSecureLock is an X11 screen lock utility.
Functions
authproto.c File Reference
#include "authproto.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "../logging.h"
#include "../mlock_page.h"
#include "../util.h"

Functions

static size_t WriteChars (int fd, const char *buf, size_t n)
 
void WritePacket (int fd, char type, const char *message)
 Writes a packet in above form. More...
 
static size_t ReadChars (int fd, char *buf, size_t n, int eof_permitted)
 
char ReadPacket (int fd, char **message, int eof_permitted)
 Reads a packet in above form. More...
 

Function Documentation

◆ ReadChars()

static size_t ReadChars ( int  fd,
char *  buf,
size_t  n,
int  eof_permitted 
)
static

◆ ReadPacket()

char ReadPacket ( int  fd,
char **  message,
int  eof_permitted 
)

Reads a packet in above form.

Parameters
fdThe file descriptor to write to.
messageA pointer to store the message (will be mlock()d). Will always be set if function returns nonzero; caller must free it.
eof_permittedIf enabled, encountering EOF at the beginning will not count as an error but return 0 silently.
Returns
The packet type, or 0 if no packet has been read. Errors are logged.

◆ WriteChars()

static size_t WriteChars ( int  fd,
const char *  buf,
size_t  n 
)
static

◆ WritePacket()

void WritePacket ( int  fd,
char  type,
const char *  message 
)

Writes a packet in above form.

Parameters
fdThe file descriptor to write to.
typeThe packet type from above macros.
messageThe message to include with the packet (NUL-terminated).