17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*4a190493Ssdussud * Common Development and Distribution License (the "License"). 6*4a190493Ssdussud * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*4a190493Ssdussud * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 277c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate /* 307c478bd9Sstevel@tonic-gate * Portions of this source code were derived from Berkeley 4.3 BSD 317c478bd9Sstevel@tonic-gate * under license from the Regents of the University of California. 327c478bd9Sstevel@tonic-gate */ 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #ifndef __YPSYM_H 357c478bd9Sstevel@tonic-gate #define __YPSYM_H 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #ifdef __cplusplus 407c478bd9Sstevel@tonic-gate extern "C" { 417c478bd9Sstevel@tonic-gate #endif 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate /* 447c478bd9Sstevel@tonic-gate * This contains symbol and structure definitions for modules in the YP server 457c478bd9Sstevel@tonic-gate */ 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate #include <ndbm.h> /* Pull this in first */ 487c478bd9Sstevel@tonic-gate #define DATUM 497c478bd9Sstevel@tonic-gate #include <stdio.h> 507c478bd9Sstevel@tonic-gate #include <errno.h> 517c478bd9Sstevel@tonic-gate #include <signal.h> 527c478bd9Sstevel@tonic-gate #include <rpc/rpc.h> 537c478bd9Sstevel@tonic-gate #include <dirent.h> 547c478bd9Sstevel@tonic-gate #include <sys/stat.h> 557c478bd9Sstevel@tonic-gate #include <sys/wait.h> 567c478bd9Sstevel@tonic-gate #include <rpcsvc/yp_prot.h> 577c478bd9Sstevel@tonic-gate #include "ypv1_prot.h" 587c478bd9Sstevel@tonic-gate #include <rpcsvc/ypclnt.h> 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate typedef void (*PFV)(); 617c478bd9Sstevel@tonic-gate typedef int (*PFI)(); 627c478bd9Sstevel@tonic-gate typedef unsigned int (*PFU)(); 637c478bd9Sstevel@tonic-gate typedef long int (*PFLI)(); 647c478bd9Sstevel@tonic-gate typedef unsigned long int (*PFULI)(); 657c478bd9Sstevel@tonic-gate typedef short int (*PFSI)(); 667c478bd9Sstevel@tonic-gate typedef unsigned short int (*PFUSI)(); 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate #ifndef TRUE 697c478bd9Sstevel@tonic-gate #define TRUE 1 707c478bd9Sstevel@tonic-gate #endif 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate #ifndef FALSE 737c478bd9Sstevel@tonic-gate #define FALSE 0 747c478bd9Sstevel@tonic-gate #endif 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate #ifdef NULL 777c478bd9Sstevel@tonic-gate #undef NULL 787c478bd9Sstevel@tonic-gate #endif 797c478bd9Sstevel@tonic-gate #define NULL 0 807c478bd9Sstevel@tonic-gate 81*4a190493Ssdussud /* 82*4a190493Ssdussud * Size of lock hash table 83*4a190493Ssdussud * 84*4a190493Ssdussud * It's for a hash table, hence better if it is prime. 85*4a190493Ssdussud * It's also the max number of maps and map locks, used 86*4a190493Ssdussud * for initializing shared memory: need to be big enough 87*4a190493Ssdussud * (until dynamic shared memory allocation is implemented ?). 88*4a190493Ssdussud */ 89*4a190493Ssdussud #define MAXHASH 1009 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate /* Maximum length of a yp map name in the system v filesystem */ 927c478bd9Sstevel@tonic-gate #define MAXALIASLEN 8 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate #define YPINTERTRY_TIME 10 /* Secs between tries for peer bind */ 957c478bd9Sstevel@tonic-gate #define YPTOTAL_TIME 30 /* Total secs until timeout */ 967c478bd9Sstevel@tonic-gate #define YPNOPORT ((unsigned short) 0) /* Out-of-range port value */ 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gate /* External refs to yp server data structures */ 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate extern bool ypinitialization_done; 1017c478bd9Sstevel@tonic-gate extern struct timeval ypintertry; 1027c478bd9Sstevel@tonic-gate extern struct timeval yptimeout; 1037c478bd9Sstevel@tonic-gate extern char myhostname[]; 1047c478bd9Sstevel@tonic-gate extern bool silent; 1057c478bd9Sstevel@tonic-gate #ifdef MINUS_C_OPTION 1067c478bd9Sstevel@tonic-gate extern bool multiflag; 1077c478bd9Sstevel@tonic-gate #endif 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate /* External ref to logging func */ 1107c478bd9Sstevel@tonic-gate extern void logprintf(char *format, ...); 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate /* External refs for /var/yp/securenets support */ 1137c478bd9Sstevel@tonic-gate extern void get_secure_nets(char *daemon_name); 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate /* External refs to yp server-only functions */ 1167c478bd9Sstevel@tonic-gate extern bool ypcheck_map_existence(char *pname); 1177c478bd9Sstevel@tonic-gate extern bool ypget_map_master(char **owner, DBM *fdb); 1187c478bd9Sstevel@tonic-gate extern DBM *ypset_current_map(char *map, char *domain, uint_t *error); 1197c478bd9Sstevel@tonic-gate extern void ypclr_current_map(void); 1207c478bd9Sstevel@tonic-gate extern bool_t ypmkfilename(char *domain, char *map, char *path); 1217c478bd9Sstevel@tonic-gate extern int yplist_maps(); 1227c478bd9Sstevel@tonic-gate extern bool yp_map_access(SVCXPRT *transp, uint_t *error, DBM *fdb); 1237c478bd9Sstevel@tonic-gate extern bool ypget_map_order(char *map, char *domain, uint_t *order); 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate extern bool ypcheck_domain(); 1267c478bd9Sstevel@tonic-gate extern datum dbm_do_nextkey(); 1277c478bd9Sstevel@tonic-gate extern void ypclr_current_map(void); 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate extern void ypdomain(SVCXPRT *transp, bool always_respond); 1307c478bd9Sstevel@tonic-gate extern void ypmatch(SVCXPRT *transp, struct svc_req *rqstp); 1317c478bd9Sstevel@tonic-gate extern void ypfirst(SVCXPRT *transp); 1327c478bd9Sstevel@tonic-gate extern void ypnext(SVCXPRT *transp); 1337c478bd9Sstevel@tonic-gate extern void ypxfr(SVCXPRT *transp, int prog); 1347c478bd9Sstevel@tonic-gate extern void ypall(SVCXPRT *transp); 1357c478bd9Sstevel@tonic-gate extern void ypmaster(SVCXPRT *transp); 1367c478bd9Sstevel@tonic-gate extern void yporder(SVCXPRT *transp); 1377c478bd9Sstevel@tonic-gate extern void ypmaplist(SVCXPRT *transp); 1387c478bd9Sstevel@tonic-gate extern void ypoldmatch(SVCXPRT *transp, struct svc_req *rqstp); 1397c478bd9Sstevel@tonic-gate extern void ypoldfirst(SVCXPRT *transp); 1407c478bd9Sstevel@tonic-gate extern void ypoldnext(SVCXPRT *transp); 1417c478bd9Sstevel@tonic-gate extern void ypoldpoll(SVCXPRT *transp); 1427c478bd9Sstevel@tonic-gate extern void ypoldpush(SVCXPRT *transp); 1437c478bd9Sstevel@tonic-gate extern void ypoldpull(SVCXPRT *transp); 1447c478bd9Sstevel@tonic-gate extern void ypoldget(SVCXPRT *transp); 1457c478bd9Sstevel@tonic-gate extern int yp_matchdns(DBM *, struct ypreq_key *, struct ypresp_val *); 1467c478bd9Sstevel@tonic-gate extern int yp_oldmatchdns(DBM *fdb, 1477c478bd9Sstevel@tonic-gate struct yprequest *req, struct ypresponse *resp); 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate extern bool _xdr_ypreqeust(XDR *xdrs, struct yprequest *ps); 1507c478bd9Sstevel@tonic-gate extern bool _xdr_ypresponse(XDR *xdrs, struct ypresponse *ps); 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gate extern void setup_resolv(bool *fwding, int *child, CLIENT **client, 1537c478bd9Sstevel@tonic-gate char *tp_type, long prognum); 1547c478bd9Sstevel@tonic-gate extern int resolv_req(bool *fwding, CLIENT **client, int *pid, 1557c478bd9Sstevel@tonic-gate char *tp, SVCXPRT *xprt, struct ypreq_key *req, 1567c478bd9Sstevel@tonic-gate char *map); 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate /* definitions for reading files of lists */ 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate struct listofnames 1627c478bd9Sstevel@tonic-gate { 1637c478bd9Sstevel@tonic-gate struct listofnames *nextname; 1647c478bd9Sstevel@tonic-gate char *name; 1657c478bd9Sstevel@tonic-gate }; 1667c478bd9Sstevel@tonic-gate typedef struct listofnames listofnames; 1677c478bd9Sstevel@tonic-gate 168*4a190493Ssdussud /* 169*4a190493Ssdussud * XXX- NAME_MAX can't be defined in <limits.h> in a POSIX conformant system 1707c478bd9Sstevel@tonic-gate * (under conditions which apply to Sun systems). Removal of this define 1717c478bd9Sstevel@tonic-gate * caused yp to break (and only yp!). Hence, NAME_MAX is defined here 1727c478bd9Sstevel@tonic-gate * *exactly* as it was in <limits.h>. I suspect this may not be the 1737c478bd9Sstevel@tonic-gate * desired value. I suspect the desired value is either: 1747c478bd9Sstevel@tonic-gate * - the maxumum name length for any file system type, or 1757c478bd9Sstevel@tonic-gate * - should be _POSIX_NAME_MAX which is the minimum-maximum name 1767c478bd9Sstevel@tonic-gate * length in a POSIX conformant system (which just happens to 1777c478bd9Sstevel@tonic-gate * be 14), or 1787c478bd9Sstevel@tonic-gate * - should be gotten by pathconf() or fpathconf(). 1797c478bd9Sstevel@tonic-gate * XXX- I leave this to the owners of yp! 1807c478bd9Sstevel@tonic-gate */ 1817c478bd9Sstevel@tonic-gate #define NAME_MAX 14 /* s5 file system maximum name length */ 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1847c478bd9Sstevel@tonic-gate } 1857c478bd9Sstevel@tonic-gate #endif 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate #endif /* __YPSYM_H */ 188