Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit ffa18e1f authored by deuce's avatar deuce

Add a domain argument to open_socket() so that it's possible to add IPv6

support to the JS API.
parent 1c3ec4bc
......@@ -62,7 +62,7 @@ int sbbs_t::exec_net(csi_t* csi)
return(0);
if(lp!=NULL) {
SOCKET sock=open_socket(SOCK_STREAM, NULL);
SOCKET sock=open_socket(PF_INET, SOCK_STREAM, NULL);
if(sock!=INVALID_SOCKET) {
SOCKADDR_IN addr;
......@@ -546,7 +546,7 @@ SOCKET sbbs_t::ftp_data_sock(csi_t* csi, SOCKET ctrl_sock, SOCKADDR_IN* addr)
return(INVALID_SOCKET);
}
if((data_sock=open_socket(SOCK_STREAM, "ftp"))==INVALID_SOCKET) {
if((data_sock=open_socket(PF_INET, SOCK_STREAM, "ftp"))==INVALID_SOCKET) {
csi->socket_error=ERROR_VALUE;
return(INVALID_SOCKET);
}
......
......@@ -58,7 +58,7 @@ BOOL identify(union xp_sockaddr *client_addr, u_short local_port, char* buf
timeout=IDENT_DEFAULT_TIMEOUT;
do {
if((sock = open_socket(SOCK_STREAM, "ident")) == INVALID_SOCKET) {
if((sock = open_socket(PF_INET, SOCK_STREAM, "ident")) == INVALID_SOCKET) {
sprintf(buf,"ERROR %d creating socket",ERROR_VALUE);
break;
}
......
......@@ -2319,7 +2319,7 @@ js_socket_constructor(JSContext *cx, uintN argc, jsval *arglist)
}
memset(p,0,sizeof(js_socket_private_t));
if((p->sock=open_socket(type,protocol))==INVALID_SOCKET) {
if((p->sock=open_socket(PF_INET,type,protocol))==INVALID_SOCKET) {
JS_ReportError(cx,"open_socket failed with error %d",ERROR_VALUE);
if(protocol)
free(protocol);
......
......@@ -53,12 +53,12 @@
scfg_t scfg;
SOCKET open_socket(int type, const char* protocol)
SOCKET open_socket(int domain, int type, const char* protocol)
{
SOCKET sock;
char error[256];
sock=socket(AF_INET, type, IPPROTO_IP);
sock=socket(domain, type, IPPROTO_IP);
if(sock!=INVALID_SOCKET && set_socket_options(&scfg, sock, protocol, error, sizeof(error)))
lprintf(LOG_ERR,"%04d !ERROR %s",sock,error);
......
......@@ -346,12 +346,12 @@ void call_socket_open_callback(BOOL open)
startup->socket_open(startup->cbdata, open);
}
SOCKET open_socket(int type, const char* protocol)
SOCKET open_socket(int domain, int type, const char* protocol)
{
SOCKET sock;
char error[256];
sock=socket(AF_INET, type, IPPROTO_IP);
sock=socket(domain, type, IPPROTO_IP);
if(sock!=INVALID_SOCKET)
call_socket_open_callback(TRUE);
if(sock!=INVALID_SOCKET && set_socket_options(&scfg, sock, protocol, error, sizeof(error)))
......@@ -5835,7 +5835,7 @@ NO_SSH:
/* open a socket and connect to yourself */
tmp_sock = open_socket(SOCK_STREAM, "passthru");
tmp_sock = open_socket(PF_INET, SOCK_STREAM, "passthru");
if(tmp_sock == INVALID_SOCKET) {
lprintf(LOG_ERR,"Node %d SSH !ERROR %d creating passthru listen socket"
......@@ -5873,7 +5873,7 @@ NO_SSH:
lprintf(LOG_INFO,"Node %d SSH passthru socket listening on port %u"
,new_node->cfg.node_num, htons(tmp_addr.sin_port));
new_node->passthru_socket = open_socket(SOCK_STREAM, "passthru");
new_node->passthru_socket = open_socket(PF_INET, SOCK_STREAM, "passthru");
if(new_node->passthru_socket == INVALID_SOCKET) {
lprintf(LOG_ERR,"Node %d SSH !ERROR %d creating passthru connecting socket"
......
......@@ -1433,7 +1433,7 @@ char* prep_code(char *str, const char* prefix);
#endif
;
void call_socket_open_callback(BOOL open);
SOCKET open_socket(int type, const char* protocol);
SOCKET open_socket(int domain, int type, const char* protocol);
SOCKET accept_socket(SOCKET s, union xp_sockaddr* addr, socklen_t* addrlen);
int close_socket(SOCKET);
u_long resolve_ip(char *addr);
......
......@@ -69,7 +69,7 @@ void sbbs_t::telnet_gate(char* destaddr, ulong mode, char* client_user_name, cha
return;
}
if((remote_socket = open_socket(SOCK_STREAM, client.protocol)) == INVALID_SOCKET) {
if((remote_socket = open_socket(PF_INET, SOCK_STREAM, client.protocol)) == INVALID_SOCKET) {
errormsg(WHERE,ERR_OPEN,"socket",0);
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment