s4-torture: don't build the lsa forest trust krb5 tests when building with MIT Kerberos.
[Samba.git] / auth / gensec / external.c
bloba26e4353192aa4a07ff518f8cf088290d649401c
1 /*
2 Unix SMB/CIFS implementation.
4 SASL/EXTERNAL authentication.
6 Copyright (C) Howard Chu <hyc@symas.com> 2013
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "includes.h"
23 #include "auth/credentials/credentials.h"
24 #include "auth/gensec/gensec.h"
25 #include "auth/gensec/gensec_internal.h"
26 #include "auth/gensec/gensec_proto.h"
27 #include "auth/gensec/gensec_toplevel_proto.h"
29 /* SASL/EXTERNAL is essentially a no-op; it is only usable when the transport
30 * layer is already mutually authenticated.
33 NTSTATUS gensec_external_init(void);
35 static NTSTATUS gensec_external_start(struct gensec_security *gensec_security)
37 if (gensec_security->want_features & GENSEC_FEATURE_SIGN)
38 return NT_STATUS_INVALID_PARAMETER;
39 if (gensec_security->want_features & GENSEC_FEATURE_SEAL)
40 return NT_STATUS_INVALID_PARAMETER;
42 return NT_STATUS_OK;
45 static NTSTATUS gensec_external_update(struct gensec_security *gensec_security,
46 TALLOC_CTX *out_mem_ctx,
47 struct tevent_context *ev,
48 const DATA_BLOB in, DATA_BLOB *out)
50 *out = data_blob_talloc(out_mem_ctx, "", 0);
51 return NT_STATUS_OK;
54 /* We have no features */
55 static bool gensec_external_have_feature(struct gensec_security *gensec_security,
56 uint32_t feature)
58 return false;
61 static const struct gensec_security_ops gensec_external_ops = {
62 .name = "sasl-EXTERNAL",
63 .sasl_name = "EXTERNAL",
64 .client_start = gensec_external_start,
65 .update = gensec_external_update,
66 .have_feature = gensec_external_have_feature,
67 .enabled = true,
68 .priority = GENSEC_EXTERNAL
72 NTSTATUS gensec_external_init(void)
74 NTSTATUS ret;
76 ret = gensec_register(&gensec_external_ops);
77 if (!NT_STATUS_IS_OK(ret)) {
78 DEBUG(0,("Failed to register '%s' gensec backend!\n",
79 gensec_external_ops.name));
81 return ret;