2 Unix SMB/CIFS implementation.
4 routines for marshalling/unmarshalling DCOM string arrays
6 Copyright (C) Jelmer Vernooij 2004
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 2 of the License, or
11 (at your option) any later version.
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.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 NTSTATUS ndr_pull_DUALSTRINGARRAY(struct ndr_pull *ndr, int ndr_flags, struct DUALSTRINGARRAY *ar)
28 uint16_t num_entries, security_offset;
30 uint32_t towernum = 0, conformant_size;
32 if (!(ndr_flags & NDR_SCALARS)) {
36 NDR_CHECK(ndr_pull_uint32(ndr, &conformant_size));
37 NDR_CHECK(ndr_pull_uint16(ndr, &num_entries));
38 NDR_CHECK(ndr_pull_uint16(ndr, &security_offset));
40 ar->stringbindings = talloc_array_p(ndr, struct STRINGBINDING *, num_entries);
41 ar->stringbindings[0] = NULL;
45 NDR_CHECK(ndr_pull_uint16(ndr, &towerid));
49 ar->stringbindings = talloc_realloc_p(ndr, ar->stringbindings, struct STRINGBINDING *, towernum+2);
50 ar->stringbindings[towernum] = talloc_p(ndr, struct STRINGBINDING);
51 NDR_CHECK(ndr_pull_STRINGBINDING(ndr, ndr_flags, ar->stringbindings[towernum]));
54 } while (towerid != 0);
56 ar->stringbindings[towernum] = NULL;
59 ar->securitybindings = talloc_array_p(ndr, struct SECURITYBINDING *, num_entries);
60 ar->securitybindings[0] = NULL;
64 NDR_CHECK(ndr_pull_uint16(ndr, &towerid));
68 ar->securitybindings = talloc_realloc_p(ndr, ar->securitybindings, struct SECURITYBINDING *, towernum+2);
69 ar->securitybindings[towernum] = talloc_p(ndr, struct SECURITYBINDING);
70 NDR_CHECK(ndr_pull_SECURITYBINDING(ndr, ndr_flags, ar->securitybindings[towernum]));
73 } while (towerid != 0);
75 ar->securitybindings[towernum] = NULL;
80 NTSTATUS ndr_push_DUALSTRINGARRAY(struct ndr_push *ndr, int ndr_flags, struct DUALSTRINGARRAY *ar)
82 return NT_STATUS_NOT_SUPPORTED;
88 void ndr_print_DUALSTRINGARRAY(struct ndr_print *ndr, const char *name, struct DUALSTRINGARRAY *ar)
91 ndr->print(ndr, "%-25s: DUALSTRINGARRAY", name);
93 ndr->print(ndr, "STRING BINDINGS");
95 for (i=0;ar->stringbindings[i];i++) {
97 asprintf(&idx, "[%d]", i);
99 ndr_print_STRINGBINDING(ndr, idx, ar->stringbindings[i]);
104 ndr->print(ndr, "SECURITY BINDINGS");
106 for (i=0;ar->securitybindings[i];i++) {
108 asprintf(&idx, "[%d]", i);
110 ndr_print_SECURITYBINDING(ndr, idx, ar->securitybindings[i]);
117 NTSTATUS ndr_pull_STRINGARRAY(struct ndr_pull *ndr, int ndr_flags, struct STRINGARRAY *ar)
120 uint32_t towernum = 0;
121 uint16_t num_entries;
123 if (!(ndr_flags & NDR_SCALARS)) {
127 NDR_CHECK(ndr_pull_uint16(ndr, &num_entries));
129 ar->stringbindings = talloc_array_p(ndr, struct STRINGBINDING *, 1);
130 ar->stringbindings[0] = NULL;
134 NDR_CHECK(ndr_pull_uint16(ndr, &towerid));
138 ar->stringbindings = talloc_realloc_p(ndr, ar->stringbindings, struct STRINGBINDING *, towernum+2);
139 ar->stringbindings[towernum] = talloc_p(ndr, struct STRINGBINDING);
140 NDR_CHECK(ndr_pull_STRINGBINDING(ndr, ndr_flags, ar->stringbindings[towernum]));
143 } while (towerid != 0);
145 ar->stringbindings[towernum] = NULL;
151 NTSTATUS ndr_push_STRINGARRAY(struct ndr_push *ndr, int ndr_flags, struct STRINGARRAY *ar)
153 return NT_STATUS_NOT_SUPPORTED;
159 void ndr_print_STRINGARRAY(struct ndr_print *ndr, const char *name, struct STRINGARRAY *ar)
162 ndr->print(ndr, "%-25s: STRINGARRAY", name);
164 for (i=0;ar->stringbindings[i];i++) {
166 asprintf(&idx, "[%d]", i);
168 ndr_print_STRINGBINDING(ndr, idx, ar->stringbindings[i]);