|
|
|
@ -37,6 +37,63 @@
@@ -37,6 +37,63 @@
|
|
|
|
|
#ifdef WIN32 |
|
|
|
|
static char WSAbuf[1024]; |
|
|
|
|
|
|
|
|
|
struct WSAERRORS { |
|
|
|
|
int id; |
|
|
|
|
char *code; |
|
|
|
|
} WSAErrors[] = { |
|
|
|
|
{ 0, "No error" }, |
|
|
|
|
{ WSAEINTR, "Interrupted system call" }, |
|
|
|
|
{ WSAEBADF, "Bad file number" }, |
|
|
|
|
{ WSAEACCES, "Permission denied" }, |
|
|
|
|
{ WSAEFAULT, "Bad address" }, |
|
|
|
|
{ WSAEINVAL, "Invalid argument" }, |
|
|
|
|
{ WSAEMFILE, "Too many open sockets" }, |
|
|
|
|
{ WSAEWOULDBLOCK, "Operation would block" }, |
|
|
|
|
{ WSAEINPROGRESS, "Operation now in progress" }, |
|
|
|
|
{ WSAEALREADY, "Operation already in progress" }, |
|
|
|
|
{ WSAENOTSOCK, "Socket operation on non-socket" }, |
|
|
|
|
{ WSAEDESTADDRREQ, "Destination address required" }, |
|
|
|
|
{ WSAEMSGSIZE, "Message too long" }, |
|
|
|
|
{ WSAEPROTOTYPE, "Protocol wrong type for socket" }, |
|
|
|
|
{ WSAENOPROTOOPT, "Bad protocol option" }, |
|
|
|
|
{ WSAEPROTONOSUPPORT, "Protocol not supported" }, |
|
|
|
|
{ WSAESOCKTNOSUPPORT, "Socket type not supported" }, |
|
|
|
|
{ WSAEOPNOTSUPP, "Operation not supported on socket" }, |
|
|
|
|
{ WSAEPFNOSUPPORT, "Protocol family not supported" }, |
|
|
|
|
{ WSAEAFNOSUPPORT, "Address family not supported" }, |
|
|
|
|
{ WSAEADDRINUSE, "Address already in use" }, |
|
|
|
|
{ WSAEADDRNOTAVAIL, "Can't assign requested address" }, |
|
|
|
|
{ WSAENETDOWN, "Network is down" }, |
|
|
|
|
{ WSAENETUNREACH, "Network is unreachable" }, |
|
|
|
|
{ WSAENETRESET, "Net connection reset" }, |
|
|
|
|
{ WSAECONNABORTED, "Software caused connection abort" }, |
|
|
|
|
{ WSAECONNRESET, "Connection reset by peer" }, |
|
|
|
|
{ WSAENOBUFS, "No buffer space available" }, |
|
|
|
|
{ WSAEISCONN, "Socket is already connected" }, |
|
|
|
|
{ WSAENOTCONN, "Socket is not connected" }, |
|
|
|
|
{ WSAESHUTDOWN, "Can't send after socket shutdown" }, |
|
|
|
|
{ WSAETOOMANYREFS, "Too many references, can't splice" }, |
|
|
|
|
{ WSAETIMEDOUT, "Connection timed out" }, |
|
|
|
|
{ WSAECONNREFUSED, "Connection refused" }, |
|
|
|
|
{ WSAELOOP, "Too many levels of symbolic links" }, |
|
|
|
|
{ WSAENAMETOOLONG, "File name too long" }, |
|
|
|
|
{ WSAEHOSTDOWN, "Host is down" }, |
|
|
|
|
{ WSAEHOSTUNREACH, "No route to host" }, |
|
|
|
|
{ WSAENOTEMPTY, "Directory not empty" }, |
|
|
|
|
{ WSAEPROCLIM, "Too many processes" }, |
|
|
|
|
{ WSAEUSERS, "Too many users" }, |
|
|
|
|
{ WSAEDQUOT, "Disc quota exceeded" }, |
|
|
|
|
{ WSAESTALE, "Stale NFS file handle" }, |
|
|
|
|
{ WSAEREMOTE, "Too many levels of remote in path" }, |
|
|
|
|
{ WSASYSNOTREADY, "Network system is unavailable" }, |
|
|
|
|
{ WSAVERNOTSUPPORTED, "Winsock version out of range" }, |
|
|
|
|
{ WSANOTINITIALISED, "WSAStartup not yet called" }, |
|
|
|
|
{ WSAEDISCON, "Graceful shutdown in progress" }, |
|
|
|
|
{ WSAHOST_NOT_FOUND, "Host not found" }, |
|
|
|
|
{ WSANO_DATA, "No host data of that type was found" }, |
|
|
|
|
{ -1, "Unknown error code" } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
char *WSAErrorMsg(void) { |
|
|
|
|
int i; |
|
|
|
|
int id = WSAGetLastError(); |
|
|
|
@ -224,6 +281,11 @@ static time_t when = 0; // when the request occurred
@@ -224,6 +281,11 @@ static time_t when = 0; // when the request occurred
|
|
|
|
|
static struct IP4ACCESS *ipaccess = NULL; |
|
|
|
|
static int ips = 0; |
|
|
|
|
|
|
|
|
|
struct APIGROUPS { |
|
|
|
|
// This becomes a string like: "|cmd1|cmd2|cmd3|" so it's quick to search
|
|
|
|
|
char *commands; |
|
|
|
|
} apigroups['Z' - 'A' + 1]; // only A=0 to Z=25 (R: noprivs, W: allprivs)
|
|
|
|
|
|
|
|
|
|
static struct io_list *io_head = NULL; |
|
|
|
|
|
|
|
|
|
static void io_reinit(struct io_data *io_data) |
|
|
|
|