~ubuntu-branches/ubuntu/maverick/samba/maverick-security

« back to all changes in this revision

Viewing changes to source/pidl/tests/ndr_align.pl

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2009-03-03 22:02:23 UTC
  • mfrom: (0.28.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090303220223-3bdlm2d9fwx1p1ye
Tags: 2:3.3.1-1ubuntu1
* Merge from Debian unstable (LP: #337094), remaining changes:
  + debian/patches/VERSION.patch:
    - setup SAMBA_VERSION_SUFFIX to Ubuntu.
  + 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/mksambapasswd.awk:
    - Do not add user with UID less than 1000 to smbpasswd.
  + debian/control:
    - Make libwbclient0 replace/conflict with hardy's likewise-open.
    - Don't build against ctdb.
  + debian/rules:
    - enable "native" PIE hardening.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
* Dropped changes, merged in Debian:
  + debian/libpam-smbpass.pam-config, debian/libpam-smbpass.postinst,
    debian/libpam-smbpass.prerm, debian/libpam-smbpass.files,
    debian/rules:
    - Make libpam-smbpasswd depend on libpam-runtime to allow 
      libpam-smbpasswd for auto-configuration.
  + debian/control:
    - Provide a config block for the new PAM framework to auto-configure
      itself
  + debian/samba.postinst:
    - When populating the new sambashare group, it is not an error
      if the user simply does not exist; test for this case and let
      the install continue instead of aborting.
  + debian/winbind.files:
    - include additional files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
# NDR alignment tests
 
3
# (C) 2005 Jelmer Vernooij. Published under the GNU GPL
 
4
use strict;
 
5
 
 
6
use Test::More tests => 5 * 8;
 
7
use FindBin qw($RealBin);
 
8
use lib "$RealBin";
 
9
use Util qw(test_samba4_ndr);
 
10
 
 
11
test_samba4_ndr('align-uint8-uint16',
 
12
'
 
13
        typedef [public] struct {
 
14
                uint8 x;
 
15
                uint16 y;
 
16
        } bla;
 
17
',
 
18
'
 
19
        struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL);
 
20
        struct bla r;
 
21
        uint8_t expected[] = { 0x0D, 0x00, 0xef, 0xbe };
 
22
        DATA_BLOB expected_blob = { expected, 4 };
 
23
        DATA_BLOB result_blob;
 
24
        r.x = 13;
 
25
        r.y = 0xbeef;
 
26
 
 
27
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
 
28
                return 1;
 
29
 
 
30
        result_blob = ndr_push_blob(ndr);
 
31
 
 
32
        if (data_blob_cmp(&result_blob, &expected_blob) != 0)
 
33
                return 2;
 
34
');
 
35
 
 
36
test_samba4_ndr('align-uint8-uint32',
 
37
'
 
38
        typedef [public] struct {
 
39
                uint8 x;
 
40
                uint32 y;
 
41
        } bla;
 
42
',
 
43
'
 
44
        struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL);
 
45
        struct bla r;
 
46
        uint8_t expected[] = { 0x0D, 0x00, 0x00, 0x00, 0xef, 0xbe, 0xef, 0xbe };
 
47
        DATA_BLOB expected_blob = { expected, 8 };
 
48
        DATA_BLOB result_blob;
 
49
        r.x = 13;
 
50
        r.y = 0xbeefbeef;
 
51
 
 
52
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
 
53
                return 1;
 
54
 
 
55
        result_blob = ndr_push_blob(ndr);
 
56
 
 
57
        if (data_blob_cmp(&result_blob, &expected_blob) != 0)
 
58
                return 2;
 
59
');
 
60
 
 
61
 
 
62
test_samba4_ndr('align-uint8-hyper',
 
63
'
 
64
        typedef [public] struct {
 
65
                uint8 x;
 
66
                hyper y;
 
67
        } bla;
 
68
',
 
69
'
 
70
        struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL);
 
71
        struct bla r;
 
72
        uint8_t expected[] = { 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
73
                               0xef, 0xbe, 0xef, 0xbe, 0xef, 0xbe, 0xef, 0xbe };
 
74
        DATA_BLOB expected_blob = { expected, 16 };
 
75
        DATA_BLOB result_blob;
 
76
        r.x = 13;
 
77
        r.y = 0xbeefbeefbeefbeefLLU;
 
78
 
 
79
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
 
80
                return 1;
 
81
 
 
82
        result_blob = ndr_push_blob(ndr);
 
83
 
 
84
        if (data_blob_cmp(&result_blob, &expected_blob) != 0)
 
85
                return 2;
 
86
');
 
87
 
 
88
test_samba4_ndr('noalignflag-uint8-uint16',
 
89
'
 
90
        typedef [public] struct {
 
91
                uint8 x;
 
92
                uint16 y;
 
93
        } bla;
 
94
',
 
95
'
 
96
        struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL);
 
97
        struct bla r;
 
98
        uint8_t expected[] = { 0x0D, 0xef, 0xbe };
 
99
        DATA_BLOB expected_blob = { expected, 3 };
 
100
        DATA_BLOB result_blob;
 
101
        ndr->flags |= LIBNDR_FLAG_NOALIGN;
 
102
 
 
103
        r.x = 13;
 
104
        r.y = 0xbeef;
 
105
 
 
106
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
 
107
                return 1;
 
108
 
 
109
        result_blob = ndr_push_blob(ndr);
 
110
 
 
111
        if (data_blob_cmp(&result_blob, &expected_blob) != 0)
 
112
                return 2;
 
113
');
 
114
 
 
115
test_samba4_ndr('align-blob-align2',
 
116
'
 
117
        typedef [public] struct {
 
118
                uint8 x;
 
119
                [flag(LIBNDR_FLAG_ALIGN2)] DATA_BLOB data;
 
120
                uint8 y;
 
121
        } blie;
 
122
',
 
123
'
 
124
        struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL);
 
125
        struct blie r;
 
126
        uint8_t data[] = { 0x01, 0x02 };
 
127
        uint8_t expected[] = { 0x0D, 0x00, 0x0E };
 
128
        DATA_BLOB expected_blob = { expected, 3 };
 
129
        DATA_BLOB result_blob;
 
130
 
 
131
        r.x = 13;
 
132
        r.y = 14;
 
133
        r.data.data = data;
 
134
        r.data.length = 2;
 
135
 
 
136
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_blie(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
 
137
                return 1;
 
138
 
 
139
        result_blob = ndr_push_blob(ndr);
 
140
 
 
141
        if (data_blob_cmp(&result_blob, &expected_blob) != 0)
 
142
                return 2;
 
143
');