1 0 stevel /* 2 0 stevel * CDDL HEADER START 3 0 stevel * 4 0 stevel * The contents of this file are subject to the terms of the 5 0 stevel * Common Development and Distribution License, Version 1.0 only 6 0 stevel * (the "License"). You may not use this file except in compliance 7 0 stevel * with the License. 8 0 stevel * 9 0 stevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 0 stevel * or http://www.opensolaris.org/os/licensing. 11 0 stevel * See the License for the specific language governing permissions 12 0 stevel * and limitations under the License. 13 0 stevel * 14 0 stevel * When distributing Covered Code, include this CDDL HEADER in each 15 0 stevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 0 stevel * If applicable, add the following below this CDDL HEADER, with the 17 0 stevel * fields enclosed by brackets "[]" replaced with your own identifying 18 0 stevel * information: Portions Copyright [yyyy] [name of copyright owner] 19 0 stevel * 20 0 stevel * CDDL HEADER END 21 0 stevel */ 22 0 stevel /* 23 0 stevel * nis_object.x 24 0 stevel * 25 0 stevel * Copyright (c) 1988-1992 Sun Microsystems Inc 26 0 stevel * All Rights Reserved. 27 0 stevel */ 28 0 stevel 29 0 stevel %#pragma ident "%Z%%M% %I% %E% SMI" 30 0 stevel 31 0 stevel #if RPC_HDR 32 0 stevel % 33 0 stevel %#ifndef __nis_object_h 34 0 stevel %#define __nis_object_h 35 0 stevel % 36 0 stevel #endif 37 0 stevel /* 38 0 stevel * This file defines the format for a NIS object in RPC language. 39 0 stevel * It is included by the main .x file and the database access protocol 40 0 stevel * file. It is common because both of them need to deal with the same 41 0 stevel * type of object. Generating the actual code though is a bit messy because 42 0 stevel * the nis.x file and the nis_dba.x file will generate xdr routines to 43 0 stevel * encode/decode objects when only one set is needed. Such is life when 44 0 stevel * one is using rpcgen. 45 0 stevel * 46 0 stevel * Note, the protocol doesn't specify any limits on such things as 47 0 stevel * maximum name length, number of attributes, etc. These are enforced 48 0 stevel * by the database backend. When you hit them you will no. Also see 49 0 stevel * the db_getlimits() function for fetching the limit values. 50 0 stevel * 51 0 stevel */ 52 0 stevel 53 0 stevel #if defined(RPC_XDR) || defined(RPC_SVC) || defined(RPC_CLNT) 54 0 stevel %#ifndef xdr_uint32_t 55 0 stevel %#define xdr_uint32_t xdr_u_int 56 0 stevel %#endif 57 0 stevel %#ifndef xdr_uint_t 58 0 stevel %#define xdr_uint_t xdr_u_int 59 0 stevel %#endif 60 0 stevel #endif 61 0 stevel 62 0 stevel /* Some manifest constants, chosen to maximize flexibility without 63 0 stevel * plugging the wire full of data. 64 0 stevel */ 65 0 stevel const NIS_MAXSTRINGLEN = 255; 66 0 stevel const NIS_MAXNAMELEN = 1024; 67 0 stevel const NIS_MAXATTRNAME = 32; 68 0 stevel const NIS_MAXATTRVAL = 2048; 69 0 stevel const NIS_MAXCOLUMNS = 64; 70 0 stevel const NIS_MAXATTR = 16; 71 0 stevel const NIS_MAXPATH = 1024; 72 0 stevel const NIS_MAXREPLICAS = 128; 73 0 stevel const NIS_MAXLINKS = 16; 74 0 stevel 75 0 stevel const NIS_PK_NONE = 0; /* no public key (unix/sys auth) */ 76 0 stevel const NIS_PK_DH = 1; /* Public key is Diffie-Hellman type */ 77 0 stevel const NIS_PK_RSA = 2; /* Public key if RSA type */ 78 0 stevel const NIS_PK_KERB = 3; /* Use kerberos style authentication */ 79 0 stevel const NIS_PK_DHEXT = 4; /* Extended Diffie-Hellman for RPC-GSS */ 80 0 stevel 81 0 stevel /* 82 0 stevel * The fundamental name type of NIS. The name may consist of two parts, 83 0 stevel * the first being the fully qualified name, and the second being an 84 0 stevel * optional set of attribute/value pairs. 85 0 stevel */ 86 0 stevel struct nis_attr { 87 0 stevel string zattr_ndx<>; /* name of the index */ 88 0 stevel opaque zattr_val<>; /* Value for the attribute. */ 89 0 stevel }; 90 0 stevel 91 0 stevel typedef string nis_name<>; /* The NIS name itself. */ 92 0 stevel 93 0 stevel /* NIS object types are defined by the following enumeration. The numbers 94 0 stevel * they use are based on the following scheme : 95 0 stevel * 0 - 1023 are reserved for Sun, 96 0 stevel * 1024 - 2047 are defined to be private to a particular tree. 97 0 stevel * 2048 - 4095 are defined to be user defined. 98 0 stevel * 4096 - ... are reserved for future use. 99 0 stevel * 100 0 stevel * EOL Alert - The non-prefixed names are present for backward 101 0 stevel * compatability only, and will not exist in future releases. Use 102 0 stevel * the NIS_* names for future compatability. 103 0 stevel */ 104 0 stevel 105 0 stevel enum zotypes { 106 0 stevel 107 0 stevel BOGUS_OBJ = 0, /* Uninitialized object structure */ 108 0 stevel NO_OBJ = 1, /* NULL object (no data) */ 109 0 stevel DIRECTORY_OBJ = 2, /* Directory object describing domain */ 110 0 stevel GROUP_OBJ = 3, /* Group object (a list of names) */ 111 0 stevel TABLE_OBJ = 4, /* Table object (a database schema) */ 112 0 stevel ENTRY_OBJ = 5, /* Entry object (a database record) */ 113 0 stevel LINK_OBJ = 6, /* A name link. */ 114 0 stevel PRIVATE_OBJ = 7, /* Private object (all opaque data) */ 115 0 stevel 116 0 stevel NIS_BOGUS_OBJ = 0, /* Uninitialized object structure */ 117 0 stevel NIS_NO_OBJ = 1, /* NULL object (no data) */ 118 0 stevel NIS_DIRECTORY_OBJ = 2, /* Directory object describing domain */ 119 0 stevel NIS_GROUP_OBJ = 3, /* Group object (a list of names) */ 120 0 stevel NIS_TABLE_OBJ = 4, /* Table object (a database schema) */ 121 0 stevel NIS_ENTRY_OBJ = 5, /* Entry object (a database record) */ 122 0 stevel NIS_LINK_OBJ = 6, /* A name link. */ 123 0 stevel NIS_PRIVATE_OBJ = 7 /* Private object (all opaque data) */ 124 0 stevel }; 125 0 stevel 126 0 stevel /* 127 0 stevel * The types of Name services NIS knows about. They are enumerated 128 0 stevel * here. The Binder code will use this type to determine if it has 129 0 stevel * a set of library routines that will access the indicated name service. 130 0 stevel */ 131 0 stevel enum nstype { 132 0 stevel UNKNOWN = 0, 133 0 stevel NIS = 1, /* Nis Plus Service */ 134 0 stevel SUNYP = 2, /* Old NIS Service */ 135 0 stevel IVY = 3, /* Nis Plus Plus Service */ 136 0 stevel DNS = 4, /* Domain Name Service */ 137 0 stevel X500 = 5, /* ISO/CCCIT X.500 Service */ 138 0 stevel DNANS = 6, /* Digital DECNet Name Service */ 139 0 stevel XCHS = 7, /* Xerox ClearingHouse Service */ 140 0 stevel CDS= 8 141 0 stevel }; 142 0 stevel 143 0 stevel /* 144 0 stevel * DIRECTORY - The name service object. These objects identify other name 145 0 stevel * servers that are serving some portion of the name space. Each has a 146 0 stevel * type associated with it. The resolver library will note whether or not 147 0 stevel * is has the needed routines to access that type of service. 148 0 stevel * The oarmask structure defines an access rights mask on a per object 149 0 stevel * type basis for the name spaces. The only bits currently used are 150 0 stevel * create and destroy. By enabling or disabling these access rights for 151 0 stevel * a specific object type for a one of the accessor entities (owner, 152 0 stevel * group, world) the administrator can control what types of objects 153 0 stevel * may be freely added to the name space and which require the 154 0 stevel * administrator's approval. 155 0 stevel */ 156 0 stevel struct oar_mask { 157 0 stevel uint_t oa_rights; /* Access rights mask */ 158 0 stevel zotypes oa_otype; /* Object type */ 159 0 stevel }; 160 0 stevel 161 0 stevel struct endpoint { 162 0 stevel string uaddr<>; 163 0 stevel string family<>; /* Transport family (INET, OSI, etc) */ 164 0 stevel string proto<>; /* Protocol (TCP, UDP, CLNP, etc) */ 165 0 stevel }; 166 0 stevel 167 0 stevel /* 168 0 stevel * Note: pkey is a netobj which is limited to 1024 bytes which limits the 169 0 stevel * keysize to 8192 bits. This is consider to be a reasonable limit for 170 0 stevel * the expected lifetime of this service. 171 0 stevel */ 172 0 stevel struct nis_server { 173 0 stevel nis_name name; /* Principal name of the server */ 174 0 stevel endpoint ep<>; /* Universal addr(s) for server */ 175 0 stevel uint_t key_type; /* Public key type */ 176 0 stevel netobj pkey; /* server's public key */ 177 0 stevel }; 178 0 stevel 179 0 stevel struct directory_obj { 180 0 stevel nis_name do_name; /* Name of the directory being served */ 181 0 stevel nstype do_type; /* one of NIS, DNS, IVY, YP, or X.500 */ 182 0 stevel nis_server do_servers<>; /* <0> == Primary name server */ 183 0 stevel uint32_t do_ttl; /* Time To Live (for caches) */ 184 0 stevel oar_mask do_armask<>; /* Create/Destroy rights by object type */ 185 0 stevel }; 186 0 stevel 187 0 stevel /* 188 0 stevel * ENTRY - This is one row of data from an information base. 189 0 stevel * The type value is used by the client library to convert the entry to 190 0 stevel * it's internal structure representation. The Table name is a back pointer 191 0 stevel * to the table where the entry is stored. This allows the client library 192 0 stevel * to determine where to send a request if the client wishes to change this 193 0 stevel * entry but got to it through a LINK rather than directly. 194 0 stevel * If the entry is a "standalone" entry then this field is void. 195 0 stevel */ 196 0 stevel const EN_BINARY = 1; /* Indicates value is binary data */ 197 0 stevel const EN_CRYPT = 2; /* Indicates the value is encrypted */ 198 0 stevel const EN_XDR = 4; /* Indicates the value is XDR encoded */ 199 0 stevel const EN_MODIFIED = 8; /* Indicates entry is modified. */ 200 0 stevel const EN_ASN1 = 64; /* Means contents use ASN.1 encoding */ 201 0 stevel 202 0 stevel struct entry_col { 203 0 stevel uint_t ec_flags; /* Flags for this value */ 204 0 stevel opaque ec_value<>; /* It's textual value */ 205 0 stevel }; 206 0 stevel 207 0 stevel struct entry_obj { 208 0 stevel string en_type<>; /* Type of entry such as "passwd" */ 209 0 stevel entry_col en_cols<>; /* Value for the entry */ 210 0 stevel }; 211 0 stevel 212 0 stevel /* 213 0 stevel * GROUP - The group object contains a list of NIS principal names. Groups 214 0 stevel * are used to authorize principals. Each object has a set of access rights 215 0 stevel * for members of its group. Principal names in groups are in the form 216 0 stevel * name.directory and recursive groups are expressed as @groupname.directory 217 0 stevel */ 218 0 stevel struct group_obj { 219 0 stevel uint_t gr_flags; /* Flags controlling group */ 220 0 stevel nis_name gr_members<>; /* List of names in group */ 221 0 stevel }; 222 0 stevel 223 0 stevel /* 224 0 stevel * LINK - This is the LINK object. It is quite similar to a symbolic link 225 0 stevel * in the UNIX filesystem. The attributes in the main object structure are 226 0 stevel * relative to the LINK data and not what it points to (like the file system) 227 0 stevel * "modify" privleges here indicate the right to modify what the link points 228 0 stevel * at and not to modify that actual object pointed to by the link. 229 0 stevel */ 230 0 stevel struct link_obj { 231 0 stevel zotypes li_rtype; /* Real type of the object */ 232 0 stevel nis_attr li_attrs<>; /* Attribute/Values for tables */ 233 0 stevel nis_name li_name; /* The object's real NIS name */ 234 0 stevel }; 235 0 stevel 236 0 stevel /* 237 0 stevel * TABLE - This is the table object. It implements a simple 238 0 stevel * data base that applications and use for configuration or 239 0 stevel * administration purposes. The role of the table is to group together 240 0 stevel * a set of related entries. Tables are the simple database component 241 0 stevel * of NIS. Like many databases, tables are logically divided into columns 242 0 stevel * and rows. The columns are labeled with indexes and each ENTRY makes 243 0 stevel * up a row. Rows may be addressed within the table by selecting one 244 0 stevel * or more indexes, and values for those indexes. Each row which has 245 0 stevel * a value for the given index that matches the desired value is returned. 246 0 stevel * Within the definition of each column there is a flags variable, this 247 0 stevel * variable contains flags which determine whether or not the column is 248 0 stevel * searchable, contains binary data, and access rights for the entry objects 249 0 stevel * column value. 250 0 stevel */ 251 0 stevel 252 0 stevel const TA_BINARY = 1; /* Means table data is binary */ 253 0 stevel const TA_CRYPT = 2; /* Means value should be encrypted */ 254 0 stevel const TA_XDR = 4; /* Means value is XDR encoded */ 255 0 stevel const TA_SEARCHABLE = 8; /* Means this column is searchable */ 256 0 stevel const TA_CASE = 16; /* Means this column is Case Sensitive */ 257 0 stevel const TA_MODIFIED = 32; /* Means this columns attrs are modified*/ 258 0 stevel const TA_ASN1 = 64; /* Means contents use ASN.1 encoding */ 259 0 stevel 260 0 stevel struct table_col { 261 0 stevel string tc_name<64>; /* Column Name */ 262 0 stevel uint_t tc_flags; /* control flags */ 263 0 stevel uint_t tc_rights; /* Access rights mask */ 264 0 stevel }; 265 0 stevel 266 0 stevel struct table_obj { 267 0 stevel string ta_type<64>; /* Table type such as "passwd" */ 268 0 stevel int ta_maxcol; /* Total number of columns */ 269 0 stevel u_char ta_sep; /* Separator character */ 270 0 stevel table_col ta_cols<>; /* The number of table indexes */ 271 0 stevel string ta_path<>; /* A search path for this table */ 272 0 stevel }; 273 0 stevel 274 0 stevel /* 275 0 stevel * This union joins together all of the currently known objects. 276 0 stevel */ 277 0 stevel union objdata switch (zotypes zo_type) { 278 0 stevel case NIS_DIRECTORY_OBJ : 279 0 stevel struct directory_obj di_data; 280 0 stevel case NIS_GROUP_OBJ : 281 0 stevel struct group_obj gr_data; 282 0 stevel case NIS_TABLE_OBJ : 283 0 stevel struct table_obj ta_data; 284 0 stevel case NIS_ENTRY_OBJ: 285 0 stevel struct entry_obj en_data; 286 0 stevel case NIS_LINK_OBJ : 287 0 stevel struct link_obj li_data; 288 0 stevel case NIS_PRIVATE_OBJ : 289 0 stevel opaque po_data<>; 290 0 stevel case NIS_NO_OBJ : 291 0 stevel void; 292 0 stevel case NIS_BOGUS_OBJ : 293 0 stevel void; 294 0 stevel default : 295 0 stevel void; 296 0 stevel }; 297 0 stevel 298 0 stevel /* 299 0 stevel * This is the basic NIS object data type. It consists of a generic part 300 0 stevel * which all objects contain, and a specialized part which varies depending 301 0 stevel * on the type of the object. All of the specialized sections have been 302 0 stevel * described above. You might have wondered why they all start with an 303 0 stevel * integer size, followed by the useful data. The answer is, when the 304 0 stevel * server doesn't recognize the type returned it treats it as opaque data. 305 0 stevel * And the definition for opaque data is {int size; char *data;}. In this 306 0 stevel * way, servers and utility routines that do not understand a given type 307 0 stevel * may still pass it around. One has to be careful in setting 308 0 stevel * this variable accurately, it must take into account such things as 309 0 stevel * XDR padding of structures etc. The best way to set it is to note one's 310 0 stevel * position in the XDR encoding stream, encode the structure, look at the 311 0 stevel * new position and calculate the size. 312 0 stevel */ 313 0 stevel struct nis_oid { 314 0 stevel uint32_t ctime; /* Time of objects creation */ 315 0 stevel uint32_t mtime; /* Time of objects modification */ 316 0 stevel }; 317 0 stevel 318 0 stevel struct nis_object { 319 0 stevel nis_oid zo_oid; /* object identity verifier. */ 320 0 stevel nis_name zo_name; /* The NIS name for this object */ 321 0 stevel nis_name zo_owner; /* NIS name of object owner. */ 322 0 stevel nis_name zo_group; /* NIS name of access group. */ 323 0 stevel nis_name zo_domain; /* The administrator for the object */ 324 0 stevel uint_t zo_access; /* Access rights (owner, group, world) */ 325 0 stevel uint32_t zo_ttl; /* Object's time to live in seconds. */ 326 0 stevel objdata zo_data; /* Data structure for this type */ 327 0 stevel }; 328 0 stevel #if RPC_HDR 329 0 stevel % 330 0 stevel %#endif /* if __nis_object_h */ 331 0 stevel % 332 0 stevel #endif 333