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

« back to all changes in this revision

Viewing changes to source/pidl/tests/ndr_alloc.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 allocation 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
# Check that an outgoing scalar pointer is allocated correctly
 
12
 
 
13
test_samba4_ndr("alloc-scalar",
 
14
'
 
15
        typedef struct {
 
16
                uint8 *x;
 
17
        } bla;
 
18
 
 
19
        [public] void TestAlloc([in] bla foo);
 
20
','
 
21
        uint8_t data[] = { 0xde, 0xad, 0xbe, 0xef, 0x03 };
 
22
        DATA_BLOB b = { data, 5 };
 
23
        struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL, NULL);
 
24
        struct TestAlloc r;
 
25
 
 
26
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_TestAlloc(ndr, NDR_IN, &r)))
 
27
                return 1;
 
28
 
 
29
        if (r.in.foo.x == NULL)
 
30
                return 2;
 
31
 
 
32
        if (*r.in.foo.x != 0x03)
 
33
                return 3;
 
34
'
 
35
);
 
36
 
 
37
# Check that an outgoing buffer pointer is allocated correctly
 
38
test_samba4_ndr("alloc-buffer",
 
39
'
 
40
        typedef struct { uint8 data; } blie;
 
41
        typedef struct { blie *x; } bla;
 
42
 
 
43
        [public] void TestAlloc([in] bla foo);
 
44
','
 
45
        uint8_t data[] = { 0xde, 0xad, 0xbe, 0xef, 0x03 };
 
46
        DATA_BLOB b = { data, 5 };
 
47
        struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL, NULL);
 
48
        struct TestAlloc r;
 
49
 
 
50
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_TestAlloc(ndr, NDR_IN, &r)))
 
51
                return 1;
 
52
 
 
53
        if (r.in.foo.x == NULL)
 
54
                return 2;
 
55
 
 
56
        if (r.in.foo.x->data != 0x03)
 
57
                return 3;
 
58
'
 
59
);
 
60
 
 
61
# Check that ref pointers aren't allocated by default
 
62
test_samba4_ndr("ref-noalloc-null",
 
63
'
 
64
        [public] void TestAlloc([in,ref] uint8 *t);
 
65
','
 
66
        uint8_t data[] = { 0x03 };
 
67
        DATA_BLOB b = { data, 1 };
 
68
        struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL, NULL);
 
69
        struct TestAlloc r;
 
70
        r.in.t = NULL;
 
71
 
 
72
        if (NDR_ERR_CODE_IS_SUCCESS(ndr_pull_TestAlloc(ndr, NDR_IN, &r)))
 
73
                return 1;
 
74
'
 
75
);
 
76
 
 
77
# Check that ref pointers aren't allocated by default
 
78
test_samba4_ndr("ref-noalloc",
 
79
'
 
80
        [public] void TestAlloc([in,ref] uint8 *t);
 
81
','
 
82
        uint8_t data[] = { 0x03 };
 
83
        DATA_BLOB b = { data, 1 };
 
84
        struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL, NULL);
 
85
        struct TestAlloc r;
 
86
        uint8_t x;
 
87
        r.in.t = &x;
 
88
 
 
89
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_TestAlloc(ndr, NDR_IN, &r)))
 
90
                return 1;
 
91
 
 
92
        if (*r.in.t != 0x03)
 
93
                return 2;
 
94
'
 
95
);
 
96
 
 
97
# Check that an outgoing ref pointer is allocated correctly
 
98
test_samba4_ndr("ref-alloc",
 
99
'
 
100
        [public] void TestAlloc([in,ref] uint8 *t);
 
101
','
 
102
        uint8_t data[] = { 0x03 };
 
103
        DATA_BLOB b = { data, 1 };
 
104
        struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL, NULL);
 
105
        struct TestAlloc r;
 
106
        ndr->flags |= LIBNDR_FLAG_REF_ALLOC;
 
107
        r.in.t = NULL;
 
108
 
 
109
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_TestAlloc(ndr, NDR_IN, &r)))
 
110
                return 1;
 
111
 
 
112
        if (r.in.t == NULL)
 
113
                return 2;
 
114
 
 
115
        if (*r.in.t != 0x03)
 
116
                return 3;
 
117
'
 
118
);