~ubuntu-branches/ubuntu/vivid/samba/vivid

« back to all changes in this revision

Viewing changes to source3/librpc/gen_ndr/ndr_printcap.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
static enum ndr_err_code ndr_push_pcap_printer(struct ndr_push *ndr, int ndr_flags, const struct pcap_printer *r)
7
7
{
8
8
        if (ndr_flags & NDR_SCALARS) {
9
 
                NDR_CHECK(ndr_push_align(ndr, 4));
 
9
                NDR_CHECK(ndr_push_align(ndr, 5));
10
10
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->name));
11
11
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->info));
 
12
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->location));
 
13
                NDR_CHECK(ndr_push_trailer_align(ndr, 5));
12
14
        }
13
15
        if (ndr_flags & NDR_BUFFERS) {
14
16
                if (r->name) {
15
 
                        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF8)));
16
 
                        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
17
 
                        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF8)));
 
17
                        NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF8)));
 
18
                        NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, 0));
 
19
                        NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF8)));
18
20
                        NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, ndr_charset_length(r->name, CH_UTF8), sizeof(uint8_t), CH_UTF8));
19
21
                }
20
22
                if (r->info) {
21
 
                        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->info, CH_UTF8)));
22
 
                        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
23
 
                        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->info, CH_UTF8)));
 
23
                        NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->info, CH_UTF8)));
 
24
                        NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, 0));
 
25
                        NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->info, CH_UTF8)));
24
26
                        NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->info, ndr_charset_length(r->info, CH_UTF8), sizeof(uint8_t), CH_UTF8));
25
27
                }
 
28
                if (r->location) {
 
29
                        NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->location, CH_UTF8)));
 
30
                        NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, 0));
 
31
                        NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->location, CH_UTF8)));
 
32
                        NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->location, ndr_charset_length(r->location, CH_UTF8), sizeof(uint8_t), CH_UTF8));
 
33
                }
26
34
        }
27
35
        return NDR_ERR_SUCCESS;
28
36
}
33
41
        TALLOC_CTX *_mem_save_name_0;
34
42
        uint32_t _ptr_info;
35
43
        TALLOC_CTX *_mem_save_info_0;
 
44
        uint32_t _ptr_location;
 
45
        TALLOC_CTX *_mem_save_location_0;
36
46
        if (ndr_flags & NDR_SCALARS) {
37
 
                NDR_CHECK(ndr_pull_align(ndr, 4));
 
47
                NDR_CHECK(ndr_pull_align(ndr, 5));
38
48
                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name));
39
49
                if (_ptr_name) {
40
50
                        NDR_PULL_ALLOC(ndr, r->name);
47
57
                } else {
48
58
                        r->info = NULL;
49
59
                }
 
60
                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_location));
 
61
                if (_ptr_location) {
 
62
                        NDR_PULL_ALLOC(ndr, r->location);
 
63
                } else {
 
64
                        r->location = NULL;
 
65
                }
 
66
                NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
50
67
        }
51
68
        if (ndr_flags & NDR_BUFFERS) {
52
69
                if (r->name) {
73
90
                        NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->info, ndr_get_array_length(ndr, &r->info), sizeof(uint8_t), CH_UTF8));
74
91
                        NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
75
92
                }
 
93
                if (r->location) {
 
94
                        _mem_save_location_0 = NDR_PULL_GET_MEM_CTX(ndr);
 
95
                        NDR_PULL_SET_MEM_CTX(ndr, r->location, 0);
 
96
                        NDR_CHECK(ndr_pull_array_size(ndr, &r->location));
 
97
                        NDR_CHECK(ndr_pull_array_length(ndr, &r->location));
 
98
                        if (ndr_get_array_length(ndr, &r->location) > ndr_get_array_size(ndr, &r->location)) {
 
99
                                return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->location), ndr_get_array_length(ndr, &r->location));
 
100
                        }
 
101
                        NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->location), sizeof(uint8_t)));
 
102
                        NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->location, ndr_get_array_length(ndr, &r->location), sizeof(uint8_t), CH_UTF8));
 
103
                        NDR_PULL_SET_MEM_CTX(ndr, _mem_save_location_0, 0);
 
104
                }
76
105
        }
77
106
        return NDR_ERR_SUCCESS;
78
107
}
80
109
_PUBLIC_ void ndr_print_pcap_printer(struct ndr_print *ndr, const char *name, const struct pcap_printer *r)
81
110
{
82
111
        ndr_print_struct(ndr, name, "pcap_printer");
 
112
        if (r == NULL) { ndr_print_null(ndr); return; }
83
113
        ndr->depth++;
84
114
        ndr_print_ptr(ndr, "name", r->name);
85
115
        ndr->depth++;
93
123
                ndr_print_string(ndr, "info", r->info);
94
124
        }
95
125
        ndr->depth--;
 
126
        ndr_print_ptr(ndr, "location", r->location);
 
127
        ndr->depth++;
 
128
        if (r->location) {
 
129
                ndr_print_string(ndr, "location", r->location);
 
130
        }
 
131
        ndr->depth--;
96
132
        ndr->depth--;
97
133
}
98
134
 
100
136
{
101
137
        uint32_t cntr_printers_0;
102
138
        if (ndr_flags & NDR_SCALARS) {
103
 
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
104
 
                NDR_CHECK(ndr_push_align(ndr, 4));
 
139
                NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->count));
 
140
                NDR_CHECK(ndr_push_align(ndr, 5));
105
141
                NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->status));
106
142
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
107
143
                for (cntr_printers_0 = 0; cntr_printers_0 < r->count; cntr_printers_0++) {
108
144
                        NDR_CHECK(ndr_push_pcap_printer(ndr, NDR_SCALARS, &r->printers[cntr_printers_0]));
109
145
                }
 
146
                NDR_CHECK(ndr_push_trailer_align(ndr, 5));
110
147
        }
111
148
        if (ndr_flags & NDR_BUFFERS) {
112
149
                for (cntr_printers_0 = 0; cntr_printers_0 < r->count; cntr_printers_0++) {
122
159
        TALLOC_CTX *_mem_save_printers_0;
123
160
        if (ndr_flags & NDR_SCALARS) {
124
161
                NDR_CHECK(ndr_pull_array_size(ndr, &r->printers));
125
 
                NDR_CHECK(ndr_pull_align(ndr, 4));
 
162
                NDR_CHECK(ndr_pull_align(ndr, 5));
126
163
                NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->status));
127
164
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
128
165
                NDR_PULL_ALLOC_N(ndr, r->printers, ndr_get_array_size(ndr, &r->printers));
135
172
                if (r->printers) {
136
173
                        NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->printers, r->count));
137
174
                }
 
175
                NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
138
176
        }
139
177
        if (ndr_flags & NDR_BUFFERS) {
140
178
                _mem_save_printers_0 = NDR_PULL_GET_MEM_CTX(ndr);
151
189
{
152
190
        uint32_t cntr_printers_0;
153
191
        ndr_print_struct(ndr, name, "pcap_data");
 
192
        if (r == NULL) { ndr_print_null(ndr); return; }
154
193
        ndr->depth++;
155
194
        ndr_print_NTSTATUS(ndr, "status", r->status);
156
195
        ndr_print_uint32(ndr, "count", r->count);
157
196
        ndr->print(ndr, "%s: ARRAY(%d)", "printers", (int)r->count);
158
197
        ndr->depth++;
159
198
        for (cntr_printers_0=0;cntr_printers_0<r->count;cntr_printers_0++) {
160
 
                char *idx_0=NULL;
161
 
                if (asprintf(&idx_0, "[%d]", cntr_printers_0) != -1) {
162
 
                        ndr_print_pcap_printer(ndr, "printers", &r->printers[cntr_printers_0]);
163
 
                        free(idx_0);
164
 
                }
 
199
                ndr_print_pcap_printer(ndr, "printers", &r->printers[cntr_printers_0]);
165
200
        }
166
201
        ndr->depth--;
167
202
        ndr->depth--;
168
203
}
 
204