LCOV - code coverage report
Current view: top level - source4/torture/nbt - nbt.c (source / functions) Hit Total Coverage
Test: coverage report for master 2b515b7d Lines: 17 17 100.0 %
Date: 2024-02-28 12:06:22 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /* 
       2             :    Unix SMB/CIFS implementation.
       3             :    SMB torture tester
       4             :    Copyright (C) Jelmer Vernooij 2006
       5             :    
       6             :    This program is free software; you can redistribute it and/or modify
       7             :    it under the terms of the GNU General Public License as published by
       8             :    the Free Software Foundation; either version 3 of the License, or
       9             :    (at your option) any later version.
      10             :    
      11             :    This program is distributed in the hope that it will be useful,
      12             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14             :    GNU General Public License for more details.
      15             :    
      16             :    You should have received a copy of the GNU General Public License
      17             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      18             : */
      19             : 
      20             : #include "includes.h"
      21             : #include "../libcli/nbt/libnbt.h"
      22             : #include "torture/torture.h"
      23             : #include "torture/nbt/proto.h"
      24             : #include "torture/smbtorture.h"
      25             : #include "libcli/resolve/resolve.h"
      26             : #include "param/param.h"
      27             : 
      28          20 : struct nbt_name_socket *torture_init_nbt_socket(struct torture_context *tctx)
      29             : {
      30          20 :         return nbt_name_socket_init(tctx, tctx->ev);
      31             : }
      32             : 
      33           7 : bool torture_nbt_get_name(struct torture_context *tctx, 
      34             :                           struct nbt_name *name, 
      35             :                           const char **address)
      36             : {
      37           7 :         make_nbt_name_server(name, strupper_talloc(tctx, 
      38             :                              torture_setting_string(tctx, "host", NULL)));
      39             : 
      40             :         /* do an initial name resolution to find its IP */
      41           7 :         torture_assert_ntstatus_ok(tctx, 
      42             :                                    resolve_name_ex(lpcfg_resolve_context(tctx->lp_ctx),
      43             :                                                    0, 0,
      44             :                                                    name, tctx, address, tctx->ev),
      45             :                                    talloc_asprintf(tctx, 
      46             :                                                    "Failed to resolve %s", name->name));
      47             :         
      48           7 :         return true;
      49             : }
      50             : 
      51        2379 : NTSTATUS torture_nbt_init(TALLOC_CTX *ctx)
      52             : {
      53        2379 :         struct torture_suite *suite = torture_suite_create(
      54             :                 ctx, "nbt");
      55             :         /* nbt tests */
      56        2379 :         torture_suite_add_suite(suite, torture_nbt_register(suite));
      57        2379 :         torture_suite_add_suite(suite, torture_nbt_wins(suite));
      58        2379 :         torture_suite_add_suite(suite, torture_nbt_dgram(suite));
      59        2379 :         torture_suite_add_suite(suite, torture_nbt_winsreplication(suite));
      60        2379 :         torture_suite_add_suite(suite, torture_bench_nbt(suite));
      61        2379 :         torture_suite_add_suite(suite, torture_bench_wins(suite));
      62             : 
      63        2379 :         suite->description = talloc_strdup(suite, 
      64             :                                          "NetBIOS over TCP/IP and WINS tests");
      65             : 
      66        2379 :         torture_register_suite(ctx, suite);
      67             : 
      68        2379 :         return NT_STATUS_OK;
      69             : }

Generated by: LCOV version 1.14