EHS Embedded HTTP Server
1.5.0.132
|
Helper class for binding of sockets to privileged ports. More...
#include <ehs.h>
Public Member Functions | |
virtual bool | BindPrivilegedPort (int socket, const char *addr, const unsigned short port)=0 |
Binds a socket to a privileged port/address. |
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.
virtual bool BindPrivilegedPort | ( | int | socket, |
const char * | addr, | ||
const unsigned short | port | ||
) | [pure virtual] |
Binds a socket to a privileged port/address.
socket | The socket to be bound. |
addr | The address to bind to in dot-qad format. |
port | The port number to bind do. |