1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 28*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate /* 31*7c478bd9Sstevel@tonic-gate * Portions of this source code were derived from Berkeley 4.3 BSD 32*7c478bd9Sstevel@tonic-gate * under license from the Regents of the University of California. 33*7c478bd9Sstevel@tonic-gate */ 34*7c478bd9Sstevel@tonic-gate 35*7c478bd9Sstevel@tonic-gate #ifndef __YPSYM_H 36*7c478bd9Sstevel@tonic-gate #define __YPSYM_H 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 41*7c478bd9Sstevel@tonic-gate extern "C" { 42*7c478bd9Sstevel@tonic-gate #endif 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate /* 45*7c478bd9Sstevel@tonic-gate * This contains symbol and structure definitions for modules in the YP server 46*7c478bd9Sstevel@tonic-gate */ 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate #include <ndbm.h> /* Pull this in first */ 49*7c478bd9Sstevel@tonic-gate #define DATUM 50*7c478bd9Sstevel@tonic-gate #include <stdio.h> 51*7c478bd9Sstevel@tonic-gate #include <errno.h> 52*7c478bd9Sstevel@tonic-gate #include <signal.h> 53*7c478bd9Sstevel@tonic-gate #include <rpc/rpc.h> 54*7c478bd9Sstevel@tonic-gate #include <dirent.h> 55*7c478bd9Sstevel@tonic-gate #include <sys/stat.h> 56*7c478bd9Sstevel@tonic-gate #include <sys/wait.h> 57*7c478bd9Sstevel@tonic-gate #include <rpcsvc/yp_prot.h> 58*7c478bd9Sstevel@tonic-gate #include "ypv1_prot.h" 59*7c478bd9Sstevel@tonic-gate #include <rpcsvc/ypclnt.h> 60*7c478bd9Sstevel@tonic-gate 61*7c478bd9Sstevel@tonic-gate typedef void (*PFV)(); 62*7c478bd9Sstevel@tonic-gate typedef int (*PFI)(); 63*7c478bd9Sstevel@tonic-gate typedef unsigned int (*PFU)(); 64*7c478bd9Sstevel@tonic-gate typedef long int (*PFLI)(); 65*7c478bd9Sstevel@tonic-gate typedef unsigned long int (*PFULI)(); 66*7c478bd9Sstevel@tonic-gate typedef short int (*PFSI)(); 67*7c478bd9Sstevel@tonic-gate typedef unsigned short int (*PFUSI)(); 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate #ifndef TRUE 70*7c478bd9Sstevel@tonic-gate #define TRUE 1 71*7c478bd9Sstevel@tonic-gate #endif 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate #ifndef FALSE 74*7c478bd9Sstevel@tonic-gate #define FALSE 0 75*7c478bd9Sstevel@tonic-gate #endif 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate #ifdef NULL 78*7c478bd9Sstevel@tonic-gate #undef NULL 79*7c478bd9Sstevel@tonic-gate #endif 80*7c478bd9Sstevel@tonic-gate #define NULL 0 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate /* Size of lock hash table */ 83*7c478bd9Sstevel@tonic-gate #define MAXHASH 91 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate /* Maximum length of a yp map name in the system v filesystem */ 86*7c478bd9Sstevel@tonic-gate #define MAXALIASLEN 8 87*7c478bd9Sstevel@tonic-gate 88*7c478bd9Sstevel@tonic-gate #define YPINTERTRY_TIME 10 /* Secs between tries for peer bind */ 89*7c478bd9Sstevel@tonic-gate #define YPTOTAL_TIME 30 /* Total secs until timeout */ 90*7c478bd9Sstevel@tonic-gate #define YPNOPORT ((unsigned short) 0) /* Out-of-range port value */ 91*7c478bd9Sstevel@tonic-gate 92*7c478bd9Sstevel@tonic-gate /* External refs to yp server data structures */ 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gate extern bool ypinitialization_done; 95*7c478bd9Sstevel@tonic-gate extern struct timeval ypintertry; 96*7c478bd9Sstevel@tonic-gate extern struct timeval yptimeout; 97*7c478bd9Sstevel@tonic-gate extern char myhostname[]; 98*7c478bd9Sstevel@tonic-gate extern bool silent; 99*7c478bd9Sstevel@tonic-gate #ifdef MINUS_C_OPTION 100*7c478bd9Sstevel@tonic-gate extern bool multiflag; 101*7c478bd9Sstevel@tonic-gate #endif 102*7c478bd9Sstevel@tonic-gate 103*7c478bd9Sstevel@tonic-gate /* External ref to logging func */ 104*7c478bd9Sstevel@tonic-gate extern void logprintf(char *format, ...); 105*7c478bd9Sstevel@tonic-gate 106*7c478bd9Sstevel@tonic-gate /* External refs for /var/yp/securenets support */ 107*7c478bd9Sstevel@tonic-gate extern void get_secure_nets(char *daemon_name); 108*7c478bd9Sstevel@tonic-gate 109*7c478bd9Sstevel@tonic-gate /* External refs to yp server-only functions */ 110*7c478bd9Sstevel@tonic-gate extern bool ypcheck_map_existence(char *pname); 111*7c478bd9Sstevel@tonic-gate extern bool ypget_map_master(char **owner, DBM *fdb); 112*7c478bd9Sstevel@tonic-gate extern DBM *ypset_current_map(char *map, char *domain, uint_t *error); 113*7c478bd9Sstevel@tonic-gate extern void ypclr_current_map(void); 114*7c478bd9Sstevel@tonic-gate extern bool_t ypmkfilename(char *domain, char *map, char *path); 115*7c478bd9Sstevel@tonic-gate extern int yplist_maps(); 116*7c478bd9Sstevel@tonic-gate extern bool yp_map_access(SVCXPRT *transp, uint_t *error, DBM *fdb); 117*7c478bd9Sstevel@tonic-gate extern bool ypget_map_order(char *map, char *domain, uint_t *order); 118*7c478bd9Sstevel@tonic-gate 119*7c478bd9Sstevel@tonic-gate extern bool ypcheck_domain(); 120*7c478bd9Sstevel@tonic-gate extern datum dbm_do_nextkey(); 121*7c478bd9Sstevel@tonic-gate extern void ypclr_current_map(void); 122*7c478bd9Sstevel@tonic-gate 123*7c478bd9Sstevel@tonic-gate extern void ypdomain(SVCXPRT *transp, bool always_respond); 124*7c478bd9Sstevel@tonic-gate extern void ypmatch(SVCXPRT *transp, struct svc_req *rqstp); 125*7c478bd9Sstevel@tonic-gate extern void ypfirst(SVCXPRT *transp); 126*7c478bd9Sstevel@tonic-gate extern void ypnext(SVCXPRT *transp); 127*7c478bd9Sstevel@tonic-gate extern void ypxfr(SVCXPRT *transp, int prog); 128*7c478bd9Sstevel@tonic-gate extern void ypall(SVCXPRT *transp); 129*7c478bd9Sstevel@tonic-gate extern void ypmaster(SVCXPRT *transp); 130*7c478bd9Sstevel@tonic-gate extern void yporder(SVCXPRT *transp); 131*7c478bd9Sstevel@tonic-gate extern void ypmaplist(SVCXPRT *transp); 132*7c478bd9Sstevel@tonic-gate extern void ypoldmatch(SVCXPRT *transp, struct svc_req *rqstp); 133*7c478bd9Sstevel@tonic-gate extern void ypoldfirst(SVCXPRT *transp); 134*7c478bd9Sstevel@tonic-gate extern void ypoldnext(SVCXPRT *transp); 135*7c478bd9Sstevel@tonic-gate extern void ypoldpoll(SVCXPRT *transp); 136*7c478bd9Sstevel@tonic-gate extern void ypoldpush(SVCXPRT *transp); 137*7c478bd9Sstevel@tonic-gate extern void ypoldpull(SVCXPRT *transp); 138*7c478bd9Sstevel@tonic-gate extern void ypoldget(SVCXPRT *transp); 139*7c478bd9Sstevel@tonic-gate extern int yp_matchdns(DBM *, struct ypreq_key *, struct ypresp_val *); 140*7c478bd9Sstevel@tonic-gate extern int yp_oldmatchdns(DBM *fdb, 141*7c478bd9Sstevel@tonic-gate struct yprequest *req, struct ypresponse *resp); 142*7c478bd9Sstevel@tonic-gate 143*7c478bd9Sstevel@tonic-gate extern bool _xdr_ypreqeust(XDR *xdrs, struct yprequest *ps); 144*7c478bd9Sstevel@tonic-gate extern bool _xdr_ypresponse(XDR *xdrs, struct ypresponse *ps); 145*7c478bd9Sstevel@tonic-gate 146*7c478bd9Sstevel@tonic-gate extern void setup_resolv(bool *fwding, int *child, CLIENT **client, 147*7c478bd9Sstevel@tonic-gate char *tp_type, long prognum); 148*7c478bd9Sstevel@tonic-gate extern int resolv_req(bool *fwding, CLIENT **client, int *pid, 149*7c478bd9Sstevel@tonic-gate char *tp, SVCXPRT *xprt, struct ypreq_key *req, 150*7c478bd9Sstevel@tonic-gate char *map); 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate 153*7c478bd9Sstevel@tonic-gate /* definitions for reading files of lists */ 154*7c478bd9Sstevel@tonic-gate 155*7c478bd9Sstevel@tonic-gate struct listofnames 156*7c478bd9Sstevel@tonic-gate { 157*7c478bd9Sstevel@tonic-gate struct listofnames *nextname; 158*7c478bd9Sstevel@tonic-gate char *name; 159*7c478bd9Sstevel@tonic-gate }; 160*7c478bd9Sstevel@tonic-gate typedef struct listofnames listofnames; 161*7c478bd9Sstevel@tonic-gate 162*7c478bd9Sstevel@tonic-gate /* XXX- NAME_MAX can't be defined in <limits.h> in a POSIX conformant system 163*7c478bd9Sstevel@tonic-gate * (under conditions which apply to Sun systems). Removal of this define 164*7c478bd9Sstevel@tonic-gate * caused yp to break (and only yp!). Hence, NAME_MAX is defined here 165*7c478bd9Sstevel@tonic-gate * *exactly* as it was in <limits.h>. I suspect this may not be the 166*7c478bd9Sstevel@tonic-gate * desired value. I suspect the desired value is either: 167*7c478bd9Sstevel@tonic-gate * - the maxumum name length for any file system type, or 168*7c478bd9Sstevel@tonic-gate * - should be _POSIX_NAME_MAX which is the minimum-maximum name 169*7c478bd9Sstevel@tonic-gate * length in a POSIX conformant system (which just happens to 170*7c478bd9Sstevel@tonic-gate * be 14), or 171*7c478bd9Sstevel@tonic-gate * - should be gotten by pathconf() or fpathconf(). 172*7c478bd9Sstevel@tonic-gate * XXX- I leave this to the owners of yp! 173*7c478bd9Sstevel@tonic-gate */ 174*7c478bd9Sstevel@tonic-gate #define NAME_MAX 14 /* s5 file system maximum name length */ 175*7c478bd9Sstevel@tonic-gate 176*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 177*7c478bd9Sstevel@tonic-gate } 178*7c478bd9Sstevel@tonic-gate #endif 179*7c478bd9Sstevel@tonic-gate 180*7c478bd9Sstevel@tonic-gate #endif /* __YPSYM_H */ 181