Logo Search packages:      
Sourcecode: nbsmtp version File versions  Download package

int nbsmtp_header ( servinfo_t serverinfo  ) 

Send received: by header.

Parameters:
[in] serverinfo Struct with info about the connection
Returns:
< 0 in case of error > 0 otherwise

Definition at line 202 of file nbsmtp.c.

References arpadate(), servinfo::domain, servinfo::fromaddr, log_msg(), and smtp_write().

Referenced by nbsmtp_data().

{
      char local_tmp_buf[BUF_SIZE];
      char *local_out_buf;
#ifdef HAVE_SSL
      char *tls_header_buf;
      int cipher_bits, algo_bits;
#endif
      
      arpadate(local_tmp_buf);

#ifdef HAVE_SSL
      if (serverinfo->using_tls)
      {
            cipher_bits = SSL_get_cipher_bits(serverinfo->ssl,&algo_bits);
            asprintf(&tls_header_buf,"\r\n\t(using %s with cipher %s (%d/%d bits))",
                        SSL_get_cipher_version(serverinfo->ssl),
                        SSL_get_cipher_name(serverinfo->ssl),
                        cipher_bits,algo_bits);
      }
#endif

      asprintf(&local_out_buf,"Received: by %s (nbSMTP-%s) for uid %d%s\r\n\t%s; %s",
                  serverinfo->domain,PACKAGE_VERSION,getuid(),
#ifdef HAVE_SSL
                  (serverinfo->using_tls ? tls_header_buf : ""),
#else
                  "",
#endif
                  serverinfo->fromaddr,local_tmp_buf);

      if (smtp_write(serverinfo,local_out_buf)<1)
      {
            log_msg(LOG_ERR,"Error writting Received: by header to the socket");
            return -1;
      }

      free(local_out_buf);
#ifdef HAVE_SSL
      if (serverinfo->using_tls)
      {
            free(tls_header_buf);
      }
#endif

      return 1;
}


Generated by  Doxygen 1.6.0   Back to index