#endif
short port = LDAP_PORT;
+#ifdef HAVE_TLS
+short tls_port = LDAP_TLS_PORT;
+#endif
/*
* when more than one slapd is running on one machine, each one might have
* it's own LOCAL for syslogging and must have its own pid/args files
time_t starttime;
struct sockaddr_in bind_addr;
ber_int_t tcps;
+#ifdef HAVE_TLS
+struct sockaddr_in tls_bind_addr;
+ber_int_t tls_tcps;
+#endif
#ifdef HAVE_WINSOCK
void WINAPI ServiceMain( DWORD argc, LPTSTR *argv )
#endif
char *serverName;
int serverMode = SLAP_SERVER_MODE;
+ int use_tls_port = 0;
(void) memset( (void*) &bind_addr, '\0', sizeof(bind_addr));
bind_addr.sin_family = AF_INET;
bind_addr.sin_addr.s_addr = htonl(INADDR_ANY);
bind_addr.sin_port = htons(port);
+#ifdef HAVE_TLS
+ tls_bind_addr.sin_family = AF_INET;
+ tls_bind_addr.sin_addr.s_addr = htonl(INADDR_ANY);
+ tls_bind_addr.sin_port = htons(tls_port);
+#endif
g_argc = argc;
g_argv = argv;
#endif
#ifdef HAVE_WINSOCK
"n:"
+#endif
+#ifdef HAVE_TLS
+ "P:T"
#endif
)) != EOF ) {
switch ( i ) {
{
fprintf(stderr, "invalid address (%s) for -a option", optarg);
}
+#ifdef HAVE_TLS
+#ifdef HAVE_WINSOCK
+ tls_bind_addr.sin_addr.S_un.S_addr = inet_addr(optarg);
+#else
+ inet_aton(optarg, &tls_bind_addr.sin_addr);
+#endif
+#endif
break;
#ifdef LDAP_DEBUG
}
} break;
+#ifdef HAVE_TLS
+ case 'P': { /* port on which to listen for TLS */
+ tls_port = (short)atoi( optarg );
+ if(! tls_port ) {
+ fprintf(stderr, "-P %s must be numeric\n", optarg);
+ } else {
+ tls_bind_addr.sin_port = htons(tls_port);
+ }
+ } break;
+#endif
+
case 's': /* set syslog level */
ldap_syslog = atoi( optarg );
break;
case 'n': /* NT service name */
NTservice = ch_strdup( optarg );
break;
+#endif
+#ifdef HAVE_TLS
+ case 'T': /* Bind on TLS port */
+ use_tls_port = 1;
+ break;
#endif
default:
usage( argv[0] );
goto destroy;
}
+#ifdef HAVE_TLS
+ ldap_pvt_tls_init();
+ ldap_pvt_tls_init_def_ctx();
+#endif
+
tcps = set_socket( inetd ? NULL : &bind_addr );
if ( tcps == -1 )
goto destroy;
+#ifdef HAVE_TLS
+ if ( use_tls_port ) {
+ tls_tcps = set_socket( inetd ? NULL : &tls_bind_addr );
+ if ( tls_tcps == -1 )
+ goto destroy;
+ } else {
+ tls_tcps = -1;
+ }
+#endif
(void) SIGNAL( LDAP_SIGUSR1, slap_do_nothing );
(void) SIGNAL( LDAP_SIGUSR2, slap_set_shutdown );
FILE *fp;
args.addr = &bind_addr;
+#ifdef HAVE_TLS
+ args.tls_addr = &tls_bind_addr;
+#endif
Debug( LDAP_DEBUG_ANY, "slapd starting\n", 0, 0, 0 );
} else {
args.addr = NULL;
+#ifdef HAVE_TLS
+ args.tls_addr = NULL;
+#endif
}
args.tcps = tcps;
+#ifdef HAVE_TLS
+ args.tls_tcps = tls_tcps;
+#endif
time( &starttime );
#ifdef HAVE_WINSOCK