LCOV - code coverage report
Current view: top level - source3/smbd - smb2_signing.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 9 11 81.8 %
Date: 2024-04-21 15:09:00 Functions: 1 1 100.0 %

          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       32669 : bool srv_init_signing(struct smbXsrv_connection *conn)
      30             : {
      31       32669 :         struct loadparm_context *lp_ctx = NULL;
      32       32669 :         bool ok = true;
      33             : 
      34       32669 :         lp_ctx = loadparm_init_s3(conn, loadparm_s3_helpers());
      35       32669 :         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       32669 :         (void)lpcfg_server_signing_allowed(lp_ctx, &conn->smb2.signing_mandatory);
      45             : 
      46             : #if defined(WITH_SMB1SERVER)
      47       32669 :         ok = smb1_srv_init_signing(lp_ctx, conn);
      48             : #endif
      49             : 
      50       32669 :         talloc_unlink(conn, lp_ctx);
      51       32669 :         return ok;
      52             : }

Generated by: LCOV version 1.14