mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-23 04:23:08 +00:00
o New port dctc version 0.59: A DirectConnect (www.neo-modus.com)
text client for file sharing o Renamed hublist to dc_hublist; former was too generic o FreeBSD's send(2) (in fact, all *BSD) does not support MSG_NOSIGMASK or any similar feature. Therefore, tried to mimick it with signal masking. However, this introduces a possible race condition which, fortunaly, is not triggered by this application since it is not concurrent. Reviewed by: Anders Nor Berle <debolaz@debolaz.com>
This commit is contained in:
parent
f472301acd
commit
bc737cecdd
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=50353
48
net-p2p/dctc/Makefile
Normal file
48
net-p2p/dctc/Makefile
Normal file
@ -0,0 +1,48 @@
|
||||
# New ports collection makefile for: Direct Connect Text Client
|
||||
# Date created: Thu Nov 22 00:19:27 BRST 2001
|
||||
# Whom: Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTNAME= dctc
|
||||
PORTVERSION= 0.59
|
||||
CATEGORIES= net
|
||||
MASTER_SITES= http://ac2i.tzo.com/dctc/
|
||||
DISTNAME= ${PORTNAME}_v${PORTVERSION}
|
||||
|
||||
MAINTAINER= lioux@FreeBSD.org
|
||||
|
||||
BUILD_DEPENDS= makedepend:${PORTSDIR}/devel/makedepend
|
||||
LIB_DEPENDS= gnugetopt.1:${PORTSDIR}/devel/libgnugetopt
|
||||
|
||||
USE_GLIB= yes
|
||||
NO_WRKSUBDIR= yes
|
||||
BUILD_WRKSRC= ${WRKSRC}/src
|
||||
MAKE_ENV= CFLAGS="${CFLAGS} -I${LOCALBASE}/include" \
|
||||
LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib -lgnugetopt"
|
||||
ALL_TARGET=
|
||||
|
||||
DOC_FILES= COPYING ChangeLog INSTALL README \
|
||||
Documentation/DCextension Documentation/commands \
|
||||
Documentation/output Documentation/programs
|
||||
PROGRAM_FILES= dc_hublist dctc
|
||||
|
||||
post-patch:
|
||||
@${PERL} -pi -e 's/(CK?\(std)(out\))/\1_\2/' ${BUILD_WRKSRC}/*
|
||||
|
||||
do-configure:
|
||||
@cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} depend
|
||||
|
||||
do-install:
|
||||
.for file in ${PROGRAM_FILES}
|
||||
@${INSTALL_PROGRAM} ${BUILD_WRKSRC}/${file} ${PREFIX}/bin
|
||||
.endfor
|
||||
.ifndef(NOPORTDOCS)
|
||||
@${MKDIR} ${DOCSDIR}
|
||||
.for file in ${DOC_FILES}
|
||||
@${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}
|
||||
.endfor
|
||||
.endif
|
||||
|
||||
.include <bsd.port.mk>
|
1
net-p2p/dctc/distinfo
Normal file
1
net-p2p/dctc/distinfo
Normal file
@ -0,0 +1 @@
|
||||
MD5 (dctc_v0.59.tar.gz) = 265848e9c73eca6837d8012862ab386e
|
10
net-p2p/dctc/files/patch-Documentation:programs
Normal file
10
net-p2p/dctc/files/patch-Documentation:programs
Normal file
@ -0,0 +1,10 @@
|
||||
--- Documentation/programs.orig Thu Nov 22 02:18:27 2001
|
||||
+++ Documentation/programs Thu Nov 22 02:18:39 2001
|
||||
@@ -1,6 +1,6 @@
|
||||
2 programs are builded by the makefile:
|
||||
|
||||
-- hublist
|
||||
+- dc_hublist
|
||||
|
||||
It retrieves the list of active hub from www.neo-modus.com.
|
||||
Output is like this (one hub per line):
|
20
net-p2p/dctc/files/patch-src:Makefile
Normal file
20
net-p2p/dctc/files/patch-src:Makefile
Normal file
@ -0,0 +1,20 @@
|
||||
--- src/Makefile.orig Thu Nov 22 02:16:36 2001
|
||||
+++ src/Makefile Thu Nov 22 02:17:21 2001
|
||||
@@ -1,6 +1,6 @@
|
||||
#CC = gcc
|
||||
-CFLAGS =-g -march=i586 -O2 -Wall `glib-config --cflags glib gthread` -Wpointer-arith -Wcast-qual -Wwrite-strings #-Wshadow
|
||||
-LDFLAGS = -g `glib-config --libs glib gthread`
|
||||
+CFLAGS +=-g -Wall `${GLIB_CONFIG} --cflags glib gthread` -Wpointer-arith -Wcast-qual -Wwrite-strings -I${LOCALBASE}/include
|
||||
+LDFLAGS += -g `${GLIB_CONFIG} --libs glib gthread`
|
||||
|
||||
CSRC = main.c action.c dc_com.c display.c key.c keyboard.c network.c typical_action.c dc_manage.c db.c he3.c gts.c user_manage.c md.c timed_out_string.c
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $(COBJ) -o dctc
|
||||
|
||||
hublist: $(COBJ1)
|
||||
- $(CC) $(CFLAGS) $(LDFLAGS) $(COBJ1) -o hublist
|
||||
+ $(CC) $(CFLAGS) $(LDFLAGS) $(COBJ1) -o dc_hublist
|
||||
|
||||
depend:
|
||||
makedepend -- $(CFLAGS) -- $(CSRC) $(CSRC1)
|
69
net-p2p/dctc/files/patch-src:db.c
Normal file
69
net-p2p/dctc/files/patch-src:db.c
Normal file
@ -0,0 +1,69 @@
|
||||
--- src/db.c.orig Thu Nov 22 00:08:34 2001
|
||||
+++ src/db.c Thu Nov 22 00:11:49 2001
|
||||
@@ -30,6 +30,15 @@
|
||||
#include <netinet/in.h>
|
||||
#include <glib.h>
|
||||
|
||||
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
|
||||
+#include <sys/param.h>
|
||||
+#endif
|
||||
+
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+#include <signal.h>
|
||||
+#define MSG_NOSIGNAL 0
|
||||
+#endif
|
||||
+
|
||||
#include "db.h"
|
||||
#include "display.h"
|
||||
#include "var.h"
|
||||
@@ -711,6 +720,9 @@
|
||||
/******************************************************************************************/
|
||||
static void send_a_db_result(int output_sck, char *dest_nick, DB_ENTRY *de, struct sockaddr_in *dest_addr, char *md5sum)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ sigset_t sigset, sigoset;
|
||||
+#endif
|
||||
GString *str;
|
||||
GString *adapted;
|
||||
|
||||
@@ -752,10 +764,38 @@
|
||||
printf("dest_addr: %s, str: %s\n",dest_addr,str->str);
|
||||
#endif
|
||||
|
||||
- if(dest_addr==NULL)
|
||||
+ if(dest_addr==NULL) {
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
send(output_sck,str->str,str->len,MSG_NOSIGNAL);
|
||||
- else
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
+ } else {
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
sendto(output_sck,str->str,str->len,MSG_NOSIGNAL,(void*)dest_addr, sizeof(struct sockaddr_in));
|
||||
+
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
+ }
|
||||
|
||||
disp_msg(INFO_MSG,"send_search_result_line",str->str,NULL);
|
||||
|
52
net-p2p/dctc/files/patch-src:dc_com.c
Normal file
52
net-p2p/dctc/files/patch-src:dc_com.c
Normal file
@ -0,0 +1,52 @@
|
||||
--- src/dc_com.c.orig Thu Nov 22 00:12:50 2001
|
||||
+++ src/dc_com.c Thu Nov 22 00:15:55 2001
|
||||
@@ -33,6 +33,15 @@
|
||||
#include "main.h"
|
||||
#include "var.h"
|
||||
|
||||
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
|
||||
+#include <sys/param.h>
|
||||
+#endif
|
||||
+
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+#include <signal.h>
|
||||
+#define MSG_NOSIGNAL 0
|
||||
+#endif
|
||||
+
|
||||
char last_cmd[5120]; /* contains the first string of the last send_dc_line call */
|
||||
/* mainly used for debug features. */
|
||||
time_t last_cmd_time;
|
||||
@@ -50,6 +59,10 @@
|
||||
/***********************************************************/
|
||||
void send_dc_line(int sck,...)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ sigset_t sigset, sigoset;
|
||||
+ ssize_t send_return;
|
||||
+#endif
|
||||
va_list ap;
|
||||
char *t;
|
||||
int have=0;
|
||||
@@ -84,7 +97,21 @@
|
||||
|
||||
if((str->len)&&(cnx_in_progress==0))
|
||||
{
|
||||
- if(send(sck,str->str,str->len,MSG_NOSIGNAL)!=str->len)
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
+ send_return = send(sck,str->str,str->len, MSG_NOSIGNAL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
+ if(send_return!=str->len)
|
||||
{
|
||||
/* abort network operation on this socket */
|
||||
/* this will either generated a hub_disconnection message (main thread) */
|
11
net-p2p/dctc/files/patch-src:dc_com.h
Normal file
11
net-p2p/dctc/files/patch-src:dc_com.h
Normal file
@ -0,0 +1,11 @@
|
||||
--- src/dc_com.h.orig Wed Nov 21 22:15:21 2001
|
||||
+++ src/dc_com.h Wed Nov 21 22:15:32 2001
|
||||
@@ -21,6 +21,8 @@
|
||||
#ifndef __DC_COM_H__
|
||||
#define __DC_COM_H__
|
||||
|
||||
+#include <time.h>
|
||||
+
|
||||
extern char last_cmd[5120]; /* contains the first string of the last send_dc_line call */
|
||||
/* mainly used for debug features. */
|
||||
|
266
net-p2p/dctc/files/patch-src:dc_manage.c
Normal file
266
net-p2p/dctc/files/patch-src:dc_manage.c
Normal file
@ -0,0 +1,266 @@
|
||||
--- src/dc_manage.c.orig Thu Nov 22 00:12:51 2001
|
||||
+++ src/dc_manage.c Thu Nov 22 00:13:13 2001
|
||||
@@ -35,6 +35,11 @@
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+#include <signal.h>
|
||||
+#define MSG_NOSIGNAL 0
|
||||
+#endif
|
||||
+
|
||||
#include "display.h"
|
||||
#include "action.h"
|
||||
#include "macro.h"
|
||||
@@ -188,6 +193,9 @@
|
||||
/*************************/
|
||||
static int send_file_data(int sck,char *filename, int start_pos, unsigned long file_len,WAIT_ACT *act)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ sigset_t sigset, sigoset;
|
||||
+#endif
|
||||
unsigned long int i;
|
||||
char buf[8192];
|
||||
unsigned long int a=file_len-start_pos;
|
||||
@@ -217,7 +225,20 @@
|
||||
goto abrt;
|
||||
|
||||
act->last_touch=time(NULL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
res=send(sck,buf,sizeof(buf),MSG_NOSIGNAL|MSG_WAITALL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
act->last_touch=time(NULL);
|
||||
if(res!=sizeof(buf))
|
||||
goto abrt;
|
||||
@@ -232,8 +253,20 @@
|
||||
res=fread(buf,1,remain,f);
|
||||
if(res!=remain) /* read error ? */
|
||||
goto abrt;
|
||||
-
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
res=send(sck,buf,remain,MSG_NOSIGNAL|MSG_WAITALL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
if(res!=remain)
|
||||
goto abrt;
|
||||
}
|
||||
@@ -250,6 +283,9 @@
|
||||
/*************************/
|
||||
static int send_array_data(int sck,GByteArray *ba,WAIT_ACT *act)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ sigset_t sigset, sigoset;
|
||||
+#endif
|
||||
unsigned long int i;
|
||||
unsigned long int nb;
|
||||
int remain;
|
||||
@@ -263,7 +299,20 @@
|
||||
for(i=0;i<nb;i++)
|
||||
{
|
||||
act->last_touch=time(NULL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
res=send(sck,ba->data+cur_pos,BLOCK_SIZE,MSG_NOSIGNAL|MSG_WAITALL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
act->last_touch=time(NULL);
|
||||
if(res!=BLOCK_SIZE)
|
||||
{
|
||||
@@ -277,7 +326,20 @@
|
||||
disp_msg(DEBUG_MSG,"send_array_data","partial",NULL);
|
||||
if(remain!=0)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
res=send(sck,ba->data+cur_pos,remain,MSG_NOSIGNAL|MSG_WAITALL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
if(res!=remain)
|
||||
goto abrt;
|
||||
}
|
||||
@@ -309,6 +371,9 @@
|
||||
/**************************************************************************/
|
||||
static int com_up_get_list_len_process(const char *cmd,WAIT_ACT *act,int sck,GString *input, char *xtra_param)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ sigset_t sigset, sigoset;
|
||||
+#endif
|
||||
GByteArray *cpy_data;
|
||||
GString *out;
|
||||
int res;
|
||||
@@ -337,8 +402,20 @@
|
||||
g_string_sprintfa(out,"%lu|",(unsigned long)cpy_data->len);
|
||||
|
||||
disp_msg(INFO_MSG,"reply",out->str,NULL);
|
||||
-
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
res=send(sck,out->str,out->len,MSG_NOSIGNAL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
res=(res!=out->len);
|
||||
g_string_free(out,TRUE);
|
||||
if(res)
|
||||
@@ -362,7 +439,20 @@
|
||||
g_string_sprintfa(out,"%lu|",(unsigned long)100000+rand()%500000);
|
||||
else
|
||||
g_string_sprintfa(out,"%lu|",(unsigned long)cpy_data->len);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
res=send(sck,out->str,out->len,MSG_NOSIGNAL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
res=(res!=out->len);
|
||||
g_string_free(out,TRUE);
|
||||
if(res)
|
||||
@@ -643,6 +733,9 @@
|
||||
/*****************************************************************/
|
||||
static int copie_fd_to_file(int remote, FILE *local, unsigned long amount,WAIT_ACT *act)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ sigset_t sigset, sigoset;
|
||||
+#endif
|
||||
while(amount!=0)
|
||||
{
|
||||
char buf[8192];
|
||||
@@ -653,7 +746,20 @@
|
||||
|
||||
/* touch the action slot to avoid timeout */
|
||||
act->last_touch=time(NULL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
ret=recv(remote,buf,nb,MSG_WAITALL|MSG_NOSIGNAL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
act->last_touch=time(NULL);
|
||||
|
||||
if((ret==-1)||(ret==0))
|
||||
@@ -983,6 +1089,9 @@
|
||||
/*****************************************************************/
|
||||
static int copie_fd_to_bytearray(int remote, GByteArray **ba, unsigned long amount,WAIT_ACT *act)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ sigset_t sigset, sigoset;
|
||||
+#endif
|
||||
int pos=0;
|
||||
int ret;
|
||||
unsigned long nb;
|
||||
@@ -996,12 +1105,25 @@
|
||||
|
||||
/* touch the action slot to avoid timeout */
|
||||
act->last_touch=time(NULL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
#if 0
|
||||
ret=recv(remote,(*ba)->data+pos,nb,MSG_WAITALL|MSG_NOSIGNAL);
|
||||
#else
|
||||
ret=recv(remote,(*ba)->data+pos,nb,MSG_NOSIGNAL);
|
||||
printf("%d\n",ret);
|
||||
#endif
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
act->last_touch=time(NULL);
|
||||
|
||||
if((ret==-1)||(ret==0))
|
||||
@@ -2606,10 +2728,26 @@
|
||||
/*******************************************************/
|
||||
int manage_srch_port(int srch_sck, int sck)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ sigset_t sigset, sigoset;
|
||||
+#endif
|
||||
char buf[8192];
|
||||
int ret;
|
||||
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
ret=recv(srch_sck,buf,sizeof(buf),MSG_NOSIGNAL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
if(ret!=-1)
|
||||
{
|
||||
int i;
|
1
net-p2p/dctc/pkg-comment
Normal file
1
net-p2p/dctc/pkg-comment
Normal file
@ -0,0 +1 @@
|
||||
A DirectConnect (www.neo-modus.com) text client for file sharing
|
19
net-p2p/dctc/pkg-descr
Normal file
19
net-p2p/dctc/pkg-descr
Normal file
@ -0,0 +1,19 @@
|
||||
[ from developer's site]
|
||||
|
||||
I. What is DCTC
|
||||
DCTC is a Direct Connect clone, a windoz client allowing users to
|
||||
share their files and talk (like IRC but more software sharing
|
||||
oriented) using a proprietary protocol.
|
||||
|
||||
DCTC stands for Direct Connect Text Client.
|
||||
|
||||
II. What is not DCTC
|
||||
DCTC is written from scratch without any help from neo-modus using
|
||||
our experience of hotline protocol.
|
||||
|
||||
DCTC is not designed to be used by human. It doesn't contains any
|
||||
GUI or CLI. The goal of this project is to build a Direct Connect
|
||||
client which can be used by other programs. So even if you can enter
|
||||
command using the keyboard, don't say the human interface is poor.
|
||||
|
||||
WWW: http://ac2i.tzo.com/dctc/
|
11
net-p2p/dctc/pkg-plist
Normal file
11
net-p2p/dctc/pkg-plist
Normal file
@ -0,0 +1,11 @@
|
||||
bin/dc_hublist
|
||||
bin/dctc
|
||||
%%PORTDOCS%%share/doc/dctc/COPYING
|
||||
%%PORTDOCS%%share/doc/dctc/ChangeLog
|
||||
%%PORTDOCS%%share/doc/dctc/DCextension
|
||||
%%PORTDOCS%%share/doc/dctc/INSTALL
|
||||
%%PORTDOCS%%share/doc/dctc/README
|
||||
%%PORTDOCS%%share/doc/dctc/commands
|
||||
%%PORTDOCS%%share/doc/dctc/output
|
||||
%%PORTDOCS%%share/doc/dctc/programs
|
||||
%%PORTDOCS%%@dirrm share/doc/dctc
|
@ -64,6 +64,7 @@
|
||||
SUBDIR += cvsupit
|
||||
SUBDIR += dante
|
||||
SUBDIR += datapipe
|
||||
SUBDIR += dctc
|
||||
SUBDIR += ddc
|
||||
SUBDIR += ddclient
|
||||
SUBDIR += ddup
|
||||
|
48
net/dctc/Makefile
Normal file
48
net/dctc/Makefile
Normal file
@ -0,0 +1,48 @@
|
||||
# New ports collection makefile for: Direct Connect Text Client
|
||||
# Date created: Thu Nov 22 00:19:27 BRST 2001
|
||||
# Whom: Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTNAME= dctc
|
||||
PORTVERSION= 0.59
|
||||
CATEGORIES= net
|
||||
MASTER_SITES= http://ac2i.tzo.com/dctc/
|
||||
DISTNAME= ${PORTNAME}_v${PORTVERSION}
|
||||
|
||||
MAINTAINER= lioux@FreeBSD.org
|
||||
|
||||
BUILD_DEPENDS= makedepend:${PORTSDIR}/devel/makedepend
|
||||
LIB_DEPENDS= gnugetopt.1:${PORTSDIR}/devel/libgnugetopt
|
||||
|
||||
USE_GLIB= yes
|
||||
NO_WRKSUBDIR= yes
|
||||
BUILD_WRKSRC= ${WRKSRC}/src
|
||||
MAKE_ENV= CFLAGS="${CFLAGS} -I${LOCALBASE}/include" \
|
||||
LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib -lgnugetopt"
|
||||
ALL_TARGET=
|
||||
|
||||
DOC_FILES= COPYING ChangeLog INSTALL README \
|
||||
Documentation/DCextension Documentation/commands \
|
||||
Documentation/output Documentation/programs
|
||||
PROGRAM_FILES= dc_hublist dctc
|
||||
|
||||
post-patch:
|
||||
@${PERL} -pi -e 's/(CK?\(std)(out\))/\1_\2/' ${BUILD_WRKSRC}/*
|
||||
|
||||
do-configure:
|
||||
@cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} depend
|
||||
|
||||
do-install:
|
||||
.for file in ${PROGRAM_FILES}
|
||||
@${INSTALL_PROGRAM} ${BUILD_WRKSRC}/${file} ${PREFIX}/bin
|
||||
.endfor
|
||||
.ifndef(NOPORTDOCS)
|
||||
@${MKDIR} ${DOCSDIR}
|
||||
.for file in ${DOC_FILES}
|
||||
@${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}
|
||||
.endfor
|
||||
.endif
|
||||
|
||||
.include <bsd.port.mk>
|
1
net/dctc/distinfo
Normal file
1
net/dctc/distinfo
Normal file
@ -0,0 +1 @@
|
||||
MD5 (dctc_v0.59.tar.gz) = 265848e9c73eca6837d8012862ab386e
|
10
net/dctc/files/patch-Documentation:programs
Normal file
10
net/dctc/files/patch-Documentation:programs
Normal file
@ -0,0 +1,10 @@
|
||||
--- Documentation/programs.orig Thu Nov 22 02:18:27 2001
|
||||
+++ Documentation/programs Thu Nov 22 02:18:39 2001
|
||||
@@ -1,6 +1,6 @@
|
||||
2 programs are builded by the makefile:
|
||||
|
||||
-- hublist
|
||||
+- dc_hublist
|
||||
|
||||
It retrieves the list of active hub from www.neo-modus.com.
|
||||
Output is like this (one hub per line):
|
20
net/dctc/files/patch-src:Makefile
Normal file
20
net/dctc/files/patch-src:Makefile
Normal file
@ -0,0 +1,20 @@
|
||||
--- src/Makefile.orig Thu Nov 22 02:16:36 2001
|
||||
+++ src/Makefile Thu Nov 22 02:17:21 2001
|
||||
@@ -1,6 +1,6 @@
|
||||
#CC = gcc
|
||||
-CFLAGS =-g -march=i586 -O2 -Wall `glib-config --cflags glib gthread` -Wpointer-arith -Wcast-qual -Wwrite-strings #-Wshadow
|
||||
-LDFLAGS = -g `glib-config --libs glib gthread`
|
||||
+CFLAGS +=-g -Wall `${GLIB_CONFIG} --cflags glib gthread` -Wpointer-arith -Wcast-qual -Wwrite-strings -I${LOCALBASE}/include
|
||||
+LDFLAGS += -g `${GLIB_CONFIG} --libs glib gthread`
|
||||
|
||||
CSRC = main.c action.c dc_com.c display.c key.c keyboard.c network.c typical_action.c dc_manage.c db.c he3.c gts.c user_manage.c md.c timed_out_string.c
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $(COBJ) -o dctc
|
||||
|
||||
hublist: $(COBJ1)
|
||||
- $(CC) $(CFLAGS) $(LDFLAGS) $(COBJ1) -o hublist
|
||||
+ $(CC) $(CFLAGS) $(LDFLAGS) $(COBJ1) -o dc_hublist
|
||||
|
||||
depend:
|
||||
makedepend -- $(CFLAGS) -- $(CSRC) $(CSRC1)
|
69
net/dctc/files/patch-src:db.c
Normal file
69
net/dctc/files/patch-src:db.c
Normal file
@ -0,0 +1,69 @@
|
||||
--- src/db.c.orig Thu Nov 22 00:08:34 2001
|
||||
+++ src/db.c Thu Nov 22 00:11:49 2001
|
||||
@@ -30,6 +30,15 @@
|
||||
#include <netinet/in.h>
|
||||
#include <glib.h>
|
||||
|
||||
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
|
||||
+#include <sys/param.h>
|
||||
+#endif
|
||||
+
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+#include <signal.h>
|
||||
+#define MSG_NOSIGNAL 0
|
||||
+#endif
|
||||
+
|
||||
#include "db.h"
|
||||
#include "display.h"
|
||||
#include "var.h"
|
||||
@@ -711,6 +720,9 @@
|
||||
/******************************************************************************************/
|
||||
static void send_a_db_result(int output_sck, char *dest_nick, DB_ENTRY *de, struct sockaddr_in *dest_addr, char *md5sum)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ sigset_t sigset, sigoset;
|
||||
+#endif
|
||||
GString *str;
|
||||
GString *adapted;
|
||||
|
||||
@@ -752,10 +764,38 @@
|
||||
printf("dest_addr: %s, str: %s\n",dest_addr,str->str);
|
||||
#endif
|
||||
|
||||
- if(dest_addr==NULL)
|
||||
+ if(dest_addr==NULL) {
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
send(output_sck,str->str,str->len,MSG_NOSIGNAL);
|
||||
- else
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
+ } else {
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
sendto(output_sck,str->str,str->len,MSG_NOSIGNAL,(void*)dest_addr, sizeof(struct sockaddr_in));
|
||||
+
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
+ }
|
||||
|
||||
disp_msg(INFO_MSG,"send_search_result_line",str->str,NULL);
|
||||
|
52
net/dctc/files/patch-src:dc_com.c
Normal file
52
net/dctc/files/patch-src:dc_com.c
Normal file
@ -0,0 +1,52 @@
|
||||
--- src/dc_com.c.orig Thu Nov 22 00:12:50 2001
|
||||
+++ src/dc_com.c Thu Nov 22 00:15:55 2001
|
||||
@@ -33,6 +33,15 @@
|
||||
#include "main.h"
|
||||
#include "var.h"
|
||||
|
||||
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
|
||||
+#include <sys/param.h>
|
||||
+#endif
|
||||
+
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+#include <signal.h>
|
||||
+#define MSG_NOSIGNAL 0
|
||||
+#endif
|
||||
+
|
||||
char last_cmd[5120]; /* contains the first string of the last send_dc_line call */
|
||||
/* mainly used for debug features. */
|
||||
time_t last_cmd_time;
|
||||
@@ -50,6 +59,10 @@
|
||||
/***********************************************************/
|
||||
void send_dc_line(int sck,...)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ sigset_t sigset, sigoset;
|
||||
+ ssize_t send_return;
|
||||
+#endif
|
||||
va_list ap;
|
||||
char *t;
|
||||
int have=0;
|
||||
@@ -84,7 +97,21 @@
|
||||
|
||||
if((str->len)&&(cnx_in_progress==0))
|
||||
{
|
||||
- if(send(sck,str->str,str->len,MSG_NOSIGNAL)!=str->len)
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
+ send_return = send(sck,str->str,str->len, MSG_NOSIGNAL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
+ if(send_return!=str->len)
|
||||
{
|
||||
/* abort network operation on this socket */
|
||||
/* this will either generated a hub_disconnection message (main thread) */
|
11
net/dctc/files/patch-src:dc_com.h
Normal file
11
net/dctc/files/patch-src:dc_com.h
Normal file
@ -0,0 +1,11 @@
|
||||
--- src/dc_com.h.orig Wed Nov 21 22:15:21 2001
|
||||
+++ src/dc_com.h Wed Nov 21 22:15:32 2001
|
||||
@@ -21,6 +21,8 @@
|
||||
#ifndef __DC_COM_H__
|
||||
#define __DC_COM_H__
|
||||
|
||||
+#include <time.h>
|
||||
+
|
||||
extern char last_cmd[5120]; /* contains the first string of the last send_dc_line call */
|
||||
/* mainly used for debug features. */
|
||||
|
266
net/dctc/files/patch-src:dc_manage.c
Normal file
266
net/dctc/files/patch-src:dc_manage.c
Normal file
@ -0,0 +1,266 @@
|
||||
--- src/dc_manage.c.orig Thu Nov 22 00:12:51 2001
|
||||
+++ src/dc_manage.c Thu Nov 22 00:13:13 2001
|
||||
@@ -35,6 +35,11 @@
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+#include <signal.h>
|
||||
+#define MSG_NOSIGNAL 0
|
||||
+#endif
|
||||
+
|
||||
#include "display.h"
|
||||
#include "action.h"
|
||||
#include "macro.h"
|
||||
@@ -188,6 +193,9 @@
|
||||
/*************************/
|
||||
static int send_file_data(int sck,char *filename, int start_pos, unsigned long file_len,WAIT_ACT *act)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ sigset_t sigset, sigoset;
|
||||
+#endif
|
||||
unsigned long int i;
|
||||
char buf[8192];
|
||||
unsigned long int a=file_len-start_pos;
|
||||
@@ -217,7 +225,20 @@
|
||||
goto abrt;
|
||||
|
||||
act->last_touch=time(NULL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
res=send(sck,buf,sizeof(buf),MSG_NOSIGNAL|MSG_WAITALL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
act->last_touch=time(NULL);
|
||||
if(res!=sizeof(buf))
|
||||
goto abrt;
|
||||
@@ -232,8 +253,20 @@
|
||||
res=fread(buf,1,remain,f);
|
||||
if(res!=remain) /* read error ? */
|
||||
goto abrt;
|
||||
-
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
res=send(sck,buf,remain,MSG_NOSIGNAL|MSG_WAITALL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
if(res!=remain)
|
||||
goto abrt;
|
||||
}
|
||||
@@ -250,6 +283,9 @@
|
||||
/*************************/
|
||||
static int send_array_data(int sck,GByteArray *ba,WAIT_ACT *act)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ sigset_t sigset, sigoset;
|
||||
+#endif
|
||||
unsigned long int i;
|
||||
unsigned long int nb;
|
||||
int remain;
|
||||
@@ -263,7 +299,20 @@
|
||||
for(i=0;i<nb;i++)
|
||||
{
|
||||
act->last_touch=time(NULL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
res=send(sck,ba->data+cur_pos,BLOCK_SIZE,MSG_NOSIGNAL|MSG_WAITALL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
act->last_touch=time(NULL);
|
||||
if(res!=BLOCK_SIZE)
|
||||
{
|
||||
@@ -277,7 +326,20 @@
|
||||
disp_msg(DEBUG_MSG,"send_array_data","partial",NULL);
|
||||
if(remain!=0)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
res=send(sck,ba->data+cur_pos,remain,MSG_NOSIGNAL|MSG_WAITALL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
if(res!=remain)
|
||||
goto abrt;
|
||||
}
|
||||
@@ -309,6 +371,9 @@
|
||||
/**************************************************************************/
|
||||
static int com_up_get_list_len_process(const char *cmd,WAIT_ACT *act,int sck,GString *input, char *xtra_param)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ sigset_t sigset, sigoset;
|
||||
+#endif
|
||||
GByteArray *cpy_data;
|
||||
GString *out;
|
||||
int res;
|
||||
@@ -337,8 +402,20 @@
|
||||
g_string_sprintfa(out,"%lu|",(unsigned long)cpy_data->len);
|
||||
|
||||
disp_msg(INFO_MSG,"reply",out->str,NULL);
|
||||
-
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
res=send(sck,out->str,out->len,MSG_NOSIGNAL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
res=(res!=out->len);
|
||||
g_string_free(out,TRUE);
|
||||
if(res)
|
||||
@@ -362,7 +439,20 @@
|
||||
g_string_sprintfa(out,"%lu|",(unsigned long)100000+rand()%500000);
|
||||
else
|
||||
g_string_sprintfa(out,"%lu|",(unsigned long)cpy_data->len);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
res=send(sck,out->str,out->len,MSG_NOSIGNAL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
res=(res!=out->len);
|
||||
g_string_free(out,TRUE);
|
||||
if(res)
|
||||
@@ -643,6 +733,9 @@
|
||||
/*****************************************************************/
|
||||
static int copie_fd_to_file(int remote, FILE *local, unsigned long amount,WAIT_ACT *act)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ sigset_t sigset, sigoset;
|
||||
+#endif
|
||||
while(amount!=0)
|
||||
{
|
||||
char buf[8192];
|
||||
@@ -653,7 +746,20 @@
|
||||
|
||||
/* touch the action slot to avoid timeout */
|
||||
act->last_touch=time(NULL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
ret=recv(remote,buf,nb,MSG_WAITALL|MSG_NOSIGNAL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
act->last_touch=time(NULL);
|
||||
|
||||
if((ret==-1)||(ret==0))
|
||||
@@ -983,6 +1089,9 @@
|
||||
/*****************************************************************/
|
||||
static int copie_fd_to_bytearray(int remote, GByteArray **ba, unsigned long amount,WAIT_ACT *act)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ sigset_t sigset, sigoset;
|
||||
+#endif
|
||||
int pos=0;
|
||||
int ret;
|
||||
unsigned long nb;
|
||||
@@ -996,12 +1105,25 @@
|
||||
|
||||
/* touch the action slot to avoid timeout */
|
||||
act->last_touch=time(NULL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
#if 0
|
||||
ret=recv(remote,(*ba)->data+pos,nb,MSG_WAITALL|MSG_NOSIGNAL);
|
||||
#else
|
||||
ret=recv(remote,(*ba)->data+pos,nb,MSG_NOSIGNAL);
|
||||
printf("%d\n",ret);
|
||||
#endif
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
act->last_touch=time(NULL);
|
||||
|
||||
if((ret==-1)||(ret==0))
|
||||
@@ -2606,10 +2728,26 @@
|
||||
/*******************************************************/
|
||||
int manage_srch_port(int srch_sck, int sck)
|
||||
{
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ sigset_t sigset, sigoset;
|
||||
+#endif
|
||||
char buf[8192];
|
||||
int ret;
|
||||
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* possible race condition since backup and restore
|
||||
+ are not guaranteed to occur as a single operation */
|
||||
+
|
||||
+ /* backup sigmask and block SIGPIPE */
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset,SIGPIPE);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset);
|
||||
+#endif
|
||||
ret=recv(srch_sck,buf,sizeof(buf),MSG_NOSIGNAL);
|
||||
+#if (defined(BSD) && (BSD >= 199103))
|
||||
+ /* restore sigmask backup */
|
||||
+ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
|
||||
+#endif
|
||||
if(ret!=-1)
|
||||
{
|
||||
int i;
|
1
net/dctc/pkg-comment
Normal file
1
net/dctc/pkg-comment
Normal file
@ -0,0 +1 @@
|
||||
A DirectConnect (www.neo-modus.com) text client for file sharing
|
19
net/dctc/pkg-descr
Normal file
19
net/dctc/pkg-descr
Normal file
@ -0,0 +1,19 @@
|
||||
[ from developer's site]
|
||||
|
||||
I. What is DCTC
|
||||
DCTC is a Direct Connect clone, a windoz client allowing users to
|
||||
share their files and talk (like IRC but more software sharing
|
||||
oriented) using a proprietary protocol.
|
||||
|
||||
DCTC stands for Direct Connect Text Client.
|
||||
|
||||
II. What is not DCTC
|
||||
DCTC is written from scratch without any help from neo-modus using
|
||||
our experience of hotline protocol.
|
||||
|
||||
DCTC is not designed to be used by human. It doesn't contains any
|
||||
GUI or CLI. The goal of this project is to build a Direct Connect
|
||||
client which can be used by other programs. So even if you can enter
|
||||
command using the keyboard, don't say the human interface is poor.
|
||||
|
||||
WWW: http://ac2i.tzo.com/dctc/
|
11
net/dctc/pkg-plist
Normal file
11
net/dctc/pkg-plist
Normal file
@ -0,0 +1,11 @@
|
||||
bin/dc_hublist
|
||||
bin/dctc
|
||||
%%PORTDOCS%%share/doc/dctc/COPYING
|
||||
%%PORTDOCS%%share/doc/dctc/ChangeLog
|
||||
%%PORTDOCS%%share/doc/dctc/DCextension
|
||||
%%PORTDOCS%%share/doc/dctc/INSTALL
|
||||
%%PORTDOCS%%share/doc/dctc/README
|
||||
%%PORTDOCS%%share/doc/dctc/commands
|
||||
%%PORTDOCS%%share/doc/dctc/output
|
||||
%%PORTDOCS%%share/doc/dctc/programs
|
||||
%%PORTDOCS%%@dirrm share/doc/dctc
|
Loading…
Reference in New Issue
Block a user