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

« back to all changes in this revision

Viewing changes to source4/heimdal/lib/asn1/asn1-template.h

  • 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:
 
1
/*
 
2
 * Copyright (c) 1997 - 2006 Kungliga Tekniska H�gskolan
 
3
 * (Royal Institute of Technology, Stockholm, Sweden).
 
4
 * All rights reserved.
 
5
 *
 
6
 * Portions Copyright (c) 2009 Apple Inc. All rights reserved.
 
7
 *
 
8
 * Redistribution and use in source and binary forms, with or without
 
9
 * modification, are permitted provided that the following conditions
 
10
 * are met:
 
11
 *
 
12
 * 1. Redistributions of source code must retain the above copyright
 
13
 *    notice, this list of conditions and the following disclaimer.
 
14
 *
 
15
 * 2. Redistributions in binary form must reproduce the above copyright
 
16
 *    notice, this list of conditions and the following disclaimer in the
 
17
 *    documentation and/or other materials provided with the distribution.
 
18
 *
 
19
 * 3. Neither the name of the Institute nor the names of its contributors
 
20
 *    may be used to endorse or promote products derived from this software
 
21
 *    without specific prior written permission.
 
22
 *
 
23
 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
 
24
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
25
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
26
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
 
27
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
28
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 
29
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 
30
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
31
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 
32
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 
33
 * SUCH DAMAGE.
 
34
 */
 
35
 
 
36
/* asn1 templates */
 
37
 
 
38
#ifndef __TEMPLATE_H__
 
39
#define __TEMPLATE_H__
 
40
 
 
41
/* tag:
 
42
 *  0..20 tag
 
43
 * 21     type
 
44
 * 22..23 class
 
45
 * 24..27 flags
 
46
 * 28..31 op
 
47
 */
 
48
 
 
49
/* parse:
 
50
 *  0..11 type
 
51
 * 12..23 unused
 
52
 * 24..27 flags
 
53
 * 28..31 op
 
54
 */
 
55
 
 
56
#define A1_OP_MASK              (0xf0000000)
 
57
#define A1_OP_TYPE              (0x10000000)
 
58
#define A1_OP_TYPE_EXTERN       (0x20000000)
 
59
#define A1_OP_TAG               (0x30000000)
 
60
#define A1_OP_PARSE             (0x40000000)
 
61
#define A1_OP_SEQOF             (0x50000000)
 
62
#define A1_OP_SETOF             (0x60000000)
 
63
#define A1_OP_BMEMBER           (0x70000000)
 
64
#define A1_OP_CHOICE            (0x80000000)
 
65
 
 
66
#define A1_FLAG_MASK            (0x0f000000)
 
67
#define A1_FLAG_OPTIONAL        (0x01000000)
 
68
#define A1_FLAG_IMPLICIT        (0x02000000)
 
69
 
 
70
#define A1_TAG_T(CLASS,TYPE,TAG)        ((A1_OP_TAG) | (((CLASS) << 22) | ((TYPE) << 21) | (TAG)))
 
71
#define A1_TAG_CLASS(x)         (((x) >> 22) & 0x3)
 
72
#define A1_TAG_TYPE(x)          (((x) >> 21) & 0x1)
 
73
#define A1_TAG_TAG(x)           ((x) & 0x1fffff)
 
74
 
 
75
#define A1_TAG_LEN(t)           ((uintptr_t)(t)->ptr)
 
76
#define A1_HEADER_LEN(t)        ((uintptr_t)(t)->ptr)
 
77
 
 
78
#define A1_PARSE_T(type)        ((A1_OP_PARSE) | (type))
 
79
#define A1_PARSE_TYPE_MASK      0xfff
 
80
#define A1_PARSE_TYPE(x)        (A1_PARSE_TYPE_MASK & (x))
 
81
 
 
82
#define A1_PF_INDEFINTE         0x1
 
83
#define A1_PF_ALLOW_BER         0x2
 
84
 
 
85
#define A1_HF_PRESERVE          0x1
 
86
#define A1_HF_ELLIPSIS          0x2
 
87
 
 
88
#define A1_HBF_RFC1510          0x1
 
89
 
 
90
 
 
91
struct asn1_template {
 
92
    uint32_t tt;
 
93
    size_t offset;
 
94
    const void *ptr;
 
95
};
 
96
 
 
97
typedef int (*asn1_type_decode)(const unsigned char *, size_t, void *, size_t *);
 
98
typedef int (*asn1_type_encode)(unsigned char *, size_t, const void *, size_t *);
 
99
typedef size_t (*asn1_type_length)(const void *);
 
100
typedef void (*asn1_type_release)(void *);
 
101
typedef int (*asn1_type_copy)(const void *, void *);
 
102
 
 
103
struct asn1_type_func {
 
104
    asn1_type_encode encode;
 
105
    asn1_type_decode decode;
 
106
    asn1_type_length length;
 
107
    asn1_type_copy copy;
 
108
    asn1_type_release release;
 
109
    size_t size;
 
110
};
 
111
 
 
112
struct template_of {
 
113
    unsigned int len;
 
114
    void *val;
 
115
};
 
116
 
 
117
enum template_types {
 
118
    A1T_IMEMBER = 0,
 
119
    A1T_HEIM_INTEGER,
 
120
    A1T_INTEGER,
 
121
    A1T_UNSIGNED,
 
122
    A1T_GENERAL_STRING,
 
123
    A1T_OCTET_STRING,
 
124
    A1T_OCTET_STRING_BER,
 
125
    A1T_IA5_STRING,
 
126
    A1T_BMP_STRING,
 
127
    A1T_UNIVERSAL_STRING,
 
128
    A1T_PRINTABLE_STRING,
 
129
    A1T_VISIBLE_STRING,
 
130
    A1T_UTF8_STRING,
 
131
    A1T_GENERALIZED_TIME,
 
132
    A1T_UTC_TIME,
 
133
    A1T_HEIM_BIT_STRING,
 
134
    A1T_BOOLEAN,
 
135
    A1T_OID,
 
136
    A1T_TELETEX_STRING,
 
137
    A1T_NULL
 
138
};
 
139
 
 
140
 
 
141
#endif