Coverage Report

Created: 2026-02-14 07:07

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
1.01k
{
28
1.01k
  uint32_t cntr_streams_0;
29
1.01k
  {
30
1.01k
    libndr_flags _flags_save_STRUCT = ndr->flags;
31
1.01k
    ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
32
1.01k
    if (ndr_flags & NDR_SCALARS) {
33
1.01k
      NDR_CHECK(ndr_push_align(ndr, 2));
34
45.6k
      for (cntr_streams_0 = 0; cntr_streams_0 < r->num_stream; cntr_streams_0++) {
35
44.6k
        NDR_CHECK(ndr_push_bkup_Win32StreamId(ndr, NDR_SCALARS, &r->streams[cntr_streams_0]));
36
44.6k
      }
37
1.00k
      NDR_CHECK(ndr_push_trailer_align(ndr, 8));
38
1.00k
    }
39
1.00k
    if (ndr_flags & NDR_BUFFERS) {
40
1.00k
    }
41
1.00k
    ndr->flags = _flags_save_STRUCT;
42
1.00k
  }
43
0
  return NDR_ERR_SUCCESS;
44
1.01k
}
45
46
164k
#define _TMP_PULL_REALLOC_N(ndr, s, t, n) do { \
47
164k
  _NDR_PULL_FIX_CURRENT_MEM_CTX(ndr);\
48
164k
  (s) = talloc_realloc(ndr->current_mem_ctx, (s), t, n); \
49
164k
  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
164k
} 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.41k
{
58
2.41k
  uint32_t cntr_streams_0;
59
2.41k
  {
60
2.41k
    libndr_flags _flags_save_STRUCT = ndr->flags;
61
2.41k
    ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
62
2.41k
    if (ndr_flags & NDR_SCALARS) {
63
2.41k
      uint32_t remaining = ndr->data_size - ndr->offset;
64
2.41k
      r->num_stream = 0;
65
2.41k
      r->streams = NULL;
66
165k
      for (cntr_streams_0 = 0; remaining > 0; cntr_streams_0++) {
67
164k
        r->num_stream += 1;
68
164k
        _TMP_PULL_REALLOC_N(ndr, r->streams,
69
164k
                struct bkup_Win32StreamId,
70
164k
                r->num_stream);
71
164k
        NDR_CHECK(ndr_pull_bkup_Win32StreamId(ndr,
72
164k
            NDR_SCALARS,
73
164k
            &r->streams[cntr_streams_0]));
74
162k
        remaining = ndr->data_size - ndr->offset;
75
162k
      }
76
2.41k
    }
77
1.01k
    if (ndr_flags & NDR_BUFFERS) {
78
1.01k
    }
79
1.01k
    ndr->flags = _flags_save_STRUCT;
80
1.01k
  }
81
0
  return NDR_ERR_SUCCESS;
82
2.41k
}