s4:lib/tls: fix enabled logic in tstream_tls_params_server()
authorStefan Metzmacher <metze@samba.org>
Thu, 7 Oct 2010 09:16:48 +0000 (11:16 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 7 Oct 2010 09:18:41 +0000 (11:18 +0200)
metze

source4/lib/tls/tls.h
source4/lib/tls/tls_tstream.c

index 4376039..e1bd9ed 100644 (file)
@@ -75,7 +75,7 @@ NTSTATUS tstream_tls_params_client(TALLOC_CTX *mem_ctx,
 
 NTSTATUS tstream_tls_params_server(TALLOC_CTX *mem_ctx,
                                   const char *dns_host_name,
-                                  bool disable,
+                                  bool enabled,
                                   const char *key_file,
                                   const char *cert_file,
                                   const char *ca_file,
index 96e6f6b..52e94b0 100644 (file)
@@ -975,7 +975,7 @@ extern void tls_cert_generate(TALLOC_CTX *, const char *, const char *, const ch
 */
 NTSTATUS tstream_tls_params_server(TALLOC_CTX *mem_ctx,
                                   const char *dns_host_name,
-                                  bool disable,
+                                  bool enabled,
                                   const char *key_file,
                                   const char *cert_file,
                                   const char *ca_file,
@@ -987,6 +987,16 @@ NTSTATUS tstream_tls_params_server(TALLOC_CTX *mem_ctx,
 #if ENABLE_GNUTLS
        int ret;
 
+       if (!enabled || key_file == NULL || *key_file == 0) {
+               tlsp = talloc_zero(mem_ctx, struct tstream_tls_params);
+               NT_STATUS_HAVE_NO_MEMORY(tlsp);
+               talloc_set_destructor(tlsp, tstream_tls_params_destructor);
+               tlsp->tls_enabled = false;
+
+               *_tlsp = tlsp;
+               return NT_STATUS_OK;
+       }
+
        ret = gnutls_global_init();
        if (ret != GNUTLS_E_SUCCESS) {
                DEBUG(0,("TLS %s - %s\n", __location__, gnutls_strerror(ret)));