int max;
int count;
-max=1000; //purgin for one seconde max;
+max=1000; //purging for 1 seconde max;
count=0;
for (;count<max;count++) {
soc->carin=0;
(void) soc_receive(soc);
if (soc->carin==0) //got no character
break;
- (void) rou_alert(0,"JMPDBG reading soc count='%d' carin='%d'",count,soc->carin);
}
if (count>=max) //one second max!
(void) rou_alert(0,"%s purge is too long with peer [%s]",OPEP,peerip);
}
#undef FMT
#undef OPEP
-(void) printf("JMP signon sent='%d'",sent);
return sent;
}
/*
{
static char *ehlostr[]= {
- "-8BITMIME",
"-STARTTLS",
+ "-8BITMIME",
"-ENHANCEDSTATUSCODES",
"-AUTH PLAIN LOGIN",
" HELP",
_Bool done;
char *fqdn;
+int strstart;
int phase;
_Bool proceed;
done=false;
+fqdn=(char *)0;
+strstart=0;
phase=0;
proceed=true;
while (proceed==true) {
(void) transmit(contact,"%d-%s ready, your IP=[%s]",
CMDOK,contact->locname,contact->peerip);
(void) transmit(contact,"%d-SIZE %ld",CMDOK,MXMSIZE);
- for (int i=0;ehlostr[i]!=(char *)0;i++) {
+ if (contact->tlsok==true)
+ strstart++;
+ for (int i=strstart;ehlostr[i]!=(char *)0;i++) {
(void) transmit(contact,"%d%s",CMDOK,ehlostr[i]);
}
done=true;
status=tcp_getline(contact,&attend,&line);
if (status<=0) //timeout or trouble?
break; //no need to go further
- (void) printf("JMPDBG getline got <%s>\n",line);
switch (eml_getcode(line)) {
case c_ehlo : //EHLO SMTP protocol
proceed=doehlo(contact,line);
case c_starttls : //EHLO start encryptel link
switch (soc_starttls(contact->socptr,contact->peerip)) {
case true : //link now in TLS crypted mode
+ contact->tlsok=true;
(void) tcp_signon(contact);
break;
case false : //unable to establish link
//version definition
#define VERSION "0.3"
-#define RELEASE "41"
+#define RELEASE "42"
//Public variables
PUBLIC int debug=0; //debug level
if (tls->ssl==(SSL *)0) //in case of trouble
(void) rou_core_dump("%s Unexpected NULL SSL (Bug?)",OPEP);
code=SSL_get_error(tls->ssl,sslerror);
- (void) rou_alert(0,"JMPDBG err code='%d'",code);
switch (code) {
case SSL_ERROR_ZERO_RETURN :
detail="zero return";
phase=0;
proceed=true;
while (proceed==true) {
- (void) printf("JMPDBG opentls phase='%d' handle=%d\n",phase,handle);
switch (phase) {
case 0 : //prepare the structure first;
tls=(TLSTYP *)calloc(1,sizeof(TLSTYP));
int sofar;
proceed=true;
- (void) printf("JMPDBG sending <%s>\n",buffer);
while (proceed==true) {
int status;
status=0;
proceed=false;
sofar=SSL_write(tls->ssl,buffer,tosend);
- (void) printf("JMPDBG sent sofar='%d'\n",sofar);
switch (sofar) {
case -1 : //trouble to write
switch (status=SSL_get_error(tls->ssl,-1)) {
case SSL_ERROR_WANT_READ : //
case SSL_ERROR_WANT_WRITE : //"Wanted" error
- (void) printf("JMPDBG SSL_get_error='%d'\n",status);
(void) usleep(1000);
proceed=true;
break;
status=0;
got=SSL_read(tls->ssl,buffer,maxread);
- (void) printf("JMPDBG read got='%d'\n",got);
switch (got) {
case -1 : //trouble to write
switch (status=SSL_get_error(tls->ssl,-1)) {
case SSL_ERROR_WANT_READ : //"wanted" error
case SSL_ERROR_WANT_WRITE : //
- (void) printf("JMPDBG SSL_get_error='%d'\n",status);
(void) usleep(1000);
break;
default :