@@ -354,8 +354,8 @@ static void sc_usage(void)
354354BIO_printf (bio_err ," -starttls prot - use the STARTTLS command before starting TLS\n" );
355355BIO_printf (bio_err ," for those protocols that support it, where\n" );
356356BIO_printf (bio_err ," 'prot' defines which one to assume. Currently,\n" );
357- BIO_printf (bio_err ," only \"smtp\", \"pop3\", \"imap\", \"ftp\", \"xmpp\", and \n" );
358- BIO_printf (bio_err ," \"telnet\" are supported.\n" );
357+ BIO_printf (bio_err ," only \"smtp\", \"pop3\", \"imap\", \"ftp\", \"xmpp\",\n" );
358+ BIO_printf (bio_err ," \"telnet\" and \"ldap\" are supported.\n" );
359359#ifndef OPENSSL_NO_ENGINE
360360BIO_printf (bio_err ," -engine id - Initialise and use the specified engine\n" );
361361#endif
580580PROTO_IMAP ,
581581PROTO_FTP ,
582582PROTO_XMPP ,
583- PROTO_TELNET
583+ PROTO_TELNET ,
584+ PROTO_LDAP
584585};
585586
586587int MAIN (int , char * * );
@@ -1059,6 +1060,8 @@ static char *jpake_secret = NULL;
10591060starttls_proto = PROTO_XMPP ;
10601061else if (strcmp (* argv , "telnet" ) == 0 )
10611062starttls_proto = PROTO_TELNET ;
1063+ else if (strcmp (* argv , "ldap" ) == 0 )
1064+ starttls_proto = PROTO_LDAP ;
10621065else
10631066goto bad ;
10641067}
@@ -1774,6 +1777,30 @@ SSL_set_tlsext_status_ids(con, ids);
17741777 if (!foundit )
17751778 BIO_printf (bio_err , "HTTP CONNECT failed\n" );
17761779 }
1780+ if (starttls_proto == PROTO_LDAP )
1781+ {
1782+ char * ldap_tls_genconf = "asn1=SEQUENCE:LDAPMessage\n"
1783+ "[LDAPMessage]\n"
1784+ "messageID=INTEGER:1\n"
1785+ "extendedReq=EXPLICIT:23A,IMPLICIT:0C,FORMAT:ASCII,OCT:1.3.6.1.4.1.1466.20037\n" ;
1786+ long errline ;
1787+ char * genstr ;
1788+ ASN1_TYPE * atyp = NULL ;
1789+ CONF * cnf = NCONF_new (NULL );
1790+ BIO * ldapbio = BIO_new (BIO_s_mem ());
1791+
1792+ BIO_puts (ldapbio , ldap_tls_genconf );
1793+ NCONF_load_bio (cnf , ldapbio , & errline );
1794+ genstr = NCONF_get_string (cnf , "default" , "asn1" );
1795+ atyp = ASN1_generate_nconf (genstr , cnf );
1796+
1797+ BIO_printf (sbio , (const char * ) atyp -> value .sequence -> data , host );
1798+ BIO_read (sbio ,sbuf ,BUFSIZZ );
1799+
1800+ BIO_free (ldapbio );
1801+ NCONF_free (cnf );
1802+ ASN1_TYPE_free (atyp );
1803+ }
17771804
17781805for (;;)
17791806{
0 commit comments