#else
-/* for systems without tls we just map the tls socket calls to the
- normal socket calls */
+/* for systems without tls we just fail the operations, and the caller
+ * will retain the original socket */
struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx)
{
struct fd_event *fde,
const char *plain_chars)
{
- if (plain_chars) {
- return socket;
- }
return NULL;
}
struct task_server *task = talloc_get_type(conn->private, struct task_server);
struct esp_data *edata = talloc_get_type(task->private, struct esp_data);
struct websrv_context *web;
+ struct socket_context *tls_socket;
web = talloc_zero(conn, struct websrv_context);
if (web == NULL) goto failed;
websrv_timeout, web);
/* Overwrite the socket with a (possibly) TLS socket */
- conn->socket = tls_init_server(edata->tls_params, conn->socket,
- conn->event.fde, "GPHO");
- if (conn->socket == NULL) goto failed;
+ tls_socket = tls_init_server(edata->tls_params, conn->socket,
+ conn->event.fde, "GPHO");
+ /* We might not have TLS, or it might not have initilised */
+ if (tls_socket) {
+ talloc_unlink(conn, conn->socket);
+ talloc_steal(conn, tls_socket);
+ conn->socket = tls_socket;
+ } else {
+ DEBUG(3, ("TLS not available for web_server connections\n"));
+ }
return;