=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/plugin/oxmisc.c,v retrieving revision 1.9 retrieving revision 1.12 diff -u -p -r1.9 -r1.12 --- OpenXM/src/kan96xx/plugin/oxmisc.c 2001/05/04 01:06:30 1.9 +++ OpenXM/src/kan96xx/plugin/oxmisc.c 2002/02/24 10:27:20 1.12 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/kan96xx/plugin/oxmisc.c,v 1.8 2000/12/03 07:29:39 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/plugin/oxmisc.c,v 1.11 2001/12/28 08:18:22 takayama Exp $ */ #include #include #include @@ -883,10 +883,18 @@ char *oxGenPass(void) { static void cancelConnection() { +#if defined(__CYGWIN__) + extern sigjmp_buf MyEnv_oxmisc; +#else extern jmp_buf MyEnv_oxmisc; +#endif signal(SIGALRM,SIG_IGN); fprintf(stderr,"Time out in TCP/IP connection.\n"); +#if defined(__CYGWIN__) + siglongjmp(MyEnv_oxmisc,1); +#else longjmp(MyEnv_oxmisc,1); +#endif } oxclientp oxCreateClient2(int fdstream,int portStream, @@ -900,15 +908,23 @@ oxclientp oxCreateClient2(int fdstream,int portStream, char *s; oxclientp client; - extern jmp_buf MyEnv_oxmisc ; +#if defined(__CYGWIN__) + extern sigjmp_buf MyEnv_oxmisc; +#else + extern jmp_buf MyEnv_oxmisc; +#endif int controlByteOrder, engineByteOrder; v = !Quiet; +#if defined(__CYGWIN__) + if (sigsetjmp(MyEnv_oxmisc,1)) { +#else if (setjmp(MyEnv_oxmisc)) { +#endif return(NULL); }else{ } - alarm((unsigned int) 10); /* setup timeout. */ + alarm((unsigned int) 20); /* setup timeout. */ signal(SIGALRM,cancelConnection); switch(ipmask) { @@ -931,18 +947,20 @@ oxclientp oxCreateClient2(int fdstream,int portStream, /* Authentication by password. */ m = strlen(pass); - s = (char *)mymalloc(sizeof(char)*(m+1)); - read(fdControl,s,m+1); s[m] = '\0'; - if (strcmp(s,pass) != 0) { - fprintf(stderr,"oxCreateClient2(): password authentication failed for control channel.\n"); - close(fdControl); - return(NULL); - } - read(fdStream,s,m+1); s[m] = '\0'; - if (strcmp(s,pass) != 0) { - fprintf(stderr,"oxCreateClient2(): password authentication failed for data channel.\n"); - close(fdStream); - return(NULL); + if (m > 0) { + s = (char *)mymalloc(sizeof(char)*(m+1)); + read(fdControl,s,m+1); s[m] = '\0'; + if (strcmp(s,pass) != 0) { + fprintf(stderr,"oxCreateClient2(): password authentication failed for control channel.\n"); + close(fdControl); + return(NULL); + } + read(fdStream,s,m+1); s[m] = '\0'; + if (strcmp(s,pass) != 0) { + fprintf(stderr,"oxCreateClient2(): password authentication failed for data channel.\n"); + close(fdStream); + return(NULL); + } } signal(SIGALRM,SIG_IGN);