/* Procedure to close and release exchange socket */
/* */
/********************************************************/
-SOCPTR *soc_release(SOCPTR *socptr)
+PUBLIC SOCPTR *soc_release(SOCPTR *socptr)
{
#define OPEP "devsoc.c:soc_release"
/* crypted channel, return true is successful. */
/* */
/********************************************************/
-_Bool soc_starttls(SOCPTR *socptr)
+PUBLIC _Bool soc_starttls(SOCPTR *socptr)
{
_Bool ok;
}
return ok;
}
+/*
+^L
+*/
+/********************************************************/
+/* */
+/* Procedure to return true if sthe socket is */
+/* in crypted mode. */
+/* */
+/********************************************************/
+PUBLIC _Bool soc_iscrypted(SOCPTR *socptr)
+
+{
+_Bool iscrypted;
+
+iscrypted=false;
+if (socptr!=(SOCPTR *)0)
+ iscrypted=((SOCTYP *)socptr)->modtls;
+return iscrypted;
+}
+/*
+^L
+*/
+/********************************************************/
+/* */
+/* Procedure to return the socket mode as a string */
+/* */
+/********************************************************/
+PUBLIC const char *soc_getstrmode(SOCPTR *socptr)
+
+{
+const char *mode;
+SOCTYP *soc;
+
+mode="Unknown";
+soc=(SOCTYP *)socptr;
+if (soc!=(SOCTYP *)0) {
+ mode="cleartext";
+ if (soc->modtls==true)
+ mode="crypted";
+ }
+return mode;
+}
static void signon(CONTYP *contact)
{
-#define FMT "%d %s ESMTP %s%s-%s; %s"
+#define FMT "%d %s ESMTP (%s) %s-%s; %s"
if (contact!=(CONTYP *)0) {
- char strcrypt[20];
+ const char *mode;
char signon[100];
- (void) strcpy(strcrypt,"");
- if (contact->tlsok==true)
- (void) strcpy(strcrypt,"(crypted) ");
+ mode=soc_getstrmode(contact->socptr);
(void) snprintf(signon,sizeof(signon),FMT,
SIGNON,contact->locname,
- strcrypt,
+ mode,
appname,
rou_getversion(),
rou_ascsysstamp(time((time_t *)0)));
static void linkready(CONTYP *contact)
{
-char *crypted;
+const char *mode;
-crypted="cleartext";
-if (contact->tlsok==true)
- crypted="crypted";
+mode=soc_getstrmode(contact->socptr);
(void) transmit(contact,"%d-%s, link (%s) ready, your IP/FQDN=[%s/%s]",
- CMDOK,contact->locname,crypted,
+ CMDOK,contact->locname,mode,
contact->peerip,contact->peername);
}
/*
case 1 : //thereis an FQDN
(void) linkready(contact);
(void) transmit(contact,"%d-SIZE %ld",CMDOK,MXMSIZE);
- if (contact->tlsok==true)
+ if (soc_iscrypted(contact->socptr)==true)
strstart++;
for (int i=strstart;ehlostr[i]!=(char *)0;i++) {
(void) transmit(contact,"%d%s",CMDOK,ehlostr[i]);
case c_starttls : //EHLO start encryptel link
switch (soc_starttls(contact->socptr)) {
case true : //link now in TLS crypted mode
- contact->tlsok=true;
(void) transmit(contact,"%d Link now encrypted",CMDOK);
(void) rou_alert(0,"%s, CMDOK sent",OPEP);
break;