~veger/ubuntu/precise/samba/fix-for-902339

« back to all changes in this revision

Viewing changes to librpc/ndr/ndr_drsblobs.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:
4
4
   Manually parsed structures found in the DRS protocol
5
5
 
6
6
   Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008
 
7
   Copyright (C) Guenther Deschner <gd@samba.org> 2010
7
8
   
8
9
   This program is free software; you can redistribute it and/or modify
9
10
   it under the terms of the GNU General Public License as published by
21
22
 
22
23
#include "includes.h"
23
24
#include "librpc/gen_ndr/ndr_drsblobs.h"
24
 
 
25
 
/* parser auto-generated by pidl, then hand-modified by abartlet */
26
 
 
27
 
/* Modified to have 'count' specified */
28
 
static enum ndr_err_code ndr_push_AuthenticationInformationArray_with_count(struct ndr_push *ndr, int ndr_flags, int count, 
29
 
                                                                 const struct AuthenticationInformationArray *r)
 
25
#include "../lib/util/asn1.h"
 
26
 
 
27
_PUBLIC_ enum ndr_err_code ndr_push_AuthenticationInformationArray(struct ndr_push *ndr, int ndr_flags, const struct AuthenticationInformationArray *r)
30
28
{
31
29
        uint32_t cntr_array_0;
32
30
        if (ndr_flags & NDR_SCALARS) {
33
31
                NDR_CHECK(ndr_push_align(ndr, 4));
34
 
                for (cntr_array_0 = 0; cntr_array_0 < count; cntr_array_0++) {
 
32
                for (cntr_array_0 = 0; cntr_array_0 < r->count; cntr_array_0++) {
35
33
                        NDR_CHECK(ndr_push_AuthenticationInformation(ndr, NDR_SCALARS, &r->array[cntr_array_0]));
36
34
                }
 
35
                NDR_CHECK(ndr_push_trailer_align(ndr, 4));
37
36
        }
38
37
        if (ndr_flags & NDR_BUFFERS) {
39
 
                for (cntr_array_0 = 0; cntr_array_0 < count; cntr_array_0++) {
40
 
                        NDR_CHECK(ndr_push_AuthenticationInformation(ndr, NDR_BUFFERS, &r->array[cntr_array_0]));
41
 
                }
42
38
        }
43
39
        return NDR_ERR_SUCCESS;
44
40
}
45
41
 
46
 
/* Modified to have 'count' specified, and to allocate the array */
47
 
static enum ndr_err_code ndr_pull_AuthenticationInformationArray_with_count(struct ndr_pull *ndr, int ndr_flags, int count, struct AuthenticationInformationArray *r)
 
42
_PUBLIC_ enum ndr_err_code ndr_pull_AuthenticationInformationArray(struct ndr_pull *ndr, int ndr_flags, struct AuthenticationInformationArray *r)
48
43
{
49
 
        uint32_t cntr_array_0;
50
 
        TALLOC_CTX *_mem_save_array_0;
51
44
        if (ndr_flags & NDR_SCALARS) {
52
 
                NDR_CHECK(ndr_pull_align(ndr, 4));
53
 
                NDR_PULL_ALLOC_N(ndr, r->array, count);
54
 
                _mem_save_array_0 = NDR_PULL_GET_MEM_CTX(ndr);
55
 
                NDR_PULL_SET_MEM_CTX(ndr, r->array, 0);
56
 
                for (cntr_array_0 = 0; cntr_array_0 < count; cntr_array_0++) {
57
 
                        NDR_CHECK(ndr_pull_AuthenticationInformation(ndr, NDR_SCALARS, &r->array[cntr_array_0]));
 
45
                r->count = 0;
 
46
                NDR_PULL_ALLOC_N(ndr, r->array, r->count);
 
47
                /* entry is at least 16 bytes large */
 
48
                while (ndr->offset + 16 <= ndr->data_size) {
 
49
                        r->array = talloc_realloc(ndr, r->array, struct AuthenticationInformation, r->count + 1);
 
50
                        NDR_ERR_HAVE_NO_MEMORY(r->array);
 
51
                        NDR_CHECK(ndr_pull_AuthenticationInformation(ndr, NDR_SCALARS, &r->array[r->count]));
 
52
                        r->count++;
58
53
                }
59
 
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_array_0, 0);
 
54
                NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
60
55
        }
61
56
        if (ndr_flags & NDR_BUFFERS) {
62
 
                for (cntr_array_0 = 0; cntr_array_0 < count; cntr_array_0++) {
63
 
                        NDR_CHECK(ndr_pull_AuthenticationInformation(ndr, NDR_BUFFERS, &r->array[cntr_array_0]));
64
 
                }
65
57
        }
66
58
        return NDR_ERR_SUCCESS;
67
59
}
68
60
 
69
 
/* Modified to have 'count' specified */
70
 
_PUBLIC_ void ndr_print_AuthenticationInformationArray_with_count(struct ndr_print *ndr, const char *name, int count, const struct AuthenticationInformationArray *r)
71
 
{
72
 
        uint32_t cntr_array_0;
73
 
        ndr_print_struct(ndr, name, "AuthenticationInformationArray");
74
 
        ndr->depth++;
75
 
        ndr->print(ndr, "%s: ARRAY(%d)", "array", (int)1);
76
 
        ndr->depth++;
77
 
        for (cntr_array_0=0;cntr_array_0<count;cntr_array_0++) {
78
 
                char *idx_0=NULL;
79
 
                if (asprintf(&idx_0, "[%d]", cntr_array_0) != -1) {
80
 
                        ndr_print_AuthenticationInformation(ndr, "array", &r->array[cntr_array_0]);
81
 
                        free(idx_0);
82
 
                }
83
 
        }
84
 
        ndr->depth--;
85
 
        ndr->depth--;
86
 
}
87
 
 
88
 
/* Modified to call AuthenticationInformationArray with 'count' specified */
89
61
_PUBLIC_ enum ndr_err_code ndr_push_trustAuthInOutBlob(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutBlob *r)
90
62
{
91
63
        if (ndr_flags & NDR_SCALARS) {
92
64
                NDR_CHECK(ndr_push_align(ndr, 4));
93
65
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
94
 
                NDR_CHECK(ndr_push_relative_ptr1(ndr, r->current));
95
 
                NDR_CHECK(ndr_push_relative_ptr1(ndr, r->previous));
96
 
        }
97
 
        if (ndr_flags & NDR_BUFFERS) {
98
 
                if (r->current) {
99
 
                        NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->current));
100
 
                        NDR_CHECK(ndr_push_AuthenticationInformationArray_with_count(ndr, NDR_SCALARS|NDR_BUFFERS, r->count, r->current));
101
 
                        NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->current));
102
 
                }
103
 
                if (r->previous) {
104
 
                        NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->previous));
105
 
                        NDR_CHECK(ndr_push_AuthenticationInformationArray_with_count(ndr, NDR_SCALARS|NDR_BUFFERS, r->count, r->previous));
106
 
                        NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->previous));
107
 
                }
108
 
        }
109
 
        return NDR_ERR_SUCCESS;
110
 
}
111
 
 
112
 
_PUBLIC_ enum ndr_err_code ndr_pull_trustAuthInOutBlob(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutBlob *r)
113
 
{
114
 
        uint32_t _ptr_current;
115
 
        TALLOC_CTX *_mem_save_current_0;
116
 
        uint32_t _ptr_previous;
117
 
        TALLOC_CTX *_mem_save_previous_0;
118
 
        if (ndr_flags & NDR_SCALARS) {
119
 
                NDR_CHECK(ndr_pull_align(ndr, 4));
120
 
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
121
 
                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_current));
122
 
                if (_ptr_current) {
123
 
                        NDR_PULL_ALLOC(ndr, r->current);
124
 
                        NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->current, _ptr_current));
125
 
                } else {
126
 
                        r->current = NULL;
127
 
                }
128
 
                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_previous));
129
 
                if (_ptr_previous) {
130
 
                        NDR_PULL_ALLOC(ndr, r->previous);
131
 
                        NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->previous, _ptr_previous));
132
 
                } else {
133
 
                        r->previous = NULL;
134
 
                }
135
 
        }
136
 
        if (ndr_flags & NDR_BUFFERS) {
137
 
                if (r->current) {
138
 
                        uint32_t _relative_save_offset;
139
 
                        _relative_save_offset = ndr->offset;
140
 
                        NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->current));
141
 
                        _mem_save_current_0 = NDR_PULL_GET_MEM_CTX(ndr);
142
 
                        NDR_PULL_SET_MEM_CTX(ndr, r->current, 0);
143
 
                        NDR_CHECK(ndr_pull_AuthenticationInformationArray_with_count(ndr, NDR_SCALARS|NDR_BUFFERS, r->count, r->current));
144
 
                        NDR_PULL_SET_MEM_CTX(ndr, _mem_save_current_0, 0);
145
 
                        ndr->offset = _relative_save_offset;
146
 
                }
147
 
                if (r->previous) {
148
 
                        uint32_t _relative_save_offset;
149
 
                        _relative_save_offset = ndr->offset;
150
 
                        NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->previous));
151
 
                        _mem_save_previous_0 = NDR_PULL_GET_MEM_CTX(ndr);
152
 
                        NDR_PULL_SET_MEM_CTX(ndr, r->previous, 0);
153
 
                        NDR_CHECK(ndr_pull_AuthenticationInformationArray_with_count(ndr, NDR_SCALARS|NDR_BUFFERS, r->count, r->previous));
154
 
                        NDR_PULL_SET_MEM_CTX(ndr, _mem_save_previous_0, 0);
155
 
                        ndr->offset = _relative_save_offset;
156
 
                }
157
 
        }
158
 
        return NDR_ERR_SUCCESS;
159
 
}
160
 
 
161
 
_PUBLIC_ void ndr_print_trustAuthInOutBlob(struct ndr_print *ndr, const char *name, const struct trustAuthInOutBlob *r)
162
 
{
163
 
        ndr_print_struct(ndr, name, "trustAuthInOutBlob");
164
 
        ndr->depth++;
165
 
        ndr_print_uint32(ndr, "count", r->count);
166
 
        ndr_print_ptr(ndr, "current", r->current);
167
 
        ndr->depth++;
168
 
        if (r->current) {
169
 
                ndr_print_AuthenticationInformationArray_with_count(ndr, "current", r->count, r->current);
170
 
        }
171
 
        ndr->depth--;
172
 
        ndr_print_ptr(ndr, "previous", r->previous);
173
 
        ndr->depth++;
174
 
        if (r->previous) {
175
 
                ndr_print_AuthenticationInformationArray_with_count(ndr, "previous", r->count, r->previous);
176
 
        }
177
 
        ndr->depth--;
178
 
        ndr->depth--;
179
 
}
 
66
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, (r->count > 0)?12:0));
 
67
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, (r->count > 0)?12 + ndr_size_AuthenticationInformationArray(&r->current, ndr_flags):0));
 
68
                {
 
69
                        struct ndr_push *_ndr_current;
 
70
                        NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_current, 0, ((r->count > 0)?12 + ndr_size_AuthenticationInformationArray(&r->current, ndr_flags):0) - ((r->count > 0)?12:0)));
 
71
                        NDR_CHECK(ndr_push_AuthenticationInformationArray(_ndr_current, NDR_SCALARS, &r->current));
 
72
                        NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_current, 0, ((r->count > 0)?12 + ndr_size_AuthenticationInformationArray(&r->current, ndr_flags):0) - ((r->count > 0)?12:0)));
 
73
                }
 
74
                {
 
75
                        uint32_t _flags_save_AuthenticationInformationArray = ndr->flags;
 
76
                        ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
 
77
                        {
 
78
                                struct ndr_push *_ndr_previous;
 
79
                                NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_previous, 0, -1));
 
80
                                NDR_CHECK(ndr_push_AuthenticationInformationArray(_ndr_previous, NDR_SCALARS, &r->previous));
 
81
                                NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_previous, 0, -1));
 
82
                        }
 
83
                        ndr->flags = _flags_save_AuthenticationInformationArray;
 
84
                }
 
85
                NDR_CHECK(ndr_push_trailer_align(ndr, 4));
 
86
        }
 
87
        if (ndr_flags & NDR_BUFFERS) {
 
88
        }
 
89
        return NDR_ERR_SUCCESS;
 
90
}
 
91
 
180
92
 
181
93
_PUBLIC_ enum ndr_err_code ndr_pull_trustDomainPasswords(struct ndr_pull *ndr, int ndr_flags, struct trustDomainPasswords *r)
182
94
{
196
108
                {
197
109
                        struct ndr_pull *_ndr_outgoing;
198
110
                        NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_outgoing, 0, r->outgoing_size));
199
 
                        NDR_CHECK(ndr_pull_trustCurrentPasswords(_ndr_outgoing, NDR_SCALARS|NDR_BUFFERS, &r->outgoing));
 
111
                        NDR_CHECK(ndr_pull_trustAuthInOutBlob(_ndr_outgoing, NDR_SCALARS|NDR_BUFFERS, &r->outgoing));
200
112
                        NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_outgoing, 0, r->outgoing_size));
201
113
                }
202
114
                {
203
115
                        struct ndr_pull *_ndr_incoming;
204
116
                        NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_incoming, 0, r->incoming_size));
205
 
                        NDR_CHECK(ndr_pull_trustCurrentPasswords(_ndr_incoming, NDR_SCALARS|NDR_BUFFERS, &r->incoming));
 
117
                        NDR_CHECK(ndr_pull_trustAuthInOutBlob(_ndr_incoming, NDR_SCALARS|NDR_BUFFERS, &r->incoming));
206
118
                        NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_incoming, 0, r->incoming_size));
207
119
                }
208
120
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->outgoing_size));
213
125
        return NDR_ERR_SUCCESS;
214
126
}
215
127
 
 
128
_PUBLIC_ void ndr_print_drsuapi_MSPrefixMap_Entry(struct ndr_print *ndr, const char *name, const struct drsuapi_MSPrefixMap_Entry *r)
 
129
{
 
130
        ndr_print_struct(ndr, name, "drsuapi_MSPrefixMap_Entry");
 
131
        {
 
132
                uint32_t _flags_save_STRUCT = ndr->flags;
 
133
                ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
 
134
                ndr->depth++;
 
135
                ndr_print_uint16(ndr, "entryID", r->entryID);
 
136
                ndr->print(ndr, "%-25s: length=%u", "oid", r->length);
 
137
                if (r->binary_oid) {
 
138
                        char *partial_oid = NULL;
 
139
                        DATA_BLOB oid_blob = data_blob_const(r->binary_oid, r->length);
 
140
                        char *hex_str = data_blob_hex_string_upper(ndr, &oid_blob);
 
141
                        ber_read_partial_OID_String(ndr, oid_blob, &partial_oid);
 
142
                        ndr->depth++;
 
143
                        ndr->print(ndr, "%-25s: 0x%s (%s)", "binary_oid", hex_str, partial_oid);
 
144
                        ndr->depth--;
 
145
                        talloc_free(hex_str);
 
146
                        talloc_free(partial_oid);
 
147
                }
 
148
                ndr->depth--;
 
149
                ndr->flags = _flags_save_STRUCT;
 
150
        }
 
151
}