Coverage Report

Created: 2026-04-01 06:26

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/samba/librpc/ndr/ndr_bkupblobs.c
Line
Count
Source
1
/*
2
   Unix SMB/CIFS implementation.
3
4
   helper routines for BKUP Blobs marshalling
5
6
   Copyright (C) Matthieu Patou <mat@matws.net> 2011
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 "librpc/gen_ndr/ndr_bkupblobs.h"
24
25
26
_PUBLIC_ enum ndr_err_code ndr_push_bkup_NTBackupFile(struct ndr_push *ndr, ndr_flags_type ndr_flags, const struct bkup_NTBackupFile *r)
27
987
{
28
987
  uint32_t cntr_streams_0;
29
987
  {
30
987
    libndr_flags _flags_save_STRUCT = ndr->flags;
31
987
    ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
32
987
    if (ndr_flags & NDR_SCALARS) {
33
987
      NDR_CHECK(ndr_push_align(ndr, 2));
34
45.4k
      for (cntr_streams_0 = 0; cntr_streams_0 < r->num_stream; cntr_streams_0++) {
35
44.5k
        NDR_CHECK(ndr_push_bkup_Win32StreamId(ndr, NDR_SCALARS, &r->streams[cntr_streams_0]));
36
44.5k
      }
37
982
      NDR_CHECK(ndr_push_trailer_align(ndr, 8));
38
982
    }
39
982
    if (ndr_flags & NDR_BUFFERS) {
40
982
    }
41
982
    ndr->flags = _flags_save_STRUCT;
42
982
  }
43
0
  return NDR_ERR_SUCCESS;
44
987
}
45
46
163k
#define _TMP_PULL_REALLOC_N(ndr, s, t, n) do { \
47
163k
  _NDR_PULL_FIX_CURRENT_MEM_CTX(ndr);\
48
163k
  (s) = talloc_realloc(ndr->current_mem_ctx, (s), t, n); \
49
163k
  if (!(s)) { \
50
0
    return ndr_pull_error(ndr, NDR_ERR_ALLOC, \
51
0
              "Alloc %u * %s failed: %s\n", \
52
0
              (unsigned)n, # s, __location__); \
53
0
  } \
54
163k
} while (0)
55
56
_PUBLIC_ enum ndr_err_code ndr_pull_bkup_NTBackupFile(struct ndr_pull *ndr, ndr_flags_type ndr_flags, struct bkup_NTBackupFile *r)
57
2.38k
{
58
2.38k
  uint32_t cntr_streams_0;
59
2.38k
  {
60
2.38k
    libndr_flags _flags_save_STRUCT = ndr->flags;
61
2.38k
    ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
62
2.38k
    if (ndr_flags & NDR_SCALARS) {
63
2.38k
      uint32_t remaining = ndr->data_size - ndr->offset;
64
2.38k
      r->num_stream = 0;
65
2.38k
      r->streams = NULL;
66
164k
      for (cntr_streams_0 = 0; remaining > 0; cntr_streams_0++) {
67
163k
        r->num_stream += 1;
68
163k
        _TMP_PULL_REALLOC_N(ndr, r->streams,
69
163k
                struct bkup_Win32StreamId,
70
163k
                r->num_stream);
71
163k
        NDR_CHECK(ndr_pull_bkup_Win32StreamId(ndr,
72
163k
            NDR_SCALARS,
73
163k
            &r->streams[cntr_streams_0]));
74
161k
        remaining = ndr->data_size - ndr->offset;
75
161k
      }
76
2.38k
    }
77
987
    if (ndr_flags & NDR_BUFFERS) {
78
987
    }
79
987
    ndr->flags = _flags_save_STRUCT;
80
987
  }
81
0
  return NDR_ERR_SUCCESS;
82
2.38k
}