1259117Shrs%/*- 2259117Shrs% * Copyright (c) 2010, Oracle America, Inc. 326206Swpaul% * 4259117Shrs% * Redistribution and use in source and binary forms, with or without 5259117Shrs% * modification, are permitted provided that the following conditions are 6259117Shrs% * met: 726206Swpaul% * 8259117Shrs% * * Redistributions of source code must retain the above copyright 9259117Shrs% * notice, this list of conditions and the following disclaimer. 10259117Shrs% * * Redistributions in binary form must reproduce the above 11259117Shrs% * copyright notice, this list of conditions and the following 12259117Shrs% * disclaimer in the documentation and/or other materials 13259117Shrs% * provided with the distribution. 14259117Shrs% * * Neither the name of the "Oracle America, Inc." nor the names of its 15259117Shrs% * contributors may be used to endorse or promote products derived 16259117Shrs% * from this software without specific prior written permission. 1726206Swpaul% * 18259117Shrs% * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19259117Shrs% * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20259117Shrs% * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21259117Shrs% * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22259117Shrs% * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 23259117Shrs% * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24259117Shrs% * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 25259117Shrs% * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26259117Shrs% * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27259117Shrs% * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28259117Shrs% * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29259117Shrs% * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3026206Swpaul% */ 3126206Swpaul 3226206Swpaul/* 3326206Swpaul * nis_object.x 3426206Swpaul * 3526206Swpaul * Copyright (c) 1988-1992 Sun Microsystems Inc 3626206Swpaul * All Rights Reserved. 3726206Swpaul */ 3826206Swpaul 39259117Shrs/* $FreeBSD: releng/11.0/include/rpcsvc/nis_object.x 259117 2013-12-09 04:26:50Z hrs $ */ 4026206Swpaul/* From: %#pragma ident "@(#)nis_object.x 1.10 94/05/03 SMI" */ 4126206Swpaul 4226206Swpaul#if RPC_HDR 4326206Swpaul% 4426206Swpaul%#ifndef __nis_object_h 4526206Swpaul%#define __nis_object_h 4626206Swpaul% 4726206Swpaul#endif 4826206Swpaul/* 4926206Swpaul * This file defines the format for a NIS object in RPC language. 5026206Swpaul * It is included by the main .x file and the database access protocol 5126206Swpaul * file. It is common because both of them need to deal with the same 5226206Swpaul * type of object. Generating the actual code though is a bit messy because 5326206Swpaul * the nis.x file and the nis_dba.x file will generate xdr routines to 5426206Swpaul * encode/decode objects when only one set is needed. Such is life when 5526206Swpaul * one is using rpcgen. 5626206Swpaul * 5726206Swpaul * Note, the protocol doesn't specify any limits on such things as 5826206Swpaul * maximum name length, number of attributes, etc. These are enforced 5926206Swpaul * by the database backend. When you hit them you will no. Also see 6026206Swpaul * the db_getlimits() function for fetching the limit values. 6126206Swpaul * 6226206Swpaul */ 6326206Swpaul 6426206Swpaul/* Some manifest constants, chosen to maximize flexibility without 6526206Swpaul * plugging the wire full of data. 6626206Swpaul */ 6726206Swpaulconst NIS_MAXSTRINGLEN = 255; 6826206Swpaulconst NIS_MAXNAMELEN = 1024; 6926206Swpaulconst NIS_MAXATTRNAME = 32; 7026206Swpaulconst NIS_MAXATTRVAL = 2048; 7126206Swpaulconst NIS_MAXCOLUMNS = 64; 7226206Swpaulconst NIS_MAXATTR = 16; 7326206Swpaulconst NIS_MAXPATH = 1024; 7426206Swpaulconst NIS_MAXREPLICAS = 128; 7526206Swpaulconst NIS_MAXLINKS = 16; 7626206Swpaul 7726206Swpaulconst NIS_PK_NONE = 0; /* no public key (unix/sys auth) */ 7826206Swpaulconst NIS_PK_DH = 1; /* Public key is Diffie-Hellman type */ 7926206Swpaulconst NIS_PK_RSA = 2; /* Public key if RSA type */ 8026206Swpaulconst NIS_PK_KERB = 3; /* Use kerberos style authentication */ 8126206Swpaul 8226206Swpaul/* 8326206Swpaul * The fundamental name type of NIS. The name may consist of two parts, 8426206Swpaul * the first being the fully qualified name, and the second being an 8526206Swpaul * optional set of attribute/value pairs. 8626206Swpaul */ 8726206Swpaulstruct nis_attr { 8826206Swpaul string zattr_ndx<>; /* name of the index */ 8926206Swpaul opaque zattr_val<>; /* Value for the attribute. */ 9026206Swpaul}; 9126206Swpaul 9226206Swpaultypedef string nis_name<>; /* The NIS name itself. */ 9326206Swpaul 9426206Swpaul/* NIS object types are defined by the following enumeration. The numbers 9526206Swpaul * they use are based on the following scheme : 9626206Swpaul * 0 - 1023 are reserved for Sun, 9726206Swpaul * 1024 - 2047 are defined to be private to a particular tree. 9826206Swpaul * 2048 - 4095 are defined to be user defined. 9926206Swpaul * 4096 - ... are reserved for future use. 10026206Swpaul */ 10126206Swpaul 10226206Swpaulenum zotypes { 10326206Swpaul BOGUS_OBJ = 0, /* Uninitialized object structure */ 10426206Swpaul NO_OBJ = 1, /* NULL object (no data) */ 10526206Swpaul DIRECTORY_OBJ = 2, /* Directory object describing domain */ 10626206Swpaul GROUP_OBJ = 3, /* Group object (a list of names) */ 10726206Swpaul TABLE_OBJ = 4, /* Table object (a database schema) */ 10826206Swpaul ENTRY_OBJ = 5, /* Entry object (a database record) */ 10926206Swpaul LINK_OBJ = 6, /* A name link. */ 11026206Swpaul PRIVATE_OBJ = 7 /* Private object (all opaque data) */ 11126206Swpaul}; 11226206Swpaul 11326206Swpaul/* 11426206Swpaul * The types of Name services NIS knows about. They are enumerated 11526206Swpaul * here. The Binder code will use this type to determine if it has 11626206Swpaul * a set of library routines that will access the indicated name service. 11726206Swpaul */ 11826206Swpaulenum nstype { 11926206Swpaul UNKNOWN = 0, 12026206Swpaul NIS = 1, /* Nis Plus Service */ 12126206Swpaul SUNYP = 2, /* Old NIS Service */ 12226206Swpaul IVY = 3, /* Nis Plus Plus Service */ 12326206Swpaul DNS = 4, /* Domain Name Service */ 12426206Swpaul X500 = 5, /* ISO/CCCIT X.500 Service */ 12526206Swpaul DNANS = 6, /* Digital DECNet Name Service */ 12626206Swpaul XCHS = 7, /* Xerox ClearingHouse Service */ 12726206Swpaul CDS= 8 12826206Swpaul}; 12926206Swpaul 13026206Swpaul/* 13126206Swpaul * DIRECTORY - The name service object. These objects identify other name 13226206Swpaul * servers that are serving some portion of the name space. Each has a 13326206Swpaul * type associated with it. The resolver library will note whether or not 13426206Swpaul * is has the needed routines to access that type of service. 13526206Swpaul * The oarmask structure defines an access rights mask on a per object 13626206Swpaul * type basis for the name spaces. The only bits currently used are 13726206Swpaul * create and destroy. By enabling or disabling these access rights for 13826206Swpaul * a specific object type for a one of the accessor entities (owner, 13926206Swpaul * group, world) the administrator can control what types of objects 14026206Swpaul * may be freely added to the name space and which require the 14126206Swpaul * administrator's approval. 14226206Swpaul */ 14326206Swpaulstruct oar_mask { 14426206Swpaul u_long oa_rights; /* Access rights mask */ 14526206Swpaul zotypes oa_otype; /* Object type */ 14626206Swpaul}; 14726206Swpaul 14826206Swpaulstruct endpoint { 14926206Swpaul string uaddr<>; 15026206Swpaul string family<>; /* Transport family (INET, OSI, etc) */ 15126206Swpaul string proto<>; /* Protocol (TCP, UDP, CLNP, etc) */ 15226206Swpaul}; 15326206Swpaul 15426206Swpaul/* 15526206Swpaul * Note: pkey is a netobj which is limited to 1024 bytes which limits the 15626206Swpaul * keysize to 8192 bits. This is consider to be a reasonable limit for 15726206Swpaul * the expected lifetime of this service. 15826206Swpaul */ 15926206Swpaulstruct nis_server { 16026206Swpaul nis_name name; /* Principal name of the server */ 16126206Swpaul endpoint ep<>; /* Universal addr(s) for server */ 16226206Swpaul u_long key_type; /* Public key type */ 16326206Swpaul netobj pkey; /* server's public key */ 16426206Swpaul}; 16526206Swpaul 16626206Swpaulstruct directory_obj { 16726206Swpaul nis_name do_name; /* Name of the directory being served */ 16826206Swpaul nstype do_type; /* one of NIS, DNS, IVY, YP, or X.500 */ 16926206Swpaul nis_server do_servers<>; /* <0> == Primary name server */ 17026206Swpaul u_long do_ttl; /* Time To Live (for caches) */ 17126206Swpaul oar_mask do_armask<>; /* Create/Destroy rights by object type */ 17226206Swpaul}; 17326206Swpaul 17426206Swpaul/* 17526206Swpaul * ENTRY - This is one row of data from an information base. 17626206Swpaul * The type value is used by the client library to convert the entry to 17726206Swpaul * it's internal structure representation. The Table name is a back pointer 17826206Swpaul * to the table where the entry is stored. This allows the client library 17926206Swpaul * to determine where to send a request if the client wishes to change this 18026206Swpaul * entry but got to it through a LINK rather than directly. 18126206Swpaul * If the entry is a "standalone" entry then this field is void. 18226206Swpaul */ 18326206Swpaulconst EN_BINARY = 1; /* Indicates value is binary data */ 18426206Swpaulconst EN_CRYPT = 2; /* Indicates the value is encrypted */ 18526206Swpaulconst EN_XDR = 4; /* Indicates the value is XDR encoded */ 18626206Swpaulconst EN_MODIFIED = 8; /* Indicates entry is modified. */ 18726206Swpaulconst EN_ASN1 = 64; /* Means contents use ASN.1 encoding */ 18826206Swpaul 18926206Swpaulstruct entry_col { 19026206Swpaul u_long ec_flags; /* Flags for this value */ 19126206Swpaul opaque ec_value<>; /* It's textual value */ 19226206Swpaul}; 19326206Swpaul 19426206Swpaulstruct entry_obj { 19526206Swpaul string en_type<>; /* Type of entry such as "passwd" */ 19626206Swpaul entry_col en_cols<>; /* Value for the entry */ 19726206Swpaul}; 19826206Swpaul 19926206Swpaul/* 20026206Swpaul * GROUP - The group object contains a list of NIS principal names. Groups 20126206Swpaul * are used to authorize principals. Each object has a set of access rights 20226206Swpaul * for members of its group. Principal names in groups are in the form 20326206Swpaul * name.directory and recursive groups are expressed as @groupname.directory 20426206Swpaul */ 20526206Swpaulstruct group_obj { 20626206Swpaul u_long gr_flags; /* Flags controlling group */ 20726206Swpaul nis_name gr_members<>; /* List of names in group */ 20826206Swpaul}; 20926206Swpaul 21026206Swpaul/* 21126206Swpaul * LINK - This is the LINK object. It is quite similar to a symbolic link 21226206Swpaul * in the UNIX filesystem. The attributes in the main object structure are 21326206Swpaul * relative to the LINK data and not what it points to (like the file system) 21426206Swpaul * "modify" privleges here indicate the right to modify what the link points 21526206Swpaul * at and not to modify that actual object pointed to by the link. 21626206Swpaul */ 21726206Swpaulstruct link_obj { 21826206Swpaul zotypes li_rtype; /* Real type of the object */ 21926206Swpaul nis_attr li_attrs<>; /* Attribute/Values for tables */ 22026206Swpaul nis_name li_name; /* The object's real NIS name */ 22126206Swpaul}; 22226206Swpaul 22326206Swpaul/* 22426206Swpaul * TABLE - This is the table object. It implements a simple 22526206Swpaul * data base that applications and use for configuration or 22626206Swpaul * administration purposes. The role of the table is to group together 22726206Swpaul * a set of related entries. Tables are the simple database component 22826206Swpaul * of NIS. Like many databases, tables are logically divided into columns 22926206Swpaul * and rows. The columns are labeled with indexes and each ENTRY makes 23026206Swpaul * up a row. Rows may be addressed within the table by selecting one 23126206Swpaul * or more indexes, and values for those indexes. Each row which has 23226206Swpaul * a value for the given index that matches the desired value is returned. 23326206Swpaul * Within the definition of each column there is a flags variable, this 23426206Swpaul * variable contains flags which determine whether or not the column is 23526206Swpaul * searchable, contains binary data, and access rights for the entry objects 23626206Swpaul * column value. 23726206Swpaul */ 23826206Swpaul 23926206Swpaulconst TA_BINARY = 1; /* Means table data is binary */ 24026206Swpaulconst TA_CRYPT = 2; /* Means value should be encrypted */ 24126206Swpaulconst TA_XDR = 4; /* Means value is XDR encoded */ 24226206Swpaulconst TA_SEARCHABLE = 8; /* Means this column is searchable */ 24326206Swpaulconst TA_CASE = 16; /* Means this column is Case Sensitive */ 24426206Swpaulconst TA_MODIFIED = 32; /* Means this columns attrs are modified*/ 24526206Swpaulconst TA_ASN1 = 64; /* Means contents use ASN.1 encoding */ 24626206Swpaul 24726206Swpaulstruct table_col { 24826206Swpaul string tc_name<64>; /* Column Name */ 24926206Swpaul u_long tc_flags; /* control flags */ 25026206Swpaul u_long tc_rights; /* Access rights mask */ 25126206Swpaul}; 25226206Swpaul 25326206Swpaulstruct table_obj { 25426206Swpaul string ta_type<64>; /* Table type such as "passwd" */ 25526206Swpaul int ta_maxcol; /* Total number of columns */ 25626206Swpaul u_char ta_sep; /* Separator character */ 25726206Swpaul table_col ta_cols<>; /* The number of table indexes */ 25826206Swpaul string ta_path<>; /* A search path for this table */ 25926206Swpaul}; 26026206Swpaul 26126206Swpaul/* 26226206Swpaul * This union joins together all of the currently known objects. 26326206Swpaul */ 26426206Swpaulunion objdata switch (zotypes zo_type) { 26526206Swpaul case DIRECTORY_OBJ : 26626206Swpaul struct directory_obj di_data; 26726206Swpaul case GROUP_OBJ : 26826206Swpaul struct group_obj gr_data; 26926206Swpaul case TABLE_OBJ : 27026206Swpaul struct table_obj ta_data; 27126206Swpaul case ENTRY_OBJ: 27226206Swpaul struct entry_obj en_data; 27326206Swpaul case LINK_OBJ : 27426206Swpaul struct link_obj li_data; 27526206Swpaul case PRIVATE_OBJ : 27626206Swpaul opaque po_data<>; 27726206Swpaul case NO_OBJ : 27826206Swpaul void; 27926206Swpaul case BOGUS_OBJ : 28026206Swpaul void; 28126206Swpaul default : 28226206Swpaul void; 28326206Swpaul}; 28426206Swpaul 28526206Swpaul/* 28626206Swpaul * This is the basic NIS object data type. It consists of a generic part 28726206Swpaul * which all objects contain, and a specialized part which varies depending 28826206Swpaul * on the type of the object. All of the specialized sections have been 28926206Swpaul * described above. You might have wondered why they all start with an 29026206Swpaul * integer size, followed by the useful data. The answer is, when the 29126206Swpaul * server doesn't recognize the type returned it treats it as opaque data. 29226206Swpaul * And the definition for opaque data is {int size; char *data;}. In this 29326206Swpaul * way, servers and utility routines that do not understand a given type 29426206Swpaul * may still pass it around. One has to be careful in setting 29526206Swpaul * this variable accurately, it must take into account such things as 29626206Swpaul * XDR padding of structures etc. The best way to set it is to note one's 29726206Swpaul * position in the XDR encoding stream, encode the structure, look at the 29826206Swpaul * new position and calculate the size. 29926206Swpaul */ 30026206Swpaulstruct nis_oid { 30126206Swpaul u_long ctime; /* Time of objects creation */ 30226206Swpaul u_long mtime; /* Time of objects modification */ 30326206Swpaul}; 30426206Swpaul 30526206Swpaulstruct nis_object { 30626206Swpaul nis_oid zo_oid; /* object identity verifier. */ 30726206Swpaul nis_name zo_name; /* The NIS name for this object */ 30826206Swpaul nis_name zo_owner; /* NIS name of object owner. */ 30926206Swpaul nis_name zo_group; /* NIS name of access group. */ 31026206Swpaul nis_name zo_domain; /* The administrator for the object */ 31126206Swpaul u_long zo_access; /* Access rights (owner, group, world) */ 31226206Swpaul u_long zo_ttl; /* Object's time to live in seconds. */ 31326206Swpaul objdata zo_data; /* Data structure for this type */ 31426206Swpaul}; 31526206Swpaul#if RPC_HDR 31626206Swpaul% 31726206Swpaul%#endif /* if __nis_object_h */ 31826206Swpaul% 31926206Swpaul#endif 320