EHS Embedded HTTP Server  1.5.0.132
PrivilegedBindHelper Class Reference

Helper class for binding of sockets to privileged ports. More...

#include <ehs.h>

List of all members.

Public Member Functions

virtual bool BindPrivilegedPort (int socket, const char *addr, const unsigned short port)=0
 Binds a socket to a privileged port/address.

Detailed Description

Helper class for binding of sockets to privileged ports.

This class abstracts an interface to an external bind helper program which facilitates binding of privileged ports (< 1024). Instead of doing it the apache way (do the bind() while running as root and then dropping privileges), we run as unprivileged user in the first place and later use that helper (an external setuid program) to temporarily elevate privileges for the bind() call. IMHO, this is safer, because that helper is very simple and does exactly one task: binding. Nothing else.

Examples:

ehs_https.cpp, ehs_privport.cpp, and ehs_wsgate.cpp.


Member Function Documentation

virtual bool BindPrivilegedPort ( int  socket,
const char *  addr,
const unsigned short  port 
) [pure virtual]

Binds a socket to a privileged port/address.

Parameters:
socketThe socket to be bound.
addrThe address to bind to in dot-qad format.
portThe port number to bind do.
Returns:
true on success.

The documentation for this class was generated from the following file: