source: releases/0.3.0/include/smb_deps.h @ 148

Last change on this file since 148 was 68, checked in by tim, 18 years ago

added usage printout to reglookup-timeline

cut left over unused junk from smb_deps.h

  • Property svn:keywords set to Id
File size: 8.6 KB
Line 
1/*
2 * This file contains miscellaneous pieces of code which regfio.c
3 * depends upon, from the Samba Subversion tree.  See:
4 *   http://websvn.samba.org/cgi-bin/viewcvs.cgi/trunk/source/
5 *
6 * Copyright (C) 2005 Timothy D. Morgan
7 * Copyright (C) 1992-2005 Samba development team
8 *               (see individual files under Subversion for details.)
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; version 2 of the License.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 * $Id: smb_deps.h 68 2006-07-30 13:41:24Z tim $
24 */
25
26#include <stdlib.h>
27#include <stdbool.h>
28#include <stdio.h>
29#include <string.h>
30#include <errno.h>
31#include <fcntl.h>
32#include <sys/stat.h>
33#include <sys/types.h>
34#include <unistd.h>
35
36#include "byteorder.h"
37
38#define DEBUG(lvl,body) 0
39
40void* zalloc(size_t size);
41void* zcalloc(size_t size, unsigned int count);
42
43/* From includes.h */
44
45#define uint8 unsigned char
46#define int16 short
47#define uint16 unsigned short
48#define int32 int
49#define uint32 unsigned int
50
51#define SMB_STRUCT_STAT struct stat
52#define QSORT_CAST (int (*)(const void *, const void *))
53
54#define MIN(a,b) ((a)<(b)?(a):(b))
55#define MAX(a,b) ((a)>(b)?(a):(b))
56
57extern int DEBUGLEVEL;
58
59#define DLIST_ADD(list, p) \
60{ \
61        if (!(list)) { \
62                (list) = (p); \
63                (p)->next = (p)->prev = NULL; \
64        } else { \
65                (list)->prev = (p); \
66                (p)->next = (list); \
67                (p)->prev = NULL; \
68                (list) = (p); \
69        }\
70}
71
72/* End of stuff from includes.h */
73
74/* From smb.h */
75
76#define MAXSUBAUTHS 15
77
78typedef struct sid_info
79{
80  uint8  sid_rev_num;             /**< SID revision number */
81  uint8  num_auths;               /**< Number of sub-authorities */
82  uint8  id_auth[6];              /**< Identifier Authority */
83  /*
84   *  Pointer to sub-authorities.
85   *
86   * @note The values in these uint32's are in *native* byteorder, not
87   * neccessarily little-endian...... JRA.
88   */
89  uint32 sub_auths[MAXSUBAUTHS];
90} DOM_SID;
91
92typedef struct nttime_info
93{
94  uint32 low;
95  uint32 high;
96} NTTIME;
97
98/* End of stuff from smb.h */
99
100/* From smb_macros.h */
101
102#define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)
103#define SMB_MALLOC_P(type) (type *)malloc_(sizeof(type))
104#define TALLOC_ARRAY(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type)
105#define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, #type)
106#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
107
108/* End of stuff from smb_macros.h */
109
110/* From ntdomain.h */
111
112struct uuid {
113       uint32 time_low;
114       uint16 time_mid;
115       uint16 time_hi_and_version;
116       uint8  clock_seq[2];
117       uint8  node[6];
118};
119
120typedef struct _prs_struct {
121        bool io; /* parsing in or out of data stream */
122        /*
123         * If the (incoming) data is big-endian. On output we are
124          * always little-endian.
125           */ 
126           bool bigendian_data;
127           uint8 align; /* data alignment */
128           bool is_dynamic; /* Do we own this memory or not ? */
129           uint32 data_offset; /* Current working offset into data. */
130           uint32 buffer_size; /* Current allocated size of the buffer. */
131           uint32 grow_size; /* size requested via prs_grow() calls */
132           char *data_p; /* The buffer itself. */
133           void *mem_ctx; /* When unmarshalling, use this.... */
134} prs_struct;
135
136#define MARSHALL 0
137#define UNMARSHALL 1
138
139#define RPC_LITTLE_ENDIAN  0
140#define RPC_PARSE_ALIGN    4
141
142/* End of stuff from ntdomain.h */
143
144
145/* From lib/time.c */
146
147#define CHAR_BIT 8
148#define TIME_T_MIN ((time_t)0 < (time_t) -1 ? (time_t) 0 \
149                    : ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1))
150#define TIME_T_MAX (~ (time_t) 0 - TIME_T_MIN)
151#define TIME_FIXUP_CONSTANT (369.0*365.25*24*60*60-(3.0*24*60*60+6.0*60*60))
152
153void unix_to_nt_time(NTTIME *nt, time_t t);
154time_t nt_time_to_unix(NTTIME *nt);
155
156/* End of stuff from lib/time.c */
157
158/* From rpc_dce.h */
159
160#define MAX_PDU_FRAG_LEN 0x10b8 /* this is what w2k sets */
161
162/* End of stuff from rpc_dce.h */
163
164/* From parse_prs.h */
165
166bool prs_grow(prs_struct *ps, uint32 extra_space);
167bool prs_align(prs_struct *ps);
168bool prs_init(prs_struct *ps, uint32 size, void *ctx, bool io);
169char *prs_mem_get(prs_struct *ps, uint32 extra_size);
170bool prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32);
171bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, 
172                 int depth, uint32 *data32s, int len);
173bool prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16);
174bool prs_uint16_pre(const char *name, prs_struct *ps, int depth, 
175                    uint16 *data16, uint32 *offset);
176bool prs_uint16_post(const char *name, prs_struct *ps, int depth, 
177                     uint16 *data16, uint32 ptr_uint16, uint32 start_offset);
178bool prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8);
179bool prs_uint8s(bool charmode, const char *name, prs_struct *ps, int depth, 
180                uint8* data8s, int len);
181bool prs_set_offset(prs_struct *ps, uint32 offset);
182
183/* End of stuff from parse_prs.h */
184
185
186/* From rpc_secdesc.h */
187
188typedef struct security_info_info
189{
190        uint32 mask;
191
192} SEC_ACCESS;
193
194typedef struct security_ace_info
195{
196        uint8 type;  /* xxxx_xxxx_ACE_TYPE - e.g allowed / denied etc */
197        uint8 flags; /* xxxx_INHERIT_xxxx - e.g OBJECT_INHERIT_ACE */
198        uint16 size;
199
200        SEC_ACCESS info;
201
202        /* this stuff may be present when type is XXXX_TYPE_XXXX_OBJECT */
203        uint32  obj_flags; /* xxxx_ACE_OBJECT_xxxx e.g present/inherited present etc */
204        struct uuid obj_guid;  /* object GUID */
205        struct uuid inh_guid;  /* inherited object GUID */             
206        /* eof object stuff */
207
208        DOM_SID trustee;
209
210} SEC_ACE;
211
212typedef struct security_acl_info
213{
214        uint16 revision; /* 0x0003 */
215        uint16 size; /* size in bytes of the entire ACL structure */
216        uint32 num_aces; /* number of Access Control Entries */
217
218        SEC_ACE *ace;
219
220} SEC_ACL;
221
222typedef struct security_descriptor_info
223{
224        uint16 revision; /* 0x0001 */
225        uint16 type;     /* SEC_DESC_xxxx flags */
226
227        uint32 off_owner_sid; /* offset to owner sid */
228        uint32 off_grp_sid  ; /* offset to group sid */
229        uint32 off_sacl     ; /* offset to system list of permissions */
230        uint32 off_dacl     ; /* offset to list of permissions */
231
232        SEC_ACL *dacl; /* user ACL */
233        SEC_ACL *sacl; /* system ACL */
234        DOM_SID *owner_sid; 
235        DOM_SID *grp_sid;
236
237} SEC_DESC;
238
239/* End of stuff from rpc_secdesc.h */
240
241
242/* From pstring.h */
243
244#define FSTRING_LEN 256
245typedef char fstring[FSTRING_LEN];
246
247/* End of stuff from pstring.h */
248
249
250/* From rpc_secdes.h */
251
252#define SEC_DESC_DACL_PRESENT           0x0004
253#define SEC_DESC_SACL_PRESENT           0x0010
254#define  SEC_DESC_HEADER_SIZE (2 * sizeof(uint16) + 4 * sizeof(uint32))
255   /* thanks for Jim McDonough <jmcd@us.ibm.com> */
256#define SEC_ACE_OBJECT_PRESENT        0x00000001
257#define SEC_ACE_OBJECT_INHERITED_PRESENT 0x00000002
258
259#define SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT      0x5
260#define SEC_ACE_TYPE_ACCESS_DENIED_OBJECT       0x6
261#define SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT        0x7
262#define SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT        0x8
263
264/* End of stuff from rpc_secdes.h */
265
266/* From rpc_parse/parse_misc.c */
267
268bool smb_io_uuid(const char *desc, struct uuid *uuid, 
269                 prs_struct *ps, int depth);
270bool smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth);
271bool smb_io_dom_sid(const char *desc, DOM_SID *sid, prs_struct *ps, int depth);
272
273/* End of stuff from rpc_parse/parse_misc.c */
274
275/* From lib/util_sid.c */
276
277size_t sid_size(const DOM_SID *sid);
278int sid_compare_auth(const DOM_SID *sid1, const DOM_SID *sid2);
279int sid_compare(const DOM_SID *sid1, const DOM_SID *sid2);
280bool sid_equal(const DOM_SID *sid1, const DOM_SID *sid2);
281
282/* End of stuff from lib/util_sid.c */
283
284/* From lib/secace.c */
285
286bool sec_ace_object(uint8 type);
287
288/* End of stuff from lib/secace.c */
289
290/* From rpc_parse/parse_sec.c */
291
292bool sec_io_access(const char *desc, SEC_ACCESS *t, prs_struct *ps, int depth);
293bool sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth);
294bool sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth);
295bool sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth);
296
297/* End of stuff from rpc_parse/parse_sec.c */
298
299/* From lib/secace.c */
300
301bool sec_ace_equal(SEC_ACE *s1, SEC_ACE *s2);
302
303/* End of stuff from lib/secace.c */
304
305/* From lib/secacl.c */
306
307bool sec_acl_equal(SEC_ACL *s1, SEC_ACL *s2);
308
309/* End of stuff from lib/secacl.c */
310
311/* From lib/secdesc.c */
312
313bool sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2);
314
315/* End of stuff from lib/secdesc.c */
Note: See TracBrowser for help on using the repository browser.