|
root / base / usr / src / uts / common / rpcsvc / idmap_prot.h
idmap_prot.h C 491 lines 14.1 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
/*
 * Please do not edit this file.
 * It was generated using rpcgen.
 */

#ifndef _IDMAP_PROT_H_RPCGEN
#define	_IDMAP_PROT_H_RPCGEN

#include <rpc/rpc.h>
#ifndef _KERNEL
#include <synch.h>
#include <thread.h>
#endif /* !_KERNEL */

#ifdef __cplusplus
extern "C" {
#endif

#if defined(_KERNEL)
#include <sys/nvpair.h>
#else
#include <libnvpair.h>
#endif
typedef nvlist_t *nvlist_t_ptr;

typedef char *idmap_utf8str;

typedef struct {
	u_int idmap_utf8str_list_len;
	idmap_utf8str *idmap_utf8str_list_val;
} idmap_utf8str_list;

typedef int idmap_retcode;

enum idmap_id_type {
	IDMAP_NONE = 0,
	IDMAP_UID = 1,
	IDMAP_GID = 1 + 1,
	IDMAP_SID = 1 + 2,
	IDMAP_USID = 1 + 3,
	IDMAP_GSID = 1 + 4,
	IDMAP_POSIXID = 1 + 5
};
typedef enum idmap_id_type idmap_id_type;

enum idmap_map_type {
	IDMAP_MAP_TYPE_UNKNOWN = 0,
	IDMAP_MAP_TYPE_DS_AD = 0 + 1,
	IDMAP_MAP_TYPE_DS_NLDAP = 0 + 2,
	IDMAP_MAP_TYPE_RULE_BASED = 0 + 3,
	IDMAP_MAP_TYPE_EPHEMERAL = 0 + 4,
	IDMAP_MAP_TYPE_LOCAL_SID = 0 + 5,
	IDMAP_MAP_TYPE_KNOWN_SID = 0 + 6,
	IDMAP_MAP_TYPE_IDMU = 0 + 7
};
typedef enum idmap_map_type idmap_map_type;

enum idmap_map_src {
	IDMAP_MAP_SRC_UNKNOWN = 0,
	IDMAP_MAP_SRC_NEW = 0 + 1,
	IDMAP_MAP_SRC_CACHE = 0 + 2,
	IDMAP_MAP_SRC_HARD_CODED = 0 + 3,
	IDMAP_MAP_SRC_ALGORITHMIC = 0 + 4
};
typedef enum idmap_map_src idmap_map_src;

struct idmap_sid {
	char *prefix;
	uint32_t rid;
};
typedef struct idmap_sid idmap_sid;

struct idmap_id {
	idmap_id_type idtype;
	union {
		uint32_t uid;
		uint32_t gid;
		idmap_sid sid;
		idmap_sid usid;
		idmap_sid gsid;
	} idmap_id_u;
};
typedef struct idmap_id idmap_id;

struct idmap_namerule {
	bool_t is_user;
	bool_t is_wuser;
	int direction;
	idmap_utf8str windomain;
	idmap_utf8str winname;
	idmap_utf8str unixname;
	bool_t is_nt4;
};
typedef struct idmap_namerule idmap_namerule;

struct idmap_namerules_res {
	idmap_retcode retcode;
	uint64_t lastrowid;
	struct {
		u_int rules_len;
		idmap_namerule *rules_val;
	} rules;
};
typedef struct idmap_namerules_res idmap_namerules_res;

struct idmap_how_ds_based {
	idmap_utf8str dn;
	idmap_utf8str attr;
	idmap_utf8str value;
};
typedef struct idmap_how_ds_based idmap_how_ds_based;

struct idmap_how {
	idmap_map_type map_type;
	union {
		idmap_how_ds_based ad;
		idmap_how_ds_based nldap;
		idmap_namerule rule;
		idmap_how_ds_based idmu;
	} idmap_how_u;
};
typedef struct idmap_how idmap_how;

struct idmap_info {
	idmap_map_src src;
	idmap_how how;
	nvlist_t_ptr trace;
};
typedef struct idmap_info idmap_info;

struct idmap_id_res {
	idmap_retcode retcode;
	idmap_id id;
	int direction;
	idmap_info info;
};
typedef struct idmap_id_res idmap_id_res;

struct idmap_ids_res {
	idmap_retcode retcode;
	struct {
		u_int ids_len;
		idmap_id_res *ids_val;
	} ids;
};
typedef struct idmap_ids_res idmap_ids_res;
#define	IDMAP_REQ_FLG_NO_NEW_ID_ALLOC 0x00000001
#define	IDMAP_REQ_FLG_VALIDATE 0x00000002
#define	IDMAP_REQ_FLG_NO_NAMESERVICE 0x00000004
#define	IDMAP_REQ_FLG_MAPPING_INFO 0x00000008
#define	IDMAP_REQ_FLG_WK_OR_LOCAL_SIDS_ONLY 0x00000020
#define	IDMAP_REQ_FLG_TRACE 0x00000040
#define	IDMAP_DIRECTION_UNDEF -1
#define	IDMAP_DIRECTION_BI 0
#define	IDMAP_DIRECTION_W2U 1
#define	IDMAP_DIRECTION_U2W 2

struct idmap_mapping {
	int32_t flag;
	int direction;
	idmap_id id1;
	idmap_utf8str id1domain;
	idmap_utf8str id1name;
	idmap_id id2;
	idmap_utf8str id2domain;
	idmap_utf8str id2name;
	idmap_info info;
};
typedef struct idmap_mapping idmap_mapping;

typedef struct {
	u_int idmap_mapping_batch_len;
	idmap_mapping *idmap_mapping_batch_val;
} idmap_mapping_batch;

struct idmap_mappings_res {
	idmap_retcode retcode;
	uint64_t lastrowid;
	struct {
		u_int mappings_len;
		idmap_mapping *mappings_val;
	} mappings;
};
typedef struct idmap_mappings_res idmap_mappings_res;

struct idmap_update_res {
	idmap_retcode retcode;
	int64_t error_index;
	idmap_namerule error_rule;
	idmap_namerule conflict_rule;
};
typedef struct idmap_update_res idmap_update_res;

enum idmap_opnum {
	OP_NONE = 0,
	OP_ADD_NAMERULE = 1,
	OP_RM_NAMERULE = 2,
	OP_FLUSH_NAMERULES = 3
};
typedef enum idmap_opnum idmap_opnum;

struct idmap_update_op {
	idmap_opnum opnum;
	union {
		idmap_namerule rule;
	} idmap_update_op_u;
};
typedef struct idmap_update_op idmap_update_op;

typedef struct {
	u_int idmap_update_batch_len;
	idmap_update_op *idmap_update_batch_val;
} idmap_update_batch;
#define	AD_DISC_MAXHOSTNAME 256

struct idmap_ad_disc_ds_t {
	int port;
	int priority;
	int weight;
	char host[AD_DISC_MAXHOSTNAME];
};
typedef struct idmap_ad_disc_ds_t idmap_ad_disc_ds_t;

enum idmap_prop_type {
	PROP_UNKNOWN = 0,
	PROP_LIST_SIZE_LIMIT = 1,
	PROP_DEFAULT_DOMAIN = 2,
	PROP_DOMAIN_NAME = 3,
	PROP_MACHINE_SID = 4,
	PROP_DOMAIN_CONTROLLER = 5,
	PROP_FOREST_NAME = 6,
	PROP_SITE_NAME = 7,
	PROP_GLOBAL_CATALOG = 8,
	PROP_AD_UNIXUSER_ATTR = 9,
	PROP_AD_UNIXGROUP_ATTR = 10,
	PROP_NLDAP_WINNAME_ATTR = 11,
	PROP_DIRECTORY_BASED_MAPPING = 12
};
typedef enum idmap_prop_type idmap_prop_type;

struct idmap_prop_val {
	idmap_prop_type prop;
	union {
		uint64_t intval;
		idmap_utf8str utf8val;
		idmap_ad_disc_ds_t dsval;
	} idmap_prop_val_u;
};
typedef struct idmap_prop_val idmap_prop_val;

struct idmap_prop_res {
	idmap_retcode retcode;
	idmap_prop_val value;
	bool_t auto_discovered;
};
typedef struct idmap_prop_res idmap_prop_res;

enum idmap_flush_op {
	IDMAP_FLUSH_EXPIRE = 0,
	IDMAP_FLUSH_DELETE = 1
};
typedef enum idmap_flush_op idmap_flush_op;

struct directory_error_rpc {
	idmap_utf8str code;
	idmap_utf8str fmt;
	struct {
		u_int params_len;
		idmap_utf8str *params_val;
	} params;
};
typedef struct directory_error_rpc directory_error_rpc;

typedef struct {
	u_int directory_value_rpc_len;
	char *directory_value_rpc_val;
} directory_value_rpc;

struct directory_values_rpc {
	bool_t found;
	union {
		struct {
			u_int values_len;
			directory_value_rpc *values_val;
		} values;
	} directory_values_rpc_u;
};
typedef struct directory_values_rpc directory_values_rpc;

enum directory_lookup_status_rpc {
	DIRECTORY_NOT_FOUND = 0,
	DIRECTORY_FOUND = 1,
	DIRECTORY_ERROR = 2
};
typedef enum directory_lookup_status_rpc directory_lookup_status_rpc;

struct directory_entry_rpc {
	directory_lookup_status_rpc status;
	union {
		struct {
			u_int attrs_len;
			directory_values_rpc *attrs_val;
		} attrs;
		directory_error_rpc err;
	} directory_entry_rpc_u;
};
typedef struct directory_entry_rpc directory_entry_rpc;

struct directory_results_rpc {
	bool_t failed;
	union {
		directory_error_rpc err;
		struct {
			u_int entries_len;
			directory_entry_rpc *entries_val;
		} entries;
	} directory_results_rpc_u;
};
typedef struct directory_results_rpc directory_results_rpc;

struct idmap_list_mappings_1_argument {
	int64_t lastrowid;
	uint64_t limit;
	int32_t flag;
};
typedef struct idmap_list_mappings_1_argument idmap_list_mappings_1_argument;

struct idmap_list_namerules_1_argument {
	idmap_namerule rule;
	uint64_t lastrowid;
	uint64_t limit;
};
typedef struct idmap_list_namerules_1_argument idmap_list_namerules_1_argument;

struct directory_get_common_1_argument {
	idmap_utf8str_list ids;
	idmap_utf8str types;
	idmap_utf8str_list attrs;
};
typedef struct directory_get_common_1_argument directory_get_common_1_argument;

#define	IDMAP_PROG	100172
#define	IDMAP_V1	1

#if defined(__STDC__) || defined(__cplusplus)
#define	IDMAP_NULL	0
extern  enum clnt_stat idmap_null_1(void *, CLIENT *);
extern  bool_t idmap_null_1_svc(void *, struct svc_req *);
#define	IDMAP_GET_MAPPED_IDS	1
extern  enum clnt_stat idmap_get_mapped_ids_1(idmap_mapping_batch , idmap_ids_res *, CLIENT *);
extern  bool_t idmap_get_mapped_ids_1_svc(idmap_mapping_batch , idmap_ids_res *, struct svc_req *);
#define	IDMAP_LIST_MAPPINGS	2
extern  enum clnt_stat idmap_list_mappings_1(int64_t , uint64_t , int32_t , idmap_mappings_res *, CLIENT *);
extern  bool_t idmap_list_mappings_1_svc(int64_t , uint64_t , int32_t , idmap_mappings_res *, struct svc_req *);
#define	IDMAP_LIST_NAMERULES	3
extern  enum clnt_stat idmap_list_namerules_1(idmap_namerule , uint64_t , uint64_t , idmap_namerules_res *, CLIENT *);
extern  bool_t idmap_list_namerules_1_svc(idmap_namerule , uint64_t , uint64_t , idmap_namerules_res *, struct svc_req *);
#define	IDMAP_UPDATE	4
extern  enum clnt_stat idmap_update_1(idmap_update_batch , idmap_update_res *, CLIENT *);
extern  bool_t idmap_update_1_svc(idmap_update_batch , idmap_update_res *, struct svc_req *);
#define	IDMAP_GET_MAPPED_ID_BY_NAME	5
extern  enum clnt_stat idmap_get_mapped_id_by_name_1(idmap_mapping , idmap_mappings_res *, CLIENT *);
extern  bool_t idmap_get_mapped_id_by_name_1_svc(idmap_mapping , idmap_mappings_res *, struct svc_req *);
#define	IDMAP_GET_PROP	6
extern  enum clnt_stat idmap_get_prop_1(idmap_prop_type , idmap_prop_res *, CLIENT *);
extern  bool_t idmap_get_prop_1_svc(idmap_prop_type , idmap_prop_res *, struct svc_req *);
#define	DIRECTORY_GET_COMMON	7
extern  enum clnt_stat directory_get_common_1(idmap_utf8str_list , idmap_utf8str , idmap_utf8str_list , directory_results_rpc *, CLIENT *);
extern  bool_t directory_get_common_1_svc(idmap_utf8str_list , idmap_utf8str , idmap_utf8str_list , directory_results_rpc *, struct svc_req *);
#define	IDMAP_FLUSH	8
extern  enum clnt_stat idmap_flush_1(idmap_flush_op , idmap_retcode *, CLIENT *);
extern  bool_t idmap_flush_1_svc(idmap_flush_op , idmap_retcode *, struct svc_req *);
extern int idmap_prog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);

#else /* K&R C */
#define	IDMAP_NULL	0
extern  enum clnt_stat idmap_null_1();
extern  bool_t idmap_null_1_svc();
#define	IDMAP_GET_MAPPED_IDS	1
extern  enum clnt_stat idmap_get_mapped_ids_1();
extern  bool_t idmap_get_mapped_ids_1_svc();
#define	IDMAP_LIST_MAPPINGS	2
extern  enum clnt_stat idmap_list_mappings_1();
extern  bool_t idmap_list_mappings_1_svc();
#define	IDMAP_LIST_NAMERULES	3
extern  enum clnt_stat idmap_list_namerules_1();
extern  bool_t idmap_list_namerules_1_svc();
#define	IDMAP_UPDATE	4
extern  enum clnt_stat idmap_update_1();
extern  bool_t idmap_update_1_svc();
#define	IDMAP_GET_MAPPED_ID_BY_NAME	5
extern  enum clnt_stat idmap_get_mapped_id_by_name_1();
extern  bool_t idmap_get_mapped_id_by_name_1_svc();
#define	IDMAP_GET_PROP	6
extern  enum clnt_stat idmap_get_prop_1();
extern  bool_t idmap_get_prop_1_svc();
#define	DIRECTORY_GET_COMMON	7
extern  enum clnt_stat directory_get_common_1();
extern  bool_t directory_get_common_1_svc();
#define	IDMAP_FLUSH	8
extern  enum clnt_stat idmap_flush_1();
extern  bool_t idmap_flush_1_svc();
extern int idmap_prog_1_freeresult();
#endif /* K&R C */

/* the xdr functions */

#if defined(__STDC__) || defined(__cplusplus)
extern  bool_t xdr_idmap_utf8str(XDR *, idmap_utf8str*);
extern  bool_t xdr_idmap_utf8str_list(XDR *, idmap_utf8str_list*);
extern  bool_t xdr_idmap_retcode(XDR *, idmap_retcode*);
extern  bool_t xdr_idmap_id_type(XDR *, idmap_id_type*);
extern  bool_t xdr_idmap_map_type(XDR *, idmap_map_type*);
extern  bool_t xdr_idmap_map_src(XDR *, idmap_map_src*);
extern  bool_t xdr_idmap_sid(XDR *, idmap_sid*);
extern  bool_t xdr_idmap_id(XDR *, idmap_id*);
extern  bool_t xdr_idmap_namerule(XDR *, idmap_namerule*);
extern  bool_t xdr_idmap_namerules_res(XDR *, idmap_namerules_res*);
extern  bool_t xdr_idmap_how_ds_based(XDR *, idmap_how_ds_based*);
extern  bool_t xdr_idmap_how(XDR *, idmap_how*);
extern  bool_t xdr_idmap_info(XDR *, idmap_info*);
extern  bool_t xdr_idmap_id_res(XDR *, idmap_id_res*);
extern  bool_t xdr_idmap_ids_res(XDR *, idmap_ids_res*);
extern  bool_t xdr_idmap_mapping(XDR *, idmap_mapping*);
extern  bool_t xdr_idmap_mapping_batch(XDR *, idmap_mapping_batch*);
extern  bool_t xdr_idmap_mappings_res(XDR *, idmap_mappings_res*);
extern  bool_t xdr_idmap_update_res(XDR *, idmap_update_res*);
extern  bool_t xdr_idmap_opnum(XDR *, idmap_opnum*);
extern  bool_t xdr_idmap_update_op(XDR *, idmap_update_op*);
extern  bool_t xdr_idmap_update_batch(XDR *, idmap_update_batch*);
extern  bool_t xdr_idmap_ad_disc_ds_t(XDR *, idmap_ad_disc_ds_t*);
extern  bool_t xdr_idmap_prop_type(XDR *, idmap_prop_type*);
extern  bool_t xdr_idmap_prop_val(XDR *, idmap_prop_val*);
extern  bool_t xdr_idmap_prop_res(XDR *, idmap_prop_res*);
extern  bool_t xdr_idmap_flush_op(XDR *, idmap_flush_op*);
extern  bool_t xdr_directory_error_rpc(XDR *, directory_error_rpc*);
extern  bool_t xdr_directory_value_rpc(XDR *, directory_value_rpc*);
extern  bool_t xdr_directory_values_rpc(XDR *, directory_values_rpc*);
extern  bool_t xdr_directory_lookup_status_rpc(XDR *, directory_lookup_status_rpc*);
extern  bool_t xdr_directory_entry_rpc(XDR *, directory_entry_rpc*);
extern  bool_t xdr_directory_results_rpc(XDR *, directory_results_rpc*);
extern  bool_t xdr_idmap_list_mappings_1_argument(XDR *, idmap_list_mappings_1_argument*);
extern  bool_t xdr_idmap_list_namerules_1_argument(XDR *, idmap_list_namerules_1_argument*);
extern  bool_t xdr_directory_get_common_1_argument(XDR *, directory_get_common_1_argument*);

#else /* K&R C */
extern bool_t xdr_idmap_utf8str();
extern bool_t xdr_idmap_utf8str_list();
extern bool_t xdr_idmap_retcode();
extern bool_t xdr_idmap_id_type();
extern bool_t xdr_idmap_map_type();
extern bool_t xdr_idmap_map_src();
extern bool_t xdr_idmap_sid();
extern bool_t xdr_idmap_id();
extern bool_t xdr_idmap_namerule();
extern bool_t xdr_idmap_namerules_res();
extern bool_t xdr_idmap_how_ds_based();
extern bool_t xdr_idmap_how();
extern bool_t xdr_idmap_info();
extern bool_t xdr_idmap_id_res();
extern bool_t xdr_idmap_ids_res();
extern bool_t xdr_idmap_mapping();
extern bool_t xdr_idmap_mapping_batch();
extern bool_t xdr_idmap_mappings_res();
extern bool_t xdr_idmap_update_res();
extern bool_t xdr_idmap_opnum();
extern bool_t xdr_idmap_update_op();
extern bool_t xdr_idmap_update_batch();
extern bool_t xdr_idmap_ad_disc_ds_t();
extern bool_t xdr_idmap_prop_type();
extern bool_t xdr_idmap_prop_val();
extern bool_t xdr_idmap_prop_res();
extern bool_t xdr_idmap_flush_op();
extern bool_t xdr_directory_error_rpc();
extern bool_t xdr_directory_value_rpc();
extern bool_t xdr_directory_values_rpc();
extern bool_t xdr_directory_lookup_status_rpc();
extern bool_t xdr_directory_entry_rpc();
extern bool_t xdr_directory_results_rpc();
extern bool_t xdr_idmap_list_mappings_1_argument();
extern bool_t xdr_idmap_list_namerules_1_argument();
extern bool_t xdr_directory_get_common_1_argument();

#endif /* K&R C */

#ifdef __cplusplus
}
#endif

#endif /* !_IDMAP_PROT_H_RPCGEN */