From 307f635325a3e780a52bde2408f3d66d5f49f9ff Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Wed, 7 Aug 2024 21:44:46 -0400 Subject: [PATCH] SSL mode start to be workable --- lib/devsoc.c | 8 ++++---- lib/subrou.c | 2 +- lib/unitls.c | 3 +-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/devsoc.c b/lib/devsoc.c index ed6b5ad..3ca6620 100644 --- a/lib/devsoc.c +++ b/lib/devsoc.c @@ -132,7 +132,6 @@ static int getnewhandle(SOCTYP *soc) int newhandle; -(void) printf("JMPDBG soc handle='%d'\n",soc->handle); if ((newhandle=accept(soc->handle,(SOCKADDR *)0,(socklen_t *)0))<0) { if (errno==EAGAIN) errno=EWOULDBLOCK; @@ -239,7 +238,6 @@ _Bool ready; int phase; _Bool proceed; -(void) printf("JMPDBG starting from waitincoming\n"); newsoc=(SOCTYP *)0; ready=false; phase=0; @@ -282,7 +280,6 @@ while (proceed==true) { } phase++; } -(void) printf("JMPDBG exit from waitincoming\n"); return newsoc; #undef OPEP } @@ -603,7 +600,6 @@ if (soc!=(SOCTYP *)0) { polling[0].events=POLLIN|POLLPRI; polling[0].revents=(short)0; - (void) printf("JMPDBG modtls='%d'\n",soc->modtls); switch (soc->modtls) { case true : polling[0].fd=SSL_get_fd(soc->tls->ssl); @@ -659,10 +655,12 @@ while (proceed==true) { phase=999; //No End Of Line yet break; case 3 : //duplicating carpile + (void) printf("JMPDBG carpil=<%s>\n",soc->carpile); *lineptr=calloc(soc->carin+1,sizeof(char)); *eol='\000'; (void) strcpy(*lineptr,soc->carpile); (void) strcat(*lineptr,soc->EOL); + (void) printf("JMPDBG *lineptr=<%s>\n",*lineptr); got=strlen(*lineptr); break; case 4 : //managing carpile @@ -737,6 +735,7 @@ if (soc!=(SOCTYP *)0) { switch (soc->modtls) { case true : got=tls_read(soc->tls,buffer,limit); + (void) printf("JMPDBG tls_read got='%d'\n",got); break; case false : got=recv(soc->handle,buffer,limit,MSG_DONTWAIT); @@ -762,6 +761,7 @@ if (soc!=(SOCTYP *)0) { if (got>0) { //we have recived some character soc->carin+=got; //managing carpile soc->carpile[soc->carin]='\000'; + (void) printf("JMPDBG soc_receive carpile=<%s>\n",soc->carpile); } } #undef OPEP diff --git a/lib/subrou.c b/lib/subrou.c index 360a2f6..2110aeb 100644 --- a/lib/subrou.c +++ b/lib/subrou.c @@ -20,7 +20,7 @@ //version definition #define VERSION "0.3" -#define RELEASE "31" +#define RELEASE "32" //Public variables PUBLIC int debug=0; //debug level diff --git a/lib/unitls.c b/lib/unitls.c index 0d0ebc2..724468c 100644 --- a/lib/unitls.c +++ b/lib/unitls.c @@ -411,7 +411,6 @@ PUBLIC int tls_write(TLSTYP *tls,char *buffer,int tosend) int sent; sent=0; -(void) printf("JMPDBG sending<%s>\n",buffer); if (tls!=(TLSTYP *)0) { _Bool proceed; int sofar; @@ -420,7 +419,7 @@ if (tls!=(TLSTYP *)0) { while (proceed==true) { proceed=false; sofar=SSL_write(tls->ssl,buffer,tosend); - switch (sent) { + switch (sofar) { case -1 : //trouble to write switch (SSL_get_error(tls->ssl,-1)) { case SSL_ERROR_WANT_READ : //"wanted" error -- 2.47.3