91,92c91,121 < log(LOG_ERR, "Protocol not supported"); < return -1; --- > char line[STRLEN]; > > fdscanf(remote, "%[^\r]", line); > while (strncmp(line,"220-",4)==0) { > if(fdprintf(local, line)<0) > return -1; > fdscanf(remote, "%[^\r]", line); > } > if(fdprintf(local, line)<0) > return -1; > if(fdprintf(remote, "EHLO localhost")<0) > return -1; > fdscanf(remote, "%[^\r]", line); > while (strncmp(line,"250-",4)==0) { > fdscanf(remote, "%[^\r]", line); > } > if(strncmp(line,"250 ",4)!=0) { > log(LOG_ERR, "Server does not support SMTP Service Extensions!"); > return -1; > } > if(fdprintf(remote, "STARTTLS")<0) > return -1; > fdscanf(remote, "%[^\r]", line); > while (strncmp(line,"220-",4)==0) { > fdscanf(remote, "%[^\r]", line); > } > if(strncmp(line,"220 ",4)!=0) { > log(LOG_ERR, "Server does not support TLS!"); > return -1; > } > return 0;