Line data Source code
1 : /*
2 : Unix SMB/CIFS implementation.
3 : SMB Signing Code
4 : Copyright (C) Jeremy Allison 2003.
5 : Copyright (C) Andrew Bartlett <abartlet@samba.org> 2002-2003
6 : Copyright (C) Stefan Metzmacher 2009
7 :
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.
12 :
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.
17 :
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/>.
20 : */
21 :
22 : #include "includes.h"
23 : #include "smbd/smbd.h"
24 : #include "smbd/globals.h"
25 : #include "../libcli/smb/smb_signing.h"
26 : #include "lib/param/param.h"
27 : #include "smb2_signing.h"
28 :
29 5320 : bool srv_init_signing(struct smbXsrv_connection *conn)
30 : {
31 5320 : struct loadparm_context *lp_ctx = NULL;
32 5320 : bool ok = true;
33 :
34 5320 : lp_ctx = loadparm_init_s3(conn, loadparm_s3_helpers());
35 5320 : if (lp_ctx == NULL) {
36 0 : DBG_DEBUG("loadparm_init_s3 failed\n");
37 0 : return false;
38 : }
39 :
40 : /*
41 : * For SMB2 all we need to know is if signing is mandatory.
42 : * It is always allowed and desired, whatever the smb.conf says.
43 : */
44 5320 : (void)lpcfg_server_signing_allowed(lp_ctx, &conn->smb2.signing_mandatory);
45 :
46 : #if defined(WITH_SMB1SERVER)
47 5320 : ok = smb1_srv_init_signing(lp_ctx, conn);
48 : #endif
49 :
50 5320 : talloc_unlink(conn, lp_ctx);
51 5320 : return ok;
52 : }
|