s3:ntlm_auth: make logs more consistent with length check
[Samba.git] / source3 / rpc_server / rpc_config.c
blobaf167d817d55a733731e195c4d4e5035f0118fbf
1 /*
2 Unix SMB/Netbios implementation.
3 Generic infrastructure for RPC Daemons
4 Copyright (C) Simo Sorce 2011
5 Copyright (C) Andreas Schneider 2011
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "includes.h"
22 #include "rpc_server/rpc_config.h"
23 #include "rpc_server/rpc_server.h"
24 #include "lib/param/param.h"
25 #include "librpc/rpc/dcesrv_core.h"
26 #include "lib/global_contexts.h"
28 #undef DBGC_CLASS
29 #define DBGC_CLASS DBGC_RPC_SRV
31 static struct dcesrv_context_callbacks srv_callbacks = {
32 .log.successful_authz = dcesrv_log_successful_authz,
33 .auth.gensec_prepare = dcesrv_auth_gensec_prepare,
34 .auth.become_root = become_root,
35 .auth.unbecome_root = unbecome_root,
36 .assoc_group.find = dcesrv_assoc_group_find,
39 static struct dcesrv_context *global_dcesrv_ctx = NULL;
41 struct dcesrv_context *global_dcesrv_context(void)
43 NTSTATUS status;
45 if (global_dcesrv_ctx == NULL) {
46 struct loadparm_context *lp_ctx = NULL;
48 DBG_INFO("Initializing DCE/RPC server context\n");
50 lp_ctx = loadparm_init_s3(NULL, loadparm_s3_helpers());
51 if (lp_ctx == NULL) {
52 smb_panic("No memory");
56 * Note we MUST use the NULL context here, not the
57 * autofree context, to avoid side effects in forked
58 * children exiting.
60 status = dcesrv_init_context(global_event_context(),
61 lp_ctx,
62 &srv_callbacks,
63 &global_dcesrv_ctx);
64 if (!NT_STATUS_IS_OK(status)) {
65 smb_panic("Failed to init DCE/RPC context");
68 talloc_steal(global_dcesrv_ctx, lp_ctx);
71 return global_dcesrv_ctx;
74 void global_dcesrv_context_free(void)
76 TALLOC_FREE(global_dcesrv_ctx);