Intial commit

This commit is contained in:
Mario Fetka
2024-05-27 16:13:40 +02:00
parent f8dc12b10a
commit d71d446104
2495 changed files with 539746 additions and 0 deletions

28
prospero/include/FILES Normal file
View File

@@ -0,0 +1,28 @@
FILES
archie.h
ardp.h
implicit_fixes.h
list_macros.h
mitra_macros.h
pcompat.h
perrno.h
pfs.h
pfs_threads.h
pfs_utils.h
plog.h
pmachine.h.dist
posix_signal.h
pparse.h
ppasswd.h
pprot.h
pserver.h.dist
psite.h.dist
psrv.h
sockettime.h
solaris_stdlib.h
string_with_strcasecmp.h
usc-copyr.h
usc-license.h
uw-copyright.h
vcache.h
wais-source.h

174
prospero/include/archie.h Normal file
View File

@@ -0,0 +1,174 @@
/*
* Copyright (c) 1993 by the University of Southern California
*
* For copying and distribution information, please see the file
* <usc-copyr.h>.
*
* Written by bcn 2/15/93 definitions for archie API
*/
#include <usc-copyr.h>
/*
* You MUST select a default archie server to be used as the default server
* for the archie client program. If you do not specify a server, users
* will have to specify the server on the command line. If you do
* select a server, users can override that selection from the command
* line, but your selection will be used by default.
*
* To specif the default server define ARCHIE_HOST to be the name of
* the server, and optionally the following port in parenthesis if not
* the standard port. The name of the server and the port must be
* inside parentheses. For example:
*
* #define ARCHIE_HOST "archie.somedomain.org" or
* #define ARCHIE_HOST "archie.somedomain.org(1528)"
*
* The followin are known archie servers, with comments about the
* version of prospero they were running when this file was last modified.
* In order to work with this version of the archie client, the sites
* must be running at least version 5 of Prospero or higher.
*
* Known archie servers (inc port) Prospero Version and comments
*
* archie.sura.net v5
* archie.sura.net(1526) secondary server not sure of version
* archie.rutgers.edu v5
* archie.au v5
* archie.sogang.ac.kr v5
* archie.kyoto-u.ac.jp v5
* archie.ans.net v1 obsolete server
* archie.unl.edu v1 obsolete server
* archie.funet.fi v1 obsolete server
* archie.doc.ic.ac.uk v1 obsolete server
* archie.ncu.edu.tw v1 obsolete server
*
* Fill in the server for following definition, then uncomment it
*
* #define ARCHIE_HOST "***FILL-IN-SERVER-HERE***"
*/
/*
* Default value for max hits. Note that this is normally different
* for different client implementations. Doing so makes it easier to
* collect statistics on the use of the various clients.
*/
#define AQ_MAX_HITS 100
#define AQ_MAX_MATCH 100
#define AQ_MAX_HITSPM 100
/*
* CLIENT_VERSION may be used to identify the version of the client if
* distributed separately from the Prospero distribution. The version
* command should then identify both the client version and the Prospero
* version identifiers. Note that this identifier is not sent across
* the network. You MUST also obtain a software identifier from
* info-prospero@isi.edu, and set PFS_SW_ID in pfs.h.
*
* #define CLIENT_VERSION "xyz"
*/
struct aquery { /* ** means opaque */
char *host; /* Archie server w/ opt port */
char *string; /* String to be matched */
struct filter *filters; /* Path or domain restrictions */
VLINK expand; /* Links to be expanded */
int maxhits; /* Max entries to return */
int maxmatch; /* Max strings to match */
int maxhitpm; /* Max hits per match */
int offset; /**Where to start search (opaque) */
char query_type; /* Search type - see above */
int (*cmp_proc)(); /* Comp procedure for sorting */
int flags; /* Options - see above */
VLINK results; /* The results of the query */
char *motd; /* Motd from server */
int qpos; /* Service queue pos if available */
int sys_time; /* Expected time til svc complete */
struct timeval retry_at; /* Time for retry */
int wait_fd; /* FD on which waiting */
struct vdir dirst; /**For directory query */
VLINK dirquery; /**Args to directory query */
int status; /* Status of query */
};
#define AQFASTCOMP /* Make assumptions about server to quicken DEFCMP */
/* Query types - search = return hits, match = return strings */
#define AQ_EXACT '=' /* Exact string search */
#define AQ_CI_SUBSTR 'S' /* Case insensitive substring search */
#define AQ_CS_SUBSTR 'C' /* Case sensitive substring search */
#define AQ_REGEX 'R' /* Regular expression search */
#define AQ_ECI_SUBSTR 's' /* Exact or case insensitive sub srch */
#define AQ_ECS_SUBSTR 'c' /* Exact or case sensitive sub search */
#define AQ_EREGEX 'r' /* Exact or regular expression search */
#define AQ_M_CI_SUBSTR 'Z' /* Case insensitive substring match */
#define AQ_M_CS_SUBSTR 'K' /* Case sensitive substring match */
#define AQ_M_REGEX 'X' /* Regular expression match */
#define AQ_M_ECI_SUBSTR 'z' /* Exact or case insensitive sub match */
#define AQ_M_ECS_SUBSTR 'k' /* Exact or case sensitive sub match */
#define AQ_M_EREGEX 'x' /* Exact or regular expression match */
#define AQ_EXP_LINK '\001' /* Expand single directory link */
#define AQ_HOSTINFO '\002' /* Obtain info on matching hosts */
#define AQ_MOTD_ONLY '\003' /* Only check for motd */
/* Flags */
#define AQ_NOSORT 0x01 /* Don't sort */
#define AQ_ASYNC 0x02 /* Run asynchronously */
#define AQ_MOTD 0x80 /* Request server's motd */
/* Status - one of the following or Prospero error code */
#define AQ_INACTIVE 0 /* Request is inactive */
#define AQ_COMPLETE -1 /* Request is complete */
#define AQ_ACTIVE -2 /* Request is executing */
/* Definitions for the comparison procedures */
#define AQ_DEFCMP aq_defcmplink /* Default for query type */
#define AQ_INVDATECMP aq_invdatecmplink /* Inverted by date */
#ifndef ARCHIE_HOST
#define ARCHIE_HOST NULL
#endif
#define aq_init(AQ) (AQ)->host = ARCHIE_HOST; \
(AQ)->string = NULL; \
(AQ)->filters = NULL; \
(AQ)->expand = (VLINK) 0; \
(AQ)->maxhits = AQ_MAX_HITS; \
(AQ)->maxmatch = AQ_MAX_MATCH; \
(AQ)->maxhitpm = AQ_MAX_HITSPM;\
(AQ)->offset = 0; \
(AQ)->query_type = AQ_EXACT; \
(AQ)->cmp_proc = AQ_DEFCMP; \
(AQ)->flags = 0; \
(AQ)->results = (VLINK) 0; \
(AQ)->motd = NULL; \
(AQ)->qpos = 0; \
(AQ)->sys_time = 0; \
(AQ)->wait_fd = -1; \
(AQ)->retry_at.tv_sec = 0; \
(AQ)->retry_at.tv_usec = 0; \
(AQ)->dirquery = (VLINK) 0; \
(AQ)->status = AQ_INACTIVE;
/* Free fields that may have been filled in in call to archie_query */
/* This must be called before a used aquery structure is freed, for */
/* example by returning from a procedure in which it was allocated */
/* on the stack. It must also be called before an aquery structure */
/* is reused. If you hang onto the results, expand, or motd fields */
/* the field should be zeroed as soon as another reference is made */
/* to it, and it then becomes your resonsibility to explicitly free */
/* the fields. */
#define aq_reset(AQ) if((AQ)->filters) fllfree((AQ)->filters); \
if((AQ)->expand) vllfree((AQ)->expand); \
if((AQ)->results) vllfree((AQ)->results); \
if((AQ)->motd) stfree((AQ)->motd); \
if((AQ)->motd) stfree((AQ)->motd); \
aq_init(AQ);
/* Function prototypes */
int aq_query(struct aquery*,int); /* Execute an archie query */
char *aq_lhost(VLINK,char*,int); /* Extract host name from link */
char *aq_lhsoname(VLINK); /* Extract filename from link */
int aq_defcmplink(VLINK,VLINK); /* Compare by host and filename */
int aq_invdatecmplink(VLINK,VLINK); /* Compare links inverted by date */
int aq_restrict(struct aquery*,char*,char*,char); /* Add filters */

537
prospero/include/ardp.h Normal file
View File

@@ -0,0 +1,537 @@
/*
* Copyright (c) 1991-1994 by the University of Southern California
*
* For copying and distribution information, please see the file
* <usc-license.h>.
*/
#include <usc-license.h>
#include <stdio.h> /* for FILE */
#ifdef ARCHIE_TIMING
#include <time.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/resource.h>
#endif
/*
* Written by bcn 1989-92 as pfs.h in the Prospero distribution
* Modified by bcn 1/93 separate include file and extended preq structure
* Modified by swa 11/93 error reporting; less dependent on Prospero
*/
#ifndef ARDP_H_INCLUDED
#define ARDP_H_INCLUDED
#include <pfs_threads.h> /* PFS threads package. */
#include <sys/time.h>
#include <sys/types.h>
/* Unfortunately, some buggy compilers (in this case, gcc 2.1 under
VAX BSD 4.3) get upset if <netinet/in.h> is included twice. */
/* Note that the IEEE C standard specifies that multiple inclusions of an
include file should not matter. */
#if !defined(IP_OPTIONS)
#include <netinet/in.h>
#endif
#include <list_macros.h>
/* Note: In doubly linked lists of the structures used for prospero, the */
/* ->previous element of the head of the list is the tail of the list and */
/* the ->next element of the tail of the list is NULL. This allows fast */
/* addition at the tail of the list. */
/* #defining this turns on extra consistency checking code in the various
memory allocators that checks for double freeing. Turn on this compilation
option if you are experimenting with the PFS library and want to make sure
you are not making this common mistake. We have left it turned on for this
ALPHA release. */
/* This consistency checking mechanism is used by the ARDP library and general
Prospero data structures. The only exception is the RREQ structure, which
does consistency checking differently. */
#define P_ALLOCATOR_CONSISTENCY_CHECK
#define ALLOCATOR_CONSISTENCY_CHECK /* deprecated but still necessary */
#ifdef P_ALLOCATOR_CONSISTENCY_CHECK /* patterns to set the 'consistency' member
to. */
#define FREE_PATTERN P__FREE_PATTERN /* old interface deprecated */
#define INUSE_PATTERN P__INUSE_PATTERN /* old interface deprecated */
#define P__FREE_PATTERN 0Xca01babe /* pattern to use if memory is now free. */
#define P__INUSE_PATTERN 0X53ad00d /* Pattern to set consistency member to
if memory is in use. */
#endif
#define PROSPERO
#ifdef PROSPERO
#define ARDP_DEFAULT_PEER "dirsrv"/* Default destination port name */
#define ARDP_DEFAULT_PORT 1525 /* Default destination port number */
#endif /* PROSPERO */
#define ARDP_BACKOFF(x) (2 * x) /* Backoff algorithm */
#define ARDP_DEFAULT_TIMEOUT 4 /* Default time before retry (sec) */
#define ARDP_DEFAULT_RETRY 3 /* Default number of times to try */
#define ARDP_DEFAULT_WINDOW_SZ 16 /* Default maximum packets to send at
once, unless special request
received from client. */
#define ARDP_MAX_WINDOW_SZ 256 /* Maximum # of packets we'll send
out, no matter what a client
requests. Might be redefined
locally if you're at the far end of
a slow link. */
#define ARDP_FIRST_PRIVP 901 /* First prived local port to try */
#define ARDP_NUM_PRIVP 20 /* Number of prived ports to try */
#define ARDP_PTXT_HDR 64 /* Max offset for start */
#define ARDP_PTXT_LEN 1250 /* Max length for data to send */
#define ARDP_PTXT_LEN_R 1405 /* Max length for received data */
/* Rationale for MAX_PTXT_LEN_R: According to IEEE std. 802.5, 1492 is the */
/* max data length for an ethernet packet. IP implementers tend to use */
/* this information in deciding how large a packet could be sent without IP */
/* fragmentation occurring. Subtract 16 octets for the IP header. */
/* Subtract 8 octets for UDP header. The maximum ARDP header size is 6 bits */
/* or 64, so subtract 64 more for the ARDP header. This leaves 1404 bytes. */
/* Note we only generate 1250 bytes because there are preV5 implementations */
/* out there with smaller limits. We also add one to MAX_PTXT_LEN_R to make */
/* sure there is always room to insert a null if needed. */
/* Must leave room to insert header when sending and to strip it on receipt */
#define ARDP_PTXT_DSZ ARDP_PTXT_LEN_R+2*ARDP_PTXT_HDR
/* Definition of text structure used to pass around each packet */
struct ptext {
#ifdef ALLOCATOR_CONSISTENCY_CHECK
int consistency;
#endif
unsigned int seq; /* Packet sequence number */
int length; /* Length of text (from start) */
char *start; /* Start of packet */
char *text; /* Start of text */
char *ioptr; /* Current position for i/o */
char dat[ARDP_PTXT_DSZ];/* The data itself incl headers */
unsigned long mbz; /* ZERO to catch runaway strings */
struct ptext *previous; /* Previous element in list */
struct ptext *next; /* Next element in linked list */
};
typedef struct ptext *PTEXT;
typedef struct ptext PTEXT_ST;
#define NOPKT ((PTEXT) 0) /* NULL pointer to ptext */
/* Request structure: maintains information about pending requests */
struct rreq {
int status; /* Status of request *rr1 */
int flags; /* Options for ARDP library *rr2 */
unsigned short cid; /* Connection ID - net byte order */
short priority; /* Priority - host byte order */
int pf_priority; /* Priority assigned by pri_func */
short peer_ardp_version;/* Peer ARD protocol version *rr3 */
struct ptext *inpkt; /* Packet in process by applic */
unsigned short rcvd_tot; /* Total # of packets to receive */
struct ptext *rcvd; /* Received packets */
unsigned short rcvd_thru; /* Received all packets through # */
struct ptext *comp_thru; /* Pointer to RCVD_THRUth packet */
struct ptext *outpkt; /* Packets not yet sent */
unsigned short trns_tot; /* Total # of packets for trns */
struct ptext *trns; /* Transmitted packets */
unsigned short prcvd_thru; /* Peer's rcvd_thru (host byte ord)*/
unsigned short window_sz; /* My window size (default: 0 (sender
does whatever they choose)
(hostorder) */
unsigned short pwindow_sz; /* Peer window (dflt ARDP_WINDOW_SZ).
0 means no limit on # to send.
(hostorder)*/
struct sockaddr_in peer; /* Sender/Destination */
#define peer_addr peer.sin_addr /* Address in network byte order */
#define peer_port peer.sin_port /* Port in network byte order */
struct timeval rcvd_time; /* Time request was received */
struct timeval svc_start_time; /* Time service began on request */
struct timeval svc_comp_time; /* Time service was completed */
struct timeval timeout; /* Initial time to wait for resp */
struct timeval timeout_adj; /* Adjusted time to wait for resp */
struct timeval wait_till; /* Time at which timeout expires */
unsigned short retries; /* Number of times to retry */
unsigned short retries_rem; /* Number of retries remaining */
unsigned short svc_rwait; /* Svc suggested tm2wait b4 retry */
unsigned short svc_rwait_seq; /* Seq # when scv_rwait changed */
unsigned short inf_queue_pos; /* Service queue pos if available */
int inf_sys_time; /* Expected time til svc complete */
#ifdef PROSPERO
struct pfs_auth_info *auth_info; /* Client authentication info */
#endif /* PROSPERO */
char *client_name; /* Client name string for logging */
char *peer_sw_id; /* Peer's software specific ident */
int (*cfunction)(); /* Function to call when done */
char *cfunction_args; /* Additional args to cfunction */
struct rreq *previous; /* Previous element in list */
struct rreq *next; /* Next element in linked list */
#ifdef ARCHIE_TIMING
int no_matches; /* Number of matches returned */
char query_state; /* State of query S,F */
char match_type; /* Type of match E,S,R */
char cached;
char case_type; /* Case S,X */
char domain_match; /* Domain match D,X */
char path_match; /* Path match P,X */
char search_str[MAXPATHLEN]; /* search string */
char launch[30]; /* Time started the processing */
char start[30]; /* Time got request */
char end[30]; /* Time returned request */
struct rusage qtime_start; /* To figure out the timings */
struct rusage qtime_end;
struct rusage stime_start;
struct rusage stime_end;
struct rusage htime_start;
struct rusage htime_end;
int hosts; /* Hosts that contain */
int hosts_searched; /* Hosts searched */
#endif
};
/* *rr1: this is also used for consistency checking. */
/* Values for this field: */
#define ARDP_STATUS_NOSTART 0 /* not started or inactive */
#define ARDP_STATUS_INACTIVE 0
#define ARDP_STATUS_COMPLETE -1 /* done */
#define ARDP_STATUS_ACTIVE -2 /* running */
#define ARDP_STATUS_ACKPEND -3
#define ARDP_STATUS_GAPS -4
#define ARDP_STATUS_ABORTED -5
#define ARDP_STATUS_FREE -6 /* used for consistency checking; free */
#define ARDP_STATUS_FAILED 255
/* *rr2: There is only one flag currently defined. */
/* Send the client's preferred window size along with the next packet you
transmit. At the moment, this flag is never cleared once it is set, so all
packets are tagged with the preferred window size. There are other
strategies that will be tried later. */
/* At the moment, this flag is only set in ardp_rqalloc(). */
#define ARDP_FLAG_SEND_MY_WINDOW_SIZE 0x1
#ifdef PROSPERO
/* This is used only on the clients. It means they're when speaking to a
Version 0 Prospero server, but one which used the Prospero 5.0, 5.1, or 5.2
releases. */
#define ARDP_FLAG_PEER_HAS_EXCESSIVE_ACK_BUG 0x2
#endif
/* *rr3: There are several odd numbers you might find. */
/* 0 is the current version of the ARDP library. */
/* -1 is an older version. This is used only on the servers when speaking to
V1 archie clients. */
/* -2 is a newer version than -1, but still old enough that bugs appeared.
This is used only on the servers when speaking to V1 archie clients. */
/* Version 1 of the ARDP library has been designed. Not yet implemented. */
#define S_AD_SZ sizeof(struct sockaddr_in)
#define PEER_PORT(req) (ntohs((req)->peer_port)) /* host byte order */
typedef struct rreq *RREQ;
typedef struct rreq RREQ_ST;
#define NOREQ ((RREQ) 0) /* NULL pointer to rreq */
/* ARDP library error status codes. */
/* These must remain in the range 0-20 for compatibility with the Prospero
File System. */
/* Note that ARDP_SUCCESS must remain 0, due to code implementation. */
#define ARDP_SUCCESS 0 /* Successful completion of call */
#define ARDP_PORT_UNKN 1 /* DIRSRV UDP port unknown */
#define ARDP_UDP_CANT 2 /* Can't open local UDP port */
#define ARDP_BAD_HOSTNAME 3 /* Can't resolve hostname */
#define ARDP_NOT_SENT 4 /* Attempt to send message failed */
#define ARDP_SELECT_FAILED 5 /* Select failed */
#define ARDP_BAD_RECV 6 /* Recvfrom failed */
#define ARDP_BAD_VERSION 7 /* bad version # in rdgram protocol */
#define ARDP_BAD_REQ 8 /* Inconsistent request structure */
#define ARDP_TIMEOUT 9 /* Timed out - retry count exceeded */
#define ARDP_REFUSED 10 /* Connection refused by server */
#define ARDP_FAILURE 11 /* Unspecified ARDP failure */
#define ARDP_TOOLONG 12 /* Buffer too long for packet */
/* These are the interface used to the ARDP library's error reporting.
These are the same as definitions used in the Prospero PFS library. */
/* extern int perrno; \* Place where error codes are set. */
extern void p_clear_errors(void); /* Clear perrno in ARDP library; clear pwarn
and p_err_string and p_warn_string as well
in PFS library. */
#define ARDP_PENDING -1 /* The request is still pending */
#define ARDP_WAIT_TILL_TO -1 /* Wait until timeout occurs */
#define ARDP_A2R_SPLIT 0x00 /* OK to split across packets */
#define ARDP_A2R_NOSPLITB 0x01 /* Don't split across packets */
#define ARDP_A2R_NOSPLITL 0x02 /* Don't split lines across packets */
#define ARDP_A2R_NOSPLITBL 0x03 /* NOSPLITB|NOSPLITL */
#define ARDP_A2R_TAGLENGTH 0x04 /* Include length tag for buffer */
#define ARDP_A2R_COMPLETE 0x08 /* This is the final packet to add */
#define ARDP_R_INCOMPLETE 0x00 /* More messages will follow */
#define ARDP_R_NOSEND 0x02 /* Add to req->trns but don't send */
#define ARDP_R_COMPLETE 0x08 /* This is the final packet to send */
/* Queuing priorities for requests */
#define ARDP_MAX_PRI 32765 /* Maximum user proiority */
#define ARDP_MAX_SPRI 32767 /* Maximum priority for system use */
#define ARDP_MIN_PRI -32765 /* Maximum user proiority */
#define ARDP_MIN_SPRI -32768 /* Maximum priority for system use */
/* LONG_TO_SHORT_NAME is needed for linkers that can't handle long names */
#ifdef LONG_TO_SHORT_NAME
#define ardp_abort RDABOR
#define ardp_abort_on_int RDABOI
#define ardp_accept RDACPT
#define ardp_activeQ RDACTV
#define ardp_add2req RDA2RQ
#define ardp_acknowledge RDACKN
#define ardp_bind_port RDBPRT
#define ardp_breply RDBREP
#define ardp_completeQ RDCMPQ
#define ardp_def_port_no RDDPNO
#define ardp_default_retry RDDFRT
#define ardp_default_timeout RDDFTO
#define ardp_doneQ RDDONQ
#define ardp_get_nxt RDGNXT
#define ardp_get_nxt_nonblocking RDGNNB
#define ardp_headers RDHDRS
#define ardp_init RDINIT
#define ardp_next_cid RDNCID
#define ardp_partialQ RDPRTQ
#define ardp_pendingQ RDPNDQ
#define ardp_port RDPORT
#define ardp_pri_func RDPRIF
#define ardp_pri_override RDOVRD
#define ardp_priority RDPRIO
#define ardp_process_active RDPACT
#define ardp_prvport RDPPRT
#define ardp_ptalloc RDPTAL
#define ardp_ptfree RDPTFR
#define ardp_ptlfree RDPTLF
#define ardp_redirect RDREDR
#define ardp_refuse RDRFSE
#define ardp_reply RDREPL
#define ardp_respond RDRESP
#define ardp_retrieve RDRETR
#define ardp_rqalloc RDRQAL
#define ardp_rqfree RDRQFR
#define ardp_rq_partialfree RDRQPF
#define ardp_rqlfree RDRQLF
#define ardp_runQ RDRUNQ
#define ardp_rwait RDRWAI
#define ardp_send RDSEND
#define ardp_set_prvport RDSPPT
#define ardp_set_queuing_policy RDSQPL
#define ardp_set_retry RDSETR
#define ardp_showbuf RDSHBF
#define ardp_snd_pkt RDSPKT
#define ardp_srvport RDSPRT
#define ardp_trap_int RDTINT
#define ardp_update_cfields RDUPCF
#define ardp_xmit RDXMIT
#define ptext_count PTXCNT
#define ptext_max PTXMAX
#define rreq_count RRQCNT
#define rreq_max RRQMAX
#endif /* LONG_TO_SHORT_NAME */
/* Please keep this list alpphabetically sorted. */
int ardp_abort(RREQ);
int ardp_abort_on_int(void);
int ardp_accept(void);
int ardp_add2req(RREQ,int,char*,int);
int ardp_acknowledge(RREQ req);
int ardp_bind_port(char*);
int ardp_breply(RREQ,int,char*,int);
RREQ ardp_get_nxt(void);
RREQ ardp_get_nxt_nonblocking(void);
int ardp_headers(RREQ);
/* Variable name "hostname" Commented out to shut up GCC -Wshadow */
int ardp_hostname2addr(const char * /* hostname */, struct sockaddr_in *hostaddr);
void ardp_hostname2addr_initcache(void);
extern int ardp_priority;
int ardp_process_active(void);
PTEXT ardp_ptalloc(void);
void ardp_ptfree(PTEXT);
void ardp_ptlfree(PTEXT);
int ardp_reply(RREQ,int,char*);
int ardp_respond(RREQ,int);
int ardp_retrieve(RREQ,int);
RREQ ardp_rqalloc(void);
void ardp_rqfree(RREQ);
#ifndef NDEBUG
void ardp_rq_partialfree(RREQ);
#endif
void ardp_rqlfree(RREQ);
int ardp_rwait(RREQ,int,short,int);
int ardp_send(RREQ,char*,struct sockaddr_in*,int);
int ardp_set_prvport(int);
int ardp_set_queuing_policy(int(*pf)(),int);
int ardp_set_retry(int,int);
void ardp_showbuf(const char *st, int length, FILE *out);
int ardp_snd_pkt(PTEXT,RREQ);
int ardp_xmit(RREQ,int);
/* these are used to look for memory leaks. Currently used by dirsrv.c to
return STATUS information. Internal to ARDP library. */
extern int dnscache_count;
extern int dnscache_max;
/* Used to see how many cached items are in */
extern int alldnscache_count;
/* Checked for memory leaks. */
extern int filelock_count;
extern int filelock_max;
extern int pfs_debug; /* used in ARDP library for error messages. */
/* Should be renamed. */
/* these are used to look for memory leaks. Currently used by dirsrv.c to
return STATUS information. */
extern int ptext_count;
extern int ptext_max;
extern int rreq_count;
extern int rreq_max;
/* Check for case-blind string equality, where s1 or s2 may be null
pointer. */
int stcaseequal(const char *s1, const char*s2);
extern const char*unixerrstr(void);
/* File locking prototypes. */
/* Could these be made ARDP internal? hope so. */
#include <../lib/ardp/flocks.h>
FILELOCK filelock_alloc(void);
void filelock_free(FILELOCK fl);
void filelock_lfree(FILELOCK fl);
void filelock_freespares(void);
void filelock_release(const char *filename, int readonly);
void filelock_obtain(const char *filename, int readonly);
/* File locking functions. Also in pfs_threads.h */
extern int locked_fclose_A(FILE *afle, const char *filename, int readonly);
extern FILE *locked_fopen(const char *filename, const char *mode);
int locked_fclose_and_rename(FILE *afile, const char *tmpfilename, const char *filename, int retval);
extern void locked_clear(FILE *a); /* also in pfs_threads.h */
/* Mutex stuff for pfs_threads on server side only still.. */
extern void ardp_init_mutexes(void); /* need not be called. */
#ifndef NDEBUG
extern void ardp_diagnose_mutexes(void); /* need not be called. */
#endif /*NDEBUG*/
EXTERN_MUTEXED_DECL(RREQ, ardp_runQ);
EXTERN_MUTEXED_DECL(RREQ, ardp_doneQ);
EXTERN_MUTEXED_DECL(RREQ, ardp_pendingQ);
#ifdef PFS_THREADS
extern p_th_mutex p_th_mutexARDP_ACCEPT; /* declared in ardp_mutexes.c */
extern p_th_mutex p_th_mutexPTEXT; /* declared in ardp_mutexes.c */
extern p_th_mutex p_th_mutexARDP_RQALLOC; /* declared in ardp_mutexes.c */
extern p_th_mutex p_th_mutexGETHOSTBYNAME; /* declared in ardp_mutexes.c */
extern p_th_mutex p_th_mutexARDP_SELFNUM; /* declared in ardp_mutexes.c */
#endif
#include <implicit_fixes.h> /* Fixes for implicit definitions */
/* Internal error handling code (formerly in pfs.h). */
/* Internal error handling routines used by the pfs code; formerly in *
* internal_error.h. These include a replacement for the assert() *
* macro, and an interface for internal error handling, better *
* documented in internal_error.c */
/* XXX These are duplicated in include/pfs_utils.h; need to do code
cleanup here. */
#ifndef NDEBUG
#ifndef assert
#define assert(expr) \
do { \
if (!(expr)) \
internal_error("assertion violated: " #expr); \
} while(0)
#endif /* assert */
#else /* NDEBUG */
#ifndef assert
#define assert(expr) do {;} while(0)
#endif /* assert() */
#endif /* NDEBUG */
#if 0 /* OLD version -- keep until new one works */
#define internal_error(msg) \
do { \
write(2, "Internal error in file " __FILE__ ": ", \
sizeof "Internal error in file " __FILE__ ": " -1); \
write(2, msg, strlen(msg)); \
write(2, "\n", 1); \
if (internal_error_handler) \
(*internal_error_handler)(__FILE__, __LINE__, msg); \
else { \
fprintf(stderr, "line of error: %d\n", __LINE__); \
abort(); \
} \
} while(0)
#else
#ifndef internal_error
#define internal_error(msg) \
internal_error_helper(msg, __LINE__)
#define internal_error_helper(msg,line) \
do { \
write(2, "Internal error in file " __FILE__ " (line " #line "): ",\
sizeof "Internal error in file " __FILE__ " (line " #line "): " -1);\
write(2, msg, strlen(msg)); \
write(2, "\n", 1); \
if (internal_error_handler) \
(*internal_error_handler)(__FILE__, line, msg); \
/* If the internal_error_handler() ever returns, we should not continue.
*/ \
abort(); \
} while(0)
#endif /* internal_error() */
#endif
/* This function may be set to handle internal errors. Dirsrv handles them in
this way, by logging to plog. We make it int instead of void, because
older versions of the PCC (Portable C Compiler) cannot handle pointers to
void functions. */
/* variable name "line" commented out to shut up GCC -Wshadow. */
extern int (*internal_error_handler)(const char file[], int /* line */, const char mesg[]);
/* Some short macros that really hike the efficiency of this code. */
/* Like bcopy(a, b, 1), but much faster. */
#define bcopy1(a, b) do { \
((char *) (b))[0] = ((char *) (a))[0]; \
} while(0)
#define bcopy2(a, b) do { \
bcopy1(a, b); \
/* Next line depends on unary cast having higher precedence than \
addition. (Guaranteed to be true.) */ \
bcopy1((char *) (a) + 1, (char *) (b) + 1); \
} while(0)
#define bcopy4(a, b) do { \
bcopy2((a), (b)); \
bcopy2((char *) (a) + 2, (char *) (b) + 2);\
} while(0)
#define bzero1(a) do { \
((char *) (a))[0] = '\0'; \
} while(0)
#define bzero2(a) do { \
bzero1(a); \
bzero1((char *) (a) + 1); \
} while (0)
#define bzero3(a) do { \
bzero2(a); \
bzero1((char *) (a) + 2); \
} while(0)
#define bzero4(a) do { \
bzero2(a); \
bzero2((char *) (a) + 2); \
} while(0)
#endif /* not ARDP_H_INCLUDED */

View File

@@ -0,0 +1,61 @@
/* The includes you need should really be specified in each file, but
there are so many places they are not included, that this is
the lazy way to do it */
/* This file works pretty well under Solaris, but these include files don't
prototype all the stuff under SunOS 4.x that they do under Solaris. So
we can't run GCC with -Wimplicit under SunOS 4.x */
#ifndef PFS_IMPLICIT_FIXES_H
#define PFS_IMPLICIT_FIXES_H
#include <string.h> /*strncmp etc */
#include <sys/types.h> /*read etc */
#include <sys/uio.h> /* read etc */
#include <unistd.h> /* read etc */
#include <stdlib.h> /* malloc etc */
#include <sys/stat.h> /* For open */
#include <fcntl.h> /* open */
#include <ctype.h> /* isascii */
#include <sys/socket.h> /* for inet_ntoa*/
#include <netinet/in.h> /* for inet_ntoa */
#include <arpa/inet.h> /* for inet_ntoa */
#ifdef SOLARIS
/* might be needed by other SYSV derived systems? */
/* not used on HPUX or SCOUNIX. */
/* Not a part of the Posix 1003.1 standard. */
#include <crypt.h> /* for crypt */
#endif
#if defined(PFS_THREADS) && defined(PARANOID)
#define VLDEBUGBEGIN \
{ \
extern int vlink_count, subthread_count; \
int vlcount = ((subthread_count > 1) ? -1 : vlink_count);
#define VLDEBUGIN(vvvv) \
{ if (vlcount != -1) vlcount += vl_nlinks(vvvv); }
#define VLDEBUGAT(at) \
{ if (vlcount != -1) vlcount += at_nlinks(at); }
#define VLDEBUGEND \
assert (subthread_count >1 || vlcount == -1 || vlcount == vlink_count); \
}
#else
#define VLDEBUGBEGIN
#define VLDEBUGIN(vl)
#define VLDEBUGAT(at)
#define VLDEBUGEND
#endif
#define VLDEBUGOB(ob) { VLDEBUGIN(ob->links); VLDEBUGIN(ob->ulinks); \
VLDEBUGAT(ob->attributes); }
#define VLDEBUGDIR(dir) { VLDEBUGIN(dir->links); VLDEBUGIN(dir->ulinks); \
VLDEBUGAT(dir->attributes); }
#define VLDEBUGFI(fi) { \
VLDEBUGIN(fi->backlinks); \
VLDEBUGIN(fi->forward); VLDEBUGAT(fi->attributes); }
extern int subthread_count;
extern void it_failed(void);
#endif /*PFS_IMPLICIT_FIXES_H*/

View File

@@ -0,0 +1,247 @@
/*
* Copyright (c) 1992, 1993 by the University of Southern California
*
* For copying and distribution information, please see the file
* <usc-copyr.h>.
*
* Written by swa 1992 To manipulate lists in prospero and ardp
* Modified by bcn 1/93 Added EXTRACT ITEM and fixed several bugs
* Modified by swa 9/93 Added APPEND_LISTS.
* Modified by swa 10/93 Quick hack to make assert() in APPEND_LISTS ok.
* Modified by swa 2/94 Added PREPEND_ITEM, renamed APPEND_LISTS to
* CONCATENATE_LISTS
* Modified by swa 4/94 Got rid of mitra changes to check_offlist.
*/
#include <usc-copyr.h>
#ifndef LIST_MACROS_H
#define LIST_MACROS_H
#include <pfs_threads.h> /* for mutex stuff */
/* All the macros in this file are documented in the Prospero library reference
manual. */
#ifndef NDEBUG
#ifndef PARANOID /* could be defined on a per-file basis */
#define PARANOID
#endif
/* See comment below about why this is normally not enabled. Turn on at your
own risk. --swa, April 15, 1994 */
/* #define MITRA_PARANOID */
#endif
#ifdef PARANOID
#define CHECK_HEAD(head) do { \
if (head) { \
assert(!(head)->previous->next) ; \
/*assert((head)->consistency == INUSE_PATTERN);*/ \
} \
} while(0)
#ifdef MITRA_PARANOID
/* This is actually not a very cool macro to use because
much of prospero does not explicitly reset items off the lists to have NULL
NEXT and PREVIOUS pointers. */
/* Mitra notes that he likes resetting items of the list to have NULL next
and previous pointers.
However, this is causing efficiency problems for some ISI applications.
Therefore, this option is normally disabled. If you enable it, you are
warned that there is likely to be code in the base Prospero release which
does not follow the Mitra convention of setting items off the lists to have
null NEXT and PREVIOUS pointers. */
#define CHECK_OFFLIST(n) do { \
/*assert(n->consistency == INUSE_PATTERN);*/ \
assert(n); \
assert(!(n)->next && !(n)->previous); \
} while(0)
/* Ditto for previous comment. */
#define CHECK_NEXT(m) assert(!(m)->next || ((m)->next->previous == (m)))
#else /*MITRA_PARANOID*/
/* not MITRA_PARANOID */
#define CHECK_OFFLIST(nonmemb) do { } while(0)
#define CHECK_NEXT(memb) do { } while(0)
#endif
#define CHECK_PTRinBUFF(b,p) assert(((b) <= (p)) && ((p) <= (b)+strlen(b)))
void check_mem(void); /* declare it */
#define CHECK_MEM() check_mem()
#else /*!PARANOID*/
#define CHECK_HEAD(head) do { } while(0)
#define CHECK_OFFLIST(nonmemb) do { } while(0)
#define CHECK_NEXT(memb) do { } while(0)
#define CHECK_PTRinBUFF(b,p) do { } while(0)
#define CHECK_MEM() do { } while(0)
#endif /*!PARANOID*/
/*
* This macro appends an item to a doubly linked list. The item goes
* at the TAIL of the list. This macro modifies its second argument.
* if head is non-null, head->previous will always be the TAIL of
* the list.
*/
#define APPEND_ITEM(new, head) do { \
CHECK_HEAD(head); \
CHECK_OFFLIST(new); \
if((head)) { \
(new)->previous = (head)->previous; \
(head)->previous = (new); \
(new)->next = NULL; \
(new)->previous->next = (new); \
} else /* !(head) */ { \
(head) = (new); \
(new)->previous = (new); \
(new)->next = NULL; \
} \
} while(0)
/* Add new to a currently empty list */
#define NEW_LIST(new,head) do { \
assert(!head); \
CHECK_OFFLIST(new); \
new->previous = head = new; \
new->next = NULL; \
} while(0)
/* Put item on head of the queue */
/* This is mitra's implemtation. It fails when the queue is empty (i.e., when
"head' is NULL.). I have commented it out in favor of the one I've been
using. */
#if 0 /* leaving it in for a while. */
#define PREPEND_ITEM(new, head) do { \
CHECK_HEAD(head); \
CHECK_OFFLIST(new); \
new->previous = head->previous; \
new->next = head; \
head = head->previous = new; \
} while(0)
#endif /* 0 */
#ifndef PREPEND_ITEM
/* Alternative implementation. Either should work. */
/*
* This macro prepends the item NEW to the doubly-linked list headed by HEAD.
* NEW should not be a member of HEAD or the results are unpredictable.
*/
#define PREPEND_ITEM(new, head) do { \
/* Make the item a one-element list. */ \
(new)->next = NULL; \
(new)->previous = (new); \
/* Concatenate the full list to the one-element list. */ \
CONCATENATE_LISTS((new), (head)); \
(head) = (new); /* reset the list head. */ \
} while(0)
#endif
#define TH_APPEND_ITEM(new, head, PREFIX) do { \
p_th_mutex_lock(p_th_mutex##PREFIX); \
APPEND_ITEM(new, head); \
p_th_mutex_unlock(p_th_mutex##PREFIX); \
} while(0)
/*
* This macro removes an item from a doubly-linked list headed by HEAD.
* If ITEM is not a member of the list, the results are not defined.
* The extracted item will NOT be freed.
* Minor efficiency (code size) improvement by Mitra
*/
/* Use this if only know head, and we know its the last item */
/* from mitra. */
#define EXTRACT_HEAD_LAST_ITEM(head) do { \
(head)->previous = (head)->previous->previous; \
(head)->previous->next->previous = NULL; \
(head)->previous->next = NULL; \
} while(0)
/* Use this if both item and head are known, and we know it's the last item */
/* from mitra. */
#define EXTRACT_LAST_ITEM(item,head) do { \
(head)->previous = (item)->previous; \
(item)->previous = NULL; \
(head)->previous->next = NULL; \
} while(0)
/* swa tends to use just this one. */
/* someone else uses the above code, they just don't have it in a macro!*/
/* I do not understand the above comment --swa, 4/13/94 */
#define EXTRACT_ITEM(item, head) do { \
if ((head) == (item)) { \
(head) = (item)->next; \
if (head) (head)->previous = (item)->previous; \
} else { \
(item)->previous->next = (item)->next; \
if ((item)->next) (item)->next->previous = (item)->previous; \
else (head)->previous = (item)->previous; \
} \
(item)->previous = NULL; (item)->next = NULL; \
} while(0)
#define TH_EXTRACT_ITEM(item,head,PREFIX) do { \
p_th_mutex_lock(p_th_mutex##PREFIX); \
EXTRACT_ITEM(item, head); \
p_th_mutex_unlock(p_th_mutex##PREFIX); \
} while(0)
/*When you dont know the head of a list, but do know that item is at the head*/
#define EXTRACT_HEAD_ITEM(item) do { \
if ((item)->next) \
(item)->next->previous = (item)->previous; \
(item)->next = (item)->previous = NULL; \
} while(0)
#define TH_EXTRACT_HEAD_ITEM(item,PREFIX) do { \
p_th_mutex_lock(p_th_mutex##PREFIX); \
EXTRACT_HEAD_ITEM(item); \
p_th_mutex_unlock(p_th_mutex##PREFIX); \
} while(0)
/* Set list1 to point to a doubly-linked list consisting of list1 appended to
LIST2.
LIST2 must not already be a part of list1 or the results are unpredictable.
LIST2 will be a garbage value at the end of this exercise, since it will no
longer point to a valid doubly-linked list.
LIST1 and LIST2 must already be valid doubly-linked lists. */
/* This performs an O(1) list appending operation. */
#define APPEND_LISTS(list1,list2) do {\
CHECK_HEAD(list1); \
CHECK_HEAD(list2); \
if (!(list1)) \
(list1) = (list2); \
else if (!(list2)) \
/* If 2nd list is empty, concatenation is a no-op. */ \
; \
else { \
/* Assertion removed for compilation problems. */ \
/* assert(!(list1)->previous->next && !(list2)->previous->next); */ \
/* OLDL1TAIL is (list2)->previous->next (scratchpad value) */ \
/* Read next line as: OLDL1TAIL = (list1)->previous */ \
(list2)->previous->next = (list1)->previous; /* scratchpad value */\
(list1)->previous->next = (list2); /* was NULL, or should've been */\
(list1)->previous = (list2)->previous; \
/* OLDL1TAIL is now list1->previous->next too */ \
(list2)->previous = (list1)->previous->next; \
(list1)->previous->next = NULL; /* reset scratch value */ \
} \
/* oops - didnt set to null if first list empty - barfed in replace_cached*/ \
(list2) = NULL; /* for safety, to prevent abuse. */ \
} while (0)
/* XXX This is odd. Potential bug. Maybe Mitra meant to make this a call to
CONCATENATE_LISTS(), not to APPEND_ITEM()? */
#define TH_APPEND_LISTS(list1,list2,PREFIX) do { \
p_th_mutex_lock(p_th_mutex##PREFIX); \
APPEND_LISTS(list1, list2); \
p_th_mutex_unlock(p_th_mutex##PREFIX); \
} while(0)
/* New name for APPEND_LISTS() */
#define CONCATENATE_LISTS(l1, l2) APPEND_LISTS((l1), (l2))
#endif /* LIST_MACROS_H */

View File

@@ -0,0 +1,153 @@
#ifndef _rmg_macros_h
#define _rmg_macros_h
#include <stdlib.h> /* For malloc free */
#include <pfs.h> /* For ALLOCATOR_CONSISTENCY_CHECK*/
#include <pfs_threads.h> /* for mutex stuff */
#define TH_STRUC_ALLOC1(prefix,PREFIX,instance) { \
p_th_mutex_lock(p_th_mutex##PREFIX); \
if(lfree) { \
instance = lfree; \
lfree = instance->next; \
} else { \
instance = (PREFIX) malloc(sizeof(PREFIX##_ST)); \
if (!instance) out_of_memory(); \
prefix##_max++; \
} \
prefix##_count++; \
/* Initialize and fill in default values */ \
instance->previous = NULL; \
instance->next = NULL; \
p_th_mutex_unlock(p_th_mutex##PREFIX); \
}
#ifdef ALLOCATOR_CONSISTENCY_CHECK
#define TH_STRUC_ALLOC(prefix,PREFIX,instance) { \
TH_STRUC_ALLOC1(prefix,PREFIX,instance); \
instance->consistency = INUSE_PATTERN; \
}
#else /*!ALLOCATOR_CONSISTENCY_CHECK*/
#define TH_STRUC_ALLOC(prefix,PREFIX,instance) \
TH_STRUC_ALLOC1(prefix,PREFIX,instance);
#endif /*ALLOCATOR_CONSISTENCY_CHECK*/
#define TH_STRUC_FREE2(prefix,PREFIX,instance) { \
p_th_mutex_lock(p_th_mutex##PREFIX); \
instance->next = lfree; \
instance->previous = NULL; \
lfree = instance; \
prefix##_count--; \
p_th_mutex_unlock(p_th_mutex##PREFIX); \
}
/* Note - no ";" on last item */
#ifdef ALLOCATOR_CONSISTENCY_CHECK
#define TH_STRUC_FREE(prefix,PREFIX,instance) \
if (!instance) return; \
assert(instance->consistency == INUSE_PATTERN); \
instance->consistency = FREE_PATTERN; \
TH_STRUC_FREE2(prefix,PREFIX,instance)
#else
#define TH_STRUC_FREE(prefix,PREFIX,instance) \
if (!instance) return; \
TH_STRUC_FREE2(prefix,PREFIX,instance)
#endif
/*
* instance_lfree - free a linked list of ATYPEDEF structures.
*
* instance_lfree takes a pointer to a channel structure frees it and
* any linked
* ATYPEDEF structures. It is used to free an entire list of ATYPEDEF
* structures.
*/
#define TH_STRUC_LFREE(PREFIX,instance,instance_free) \
{ \
PREFIX this; \
PREFIX nxt; \
/* Set instance to 0 so others can access it while we trash the list */\
nxt = instance; instance = NULL; \
while((this=nxt) != NULL) { \
nxt = this->next; \
instance_free(this); \
} \
}
/* temp should be set to point to a list, cnt should be 0
temp will be NULL afterwards and cnt the count*/
#define COUNT_LISTS(temp,cnt) \
while (temp) { \
cnt++; \
temp = temp->next; \
}
/* Find val in field, instance set to match or NULL */
/* Need to mutex this, cos if struc changes while walking it could fail */
#define FIND_LIST(instance,field,val) \
while (instance != NULL) { \
if (instance->field == val) \
break; \
instance = instance->next; \
}
#define TH_FIND_LIST(instance,field,val,PREFIX) { \
p_th_mutex_lock(p_th_mutex##PREFIX); \
FIND_LIST(instance,field,val); \
p_th_mutex_unlock(p_th_mutex##PREFIX) ; }
#define FIND_FNCTN_LIST(instance, field, val, fnctn) \
while(instance != NULL) { \
if (fnctn(instance->field, val)) \
break; \
instance = instance->next; \
}
#define FIND_OBJFNCTN_LIST(instance, ob2, fnctn) \
while(instance != NULL) { \
if (fnctn(instance, ob2)) \
break; \
instance = instance->next; \
}
#define TH_FIND_FNCTN_LIST(instance, field, val, fctn, PREFIX) { \
p_th_mutex_lock(p_th_mutex##PREFIX); \
FIND_FNCTN_LIST(instance, field, val, fctn) \
p_th_mutex_unlock(p_th_mutex##PREFIX);}
#define TH_FIND_OBJFNCTN_LIST(instance, ob2, fctn, PREFIX) { \
p_th_mutex_lock(p_th_mutex##PREFIX); \
FIND_OBJFNCTN_LIST(instance, ob2, fctn) \
p_th_mutex_unlock(p_th_mutex##PREFIX);}
#define TH_FIND_STRING_LIST_CASE(instance, field, val, PREFIX) \
TH_FIND_FNCTN_LIST(instance, field, val, stcaseequal,PREFIX)
#define TH_FIND_STRING_LIST(instance, field, val, PREFIX) \
TH_FIND_FNCTN_LIST(instance, field, val, stequal,PREFIX)
#define TH_FREESPARES(prefix,PREFIX) { \
PREFIX this, next; \
p_th_mutex_lock(p_th_mutex##PREFIX); \
next = lfree ; lfree = NULL; \
p_th_mutex_unlock(p_th_mutex##PREFIX); \
while((this = next) != NULL) { \
next = this->next; \
free(this); /* Matches malloc in STRUC_ALLOC1*/ \
prefix##_max--; \
} \
}
/* Cant take an offset from a null value, shortcuts to return NULL */
#define L2(a,b) (a ? a->b : NULL)
#define L3(a,b,c) (a ? (a->b ? a->b->c : NULL ) : NULL)
#define L4(a,b,c,d) (a ? (a->b ? (a->b->c ? a->b->c->d \
: NULL) : NULL ) : NULL)
/* String functions on some systems dont like operating on NULLS */
#define Strlen(a) (a ? strlen(a) : 0)
#endif /*_rmg_macros_h*/

158
prospero/include/pcompat.h Normal file
View File

@@ -0,0 +1,158 @@
/*
* Copyright (c) 1991, 1992, 1994 by the University of Southern California
*
* For copying and distribution information, please see the file
* <usc-license.h>.
*/
#include <usc-license.h>
#include <pfs_threads.h>
/*
* pcompat.h - Definitions for compatability library
*
* This file contains the defintions used by the compatability
* library. Among the definitions are the possible values for
* the pfs_enable variable. This file also contains the external
* declaration of that variable. The module pfs_enable.o is included in
* libpfs.a because some of the routines in that library set it.
* It can also be explicitly declared in a program that uses the compatability
* library, if you wish.
*
* The only place it is checked, however, is in pfs_access,
* found in libpcompat.a
*/
#if 0 /* this code is commented out because
pfs_default is no longer an external
interface. --swa, April 13, 1994*/
extern int pfs_default; /* initialized to PMAP_UNINITIALIZED in
libpcompat. Set to some other value in
p__get_pfs_default(), which might include
PMAP_UNSET. Keeping this as a global
variable isn't really necessary. It does
let the users know what the starting value
of PFS_DEFAULT was, but I'm not sure that's
strictly necessary.
This variable is currently used entirely
internally to the PCOMPAT library, and could
be renamed easily, since no users are using
it as an interface. */
#endif
extern int pfs_enable; /* pfs_enable is declared in the PFS library,
since routines in that library modify it.
In that library, it defaults to PMAP_UNSET.
This can be declared explicitly in a file
linked with the program using this library
if the programmer wants to override the
value. */
extern int pfs_quiet; /* see lib/pcompat/pfs_quiet.c. This can be
declared explicitly in a file linked with
the program using this library if the
programmer wants to override the
value. Non-zero value means system calls
don't print any information. */
/* Definitions for values of pfs_enable */
#if 0 /* this will probably never be needed, and can
be deleted after Beta.5.3 goes out.
--swa, April 13, 1994*/
#define PMAP_UNINITIALIZED (-1) /* Used only for pfs_default. Indicates that
its starting value hasn't been read from the
environment yet. If the environment has
already been searched for PFS_DEFAULT, then
this will be reset to PMAP_UNSET. */
#endif
#define PMAP_DISABLE 0 /* always resolve names in UNIX */
#define PMAP_ENABLE 1 /* always reslve names in VS */
#define PMAP_COLON 2 /* Resolve names in UNIX by default. Names
preceded with a colon are resolved in the
VS. */
#define PMAP_ATSIGN_NF 3 /* Resolve names in VS by default. Names
preceded with an @ sign and names not found
in the VS are resolved in the UNIX
filesystem. */
#define PMAP_ATSIGN 4 /* Resolve names in the VS by default. Names
preceded with an @ sign are resolved in the
UNIX filesystem. */
#define PMAP_UNSET 5 /* pfs_enable is initialized to this value by
the pcompat library, unless the user program
declares its own version of pfs_enable and
initializes it to something else. If
pfs_enable is set to PMAP_UNSET, then
p__initialize_pfs_enable() will be called by
the PCOMPAT library routines in order to
initialize pfs_enable to the current pfs
default.
This allows a user program to initialize
pfs_enable and not have it overridden by
pfs_default. */
/* Definitions for PFS_ACCESS */
#define PFA_MAP 0 /* Map the file name only */
#define PFA_CREATE 1 /* Create file if not found */
#define PFA_CRMAP 2 /* Map file name. Map to new name if not found */
#define PFA_RO 4 /* Access to file is read only */
#define DISABLE_PFS(stmt) do {int DpfStmp; DpfStmp = pfs_enable;\
pfs_enable = PMAP_DISABLE; \
stmt; \
pfs_enable = DpfStmp;} while (0)
#define DISABLE_PFS_START() DpfStmp = pfs_enable; pfs_enable = PMAP_DISABLE;
#define DISABLE_PFS_END() pfs_enable = DpfStmp;
#if 0 /* This interface is dead as of 4/13/94 --swa
*/
void p__get_pfs_default(); /* only used here :) */
#define check_pfs_default() \
do { if(pfs_default == -1) p__get_pfs_default(); } while (0)
#endif
/* New interface as of 4/13/94 --swa */
/* This is called by the p__compat_initialize() routine, iff pfs_enable is set
to PMAP_UNSET. It looks for the PFS_DEFAULT environment variable and
attempts to set pfs_enable accordingly.
*/
void p__set_pfs_enable_from_default(void);
extern int pfs_access(const char path[], char npath[], int npathlen, int
flags);
/* Subfunctions used internally by the PCOMPAT library. */
extern int p__getvdirentries(int fd, char *buf, int nbytes, int *basep);
extern int p__readvdirentries(char *dirname);
extern int p__delvdirentries(int desc);
extern int p__seekvdir(int desc, int pos);
extern int p__getvdbsize(int desc, int pos);
#ifndef DIR
#include <pmachine.h> /* for USE_SYS_DIR_H test. */
/* Needed if not already included. */
#ifdef USE_SYS_DIR_H
#include <sys/dir.h>
#else /* USE_SYS_DIR_H */
#include <dirent.h>
#endif /* USE_SYS_DIR_H */
#endif /* DIR */
/* Called by seekdir(). */
extern void p__seekdir(register DIR *dirp, long loc);
/* This is called internally by all pcompat library functions that call
PFS library functions. It makes sure that the PFS library and any libraries
that PFS uses are properly initialized before usage. */
extern void p__compat_initialize(void);

157
prospero/include/perrno.h Normal file
View File

@@ -0,0 +1,157 @@
/*
* Copyright (c) 1991-1994 by the University of Southern California
*
* For copying and distribution information, please see the file
* <usc-license.h>.
*/
#include <usc-license.h>
#ifndef PFS_PERRNO_H
#define PFS_PERRNO_H
#include <pfs_threads.h>
/* this file and lib/pfs/perrmesg.c should be updated simultaneously */
/*
* perrno.h - definitions for perrno
*
* This file contains the declarations and defintions of of the external
* error values in which errors are returned by the pfs and psrv
* libraries.
*/
extern char *p_err_text[];
extern char *p_warn_text[];
EXTERN_INT_DECL(perrno);
#define perrno p_th_arperrno[p__th_self_num()]
EXTERN_INT_DECL(pwarn);
#define pwarn p_th_arpwarn[p__th_self_num()]
EXTERN_CHARP_DECL(p_warn_string);
#define p_warn_string p_th_arp_warn_string[p__th_self_num()]
EXTERN_CHARP_DECL(p_err_string);
#define p_err_string p_th_arp_err_string[p__th_self_num()]
/* Error codes returned or found in perrno */
#ifndef PSUCCESS
#define PSUCCESS 0
#endif
/* Error codes 1 through 20 are reserved for the ardp library */
/* Defined in include/ardp.h */
/* vl_insert */
#define VL_INSERT_ALREADY_THERE 21 /* Link already exists */
#define VL_INSERT_CONFLICT 22 /* Link exists with same name */
/* ul_insert */
#define UL_INSERT_ALREADY_THERE 25 /* Link already exists */
#define UL_INSERT_SUPERSEDING 26 /* Replacing existing link */
#define UL_INSERT_POS_NOTFOUND 27 /* Prv entry not in dir->ulinks */
/* rd_vdir */
#define RVD_DIR_NOT_THERE 41 /* Temporary NOT_FOUND */
#define RVD_NO_CLOSED_NS 42 /* Namespace not closed w/ object:: */
#define RVD_NO_NS_ALIAS 43 /* No alias for namespace NS#: */
#define RVD_NS_NOT_FOUND 44 /* Specified namespace not found */
/* pfs_access */
#define PFSA_AM_NOT_SUPPORTED 51 /* Access method not supported */
/* p__map_cache */
#define PMC_DELETE_ON_CLOSE 55 /* Delete cached copy on close */
#define PMC_RETRIEVE_FAILED 56 /* Unable to retrieve file */
/* mk_vdir */
/* #define MKVD_ALREADY_EXISTS 61 * Directory already exists */
/* #define MKVD_NAME_CONFLICT 62 * Link with name already exists */
/* vfsetenv */
#define VFSN_NOT_A_VS 65 /* Not a virtual system */
#define VFSN_CANT_FIND_DIR 66 /* Not a virtual system */
/* add_vlink */
/* #define ADDVL_ALREADY_EXISTS 71 * Directory already exists */
/* #define ADDVL_NAME_CONFLICT 72 * Link with name already exists */
/* pset_at */
#define PSET_AT_TARGET_NOT_AN_OBJECT 81 /* The link passed to PSET_AT() has a
TARGET such that it does not
refer to an object, so we can't set
any object attributes on it. */
/* Error codes for parsing problems. */
#define PARSE_ERROR 101 /* General parsing syntax error . */
/* Local error codes on server */
/* dsrdir */
#define DSRDIR_NOT_A_DIRECTORY 111 /* Not a directory name */
/* dsrfinfo */
#define DSRFINFO_NOT_A_FILE 121 /* Object not found */
#define DSRFINFO_FORWARDED 122 /* Object has moved */
/* Error codes that may be returned by various procedures */
#define PFS_FILE_NOT_FOUND 230 /* File not found */
#define PFS_DIR_NOT_FOUND 231 /* Directory in path not found */
#define PFS_SYMLINK_DEPTH 232 /* Max sym-link depth exceeded */
#define PFS_ENV_NOT_INITIALIZED 233 /* Can't read environment */
#define PFS_EXT_USED_AS_DIR 234 /* Can't use externals as dirs */
#define PFS_MAX_FWD_DEPTH 235 /* Exceeded max forward depth */
/* Error codes returned by directory server */
/* some of these duplicate errors from individual routines */
/* some of those error codes should be eliminated */
#define DIRSRV_WAIS 240 /* WAIS gateway failure */
#define DIRSRV_GOPHER 241 /* Gopher gateway failure */
#define DIRSRV_AUTHENT_REQ 242 /* Authentication required */
#define DIRSRV_NOT_AUTHORIZED 243 /* Not authorized */
#define DIRSRV_NOT_FOUND 244 /* Not found */
#define DIRSRV_BAD_VERS 245
#define DIRSRV_NOT_DIRECTORY 246
#define DIRSRV_ALREADY_EXISTS 247 /* Identical link already exists */
#define DIRSRV_NAME_CONFLICT 248 /* Link with name already exists */
#define DIRSRV_TOO_MANY 249 /* Too many matches to return */
#define DIRSRV_UNIMPLEMENTED 251 /* Unimplemented command */
#define DIRSRV_BAD_FORMAT 252
#define DIRSRV_ERROR 253
#define DIRSRV_SERVER_FAILED 254 /* Unspecified server failure */
#ifndef PFAILURE
#define PFAILURE 255 /* Random other complaint. */
#endif
/* If DEBUG_PFAILURE is defined, then the no-op function it_failed() will be
called right before any function originates a PFAILURE return. This can be
handy in tracking down an error in library usage when a library call is
returning PFAILURE to you. This is normally not enabled so that we can
avoid the overhead of the unnecessary call to it_failed().
it_failed() is in lib/pfs/perrmesg.c. */
#ifdef DEBUG_PFAILURE
#define RETURNPFAILURE do { it_failed(); return(PFAILURE); } while(0)
#else
#define RETURNPFAILURE return(PFAILURE)
#endif
/* Warning codes */
#define PNOWARN 0 /* No warning indicated */
#define PWARN_OUT_OF_DATE 1 /* Software is out of date */
#define PWARN_MSG_FROM_SERVER 2 /* Warning in p_warn_string */
#define PWARN_UNRECOGNIZED_RESP 3 /* Unrecognized line in response */
#define PWARNING 255 /* Warning in p_warn_string */
/* Function to reset error and warning codes */
extern void p_clear_errors(void);
#if 0
/* This macro is deprecated and will go away soon. Use p_clear_errors()
instead. */
#define clear_prospero_errors() p_clear_errors()
#endif
#endif /*PFS_PERRNO_H*/

1126
prospero/include/pfs.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,453 @@
/*
* Copyright (c) 1993-1994 by the University of Southern California
*
* For copying and distribution information, please see the file
* <usc-license.h>.
*/
#include <usc-license.h>
/* This is the Prospero interface to threads. This threads package
is currently used exclusively by the Prospero server when it is operating in
multi-threaded mode.
At the moment, this stuff is experimental. It will only be tested on the
server side, not on the client.
*/
/*
* The interface to the Prospero server's use of threads is fully defined in
* this file. That means that as long as you provide the external interface
* herein defined, you're OK. */
/* This interface does not currently attempt to handle issues of cancelling
* threads, although that will be a later extension.
*/
/* Every thread (on the server) has an active RREQ associated with it. Every
* active RREQ has a live thread associated with it. RREQs get moved off of
* the queue of items to be processed to the list of items in progress when an
* available thread is there for them. When a thread is available,
* ardp_accept() is called.
*/
#ifndef PFS_THREADS_H
#define PFS_THREADS_H
#include <stdio.h> /* needed for FILE */
/* #define P_MAX_NUM_THREADS here if you want any threads, and PFS_THREADS. */
/*#define PFS_THREADS */ /* Part of the external interface. */
#ifdef PFS_THREADS
#define P_MAX_NUM_THREADS 61 /* This will define threads 0 through 60,
quite a lot. */
/* You can easily set a lower value for the number of threads the server
* will actually use, by modifying DIRSRV_SUB_THREAD_COUNT in dirsrv.c.
*/
#define PFS_THREADS_HAVE_SAFE_MALLOC /* Version */
/* Define which PFS_THREADS package you have, options supported currently
include PFS_THREADS_SOLARIS or PFS_THREADS_FLORIDA - note NONE
of these must be defined if PFS_THREADS is undefined */
/* #define PFS_THREADS_SOLARIS */
#endif /* PFS_THREADS */
#include <pfs_utils.h> /* assert */
/* To port to a new threads package
- pick an identifer (e.g. PFS_THREADS_DCE).
-- Note PFS_THREADS_POSIX is reservered for post-balloting implementation
-- Tell prospero-developers@isi.edu which you are using.
- Grep through all of the source for instances of PFS_THREADS_
-- Editing these is documented where they apply
-- This will include lib/ardp/p_th_self_num server/dirsrv
*/
#ifdef PFS_THREADS_FLORIDA
/* pthread.h is the include file from the Florida State University
PART project PTHREADS distribution.
It prototypes all of the functions and interfaces whose names start with
pthread_.
*/
#include <pthread.h>
#endif /* PFS_THREADS_FLORIDA */
#ifdef PFS_THREADS_SOLARIS
/* Make sure we get our signal.h with _POSIX_C_SOURCE before thread.h
includes sys/signal.h */
#include <posix_signal.h>
/* Thread.h prototypes most functions starting thr_ */
#include <thread.h>
#endif /* PFS_THREADS_SOLARIS */
#ifdef PFS_THREADS
/* Yield a unique integer between 0 and P_MAX_NUM_THREADS - 1 for the current
thread. Hopefully this function will go away eventually as the server's
internal structure changes in a way that a reference to the current thread
is passed around to all subfunctions. But maybe not, too.
This is implemented using the per-thread key mechanisms. */
extern void p_th_allocate_self_num(void); /* external; must be called by thread
after startup. */
extern void p_th_deallocate_self_num(void); /* external; must be called by
thread before exit. */
#endif /*PFS_THREADS*/
#ifdef PFS_THREADS
extern int p__th_self_num(void); /* not external interface. */
#else
#define p__th_self_num() 0
#endif /* PFS_THREADS */
/* We don't include a trailing ; at the end of our declarations and definitions
because a ; by itself in a declarations list is treated by C as a statement,
not as an empty declaration. This means that the AUTOSTAT declaration has to
be the last one. */
/* This declares an automatic variable name VARNAME of type char **. *VARNAME
will be a reference to a persistent per-thread static variable of type char
*, with function scope. Note that *varname will be initially NULL, but may
expand with time. Part of the external interface.*/
#ifdef PFS_THREADS
#define AUTOSTAT_CHARPP(VARNAME) \
static char *(VARNAME##_target[P_MAX_NUM_THREADS]); /* NULL by default. */\
char **VARNAME = (VARNAME##_target + p__th_self_num())
#else
#define AUTOSTAT_CHARPP(VARNAME) \
static char *VARNAME##_target = NULL; \
char **VARNAME = &VARNAME##_target
#endif /* PFS_THREADS */
/* ditto, for int* . Part of the external interface. */
#ifdef PFS_THREADS
#define AUTOSTAT_INTP(VARNAME) \
static int (VARNAME##_target[P_MAX_NUM_THREADS]); /* automatically 0 */\
int *VARNAME = (VARNAME##_target + p__th_self_num())
#else
#define AUTOSTAT_INTP(VARNAME) \
static int VARNAME##_target = 0; \
int *VARNAME = &VARNAME##_target
#endif /* PFS_THREADS */
/* ditto, for an arbitrary type* . Part of the external interface. */
#ifdef PFS_THREADS
#define AUTOSTAT_TYPEP(TYPE,VARNAME) \
static (TYPE) (VARNAME##_target[P_MAX_NUM_THREADS]); /* automatically 0 */\
(TYPE) *VARNAME = (VARNAME##_target + p__th_self_num())
#else
#define AUTOSTAT_TYPEP(TYPE,VARNAME) \
static (TYPE) VARNAME##_target = 0; \
(TYPE) *VARNAME = &VARNAME##_target
#endif /* PFS_THREADS */
#ifdef PFS_THREADS
#define AUTOSTATIC_VAR_INITIALIZED(TYPE,VARNAME,INITIALIZER) \
static TYPE (VARNAME##_target[P_MAX_NUM_THREADS]); /* automatically 0 */\
TYPE *VARNAME = (VARNAME##_target + p__th_self_num())
#else
#define AUTOSTATIC_VAR_INITIALIZED(VARNAME) \
static TYPE VARNAME##_target = 0; \
TYPE *VARNAME = &VARNAME##_target
#endif /* PFS_THREADS */
/* Possible alternative interface for a common case. I'm experimenting with
it. Experimental part of external interface. */
#if 1
#define SCRATCHBUF_CHARPP_DEF(VARNAME) AUTOSTAT_CHARPP(VARNAME)
/* Set using *VARNAME = or passing VARNAME as a pointer to the target. */
#define SCRATCHBUF_CHARPP_CLEANUP(VARNAME)
#else
/* This version of the interface will always allocate a new buffer upon
entry. It has the sole advantage that it does not leave static buffers
around. It has disadvantages too: presumably the many calls to malloc()
will not be an efficient way of using the processor. */
/* A good optimizing compiler should clean up the following (I hope). */
#define SCRATCHBUF_CHARPP_DEF(VARNAME) \
char * VARNAME##_target = NULL; \
char **VARNAME = &VARNAME##_target
/* Set using *VARNAME = or passing VARNAME as a pointer to the target. */
#define SCRATCHBUF_CHARPP_CLEANUP(VARNAME) do { \
stfree(*VARNAME); \
*VARNAME = NULL; \
} while(0)
#endif
/* The following abstraction is used for statics (per-file externs) and
real externs. */
/* Externs need separate declarations and data definitions. */
/* Each extern will need one of these after the declaration, to keep the old
stuff working. */
#ifdef PFS_THREADS
#define EXTERN_LONG_DECL(VARNAME) \
extern long p_th_ar##VARNAME[P_MAX_NUM_THREADS]
#define EXTERN_LONG_DEF(VARNAME) \
long p_th_ar##VARNAME[P_MAX_NUM_THREADS]
#define PERFILE_STATIC_LONG_DEF(VARNAME) \
static long p_th_ar##VARNAME[P_MAX_NUM_THREADS]
#define EXTERN_INT_DECL(VARNAME) \
extern int p_th_ar##VARNAME[P_MAX_NUM_THREADS]
#define EXTERN_INT_DEF(VARNAME) \
int p_th_ar##VARNAME[P_MAX_NUM_THREADS]
#define PERFILE_STATIC_INT_DEF(VARNAME) \
static int p_th_ar##VARNAME[P_MAX_NUM_THREADS]
#define EXTERN_CHARP_DECL(VARNAME) \
extern char * p_th_ar##VARNAME[P_MAX_NUM_THREADS]
#define EXTERN_CHARP_DEF(VARNAME) \
char * p_th_ar##VARNAME[P_MAX_NUM_THREADS]
#define PERFILE_STATIC_CHARP_DEF(VARNAME) \
static char * p_th_ar##VARNAME[P_MAX_NUM_THREADS]
#define EXTERN_TYPEP_DECL(TYPE,VARNAME) \
extern TYPE p_th_ar##VARNAME[P_MAX_NUM_THREADS]
#define EXTERN_TYPEP_DEF(TYPE,VARNAME) \
TYPE p_th_ar##VARNAME[P_MAX_NUM_THREADS]
#else
#define EXTERN_LONG_DECL(VARNAME) \
extern long p_th_ar##VARNAME[1]
#define EXTERN_LONG_DEF(VARNAME) \
long p_th_ar##VARNAME[1]
#define PERFILE_STATIC_LONG_DEF(VARNAME) \
static long p_th_ar##VARNAME[1]
#define EXTERN_INT_DECL(VARNAME) \
extern int p_th_ar##VARNAME[1]
#define EXTERN_INT_DEF(VARNAME) \
int p_th_ar##VARNAME[1]
#define PERFILE_STATIC_INT_DEF(VARNAME) \
static int p_th_ar##VARNAME[1]
#define EXTERN_CHARP_DECL(VARNAME) \
extern char * p_th_ar##VARNAME[1]
#define EXTERN_CHARP_DEF(VARNAME) \
char * p_th_ar##VARNAME[1]
#define PERFILE_STATIC_CHARP_DEF(VARNAME) \
static char * p_th_ar##VARNAME[1]
#define EXTERN_TYPEP_DECL(VARNAME) \
extern TYPE p_th_ar##VARNAME[1]
#define EXTERN_TYPEP_DEF(VARNAME) \
TYPE p_th_ar##VARNAME[1]
#endif /* PFS_THREADS */
/* In any case, follow definitions with a:
#define VARNAME p_th_arVARNAME[p__th_self_num()] */
#if 0 /* first attempt */
/* Externs need separate declarations and data definitions. */
#define EXTERN_INTP_DECL(VARNAMEP) extern int *VARNAMEP
/* Each extern will need one of these after the declaration, to keep the old
stuff working. */
/* #define VARNAME (*VARNAMEP) */
/* Definition. */
#define EXTERN_INTP_DEF(VARNAMEP) int *VARNAMEP
#endif /* #if 0 */
/* Mutexes,implemented on top of the pthreads package. */
/* p_th_mutex is an exported data type, used when we mutex functions or
collections of functions. See lib/ardp/ptalloc.c for an example of this.
*/
/*
Do so in init code, to keep
from depending on ONCE implementation. Again, this interface is only
called directly by Prospero and ARDP code when a set of functions need to be
mutexed; otherwise, the *_MUTEXED_* variable declaration and definition
interfaces below are used. */
#ifndef NDEBUG
#define zz(a) assert((a) == 0)
#else
#define zz(a) a
#endif
#if defined(PFS_THREADS) && !defined(NDEBUG)
#define DIAGMUTEX(MX1,MX2) if (p_th_mutex_islocked(&p_th_mutex##MX1 )) { printf(mutex_locked_msg,MX2); }
extern char mutex_locked_msg[];
#else
#define DIAGMUTEX(MX1,MX2) do { } while(0)
#endif
#ifdef PFS_THREADS_FLORIDA
typedef pthread_mutex_t p_th_mutex;
#define p_th_mutex_init(MUTEX) \
pthread_mutex_init(&(MUTEX), (pthread_mutexattr_t *) NULL)
#define p_th_mutex_lock(MUTEX) { pthread_mutex_lock(&(MUTEX)) }
#define p_th_mutex_unlock(MUTEX) pthread_mutex_unlock(&(MUTEX))
#define p_th_mutex_islocked(MUTEX) (pthread_mutex_trylock(&(MUTEX)) == -1)
#define p_th_mutex_trylock(MUTEX) \
( (p_th_mutex_trylock(&(MUTEX)) != -1) \
? p_th_mutex_lock(MUTEX) \
: TRUE )
#endif /*PFS_THREADS_FLORIDA*/
#ifdef PFS_THREADS_SOLARIS
typedef mutex_t p_th_mutex;
#define p_th_mutex_init(MUTEX) zz(mutex_init(&(MUTEX), USYNC_THREAD, NULL))
#define p_th_mutex_lock(MUTEX) zz(mutex_lock(&(MUTEX)))
#define p_th_mutex_unlock(MUTEX) zz(mutex_unlock(&(MUTEX)))
extern int p_th_mutex_islocked(mutex_t *mp);
#define p_th_mutex_trylock(MUTEX) (mutex_trylock(&(MUTEX)))
#endif /*PFS_THREADS_SOLARIS*/
#ifndef PFS_THREADS
#define p_th_mutex_init(MUTEX) do { } while(0)
#define p_th_mutex_lock(MUTEX) do { } while(0)
#define p_th_mutex_unlock(MUTEX) do { } while(0)
/* Used only in ardp_accept() */
#define p_th_mutex_islocked(MUTEX) 0
#define p_th_mutex_trylock(MUTEX) 0
#endif /*!PFS_THREADS*/
/* Handling of global shared variables (e.g., ardp_runQ) */
/* Mutex initialized in ardp_mutexes.c (ardp_init_mutexes()). */
/* Variable defined and declared as mutexed. */
#ifdef PFS_THREADS
#define EXTERN_MUTEX_DECL(VARNAME) \
extern p_th_mutex p_th_mutex##VARNAME
#define EXTERN_MUTEX_DEF(VARNAME) \
p_th_mutex p_th_mutex##VARNAME
/* Initialize the mutex (in ardp_init_mutexes(), pfs_init_mutexes(),
dirsrv_init_mutexes()) */
#define EXTERN_MUTEXED_INIT_MUTEX(VARNAME) \
p_th_mutex_init(p_th_mutex##VARNAME)
#else
/* No-ops if not threaded. */
#define EXTERN_MUTEX_DECL(VARNAME)
#define EXTERN_MUTEX_DEF(VARNAME)
#define EXTERN_MUTEXED_INIT_MUTEX(VARNAME) do {} while(0) /* no-op */
#endif /* PFS_THREADS */
#define EXTERN_ALLOC_DECL(VARNAME) \
EXTERN_MUTEX_DECL(VARNAME)
#define EXTERN_MUTEXED_DECL(TYPE,VARNAME) \
EXTERN_MUTEX_DECL(VARNAME); \
extern TYPE VARNAME
#define EXTERN_MUTEXED_DEF(TYPE,VARNAME) \
EXTERN_MUTEX_DEF(VARNAME); \
TYPE VARNAME
#define EXTERN_MUTEXED_DEF_INITIALIZER(TYPE,VARNAME,INITIALIZER) \
EXTERN_MUTEX_DEF(VARNAME); \
TYPE VARNAME = (INITIALIZER)
/* Lock and unlock a mutexed external variable. */
/* In order to avoid potential deadlock situations, all variables must be
locked in alphabetical order. */
#ifdef PFS_THREADS
#define EXTERN_MUTEXED_LOCK(VARNAME) p_th_mutex_lock(p_th_mutex##VARNAME)
#define EXTERN_MUTEXED_UNLOCK(VARNAME) p_th_mutex_unlock(p_th_mutex##VARNAME)
#else
#define EXTERN_MUTEXED_LOCK(VARNAME) do {} while (0)
#define EXTERN_MUTEXED_UNLOCK(VARNAME) do {} while (0)
#endif /* PFS_THREADS */
/* This is found in assertions inside functions that expect to be called only
when they are running as the 'master' thread in Prospero. */
/* The master thread is the one that is started off. When we're
single-threaded, that's the master. */
/* This is used entirely in assertions. */
#define P_IS_THIS_THREAD_MASTER() (p__th_self_num() == 0)
#ifdef PFS_THREADS_FLORIDA
/* Note that under the Draft 7 standard, pthread_detach
takes a pthread_t, whereas under Draft 6, it takes a pointer to
a pthread_t. This implementation uses Draft 6. */
#define p_th_t pthread_t
#define p_th_create_detached(NEWTHREAD,FUNC,ARG) ( \
pthread_create(&NEWTHREAD, (pthread_attr_t *) NULL, \
(pthread_funct_t) FUNC, (any_t) ARG) \
: pthread_detach(&NEWTHREAD) \
)
#define p_th_self pthread_self
#define p_th_equal(a,b) pthread_equal(a,b)
#endif
#ifdef PFS_THREADS_SOLARIS
#define p_th_t thread_t
/* caller needs to check this for errors */
#define p_th_create_detached(NEWTHREAD,FUNC,ARG) \
thr_create(NULL,0,(void *)FUNC,ARG,THR_DETACHED, &NEWTHREAD)
#define p_th_self thr_self
/* thread_t is an int so ...*/
#define p_th_equal(a,b) (a == b)
#endif
/* Mutexed versions of everything that might possibly call malloc() and free().
We can yank this out once we have thread-safe libraries, but that might be a
few years off. */
/* Note that we have converted over all of the server code that might be
called when multi-threaded to not call any of the printf() family of
functions. With a thread_safe malloc() now available from FSU, that
means we need none of these special definitions. Hooray! */
#if defined(PFS_THREADS) && !defined(PFS_THREADS_SOLARIS) && !defined(PFS_THREADS_FLORIDA)
/* commented out for the implemented thread implementations.*/
#define free(P) p_th_free((P))
extern void p_th_free(void *P);
#define malloc(P) p_th_malloc((P))
extern void *p_th_malloc(unsigned size);
#define calloc(A,B) p_th_calloc((A),(B))
extern void *p_th_calloc(unsigned nelem, unsigned size);
#define _filbuf(p) p_th__filbuf((p))
#define _flsbuf(p,q) p_th__flsbuf((p),(q))
#define fgets(a,b,c) p_th_fgets((a),(b), (c))
extern char *p_th_fgets(char *s, int n, FILE *stream);
#define gets(a) p_th_gets((a))
extern char *p_th_gets(char *s);
#define fputs(a,b) p_th_fputs((a),(b))
extern int p_th_fputs(const char *s, FILE *stream);
#define puts(a) p_th_puts((a))
extern int p_th_puts(const char *s);
#define sprintf p_th_sprintf
extern char *p_th_sprintf();
#define fprintf p_th_fprintf
#define printf p_th_printf
#define fflush(a) p_th_fflush((a))
extern int p_th_fflush(FILE *);
#define fgetc(a) p_th_fgetc((a))
extern int p_th_fgetc(FILE *);
#define fputc(a,b) p_th_fputc((a),(b))
extern int p_th_fputc();
#define fread(a,b,c,d) p_th_fread((a),(b),(c), (d))
extern int p_th_fread(char *ptr, int size, int nitems, FILE*stream);
#define fwrite(a,b,c,d) p_th_fwrite((a),(b),(c), (d))
extern int p_th_fwrite(const char *ptr, int size, int nitems, FILE *stream);
#define fopen(a,b) p_th_fopen((a),(b))
extern FILE *p_th_fopen(const char *a, const char *b);
#define fclose(a) p_th_fclose((a))
extern int p_th_fclose(FILE *a);
#endif /* !defined(PFS_THREADS_FLORIDA) && !defined(PFS_THREADS_SOLARIS */
/* also in ardp.h */
extern FILE *locked_fopen(const char *a, const char *b);
extern int locked_fclose_A(FILE *a, const char*filename, int readonly);
extern void locked_clear(FILE *a);
int locked_fclose_and_rename(FILE *afile, const char *tmpfilename, const char *filename, int retval);
#if 0
#define locked_fopen(a,b) fopen((a),(b))
#define locked_fclose_A(a,b,c) fclose((a))
#define locked_clear(a)
#endif /* 0 */
extern void p__th_set_self_master();
#endif /* PFS_THREADS_H */

View File

@@ -0,0 +1,48 @@
/* This file is intended for inclusion by ardp or pfs */
/* NOTE: It is *not* dependent on pmachine.h */
/* Internal error handling routines used by the pfs code; formerly in */
/* internal_error.h. These include a replacement for the assert() */
/* macro, and an interface for internal error handling, better */
/* documented in internal_error.c */
#ifndef NDEBUG
/* This is duplicated over in ardp.h. A final cleanup will need to be made.
*/
#ifndef assert
#define assert(expr) do { \
if (!(expr)) \
p__finternal_error(__FILE__, __LINE__, "assertion violated: " #expr); \
} while(0)
#endif /* assert() */
#else /* NDEBUG */
#ifndef assert
#define assert(expr) do {;} while(0)
#endif /* assert() */
#endif /* NDEBUG */
#ifndef internal_error
#define internal_error(msg) do { \
write(2, "Internal error in file " __FILE__ ": ", \
sizeof "Internal error in file " __FILE__ ": " -1); \
write(2, msg, strlen(msg)); \
write(2, "\n", 1); \
if (internal_error_handler) \
(*internal_error_handler)(__FILE__, __LINE__, msg); \
else { \
fprintf(stderr, "line of error: %d\n", __LINE__); \
abort(); \
} \
} while(0)
#endif /* internal_error */
/* This function may be set to handle internal errors. Dirsrv handles them in
this way, by logging to plog. We make it int instead of void, because
older versions of the PCC (Portable C Compiler) cannot handle pointers to
void functions. */
extern int (*internal_error_handler)(const char file[], int linenumber, const char mesg[]);
/* function form of internal_error. */
void p__finternal_error(const char file[], int linenumber, const char mesg[]);

215
prospero/include/plog.h Normal file
View File

@@ -0,0 +1,215 @@
/*
* Copyright (c) 1991-1994 by the University of Southern California
*
* For copying and distribution information, please see the file
* <usc-license.h>.
*/
#include <usc-license.h>
#ifndef PLOG_H_INCLUDED
#define PLOG_H_INCLUDED
/*
* IMPORTANT: This file defines the configuration for the
* information to be logged for each type of Prospero query. As
* distributed, Prospero is configured to log lots of information,
* including the names of clients and the specific commands issued. This
* information should be considered sensitive and you must protect the
* logfile. Additionally, you should configure the server to log only
* the information you actually need. This can be accomplished by
* copying the definition of INITIAL_LOG_VECTOR to <pserver.h> and editing it.
*/
/* This file will be preceded by <pserver.h>, which can contain definitions
overriding some of the ones in the following file. You should edit that
file in preference to this one, so that when you upgrade to a later release
of Prospero you will be able to use the stock version of plog.h and just
change <pserver.h>.
*/
#include <stddef.h>
#include <stdarg.h>
#define PLOG_TOFILE_ENABLED 0x80000000
#define PLOG_TOFILE_DISABLED 0x00000000
/*
* If log messages are to be written to the prospero log file,
* PLOG_TOFILE must be set to PLOG_TOFILE_ENABLED. To disable logging
* to the log file, it's value should be PLOG_TOFILE_DISABLED. Note that
* it is acceptable to log to both syslog and the log file.
*
* This can most conveniently be set by #defining PSRV_LOGFILE in the
* "include/pserver.h" configuration file.
*/
#ifndef PSRV_LOGFILE
#define PLOG_TOFILE PLOG_TOFILE_DISABLED
#define PSRV_LOGFILE "pfs.nolog"
#else
#define PLOG_TOFILE PLOG_TOFILE_ENABLED
#endif
/*
* This following definitions define the types of log messages logged by
* plog. The action to be taken for each event can be selectively
* defined by setting the corresponding entry in INITIAL_LOG_VECTOR.
*/
#define MXPLOGENTRY 1000 /* Maximum length of single entry */
#define NLOGTYPE 25 /* Maximum number of log msg types */
#define L_FIELDS 0 /* Fields to include in messages */
#define L_STATUS 1 /* Startup, termination, etc */
#define L_FAILURE 2 /* Failure condition */
#define L_STATS 3 /* Statistics on server usage */
#define L_NET_ERR 4 /* Unexpected error in network code */
#define L_NET_RDPERR 5 /* Reliable datagram protocol error */
#define L_NET_INFO 6 /* Info on network activity */
#define L_QUEUE_INFO 7 /* Info on queue managment */
#define L_QUEUE_COMP 8 /* Requested service completed */
#define L_DIR_PERR 9 /* PFS Directory protocol errors */
#define L_DIR_PWARN 10 /* PFS Directory protocol warning */
#define L_DIR_PINFO 11 /* PFS Directory protocol info */
#define L_DIR_ERR 12 /* PFS Request error */
#define L_DIR_WARN 13 /* PFS Request warning */
#define L_DIR_REQUEST 14 /* PFS information request */
#define L_DIR_UPDATE 15 /* PFS information update */
#define L_AUTH_ERR 16 /* Unauthorized operation attempted */
#define L_DATA_FRM_ERR 17 /* PFS directory format error */
#define L_DB_ERROR 18 /* Error in database operation */
#define L_DB_INFO 19 /* Error in database operation */
#define L_ACCOUNT 20 /* Accounting info. record */
#define L_ERR_UNK NLOGTYPE /* Unknown error type */
/* Fields to include in log messages (L_FIELDS_HNAME not yet implemented) */
#define L_FIELDS_USER_R 0x01 /* Include user ID in request log message */
#define L_FIELDS_USER_U 0x02 /* Include user ID in update log messages */
#define L_FIELDS_USER_I 0x04 /* Include user ID in informational msgs */
#define L_FIELDS_HADDR 0x08 /* Include host address in log messages */
#define L_FIELDS_HNAME 0x10 /* Include host name in log messages */
#define L_FIELDS_SW_ID 0x20 /* Include host name in log messages */
#define L_FIELDS_CID 0x40 /* Include connection ID in log messages */
#define L_FIELDS_PORT 0x80 /* Include UDP port number in log msgs */
#define L_FIELDS_STIME 0x100 /* Include cuurent system time of rreq */
#define L_FIELDS_USER (L_FIELDS_USER_R|L_FIELDS_USER_U|L_FIELDS_USER_I)
/*
* P_LOGTO_SYSLOG should be defined if log messages are to be sent to syslog.
* If you are logging to syslog, you will probably be better off if you
* assign one of the local facility names (e.g., LOG_LOCAL1) to Prospero and
* define LOG_PROSPERO (below) accordingly. By default, Prospero does a lot
* of logging. If you choose to use LOG_DAEMON (which is the default value
* of LOG_PROSPERO), you might want to turn off logging of certain events
* to reduce clutter in your system wide log files.
*
* This can also be conveniently set by #defining P_LOGTO_SYSLOG in the
* "include/pserver.h" configuration file, and possibly also LOG_PROSPERO
*/
/*
* #define P_LOGTO_SYSLOG
*/
#ifdef P_LOGTO_SYSLOG
#include <syslog.h>
#define LOG_PROSPERO LOG_DAEMON
#else
#define LOG_PROSPERO 0
#endif
#ifndef LOG_INFO
#define LOG_CRIT 2
#define LOG_ERR 3
#define LOG_WARNING 4
#define LOG_NOTICE 5
#define LOG_INFO 6
#endif LOG_INFO
/* If L_FILEDS_STIME selected, then... */
/* This can also be conveniently set by #defining L_WTTIME_THRESHOLD in the
* "include/pserver.h" configuration file.
*/
#ifndef L_WTTIME_THRESHOLD
#define L_WTTIME_THRESHOLD 1 /* log waiting time if >= seconds */
#endif
/* This can also be conveniently set by #defining L_SYSTIME_THRESHOLD in the
* "include/pserver.h" configuration file.
*/
#ifndef L_SYSTIME_THRESHOLD
#define L_SYSTIME_THRESHOLD 1 /* log systime if >= seconds */
#endif
/* This can also be conveniently redefined by #defining L_SVCTIME_THRESHOLD in
* the"include/pserver.h" configuration file.
*/
#ifndef L_SVCTIME_THRESHOLD
#define L_SVCTIME_THRESHOLD 1 /* log svctime if >= seconds */
#endif
/* If L_QUEUE_COMP selected, then the following conditions are ANDed */
/* This can also be conveniently redefined by #defining L_COMP_SVC_THRESHOLD
* in the"include/pserver.h" configuration file.
*/
#ifndef L_COMP_SVC_THRESHOLD
#define L_COMP_SVC_THRESHOLD 30 /* Log L_QUEUE_COMP only if svctime exceeds */
#endif
/* This can also be conveniently redefined by #defining L_COMP_SYS_THRESHOLD
* in the"include/pserver.h" configuration file.
*/
#ifndef L_COMP_SYS_THRESHOLD
#define L_COMP_SYS_THRESHOLD 0 /* Log L_QUEUE_COMP only if systime exceeds */
#endif
/*
* INITIAL_LOG_VECTOR defines the actions to be taken for log messages
* of particular types. If INITIAL_LOG_VECTOR is defined in psite.h,
* that definition will override the definition that appears here.
*
* Event 0 in the vector is a bit vector identifying the information
* to be included in each log message (see L_FIELDS above). All other
* events in the vector specify the (OR'd together) syslog facility and
* priority to be used for the log message if P_LOGTO_SYSLOG is defined.
* The facility and priority are also OR'd with PLOG_TOFILE to indicate
* that the message should be written to the Prospero logfile
* (conditional on PLOG_TOFILE being enabled). If the entry for an
* event is 0, then no logging will occur.
*
* NOTE: The syslog event and priority of 0 is being overloaded.
* You cannot specify the combination of the LOG_EMERG priority
* and the LOG_KERN facility.
*/
/* This can also be conveniently redefined by #defining INITIAL_LOG_VECTOR
* in the"include/pserver.h" configuration file.
*/
#ifndef INITIAL_LOG_VECTOR
#define INITIAL_LOG_VECTOR { \
L_FIELDS_USER|L_FIELDS_HADDR|L_FIELDS_SW_ID, /* L_FIELDS */ \
LOG_PROSPERO|LOG_NOTICE|PLOG_TOFILE, /* L_STATUS */ \
LOG_PROSPERO|LOG_CRIT|PLOG_TOFILE, /* L_FAILURE */ \
PLOG_TOFILE, /* L_STATS */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_NET_ERR */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_NET_RDPERR */ \
0, /* L_NET_INFO */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE, /* L_QUEUE_INFO */ \
0, /* L_QUEUE_COMP */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_DIR_PERR */ \
LOG_PROSPERO|LOG_WARNING|PLOG_TOFILE, /* L_DIR_PWARN */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE, /* L_DIR_PINFO */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_DIR_ERR */ \
LOG_PROSPERO|LOG_WARNING|PLOG_TOFILE, /* L_DIR_WARN */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE, /* L_DIR_REQUEST */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE, /* L_DIR_UPDATE */ \
LOG_PROSPERO|LOG_WARNING|PLOG_TOFILE, /* L_AUTH_ERR */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_DATA_FRM_ERR */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_DB_ERROR */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE, /* L_DB_INFO */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE /* L_ACCOUNT */ \
}
#endif /* INITIAL_LOG_VECTOR */
extern char *vplog(int, RREQ, char *, va_list);
extern char *plog(int, RREQ, char *, ...);
extern void plog_manual(FILE *outf); /* call if plogging manually. */
#endif /* PLOG_H_INCLUDED */

View File

@@ -0,0 +1,52 @@
/*
* Machine types - Supported values
*
* VAX, SUN, HP9000_S300, HP9000_S700, IBM_RTPC, ENCORE_NS32K,
* ENCORE_S93, ENCORE_S91, APOLLO, IBM_RS6000, IBM_PC
*
* MIPS_BE - MIPS Chip (Big Endian Byte Order)
* MIPS_LE - MIPS Chip (Little Endian Byte Order)
*
* Add others as needed.
*
* Files that check these defintions:
* include/pmachine.h
*/
#ifdef AIX
#define P_MACHINE_TYPE "IBM_RS6000"
#define IBM_RS6000
#endif
#ifdef SUNOS
#define P_MACHINE_TYPE "SUN"
#define SUN
#endif
#ifdef SOLARIS
#define P_MACHINE_TYPE "SUN"
#define SUN
#endif
/*
* Operating system - Supported values
*
* ULTRIX, BSD43, SUNOS (version 4), SUNOS_V3 (SunOS version 3), HPUX, SYSV,
* MACH, DOMAINOS, AIX, SOLARIS (a.k.a. SunOS version 5), SCOUNIX
*
* Add others as needed.
*
* Files that check these defintions:
* include/pmachine.h, lib/pcompat/opendir.c, lib/pcompat/readdir.c
*/
#ifdef AIX
#define P_OS_TYPE "AIX"
#endif
#ifdef SUNOS
#define P_OS_TYPE "SUNOS"
#endif
#ifdef SOLARIS
#define P_OS_TYPE "SOLARIS"
#endif

573
prospero/include/pmachine.h Normal file
View File

@@ -0,0 +1,573 @@
/*
* Copyright (c) 1991-1994 by the University of Southern California
*
* For copying and distribution information, please see the file
* <usc-license.h>.
*/
#include <usc-license.h>
#include <stdio.h>
/*
* pmachine.h - Processor/OS specific definitions
*/
/*
* Machine types - Supported values
*
* VAX, SUN, HP9000_S300, HP9000_S700, IBM_RTPC, ENCORE_NS32K,
* ENCORE_S93, ENCORE_S91, APOLLO, IBM_RS6000, IBM_PC
*
* MIPS_BE - MIPS Chip (Big Endian Byte Order)
* MIPS_LE - MIPS Chip (Little Endian Byte Order)
*
* Add others as needed.
*
* Files that check these defintions:
* include/pmachine.h
*/
#include "pmachine-conf.h" /* lucb */
#ifdef 0 /* lucb */
#define P_MACHINE_TYPE "SUN"
#define SUN
#endif
/*
* Operating system - Supported values
*
* ULTRIX, BSD43, SUNOS (version 4), SUNOS_V3 (SunOS version 3), HPUX, SYSV,
* MACH, DOMAINOS, AIX, SOLARIS (a.k.a. SunOS version 5), SCOUNIX
*
* Add others as needed.
*
* Files that check these defintions:
* include/pmachine.h, lib/pcompat/opendir.c, lib/pcompat/readdir.c
*/
#ifdef 0 /* lucb */
#define P_OS_TYPE "SUNOS"
#define SUNOS
#endif
/*
* Miscellaneous definitions
*
* Even within a particular hardware and OS type, not all systems
* are configured identically. Some systems may need additinal
* definitions, some of which are included below. Note that for
* some system types, these are automatically defined.
*
* define ARDP_MY_WINDOW_SZ if your system has some sort of internal limit
* on the number of UDP packets that can be queued. SOLARIS has a limit of
* 9 or less (6 seems to work for Pandora Systems), which inspired
* this change. If defined, the client will explicity request that
* the server honor this window size. This reduces retries and wasted
* messages.
* define NEED_MODE_T if mode_t is not typedefed on your system
* define DD_SEEKLEN if your system doesn't support dd_bbase and dd_bsize
* define DIRECT if direct is the name of your dirent structure
* This generally goes along with using sys/dir.h.
* define USE_SYS_DIR_H if your system doesn't include sys/dirent.h, and
* sys/dir.h should be used instead.
* define CLOSEDIR_RET_TYPE_VOID if your closedir returns void
* Define GETDENTS if your system supports getdents instead of getdirentries
* Define OPEN_MODE_ARG_IS_INT if your system has the optional third argument
* to open() as an int. Don't #define it if the optional third argument to
* open() is a mode_t. You will need to #undef this if you're using the
* sysV interface to SunOS.
* Define SIGCONTEXT_LACKS_SC_PC if your system's sigcontext structure lacks
* an sc_pc member. This appears to be the case on HPUX version 8.07 on the
* HP 9000 series 700 workstations. I don't know if it's the case anywhere
* else, and I suspect it's a bug in the release that will be fixed later.
* Define PROTOTYPE_FOR_OPEN_HAS_EMPTY_ARGLIST if your system prototypes the
* open() function with an empty argument list. This is necessary because
* gcc requires the prototype to match the function invocation.
* Define PROTOTYPE_FOR_SELECT_USES_INT_POINTER if your system prototypes the
* select() function with 'int *' for the second, third, and fourth arguments
* instead of 'fd_set *'.
* Define BSD_UNION_WAIT if your system doesn't support the new POSIX wait()
* interface and does support the old BSD wait() interface and 'union wait'
* member.
* Define INCLUDE_FILES_LACK_FDOPEN_PROTOTYPE if your system's <stdio.h> lacks
* an fdopen() prototype.
* Define INCLUDE_FILES_LACK_POPEN_PROTOTYPE if your system's <stdio.h> lacks
* an popen() prototype.
* Define INCLUDE_FILES_LACK_TEMPNAM_PROTOTYPE if your system's <stdio.h> lacks
* a prototype for tempnam().
*/
#ifdef SOLARIS
#define ARDP_MY_WINDOW_SZ 6
#endif
/* Not sure if we need this as well, we certainly need the definition
of direct as dirent below */
#ifdef SCOUNIX
#define DIRECT
#endif
/*****************************************************************/
/* If your machine and OS type are listed above, and if your */
/* configuration is relatively standard for your machine and */
/* OS, there should be no need for any changes below this point. */
/*****************************************************************/
/*
* Machine or OS dependent parameters
*
* The comment at the head of each section names the paramter
* and the files that use the definition
*/
/*
* BYTE_ORDER: lib/psrv/plog.c, lib/psrv/check_acl.c
* #ifdefs by lucb
*/
#ifdef BIG_ENDIAN
# undef BIG_ENDIAN
#endif
#ifdef LITTLE_ENDIAN
# undef LITTLE_ENDIAN
#endif
#ifdef BYTE_ORDER
# undef BYTE_ORDER
#endif
#define BIG_ENDIAN 1
#define LITTLE_ENDIAN 2
#if defined(SUN) || defined(HP9000_S300) || defined(HP9000_S700) || \
defined(IBM_RTPC) || defined(IBM_RS6000) || \
defined(ENCORE_S91) || defined(ENCORE_S93) || defined(APOLLO) || \
defined(MIPS_BE)
#define BYTE_ORDER BIG_ENDIAN
#else
#define BYTE_ORDER LITTLE_ENDIAN
#endif
/*
* PUTENV: lib/pfs/vfsetenv.c
*
* PUTENV must be defined if your C library supports the putenv
* call instead of setenv (e.g. Ultrix and SunOS).
*/
#if defined(ULTRIX) || defined(SUNOS) || defined(SUNOS_V3) || defined(HPUX) \
|| defined(SOLARIS) || defined(SCOUNIX) || defined(AIX)
#define PUTENV
#endif
/*
* BADSETENV: lib/pfs/penviron.c
*
* Older BSD 4.3 systems have a bug in the C library routine setenv.
* Define BADSETENV if you wish to compile a working version of this
* this routine.
*
* #define BADSETENV
*/
/*
* NOREGEX: lib/pfs/wcmatch.c
*
* NOREGEX must be defined if your C library does not support the
* re_comp and re_exec regular expression routines.
*/
#if defined(HPUX) || defined(SOLARIS) || defined(SCOUNIX)
#define NOREGEX
#endif
/*
* String and byte manipulating
* procedures: lib/pfs/sindex.c, lib/pcompat/pfs_access.c
*/
#if defined(HPUX) || defined(SYSV) || defined(SOLARIS)
#define index strchr
#define rindex strrchr
#define bcopy(a,b,n) memmove(b,a,n)
#define bzero(a,n) memset(a,0,n)
#define bcmp memcmp
#endif
/*
* getwd: server/pstart.c
*/
#if defined(HPUX) || defined(SYSV) || defined(SOLARIS)
#define getwd(d) getcwd(d, MAXPATHLEN)
#endif
/*
* SETSID: server/dirsrv.c
*
* SETSID is to be defined if the system supports the POSIX
* setsid() routine to create a new session and set the process
* group ID.
*/
#if defined(HPUX) || defined(SOLARIS) || defined(SCOUNIX)
#define SETSID
#endif
/*
* NFILES: user/vget/pclose.c
*
* NFILES is the size of the descriptor table.
*/
#if defined(HPUX)
#define NFILES _NFILE
#elif defined (SOLARIS)
#define NFILES sysconf(_SC_OPEN_MAX)
#else
#define NFILES getdtablesize()
#endif
/*
* SIGNAL_RET_TYPE: user/vget/ftp.c, user/vget/pclose.c
*
* This is the type returned by the procedure returned by
* signal(2) (or signal(3C)). In some systems it is void, in others int.
*
*/
#if defined (BSD43) || defined(SUNOS_V3)
#define SIGNAL_RET_TYPE int
#else
#define SIGNAL_RET_TYPE void
#endif
/*
* CLOSEDIR_RET_TYPE_VOID: lib/pcompat/closedir.c
*
* If set, closedir() returns void.
*/
#if defined (NOTDEFINED)
#define CLOSEDIR_RET_TYPE_VOID
#endif
/*
* DIRECT: lib/pcompat/ *dir.c app/ls.c
*
* Use direct as the name of the dirent struct
*/
#if defined(DIRECT)
#define dirent direct
#endif
/*
* USE_SYS_DIR_H: lib/pcompat/ *dir.c app/ls.c
*
* Include the file <sys/dir.h> instead of <dirent.h>
*/
#if defined (NOTDEFINED)
#define USE_SYS_DIR_H /* slowly fading out of necessity */
/* Hopefully it's finally dead. */
#endif
/*
* DIR structure definitions: lib/pcompat/telldir.c,opendir.c
*/
#if defined (SUNOS) || defined(SUNOS_V3)
#define dd_bbase dd_off
#endif
#if defined (DD_SEEKLEN)
#define dd_bbase dd_seek
#define dd_bsize dd_len
#endif
/*
* GETDENTS: lib/pcompar/readdir.c
*
* Define GETDENTS if your system supports getdents instead of
* getdirentries.
*/
#if defined (SOLARIS)
#define GETDENTS
#endif
#if defined (GETDENTS)
#define getdirentries(F,B,N,P) getdents(F,B,N)
#endif
/*
* NEED MODE_T typedef: ls.c
*
* Define this if mode_t is not defined by your system's include
* files (sys/types.h or sys/stdtypes.h or sys/stat.h).
*/
#if defined (NEED_MODE_T)
typedef unsigned short mode_t;
#endif
/*
* OPEN_MODE_ARG_IS_INT: used: lib/pcompat/open.c
* Define OPEN_MODE_ARG_IS_INT if your system has the optional third argument
* to open() as an int. Don't #define it if the optional third argument to
* open() is a mode_t. You will need to #undef this if you're using the
* sysV interface to SunOS.
*/
/* Not sure how MACH and DOMAINOS actually need it; this is a guess. */
#if defined(ULTRIX) || defined(BSD43) || defined(SUNOS) || defined(SUNOS_V3) \
|| defined(MACH) || defined(DOMAINOS)
#define OPEN_MODE_ARG_IS_INT
#endif
/*
* SIGCONTEXT_LACKS_SC_PC typedef: server/dirsrv.c
*
* Define SIGCONTEXT_LACKS_SC_PC if your system's sigcontext structure lacks
* an sc_pc member. This appears to be the case on HPUX version 8.07 on the
* HP 9000 series 700 workstations. I don't know if it's the case anywhere
* else, and I suspect it's a bug in the release that will be fixed later.
*/
#if (defined(HPUX) && defined(HP9000_S700)) || defined(SOLARIS) || defined(SCOUNIX)
#define SIGCONTEXT_LACKS_SC_PC
#endif
/*
* PROTOTYPE_FOR_OPEN_HAS_EMPTY_ARGLIST: lib/pcompat/open.c
* See the file for how this is used. In GCC, an old-style function prototype
* is not compatible with a full ANSI function definition containing a ...
* (variable argument list). This definition makes sure that we use the
* appropriate definition of open() to correspond with the system include
* files.
*/
/*
* This is triggered if we're using the GCC fixed <sys/fcntlcom.h> under an
* ANSI C compiler; means that open() will be fully prototyped.
*/
#if !defined(HPUX) && !defined(SOLARIS) && (!defined(_PARAMS) && !defined(__STDC__))
#define PROTOTYPE_FOR_OPEN_HAS_EMPTY_ARGLIST
#endif
/*
* Define PROTOTYPE_FOR_SELECT_USES_INT_POINTER if your system prototypes the
* select() function with 'int *' for the second, third, and fourth arguments
* instead of 'fd_set *'. This avoids compilation warnings in libardp.
*/
#if defined(HPUX)
#define PROTOTYPE_FOR_SELECT_USES_INT_POINTER
#endif
#ifdef PROTOTYPE_FOR_SELECT_USES_INT_POINTER
#define select(width, readfds, writefds, exceptfds, timeout) \
select(width, (int *) readfds, (int *) writefds, (int *) exceptfds, timeout)
#endif
/*
* Define BSD_UNION_WAIT if your system doesn't support the new POSIX wait()
* interface and does support the old BSD wait() interface and 'union wait'
* member.
* Used in: lib/pcompat/pmap_cache.c, lib/pcompat/pmap_nfs.c, user/vget.c
*/
#if defined(NOTDEFINED)
#define BSD_UNION_WAIT
#endif
#if defined(SOLARIS)
/* In theory these are defined in stdio.h, but they're not present (at least in
* Solaris 2.3 they're not) and GCC doesn't fix this correctly right now.
*/
#define INCLUDE_FILES_LACK_FDOPEN_PROTOTYPE
#define INCLUDE_FILES_LACK_POPEN_PROTOTYPE
#define INCLUDE_FILES_LACK_TEMPNAM_PROTOTYPE
#endif /* SOLARIS */
/*
* Catch any definitions not in system include files
*
* The comment at the head of each section names the paramter
* and the files that use the definition
*/
/*
* OPEN_MAX: Maximum number of files a process can have open
*/
#ifndef OPEN_MAX
#define OPEN_MAX 64
#endif
/* MAXPATHLEN is still needed despite recommended change to pprot.h
since some files include sys/param.h but not pprot.h and use MAXPATHLEN
XXX MAXPATHLEN will eventually disappear from Prospero. SCO doesn't
provide that interface, and neither does Posix. All the fixed-length
code that uses MAXPATHLEN sized buffers will have to be rewritten to use
flexible-length names. -swa, Mar 10, 1994
*/
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
#ifdef SCOUNIX
/* sys/types.h is needed to define u_long, it must be before the FD_SET stuff*/
/* I dont know why this is so, but remember it from another port */
#define vfork fork
#endif
/* End of stuff required for SCO Unix */
/*
* FD_SET: lib/pfs/dirsend.c, user/vget/ftp.c
*/
#include <sys/types.h>
/* FD_SET is provided in SOLARIS by <sys/select.h>. This include file does not
exist on SunOS 4.1.3; on SunOS it's provided in <sys/types.h>.
No <sys/select.h> on HP-UX.
Don't know about other versions of UNIX. */
#ifdef SOLARIS
#include <sys/select.h> /* Include it before override it */
#endif
#ifndef FD_SET
#define NFDBITS 32
#define FD_SETSIZE 32
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
#endif
/*
* howmany: app/ls.c
*/
#ifndef howmany
#define howmany(x, y) ((((u_int)(x))+(((u_int)(y))-1))/((u_int)(y)))
#endif
/*
* MAXHOSTNAMELEN: user/vget/ftp.c
*/
#ifdef SOLARIS
#include <netdb.h>
#endif
#ifdef SUNOS
#include <sys/param.h>
#endif
#ifdef AIX
#include <sys/param.h>
#endif
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
#endif
/*
* O_ACCMODE: lib/pcompat/open.c
*/
#ifndef AIX /* lucb */
#include <sys/fcntl.h> /* Make sure include before overridden */
#else
#include <fcntl.h> /* Make sure include before overridden */
#endif
#ifndef O_ACCMODE
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
#endif
/*
* Definitions from stat.h: app/ls.c lib/pfs/mkdirs.c
*/
#include <sys/stat.h> /* Make sure included before overridden */
#ifndef S_IFMT
#define S_IFMT 070000
#endif
#ifndef S_IFDIR
#define S_IFDIR 040000
#endif
#ifndef S_IFCHR
#define S_IFCHR 020000
#endif
#ifndef S_IFBLK
#define S_IFBLK 060000
#endif
#ifndef S_IXUSR
#define S_IXUSR 0100
#endif
#ifndef S_IXGRP
#define S_IXGRP 0010
#endif
#ifndef S_IXOTH
#define S_IXOTH 0001
#endif
#ifndef S_ISDIR
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#endif
#ifndef S_ISCHR
#define S_ISCHR(m) ((S_IFLNK & m) == S_IFCHR)
#endif
#ifndef S_ISBLK
#define S_ISBLK(m) ((S_IFLNK & m) == S_IFBLK)
#endif
/* The ULTRIX include files don't bother to prototype the non-ansi string
manipulation functions.
*/
#ifdef ULTRIX
char *index(), *rindex();
#endif
#ifndef SCOUNIX
#define HAVE_WRITEV
#endif
#if defined(SCOUNIX) || defined(SOLARIS)
#define POSIX_SIGNALS
#endif
/* Define this if your system doesn't support the readv() and writev()
scatter/gather I/O primitives. If they're present, a couple of minor
optimizations happen.
*/
#ifdef SCOUNIX
#define NO_IOVEC
#endif
/* SOLARIS doesn't have sys_nerr or sys_errlist. It provides the strerror()
interface instead. All references to strerror() or to sys_nerr and
sys_errlist in Prospero now go through the unixerrstr() function in
lib/ardp/unixerrstr.c --swa
*/
#if defined(SOLARIS)
#define HAVESTRERROR
#else
#undef HAVESTRERROR
#endif
#ifdef INCLUDE_FILES_LACK_FDOPEN_PROTOTYPE
/* This seems to be the case only on SOLARIS, at least through 2.3*/
/*Should be defined in stdio.h */
extern FILE *fdopen(const int fd, const char *opts);
#endif
#ifdef INCLUDE_FILES_LACK_TEMPNAM_PROTOTYPE
/* Supposed to be defined in stdio.h, not there in Solaris2.3 */
extern char *tempnam(const char *, const char *);
#endif
#ifdef INCLUDE_FILES_LACK_POPEN_PROTOTYPE
/* This seems to be the case only on SOLARIS, at least through 2.3. */
/*Should be defined in stdio.h */
extern FILE *popen(const char *, const char *);
#endif
#if defined(SCOUNIX)
#define TCPTIMEOUTS
#else
/* Definitely not working on SOLARIS yet */
#undef TCPTIMEOUTS
#endif
#if defined(SOLARIS)
/* Currently used only in lib/psrv/ppasswd.c.
Solaris prototypes the library function crypt() in the crypt.h
include file. */
#define CRYPT_FUNCTION_PROTOTYPE_IN_CRYPT_H
#endif

View File

@@ -0,0 +1,536 @@
/*
* Copyright (c) 1991-1994 by the University of Southern California
*
* For copying and distribution information, please see the file
* <usc-license.h>.
*/
#include <usc-license.h>
/*
* pmachine.h - Processor/OS specific definitions
*/
/*
* Machine types - Supported values
*
* VAX, SUN, HP9000_S300, HP9000_S700, IBM_RTPC, ENCORE_NS32K,
* ENCORE_S93, ENCORE_S91, APOLLO, IBM_RS6000, IBM_PC
*
* MIPS_BE - MIPS Chip (Big Endian Byte Order)
* MIPS_LE - MIPS Chip (Little Endian Byte Order)
*
* Add others as needed.
*
* Files that check these defintions:
* include/pmachine.h
*/
#define P_MACHINE_TYPE "SUN"
#define SUN
/*
* Operating system - Supported values
*
* ULTRIX, BSD43, SUNOS (version 4), SUNOS_V3 (SunOS version 3), HPUX, SYSV,
* MACH, DOMAINOS, AIX, SOLARIS (a.k.a. SunOS version 5), SCOUNIX
*
* Add others as needed.
*
* Files that check these defintions:
* include/pmachine.h, lib/pcompat/opendir.c, lib/pcompat/readdir.c
*/
#define P_OS_TYPE "SUNOS"
#define SUNOS
/*
* Miscellaneous definitions
*
* Even within a particular hardware and OS type, not all systems
* are configured identically. Some systems may need additinal
* definitions, some of which are included below. Note that for
* some system types, these are automatically defined.
*
* define ARDP_MY_WINDOW_SZ if your system has some sort of internal limit
* on the number of UDP packets that can be queued. SOLARIS has a limit of
* 9 or less (6 seems to work for Pandora Systems), which inspired
* this change. If defined, the client will explicity request that
* the server honor this window size. This reduces retries and wasted
* messages.
* define NEED_MODE_T if mode_t is not typedefed on your system
* define DD_SEEKLEN if your system doesn't support dd_bbase and dd_bsize
* define DIRECT if direct is the name of your dirent structure
* This generally goes along with using sys/dir.h.
* define USE_SYS_DIR_H if your system doesn't include sys/dirent.h, and
* sys/dir.h should be used instead.
* define CLOSEDIR_RET_TYPE_VOID if your closedir returns void
* Define GETDENTS if your system supports getdents instead of getdirentries
* Define OPEN_MODE_ARG_IS_INT if your system has the optional third argument
* to open() as an int. Don't #define it if the optional third argument to
* open() is a mode_t. You will need to #undef this if you're using the
* sysV interface to SunOS.
* Define SIGCONTEXT_LACKS_SC_PC if your system's sigcontext structure lacks
* an sc_pc member. This appears to be the case on HPUX version 8.07 on the
* HP 9000 series 700 workstations. I don't know if it's the case anywhere
* else, and I suspect it's a bug in the release that will be fixed later.
* Define PROTOTYPE_FOR_OPEN_HAS_EMPTY_ARGLIST if your system prototypes the
* open() function with an empty argument list. This is necessary because
* gcc requires the prototype to match the function invocation.
* Define PROTOTYPE_FOR_SELECT_USES_INT_POINTER if your system prototypes the
* select() function with 'int *' for the second, third, and fourth arguments
* instead of 'fd_set *'.
* Define BSD_UNION_WAIT if your system doesn't support the new POSIX wait()
* interface and does support the old BSD wait() interface and 'union wait'
* member.
* Define INCLUDE_FILES_LACK_FDOPEN_PROTOTYPE if your system's <stdio.h> lacks
* an fdopen() prototype.
* Define INCLUDE_FILES_LACK_POPEN_PROTOTYPE if your system's <stdio.h> lacks
* an popen() prototype.
* Define INCLUDE_FILES_LACK_TEMPNAM_PROTOTYPE if your system's <stdio.h> lacks
* a prototype for tempnam().
*/
#ifdef SOLARIS
#define ARDP_MY_WINDOW_SZ 6
#endif
/* Not sure if we need this as well, we certainly need the definition
of direct as dirent below */
#ifdef SCOUNIX
#define DIRECT
#endif
/*****************************************************************/
/* If your machine and OS type are listed above, and if your */
/* configuration is relatively standard for your machine and */
/* OS, there should be no need for any changes below this point. */
/*****************************************************************/
/*
* Machine or OS dependent parameters
*
* The comment at the head of each section names the paramter
* and the files that use the definition
*/
/*
* BYTE_ORDER: lib/psrv/plog.c, lib/psrv/check_acl.c
*/
#define BIG_ENDIAN 1
#define LITTLE_ENDIAN 2
#if defined(SUN) || defined(HP9000_S300) || defined(HP9000_S700) || \
defined(IBM_RTPC) || defined(IBM_RS6000) || \
defined(ENCORE_S91) || defined(ENCORE_S93) || defined(APOLLO) || \
defined(MIPS_BE)
#define BYTE_ORDER BIG_ENDIAN
#else
#define BYTE_ORDER LITTLE_ENDIAN
#endif
/*
* PUTENV: lib/pfs/vfsetenv.c
*
* PUTENV must be defined if your C library supports the putenv
* call instead of setenv (e.g. Ultrix and SunOS).
*/
#if defined(ULTRIX) || defined(SUNOS) || defined(SUNOS_V3) || defined(HPUX) \
|| defined(SOLARIS) || defined(SCOUNIX)
#define PUTENV
#endif
/*
* BADSETENV: lib/pfs/penviron.c
*
* Older BSD 4.3 systems have a bug in the C library routine setenv.
* Define BADSETENV if you wish to compile a working version of this
* this routine.
*
* #define BADSETENV
*/
/*
* NOREGEX: lib/pfs/wcmatch.c
*
* NOREGEX must be defined if your C library does not support the
* re_comp and re_exec regular expression routines.
*/
#if defined(HPUX) || defined(SOLARIS) || defined(SCOUNIX)
#define NOREGEX
#endif
/*
* String and byte manipulating
* procedures: lib/pfs/sindex.c, lib/pcompat/pfs_access.c
*/
#if defined(HPUX) || defined(SYSV) || defined(SOLARIS)
#define index strchr
#define rindex strrchr
#define bcopy(a,b,n) memmove(b,a,n)
#define bzero(a,n) memset(a,0,n)
#define bcmp memcmp
#endif
/*
* getwd: server/pstart.c
*/
#if defined(HPUX) || defined(SYSV) || defined(SOLARIS)
#define getwd(d) getcwd(d, MAXPATHLEN)
#endif
/*
* SETSID: server/dirsrv.c
*
* SETSID is to be defined if the system supports the POSIX
* setsid() routine to create a new session and set the process
* group ID.
*/
#if defined(HPUX) || defined(SOLARIS) || defined(SCOUNIX)
#define SETSID
#endif
/*
* NFILES: user/vget/pclose.c
*
* NFILES is the size of the descriptor table.
*/
#if defined(HPUX)
#define NFILES _NFILE
#elif defined (SOLARIS)
#define NFILES sysconf(_SC_OPEN_MAX)
#else
#define NFILES getdtablesize()
#endif
/*
* SIGNAL_RET_TYPE: user/vget/ftp.c, user/vget/pclose.c
*
* This is the type returned by the procedure returned by
* signal(2) (or signal(3C)). In some systems it is void, in others int.
*
*/
#if defined (BSD43) || defined(SUNOS_V3)
#define SIGNAL_RET_TYPE int
#else
#define SIGNAL_RET_TYPE void
#endif
/*
* CLOSEDIR_RET_TYPE_VOID: lib/pcompat/closedir.c
*
* If set, closedir() returns void.
*/
#if defined (NOTDEFINED)
#define CLOSEDIR_RET_TYPE_VOID
#endif
/*
* DIRECT: lib/pcompat/ *dir.c app/ls.c
*
* Use direct as the name of the dirent struct
*/
#if defined(DIRECT)
#define dirent direct
#endif
/*
* USE_SYS_DIR_H: lib/pcompat/ *dir.c app/ls.c
*
* Include the file <sys/dir.h> instead of <dirent.h>
*/
#if defined (NOTDEFINED)
#define USE_SYS_DIR_H /* slowly fading out of necessity */
/* Hopefully it's finally dead. */
#endif
/*
* DIR structure definitions: lib/pcompat/telldir.c,opendir.c
*/
#if defined (SUNOS) || defined(SUNOS_V3)
#define dd_bbase dd_off
#endif
#if defined (DD_SEEKLEN)
#define dd_bbase dd_seek
#define dd_bsize dd_len
#endif
/*
* GETDENTS: lib/pcompar/readdir.c
*
* Define GETDENTS if your system supports getdents instead of
* getdirentries.
*/
#if defined (SOLARIS)
#define GETDENTS
#endif
#if defined (GETDENTS)
#define getdirentries(F,B,N,P) getdents(F,B,N)
#endif
/*
* NEED MODE_T typedef: ls.c
*
* Define this if mode_t is not defined by your system's include
* files (sys/types.h or sys/stdtypes.h or sys/stat.h).
*/
#if defined (NEED_MODE_T)
typedef unsigned short mode_t;
#endif
/*
* OPEN_MODE_ARG_IS_INT: used: lib/pcompat/open.c
* Define OPEN_MODE_ARG_IS_INT if your system has the optional third argument
* to open() as an int. Don't #define it if the optional third argument to
* open() is a mode_t. You will need to #undef this if you're using the
* sysV interface to SunOS.
*/
/* Not sure how MACH and DOMAINOS actually need it; this is a guess. */
#if defined(ULTRIX) || defined(BSD43) || defined(SUNOS) || defined(SUNOS_V3) \
|| defined(MACH) || defined(DOMAINOS)
#define OPEN_MODE_ARG_IS_INT
#endif
/*
* SIGCONTEXT_LACKS_SC_PC typedef: server/dirsrv.c
*
* Define SIGCONTEXT_LACKS_SC_PC if your system's sigcontext structure lacks
* an sc_pc member. This appears to be the case on HPUX version 8.07 on the
* HP 9000 series 700 workstations. I don't know if it's the case anywhere
* else, and I suspect it's a bug in the release that will be fixed later.
*/
#if (defined(HPUX) && defined(HP9000_S700)) || defined(SOLARIS) || defined(SCOUNIX)
#define SIGCONTEXT_LACKS_SC_PC
#endif
/*
* PROTOTYPE_FOR_OPEN_HAS_EMPTY_ARGLIST: lib/pcompat/open.c
* See the file for how this is used. In GCC, an old-style function prototype
* is not compatible with a full ANSI function definition containing a ...
* (variable argument list). This definition makes sure that we use the
* appropriate definition of open() to correspond with the system include
* files.
*/
/*
* This is triggered if we're using the GCC fixed <sys/fcntlcom.h> under an
* ANSI C compiler; means that open() will be fully prototyped.
*/
#if !defined(HPUX) && !defined(SOLARIS) && (!defined(_PARAMS) && !defined(__STDC__))
#define PROTOTYPE_FOR_OPEN_HAS_EMPTY_ARGLIST
#endif
/*
* Define PROTOTYPE_FOR_SELECT_USES_INT_POINTER if your system prototypes the
* select() function with 'int *' for the second, third, and fourth arguments
* instead of 'fd_set *'. This avoids compilation warnings in libardp.
*/
#if defined(HPUX)
#define PROTOTYPE_FOR_SELECT_USES_INT_POINTER
#endif
#ifdef PROTOTYPE_FOR_SELECT_USES_INT_POINTER
#define select(width, readfds, writefds, exceptfds, timeout) \
select(width, (int *) readfds, (int *) writefds, (int *) exceptfds, timeout)
#endif
/*
* Define BSD_UNION_WAIT if your system doesn't support the new POSIX wait()
* interface and does support the old BSD wait() interface and 'union wait'
* member.
* Used in: lib/pcompat/pmap_cache.c, lib/pcompat/pmap_nfs.c, user/vget.c
*/
#if defined(NOTDEFINED)
#define BSD_UNION_WAIT
#endif
#if defined(SOLARIS)
/* In theory these are defined in stdio.h, but they're not present (at least in
* Solaris 2.3 they're not) and GCC doesn't fix this correctly right now.
*/
#define INCLUDE_FILES_LACK_FDOPEN_PROTOTYPE
#define INCLUDE_FILES_LACK_POPEN_PROTOTYPE
#define INCLUDE_FILES_LACK_TEMPNAM_PROTOTYPE
#endif /* SOLARIS */
/*
* Catch any definitions not in system include files
*
* The comment at the head of each section names the paramter
* and the files that use the definition
*/
/*
* OPEN_MAX: Maximum number of files a process can have open
*/
#ifndef OPEN_MAX
#define OPEN_MAX 64
#endif
/* MAXPATHLEN is still needed despite recommended change to pprot.h
since some files include sys/param.h but not pprot.h and use MAXPATHLEN
XXX MAXPATHLEN will eventually disappear from Prospero. SCO doesn't
provide that interface, and neither does Posix. All the fixed-length
code that uses MAXPATHLEN sized buffers will have to be rewritten to use
flexible-length names. -swa, Mar 10, 1994
*/
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
#ifdef SCOUNIX
/* sys/types.h is needed to define u_long, it must be before the FD_SET stuff*/
/* I dont know why this is so, but remember it from another port */
#define vfork fork
#endif
/* End of stuff required for SCO Unix */
/*
* FD_SET: lib/pfs/dirsend.c, user/vget/ftp.c
*/
#include <sys/types.h>
/* FD_SET is provided in SOLARIS by <sys/select.h>. This include file does not
exist on SunOS 4.1.3; on SunOS it's provided in <sys/types.h>.
No <sys/select.h> on HP-UX.
Don't know about other versions of UNIX. */
#ifdef SOLARIS
#include <sys/select.h> /* Include it before override it */
#endif
#ifndef FD_SET
#define NFDBITS 32
#define FD_SETSIZE 32
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
#endif
/*
* howmany: app/ls.c
*/
#ifndef howmany
#define howmany(x, y) ((((u_int)(x))+(((u_int)(y))-1))/((u_int)(y)))
#endif
/*
* MAXHOSTNAMELEN: user/vget/ftp.c
*/
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
#endif
/*
* O_ACCMODE: lib/pcompat/open.c
*/
#include <sys/fcntl.h> /* Make sure include before overridden */
#ifndef O_ACCMODE
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
#endif
/*
* Definitions from stat.h: app/ls.c lib/pfs/mkdirs.c
*/
#include <sys/stat.h> /* Make sure included before overridden */
#ifndef S_IFMT
#define S_IFMT 070000
#endif
#ifndef S_IFDIR
#define S_IFDIR 040000
#endif
#ifndef S_IFCHR
#define S_IFCHR 020000
#endif
#ifndef S_IFBLK
#define S_IFBLK 060000
#endif
#ifndef S_IXUSR
#define S_IXUSR 0100
#endif
#ifndef S_IXGRP
#define S_IXGRP 0010
#endif
#ifndef S_IXOTH
#define S_IXOTH 0001
#endif
#ifndef S_ISDIR
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#endif
#ifndef S_ISCHR
#define S_ISCHR(m) ((S_IFLNK & m) == S_IFCHR)
#endif
#ifndef S_ISBLK
#define S_ISBLK(m) ((S_IFLNK & m) == S_IFBLK)
#endif
/* The ULTRIX include files don't bother to prototype the non-ansi string
manipulation functions.
*/
#ifdef ULTRIX
char *index(), *rindex();
#endif
#ifndef SCOUNIX
#define HAVE_WRITEV
#endif
#if defined(SCOUNIX) || defined(SOLARIS)
#define POSIX_SIGNALS
#endif
/* Define this if your system doesn't support the readv() and writev()
scatter/gather I/O primitives. If they're present, a couple of minor
optimizations happen.
*/
#ifdef SCOUNIX
#define NO_IOVEC
#endif
/* SOLARIS doesn't have sys_nerr or sys_errlist. It provides the strerror()
interface instead. All references to strerror() or to sys_nerr and
sys_errlist in Prospero now go through the unixerrstr() function in
lib/ardp/unixerrstr.c --swa
*/
#if defined(SOLARIS)
#define HAVESTRERROR
#else
#undef HAVESTRERROR
#endif
#ifdef INCLUDE_FILES_LACK_FDOPEN_PROTOTYPE
/* This seems to be the case only on SOLARIS, at least through 2.3*/
/*Should be defined in stdio.h */
extern FILE *fdopen(const int fd, const char *opts);
#endif
#ifdef INCLUDE_FILES_LACK_TEMPNAM_PROTOTYPE
/* Supposed to be defined in stdio.h, not there in Solaris2.3 */
extern char *tempnam(const char *, const char *);
#endif
#ifdef INCLUDE_FILES_LACK_POPEN_PROTOTYPE
/* This seems to be the case only on SOLARIS, at least through 2.3. */
/*Should be defined in stdio.h */
extern FILE *popen(const char *, const char *);
#endif
#if defined(SCOUNIX)
#define TCPTIMEOUTS
#else
/* Definitely not working on SOLARIS yet */
#undef TCPTIMEOUTS
#endif
#if defined(SOLARIS)
/* Currently used only in lib/psrv/ppasswd.c.
Solaris prototypes the library function crypt() in the crypt.h
include file. */
#define CRYPT_FUNCTION_PROTOTYPE_IN_CRYPT_H
#endif

View File

@@ -0,0 +1,17 @@
/* Make sure sys/types included here before included by signal.h */
#include <sys/types.h>
#ifdef _POSIX_C_SOURCE
#define OLD_POSIX_C_SOURCE _POSIX_C_SOURCE
#else
#undef OLD_POSIX_C_SOURCE
#endif
#define _POSIX_C_SOURCE 1
#include "/usr/include/signal.h"
#ifdef OLD_POSIX_C_SOURCE
#define _POSIX_C_SOURCE OLD_POSIX_C_SOURCE
#undef OLD_POSIX_C_SOURCE
#else
#undef _POSIX_C_SOURCE
#endif

208
prospero/include/pparse.h Normal file
View File

@@ -0,0 +1,208 @@
/* pparse.h */
/* Copyright (c) 1992, 1993 by the University of Southern California
For copying information, see the file <usc-copyr.h>
*/
#ifndef PPARSE_H_INCLUDED
#define PPARSE_H_INCLUDED
#include <usc-copyr.h>
#ifndef FILE
#include <stdio.h>
#endif
#ifndef PFS_SW_ID
#include <pfs.h>
#endif
#include <stddef.h>
#include <stdarg.h>
#include <ardp.h>
/* This structure is used by the parsing code. It defines a standard IO type
that lets the parsing code know where to read its input from. This code is
shared among the client protocol interface, server protocol interface, and
server directory format reading mechanism. All information about the next
location to read input from is contained INSIDE this structure.
That means that if we make a duplicate of the structure (using input_copy())
and feed it to a function that resets the pointer (e.g., in_inc(), or
in_line()), the input pointer will be reset for the copy but not for the
original.
If there are any data structures which have been allocated for an INPUT,
then input_freelinks() will free them. At the moment, this is a null
macro.
The user is responsible for freeing any memory that the user passed to
rreqtoin() or filetoin(). The sending functions will normally do this, as
will fclose().
The only low-level functions that actually read from this all eventually
call in_readc() and in_readcahead() and in_incc().
*/
enum iotype {IO_UNSET = 0, IO_RREQ, IO_STRING, IO_FILE, IO_BSTRING};
struct input {
enum iotype sourcetype;
RREQ rreq; /* server or client reading */
struct ptext *inpkt; /* packet in process. Null iff no more input.
*/
char *ptext_ioptr; /* position of next character from within ptxt.
This will point to a null iff there is no
more input. */
const char *s; /* Current position in string or bstring */
FILE *file; /* server, set if reading via dsrfile() or
dsrdir() */
long bstring_length; /* Length of the bstring. */
long offset; /* Offset from start of file or input stream.
This is repeatedly set and tested.
Used to make sure that having two INPUT
variables referring to the same FILE with
different read pointers will not cause
problems. Also used in in_line() to
allocate appropriate memory. */
/* Also used for BSTRINGs to see how much data
is still readable. */
int flags;
#define CONSUME_INPUT 0x1 /* qscanf() should consume input.
Not currently implemented. */
#define PERCENT_R_TARGET_IS_STRING 0x2 /* if set, the target for %r is a
string. Otherwise, it's an IN.
This is temporarily set by the
qsscanf() interface to qscanf()
*/
#define JUST_INITIALIZED 0x4 /* set upon initialization.
Not currently used. */
#define SERVER_DATA_FILE 0x8 /* A server data file,
whether Cached by the
wholefiletoin() or treated in
raw form by the (unused)
filetoin() interface. */
};
typedef struct input INPUT_ST;
typedef struct input *INPUT;
/* Copy the whole schmeer. */
#define input_copy(src,dest) do { \
*dest = *src; \
} while (0)
#define input_freelinks() do ; while (0)
/* All of these input functions, except for input_line, report their errors to
their callers. */
/* in_line does not do this, though. */
/* Set up for input. Fills in its 2nd argument. Found in lib/pfs/in_line.c */
extern void rreqtoin(RREQ rreq, INPUT in);
extern void filetoin(FILE *file, INPUT in);
extern int wholefiletoin(FILE *file, INPUT in);
/* These are the low-level input routines. */
/* This replaces in_line(), eventually. */
extern int qscanf(INPUT in, const char fmt[], ...);
extern int vqscanf(INPUT in, const char fmt[], va_list ap);
extern int in_line(INPUT in, char **commandp, char **next_wordp);
extern char *in_nextline(INPUT in); /* returns the command that the next
in_line would read. Just the first
word is enough. NULL If no more
stuff. */
extern int in_readc(INPUT in);
extern int in_readcahead(INPUT in, int howfar);
extern void in_incc(INPUT in);
extern int in_eof(INPUT in); /* test for EOF status. 1 if true; 0 if not.
*/
/* These handy little functions parse input for us. */
extern int in_acl(INPUT in, ACL *aclp);
extern int in_ge1_acl(INPUT in, char *command, char *next_word, ACL *aclp);
extern int in_atr_data(INPUT in, char *command, char *next_word, int nesting,
PATTRIB at);
extern int in_atrs(INPUT in, int nesting, PATTRIB *valuep);
extern int in_ge1_atrs(INPUT in, char *command, char *next_word,
PATTRIB *valuep);
extern int in_filter(INPUT in, char *command, char *next_word, int nesting,
FILTER *valuep);
extern int in_forwarded_data(INPUT in, char *command, char *next_word,
VLINK dlink);
extern int in_id(INPUT in, long *magic_nop);
extern int in_select(INPUT in, long *magic_nop);
extern int in_link(INPUT in, char *command, char *next_word, int nesting,
VLINK *valuep, TOKEN *argsp);
extern int in_sequence(INPUT in, char *command, char *next_word,
TOKEN *valuep);
/* Used to look at error messages */
extern int scan_error(char *line, RREQ req);
/* This structure is used by the formatting code. It defines a standard
output type that lets the formatting code know where to send the output.
*/
struct output {
RREQ req; /* Server -- replying to client request */
RREQ request; /* Client -- querying the server */
FILE *f; /* Server, writing to dsfile.c or dsdir.c */
/* No need for string output. */
};
typedef struct output *OUTPUT;
typedef struct output OUTPUT_ST;
/* requesttoout() and reqtoout() are inherently different, because libardp has
an asymmetry between a client sending a request to a server and a server
replying to a client's request.
Requests to the server are sent as a unit, whereas replies are returned a
packet at a time as data becomes available. Also, the functions they use to
push the output & terminate the request are different.
*/
/* Automatic reply and formatting utilities (unparsing, sort of :)). */
/* Set up for output. Fills in its 2nd argument.*/
/* lib/pfs/cl_qoprintf.c */
extern int requesttoout(RREQ req, OUTPUT out);
/* lib/psrv/srv_qoprintf.c */
extern void reqtoout(RREQ req, OUTPUT out);
extern void filetoout(FILE *file, OUTPUT out);
/* outputs raw lines and data. */
extern int (*qoprintf)(OUTPUT out, const char format[], ...);
/* set to one of the two below. */
extern int cl_qoprintf(OUTPUT out, const char format[], ...);
extern int srv_qoprintf(OUTPUT out, const char format[], ...);
/* outputs formatted stuff. */
extern int out_acl(OUTPUT out, ACL acl);
extern int out_atr(OUTPUT out, PATTRIB at, int nesting);
extern int out_atrs(OUTPUT out, PATTRIB at, int nesting);
extern int out_filter(OUTPUT out, FILTER fil, int nesting);
extern int out_link(OUTPUT out, VLINK vlink, int nesting, TOKEN args);
extern int out_sequence(OUTPUT out, TOKEN tk);
/* in LIBPSRV. */
/* Attribute manipulation stuff that is used by the parsing code too. */
/* These report errors by writing to p_err_string and returning error codes. */
/* Used by in_link() in LIBPFS and by edit_link_info() in the server. */
extern int vl_add_atrs(PATTRIB at, VLINK clink);
extern int vl_add_atr(PATTRIB at, VLINK clink);
extern void vl_atput(VLINK vl, char *name, ...);
/* Used ONLY by in_atrs() and atr_out() */
/* used by atr_out() */
extern char * lookup_precedencename_by_precedence(int precedence);
extern char * lookup_avtypename_by_avtype(int avtype);
/* used by in_atrs() */
extern int lookup_avtype_by_field_name(const char aname[]);
extern int lookup_precedence_by_precedencename(const char t_precedence[]);
extern int lookup_avtype_by_avtypename(const char []);
/* This variable is set to the real function in the stdio library if you
want the IN package to deal with input streams as defined in <stdio.h>.
They are set by dirsrv.c and by shadowcvt.c
They should be set when you set qoprintf().
*/
extern int (*stdio_fseek)();
#endif /* PPARSE_H_INCLUDED */

View File

@@ -0,0 +1,41 @@
/*
* Copyright (c) 1989, 1990, 1991 by the University of Washington
* Copyright (c) 1991, 1992, 1993 by the University of Southern California
*
* For copying and distribution information, please see the files
* <uw-copyright.h> and <usc-copyr.h>.
*/
#include <uw-copyright.h>
#include <usc-copyr.h>
#ifndef P_PASSWD_H_INCLUDED
#define P_PASSWD_H_INCLUDED
/* Structure used to contain entry for the prospero password file */
typedef struct _p_passwd {
char *principal;
char *encrypted_passwd;
} p_passwd;
/* Get password file entry for principal. Returns pointer to p_passwd */
/* structure if found, else returns NULL. */
p_passwd *get_ppw_entry(char *principal);
/* Set password for principal in password file, overwriting old */
/* entry if one exists. */
int set_passwd(char *principal, char *passwd);
/* Returns TRUE if password specified for the principal matches */
/* password in entry for principal in password file, and FALSE */
/* otherwise */
int passwd_correct(char *principal, char *passwd);
/* Deletes principal's password entry from file */
int delete_ppw_entry(char *principal);
/* Lists the principals in the Prospero password file */
int list_ppw_file(void);
#endif /* P_PASSWD_H_INCLUDED */

72
prospero/include/pprot.h Normal file
View File

@@ -0,0 +1,72 @@
/*
* Copyright (c) 1989, 1990, 1991 by the University of Washington
* Copyright (c) 1991, 1992 by the University of Southern California
*
* For copying and distribution information, please see the files
* <uw-copyright.h> and <usc-copyr.h>.
*/
#include <uw-copyright.h>
#include <usc-copyr.h>
/*
* CONFLICT_BETWEEN_DEFINITION_OF_NULL_IN_SYS_PARAM_H_AND_STDDEF_H:
* include/pprot.h, server/dirsrv.h, server/shadowcvt.c
* This appears to be an unpleasant interaction between GCC
* version 1.41 and the Ultrix version 4.2A system include files. The
* compiler complained about conflicting definitions of NULL in <sys/param.h>
* and <stddef.h>. The definitions are in fact the same, but with different
* spacing, which the ANSI standard says should be irrelevant.
* (Section 3.8.3, 'Macro Replacement' clearly states that:
* "An object currently defined as a macro without use of lparen (an
* object-like macro) may be reedefined by another #define preprocessing
* directive provided that the second definition is an object-like macro
* definition and the two replacement lists are identical."
* It also clearly states that, in considering whether the replacment lists
* are identical, "all white-space separations are considered identical"
* You can #define this if you encounter this bug. It will slightly slow
* down the compilation if this is left #defined, but not very much.
* I suggest you define it by modifying the definition of MACHDEF in the
* top-level MAKEFILE, since this gross kludge is necessary in
* include/pprot.h, server/dirsrv.h, and server/shadowcvt.c.
*/
#if defined (NOTDEFINED)
#define CONFLICT_BETWEEN_DEFINITION_OF_NULL_IN_SYS_PARAM_H_AND_STDDEF_H
#endif
#ifndef MAXPATHLEN
#ifdef CONFLICT_BETWEEN_DEFINITION_OF_NULL_IN_SYS_PARAM_H_AND_STDDEF_H
#undef NULL
#endif /* #ifdef CONFLICT... */
#include <sys/param.h> /* XXX This should Change. MAXPATHLEN is too
UNIX-specific. It is almost always 1024,
but we should use MAX_VPATH instead. */
/* Not defined on SCO Unix */
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
#ifdef CONFLICT_BETWEEN_DEFINITION_OF_NULL_IN_SYS_PARAM_H_AND_STDDEF_H
#ifndef NULL
#include <stddef.h>
#endif /* #ifndef NULL */
#endif /* #ifdef CONFLICT... */
#endif /* #ifndef MAXPATHLEN */
/* Protocol Definitions */
#define VFPROT_VNO 5 /* Protocol Version Number */
#define DIRSRV_PORT 1525 /* Server port used if not in srvtab */
#define PROSPERO_PORT 191 /* Officially assigned prived port */
#define SEQ_SIZE 32 /* Max size of sequence text in resp */
/* This definition is now obsolete. It only exists to support Version 1
code; version 5 code dynamically allocates buffers. */
#define MAX_DIR_LINESIZE 160+MAXPATHLEN /* Max linesize in directory */
#define MAX_FWD_DEPTH 20 /* Max fwd pointers to follow */
#define S_AD_SZ sizeof(struct sockaddr_in)

604
prospero/include/pserver.h Normal file
View File

@@ -0,0 +1,604 @@
/*
* pserver.h - server specific parameters for Prospero
*
* This file contains local definitions for the Prospero server.
* It is expected that it will be different on different systems.
*/
/*
* Written by bcn 1989 as part of psite.h
* Modified by bcn 1/19/93 to leave only server specific definitions
*/
/*
* Copyright (c) 1991-1994 by the University of Southern California
*
* For copying and distribution information, please see the file
* <usc-license.h>.
*/
#include <usc-license.h>
/*
* This option is temporary, until we make the forwarding mechanism more
* efficient.
* It hikes the efficiency considerably. Developers having long turnaround
* times on rd_vdir() need it. Talk to swa@ISI.EDU.
*/
#define SERVER_DO_NOT_SUPPORT_FORWARDING
/*
* SERVER_SUPPORT_V1 indicates that the server is to reply to version 1
* Prospero Protocol requests. It is recommended that you define
* this for the time being since there are many Version 1 clients still
* in use. Note that version 1 clients will *not* be able to speak
* to certain new services so it's a good idea to upgrade your clients.
*/
#define SERVER_SUPPORT_V1
#define SERVER_DONT_FLAG_V1
/*
* P_DIRSRV_BINARY defines the full path by which pstart will
* find the binary for the directory server.
*/
#if 0
#define P_DIRSRV_BINARY "/usr/pfs/bin/dirsrv"
#else
#define P_DIRSRV_BINARY (char *) get_pfs_file("bin/dirsrv")
#endif
/*
* PROSPERO_CONTACT specifies the e-mail address of the individual
* or individuals responsible for running the Prospero server on the
* local system. If specified, this string will appear in responses to
* status requests. This definition is optional.
*
* #define PROSPERO_CONTACT "yourname@host.org.domain"
*/
#define PROSPERO_CONTACT "info-prospero@ISI.EDU"
/*
* PSRV_HOSTNAME specifies the name of the host on which the server
* will run. It only needs to be defined if gethostbyname does not
* return the name of the host as a fully qualified domain name.
*
* #define PSRV_HOSTNAME "HOST.ORG.DOMAIN"
*
*/
/*
* PSRV_USER_ID specifies the user name under which the Prospero
* server will run. The server will run under the home group of
* PSRV_USER_ID, but (in systems which support membership in multiple
* groups) not under any supplementary groups to which that user may
* belong.
*/
#if 0
#define PSRV_USER_ID "pfs"
#else
#define PSRV_USER_ID "archie"
#endif
/*
* P_RUNDIR is the name of the directory under which the Prospero
* server will run. If left out, it defaults to /tmp.
*
* #define PSRV_RUNDIR "/tmp"
*/
/*
* PSRV_LOGFILE is the name of the file in which events are logged.
* By default Prospero logs all requests if PSRV_LOGFILE is defined. If you
* would like to change the list of events that are logged, or if you would
* like to use syslog for logging, edit the file plog.h.
*/
#define PSRV_LOGFILE "/pfs/pfs.log"
/*
* PSRV_ROOT defines that part of the system's directory tree for which
* directory information will be readable over the network. Directory
* information will also be available for files under AFTPDIRECTORY and
* AFSDIRECTORY if these access methods are supported.
*
* If PSRV_ROOT is not defined, then directory information will only be
* available for those files under AFTPDIRECTORY or AFSDIRECTORY.
*
* #define PSRV_ROOT "/"
*/
#define PSRV_ROOT "/pfs/info-tree"
/*
* PSRV_READ_ONLY specifies that the server is only to accept
* operations that read the directory structure. No changes to virtual
* directories stored on this system will be allowed. NODOTDOT is used to
* disallow the use of path names that include "..". If you are
* restricting the part of the directory tree which will be accessible
* (i.e. if PSRV_ROOT is other than "/"), NODOTDOT should be set.
*
* #define PSRV_READ_ONLY
* #define NODOTDOT
*/
#if 0
#define PSRV_READ_ONLY
#define NODOTDOT
#endif
/*
* PSRV_SHADOW is the name of the shadow hierarchy that contains additional
* information about Prospero files. PSRV_STORAGE is the name of the directory
* under which new files can be created, if that option is supported by
* your distribution. PSRV_SECURITY is the name of the directory where
* security information is stored by the prospero server. All three names are
* relative to the home directory for the
* user ID specified by P_USER_ID.
*
* You will normally have no desire to change this, but it IS posible and legal
* to do so. If you do change it, then please make a corresponding change in
* section III of Makefile.config.
*/
#define PSRV_SHADOW "shadow"
#define PSRV_STORAGE "pfsdat"
#define PSRV_SECURITY "security"
/*
* If PSRV_UNDER_UDIR is defined, pstart calculates the full path names of
* of the directories corresponding to PSRV_SHADOW and PSRV_STORAGE and
* PSRV_SECURITY by
* finding the home directory for the Prospero user ID, then appending
* PSRV_SHADOW or PSRV_STORAGE or PSRV_SECURITY.
*
* If PSRV_UNDER_UDIR is not defined, or if dirsrv is called directly,
* the full path names are taken from PSRV_FSHADOW and PSRV_FSTORAGE and
* PSRV_FSECURITY. These
* should be stable names for those directories. They may be aliases
* (symbolic links) if the directories move around. If they are symbolic
* links, the links should be updated whenever the directories move.
*
* Note that if PSRV_UNDER_UDIR is set, the full path names are calculated
* only when the Prospero server is started by pstart. If you expect
* to start the server by hand (for example, when debugging), PSRV_FSHADOW
* and PSRV_FSTORAGE should also be defined.
*
* In any case these must match the definitions at the top of Makefile
*/
#define PSRV_UNDER_UDIR
#define PSRV_FSHADOW "/pfs/shadow"
#define PSRV_FSTORAGE "/pfs/pfsdat"
#define PSRV_FSECURITY "/pfs/security"
/*
* AFTPDIRECTORY contains the name of the root directory as seen through
* anonymous FTP. It is used to determine which files may be accessed
* using the anonymous FTP access mechanism, and to determine the file name
* that must be used when doing so. It also adds to the set of files about
* which directory information is available.
*
* Note: AFTPDIRECTORY should be a stable name for the FTP directory.
* It may be an alias (symbolic link) if the FTP directory
* moves around. If it is a symbolic link, that symbolic link should
* be updated whenever the directory moves.
*/
/* #define AFTPDIRECTORY "/usr/ftp" */
/*
* AFTPUSER contains the name of the anonymous FTP user (usually ftp)
* If defined, pstart will look up the home directory for this user
* and use it instead of AFTPDIRECTORY. If it fails, the value of
* AFTPDIRECTORY (defined above) will be used.
*
* Note that if AFTPUSER is set, the path name of the FTP directory is
* calculated only when the Prospero server is started by pstart.
* If you expect to start the server by hand (for example, when
* debugging), AFTPDIRECTORY should also be defined.
*
* Also note that when started by pstart, if AFTPUSER is defined, the
* path taken from the password file will override that specified by
* AFTPDIRECTORY. If AFTPDIRECTORY is a stable path, do not define
* AFTPUSER.
*
* #define AFTPUSER "ftp"
*/
/*
* NFS_EXPORT should be defined if your system allows others to
* access files using NFS. If defined, you will have to modify
* lib/psrv/check_nfs.c so that the directory server is aware of
* your system's policy for NFS mounts (this is necessary so that
* the directory server will not tell the client to use NFS when
* such access is not supported).
*
* #define NFS_EXPORT
*/
/*
* AFSDIRECTORY contains the name of the root of the AFS directory
* hierarchy. It should only be defined if your host supports AFS
* and you are willing to make information about AFS files available
* through your server. AFSDIRECTORY is used to to determine which files
* may be accessed using the AFS access mechanism. It also adds to
* the set of files about which directory information is available.
*
* Note: AFSDIRECTORY must be the true name for the directory
* after all symbolic links have been expanded.
*
* #define AFSDIRECTORY "/afs"
*/
/*
* PSRV_KERBEROS, if defined, means that the server will understand
* Kerberos (version 5) authentication information. This should be
* #defined if your site uses Kerberos authentication; otherwise, you
* won't have a use for it. If you #define this, then you also need
* to make the appropriate definitions in the top-level makefile.
*
* Note that most Kerberos sites still use the older version 4,
* which is not supported by Prospero.
*
* #define PSRV_KERBEROS
*/
/*
* KERBEROS_SRVTAB, if defined, tells the server the location of the
* server's keytab file that contains its Kerberos key. Define this
* only if, firstly, you are using Kerberos (i.e. PSRV_KERBEROS is
* defined), and, secondly, if you want to keep this key in a location
* different from its default location (typically /etc/v5srvtab).
*
* #define KERBEROS_SRVTAB "/usr/pfs/v5srvtab"
*/
/*
* PSRV_P_PASSWORD, if defined, means that server will understand
* the Prospero password authentication information. It will not do you
* any harm to define this, and we have left it turned on by default.
* The passwording mechanism is described more fully in the user's manual
* (or will be after it's updated).
*/
#define PSRV_P_PASSWORD
#ifdef PSRV_P_PASSWORD
/* PSRV_PW_FILE contains the name of the servers password file used
* for P_PASSWORD authentication. Define this only if you are using
* this type of authentication.
*
* #define PSRV_PW_FILE "/usr/pfs/ppasswd"
*/
#define PSRV_PW_FILE "/pfs/ppasswd"
#endif
/*
* PSRV_ACCOUNT, if defined, the server will understand accounting
* information and may charge clients for services.
*
* #define PSRV_ACCOUNT
*/
/*
* DEFAULT_ACL, SYSTEM_ACL, OVERRIDE_ACL and MAINT_ACL are access
* control lists used to control access to Prospero directories.
* DEFAULT_ACL applies to those directories for which no individual
* access control list has been specified. All access control lists
* initially include SYSTEM_ACL, but the entry may be explicitly
* removed by the administrator of a directory or link. OVERRIDE_ACL
* grants rights to a directory regardless of the contents of any
* other access control list. MAINT_ACL is an access control list
* for performing remote maintenance on the server.
*/
#if 0
#define DEFAULT_ACL {{ACL_ANY, NULL, "YvlGgrwu" }}
#else
#define DEFAULT_ACL {{ACL_ANY, NULL, "ALRMDIWYvlGgr", "*@%.%.%.%"}}
#endif
#define SYSTEM_ACL {{ACL_ASRTHOST, NULL, "ALRWD", "pfs@128.9.*.*"}}
#define OVERRIDE_ACL {{ACL_TRSTHOST, NULL, "A", "root@%.%.%.%"},\
{ACL_OWNER, NULL, "A"}}
#ifdef 0
#define MAINT_ACL {{ACL_ASRTHOST, NULL, "STUP", "pfs@128.9.*.*"},\
{ACL_ASRTHOST, NULL, "STU", "*@128.9.*.*"},\
{ACL_ANY, NULL, "Y"}}
#endif
#define MAINT_ACL {{ACL_ASRTHOST, NULL, "STUP", "root@%.%.%.%"},\
{ACL_ASRTHOST, NULL, "STUP", "root@192.77.55.2"},\
{ACL_ANY, NULL, "Y"}}
/*
* PSRV_ARCHIE, if defined, indicates that your server is to
* make available information from the archie database. You
* must already have the archie database installed on your
* machine and you must follow the additional directions in
* lib/psrv/archie2 or lib/psrv/archie3 to configure the server.
*
* #define PSRV_ARCHIE
*/
#define PSRV_ARCHIE
/* PSRV_GOPHER_GW, if defined, indicates that this server will have
* the capability to make Gopher protocol queries in response to
* Prospero protocol queries. If you install this option, you must
* uncomment the line reading
* #SUBDIR=gopher_gw.dir
* in lib/psrv/Makefile, and uncomment the line reading:
* #DB_LIBS= ../lib/psrv/gopher_gw/libpgoph_gw.a
* in server/Makefile. This option *is* presently supported.
*
* #define PSRV_GOPHER_GW
*/
/*
* Gopher servers frequently gateway queries to anonymous FTP sites. When
* they return links in this form, all retrievals then proceed through
* that server. This is inefficient.
*
* You can set GOPHER_GW_NEARBY_GOPHER_SERVER to be a
* Gopher server at your site or nearby that you want the gopher
* gateway to to gateway Gopher AFTP queries through
* instead of the GOPHER server that returned the AFTP links. Thanks to
* mitra@path.net for this optimization.
*
* If you don't define this, things will still work OK; the gopher server
* just won't rewrite such links. In other words, if you don't define this,
* the gopher gateway will exhibit the default behavior for most Gopher
* clients, as distributed.
*
* #define GOPHER_GW_NEARBY_GOPHER_SERVER "gopher.your.net(70)"
*/
/* PSRV_WAIS_GW, if defined, indicates that this server will have
* the capability to make Wais protocol queries in response to
* Prospero protocol queries. If you install this option, you must
* uncomment the line reading
* #SUBDIR=wais_gw.dir
* in lib/psrv/Makefile, and uncomment the line reading:
* #DB_LIBS= ../lib/psrv/wais_gw/libwais_gw.a
* in server/Makefile. This option *is* presently supported.
* #define PSRV_WAIS_GW
*/
/*
* PSRV_GOPHER, if defined, indicates that your server is to make
* available information from gopher files locally stored on your
* machine. You must already have gopher installed on your machine and
* you must follow the additional directions in lib/psrv/gopher to
* configure the server. This option is not presently supported.
*
* XXX This might not ever be a supported part of the distribution, if it
* turns out that the existing GOPHER_GW code meets the needs this
* was intended to fulfill. Please send feedback to
* info-prospero@isi.edu.
*
* #define PSRV_GOPHER
*/
/*
* SHARED_PREFIXES, if defined, indicates that the host on which your
* server runs shares some part of its filesystem with other specified
* hosts (perhaps via an NFS auto-mounter). If you define
* SHARED_PREFIXES appropriately, then Prospero clients on machines
* with access to the shared part of the filesystem will be able to
* retrieve files on the server that might be unreachable via another
* access method.
*
* You should specify SHARED_PREFIXES only if you want the server to
* return a LOCAL access-method for files in these areas on your
* server. If you don't understand this definition, just leave it
* undefined.
*
* The format of the SHARED_PREFIXES definition is a concatenated series of
* entries, each one describing a particular subtree of the filesystem
* that is exported. Each entry is composed of 4 subitems. The subitems
* are:
*
* a) Name (or names, if alternate names for directories are present) of
* the subtree on the server host. The last name is followed by a NULL
* b) Name of the subtree on the client host(s). There must be no more
* than one of these entries. This subitem is followed by a NULL.
* c) Internet addresses of the hosts which have this subtree as part
* of the local filesystem namespace. These can be wildcarded;
* - any octet may be replaced with a '*' (indicating match any).
* - any octet may be replaced with a '%' (indicating to match
* with the value of this octet in the server host's address)
* This subitem is followed by a NULL.
* d) exception list: a list of hosts which do NOT have this subtree
* as part of the local filesystem namespace. This lets one exclude
* special hosts or subnets that don't share in an organization's
* overall networked filesystem. This subitem is followed by a NULL.
*
*
* An example may make this clearer. Here is the entry we use on the
* server on PROSPERO.ISI.EDU:
*
* #define SHARED_PREFIXES { \
* "/nfs", NULL, "/nfs", NULL, "128.9.*.*", NULL, NULL, \
* "/ftp", NULL, "/auto/gum/gum/ftp", NULL, "128.9.*.*", NULL, NULL, \
* "/afs", NULL, "/nfs/afs", NULL, "128.9.*.*", NULL, NULL }
*/
/******************************************************************
* You should not need to change any definitions below this line. *
******************************************************************/
/*
* DSHADOW and DCONTENTS are the names of the file in the shadow
* directory used to store information about directories. There
* should be no need to change them.
*/
#define DSHADOW ".directory#shadow"
#define DCONTENTS ".directory#contents"
/*
* ARCHIE_PREFIX is an entry for archie that will appear
* in the DATABASE_PREFIXES definition. It should not be set
* directly but is instead set automatically if PSRV_ARCHIE is
* defined. If not, it will be empty. If set, it must be
* followed by a ,.
*/
#ifdef PSRV_ARCHIE
#define ARCHIE
#define ARCHIE_PREFIX {"ASCII", "ARCHIE", arch_dsdb, NULL, "ARCHIE"},
#ifdef SERVER_SUPPORT_V1
#define DATABASE_PREFIX "ARCHIE" /* Backwards compatability; v1 stuff */
#endif
#else
#define ARCHIE_PREFIX
#endif
/* GOPHER_GW_PREFIX is an entry for GOPHER that will appear in the
* DATABASE_PREFIXES definition. It should not be set
* directly but is instead set automatically if PSRV_GOPHER_GW is
* defined. If not, it will be empty. If set, it must be
* followed by a ,.
*/
#ifdef PSRV_GOPHER_GW
#define GOPHER_GW_PREFIX {"ASCII", "GOPHER-GW", gopher_gw_dsdb, NULL, "GOPHER-GW"},
#else
#define GOPHER_GW_PREFIX
#endif
/* WAIS_GW_PREFIX is an entry for WAIS that will appear in the
* DATABASE_PREFIXES definition. It should not be set
* directly but is instead set automatically if PSRV_WAIS_GW is
* defined. If not, it will be empty. If set, it must be
* followed by a ,.
*/
#ifdef PSRV_WAIS_GW
#define WAIS_GW_PREFIX {"ASCII", "WAIS-GW", wais_gw_dsdb, NULL, "WAIS-GW"},
#else
#define WAIS_GW_PREFIX
#endif
/*
* GOPHER_PREFIXES are the entries for gopher that will appear
* in the DATABASE_PREFIXES definition. It should not be set
* directly but is instead set automatically if PSRV_GOPHER is
* defined. If not, it will be empty. If set, it must be
* followed by a ,.
*
* XXX This is not yet a supported part of the distribution.
* XXX This might not ever be a supported part of the distribution, if it
* turns out that the existing GOPHER_GW code meets the needs this
* was intended to fulfill.
*
* If you run a Gopher server, define GOPHER to be a list of
* pairs of Gopher hierarchy root directories and TCP ports. This list
* must be terminated with the record {"", 0}.
*
* #define GOPHER {{"/nfs/pfs/gopherroot", 70}, {"", 0}}
*
*/
#ifdef PSRV_GOPHER
#define GOPHER_PREFIX {"ASCII", "GOPHER", gopher_dsdb, NULL, "GOPHER"},
#else
#define GOPHER_PREFIX
#endif
/*
* DATABASE_PREFIXES is an array of structures, each representing
* a particular database prefix and its acompanying prospero query
* function. It is for use when the Prospero server provides information
* from sources other than the file system. It should be set
* automatically if the appropriate database has been configured.
* you should not need to set it directly. The last element in the
* array must be a NULL pointer.
*
* DATABASE_PREFIXES supersedes the old DATABASE_PREFIX option.
*
*/
#define DATABASE_PREFIXES { ARCHIE_PREFIX GOPHER_GW_PREFIX GOPHER_PREFIX \
WAIS_GW_PREFIX }
/*
* If DIRSRV_EXPLAIN_LAST_RESTART is defined and the server detects an
* internal error and restarts itself, the message that caused the
* error will be explained in the logfile and in the message returned
* by pstatus.
*/
#define DIRSRV_EXPLAIN_LAST_RESTART
/*
* If PSRV_CACHE_NATIVE is defined, the server will cache directories which
* are entirely native (e.g., directories in the anonymous FTP area which
* contain no links with special attributes defined on them.)
* This option is unset by default because otherwise the prospero server
* running on a big anonymous FTP site would consume too much disk space.
*
* #define PSRV_CACHE_NATIVE
*/
/*
* If DNSCACHE_MAX is defined, then dirsrv will cache up to that many
* DNS addresses. "undef" this for no caching at all.
*
*/
#define DNSCACHE_MAX 300
/*
* If DIRECTORYCACHING is defined, then dirsrv will cache directories
* on disk under /usr/pfs/shadow/{GOPHER-GW,WAIS-GW,<other-database-name>}
* Note that this isn't a GREAT way of structuring the database, in case there
* really is a directory named /GOPHER-GW on the machine (confusion). This is
* a risk we currently take.
*
* #define DIRECTORYCACHING
*/
/* These following definitions override those in plog.h
*
* Place any definitions you like here that should override those in plog.h
* By changing this file instead of <plog.h>, we can keep down the number of
* files that must be changed in order to configure Prospero.
*/
#define L_WTTIME_THRESHOLD 1
#define L_SVCTIME_THRESHOLD 1
#define L_SYSTIME_THRESHOLD 9999
#define L_COMP_THRESHOLD 1
#define INITIAL_LOG_VECTOR { \
L_FIELDS_USER|L_FIELDS_HADDR|L_FIELDS_SW_ID|L_FIELDS_STIME, /* L_FIELDS */ \
LOG_PROSPERO|LOG_NOTICE|PLOG_TOFILE, /* L_STATUS */ \
LOG_PROSPERO|LOG_CRIT|PLOG_TOFILE, /* L_FAILURE */ \
PLOG_TOFILE, /* L_STATS */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_NET_ERR */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_NET_RDPERR */ \
0, /* L_NET_INFO */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE, /* L_QUEUE_INFO */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE, /* L_QUEUE_COMP */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_DIR_PERR */ \
LOG_PROSPERO|LOG_WARNING|PLOG_TOFILE, /* L_DIR_PWARN */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE, /* L_DIR_PINFO */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_DIR_ERR */ \
LOG_PROSPERO|LOG_WARNING|PLOG_TOFILE, /* L_DIR_WARN */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE, /* L_DIR_REQUEST */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE, /* L_DIR_UPDATE */ \
LOG_PROSPERO|LOG_WARNING|PLOG_TOFILE, /* L_AUTH_ERR */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_DATA_FRM_ERR */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_DB_ERROR */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE /* L_DB_INFO */ \
}

View File

@@ -0,0 +1,581 @@
/*
* pserver.h - server specific parameters for Prospero
*
* This file contains local definitions for the Prospero server.
* It is expected that it will be different on different systems.
*/
/*
* Written by bcn 1989 as part of psite.h
* Modified by bcn 1/19/93 to leave only server specific definitions
*/
/*
* Copyright (c) 1991-1994 by the University of Southern California
*
* For copying and distribution information, please see the file
* <usc-license.h>.
*/
#include <usc-license.h>
/*
* This option is temporary, until we make the forwarding mechanism more
* efficient.
* It hikes the efficiency considerably. Developers having long turnaround
* times on rd_vdir() need it. Talk to swa@ISI.EDU.
*/
#define SERVER_DO_NOT_SUPPORT_FORWARDING
/*
* SERVER_SUPPORT_V1 indicates that the server is to reply to version 1
* Prospero Protocol requests. It is recommended that you define
* this for the time being since there are many Version 1 clients still
* in use. Note that version 1 clients will *not* be able to speak
* to certain new services so it's a good idea to upgrade your clients.
*/
#define SERVER_SUPPORT_V1
#define SERVER_DONT_FLAG_V1
/*
* P_DIRSRV_BINARY defines the full path by which pstart will
* find the binary for the directory server.
*/
#define P_DIRSRV_BINARY "/usr/pfs/bin/dirsrv"
/*
* PROSPERO_CONTACT specifies the e-mail address of the individual
* or individuals responsible for running the Prospero server on the
* local system. If specified, this string will appear in responses to
* status requests. This definition is optional.
*
* #define PROSPERO_CONTACT "yourname@host.org.domain"
*/
/*
* PSRV_HOSTNAME specifies the name of the host on which the server
* will run. It only needs to be defined if gethostbyname does not
* return the name of the host as a fully qualified domain name.
*
* #define PSRV_HOSTNAME "HOST.ORG.DOMAIN"
*
*/
/*
* PSRV_USER_ID specifies the user name under which the Prospero
* server will run. The server will run under the home group of
* PSRV_USER_ID, but (in systems which support membership in multiple
* groups) not under any supplementary groups to which that user may
* belong.
*/
#define PSRV_USER_ID "pfs"
/*
* P_RUNDIR is the name of the directory under which the Prospero
* server will run. If left out, it defaults to /tmp.
*
* #define PSRV_RUNDIR "/tmp"
*/
/*
* PSRV_LOGFILE is the name of the file in which events are logged.
* By default Prospero logs all requests if PSRV_LOGFILE is defined. If you
* would like to change the list of events that are logged, or if you would
* like to use syslog for logging, edit the file plog.h.
*/
#define PSRV_LOGFILE "/usr/pfs/pfs.log"
/*
* PSRV_ROOT defines that part of the system's directory tree for which
* directory information will be readable over the network. Directory
* information will also be available for files under AFTPDIRECTORY and
* AFSDIRECTORY if these access methods are supported.
*
* If PSRV_ROOT is not defined, then directory information will only be
* available for those files under AFTPDIRECTORY or AFSDIRECTORY.
*
* #define PSRV_ROOT "/"
*/
/*
* PSRV_READ_ONLY specifies that the server is only to accept
* operations that read the directory structure. No changes to virtual
* directories stored on this system will be allowed. NODOTDOT is used to
* disallow the use of path names that include "..". If you are
* restricting the part of the directory tree which will be accessible
* (i.e. if PSRV_ROOT is other than "/"), NODOTDOT should be set.
*
* #define NODOTDOT
*/
#define PSRV_READ_ONLY
#define NODOTDOT
/*
* PSRV_SHADOW is the name of the shadow hierarchy that contains additional
* information about Prospero files. PSRV_STORAGE is the name of the directory
* under which new files can be created, if that option is supported by
* your distribution. PSRV_SECURITY is the name of the directory where
* security information is stored by the prospero server. All three names are
* relative to the home directory for the
* user ID specified by P_USER_ID.
*
* You will normally have no desire to change this, but it IS posible and legal
* to do so. If you do change it, then please make a corresponding change in
* section III of Makefile.config.
*/
#define PSRV_SHADOW "shadow"
#define PSRV_STORAGE "pfsdat"
#define PSRV_SECURITY "security"
/*
* If PSRV_UNDER_UDIR is defined, pstart calculates the full path names of
* of the directories corresponding to PSRV_SHADOW and PSRV_STORAGE and
* PSRV_SECURITY by
* finding the home directory for the Prospero user ID, then appending
* PSRV_SHADOW or PSRV_STORAGE or PSRV_SECURITY.
*
* If PSRV_UNDER_UDIR is not defined, or if dirsrv is called directly,
* the full path names are taken from PSRV_FSHADOW and PSRV_FSTORAGE and
* PSRV_FSECURITY. These
* should be stable names for those directories. They may be aliases
* (symbolic links) if the directories move around. If they are symbolic
* links, the links should be updated whenever the directories move.
*
* Note that if PSRV_UNDER_UDIR is set, the full path names are calculated
* only when the Prospero server is started by pstart. If you expect
* to start the server by hand (for example, when debugging), PSRV_FSHADOW
* and PSRV_FSTORAGE should also be defined.
*
* In any case these must match the definitions at the top of Makefile
*/
#define PSRV_FSHADOW "/usr/pfs/shadow"
#define PSRV_FSTORAGE "/usr/pfs/pfsdat"
#define PSRV_FSECURITY "/usr/pfs/security"
/*
* AFTPDIRECTORY contains the name of the root directory as seen through
* anonymous FTP. It is used to determine which files may be accessed
* using the anonymous FTP access mechanism, and to determine the file name
* that must be used when doing so. It also adds to the set of files about
* which directory information is available.
*
* Note: AFTPDIRECTORY should be a stable name for the FTP directory.
* It may be an alias (symbolic link) if the FTP directory
* moves around. If it is a symbolic link, that symbolic link should
* be updated whenever the directory moves.
*/
/* #define AFTPDIRECTORY "/usr/ftp" */
/*
* AFTPUSER contains the name of the anonymous FTP user (usually ftp)
* If defined, pstart will look up the home directory for this user
* and use it instead of AFTPDIRECTORY. If it fails, the value of
* AFTPDIRECTORY (defined above) will be used.
*
* Note that if AFTPUSER is set, the path name of the FTP directory is
* calculated only when the Prospero server is started by pstart.
* If you expect to start the server by hand (for example, when
* debugging), AFTPDIRECTORY should also be defined.
*
* Also note that when started by pstart, if AFTPUSER is defined, the
* path taken from the password file will override that specified by
* AFTPDIRECTORY. If AFTPDIRECTORY is a stable path, do not define
* AFTPUSER.
*
* #define AFTPUSER "ftp"
*/
/*
* NFS_EXPORT should be defined if your system allows others to
* access files using NFS. If defined, you will have to modify
* lib/psrv/check_nfs.c so that the directory server is aware of
* your system's policy for NFS mounts (this is necessary so that
* the directory server will not tell the client to use NFS when
* such access is not supported).
*
* #define NFS_EXPORT
*/
/*
* AFSDIRECTORY contains the name of the root of the AFS directory
* hierarchy. It should only be defined if your host supports AFS
* and you are willing to make information about AFS files available
* through your server. AFSDIRECTORY is used to to determine which files
* may be accessed using the AFS access mechanism. It also adds to
* the set of files about which directory information is available.
*
* Note: AFSDIRECTORY must be the true name for the directory
* after all symbolic links have been expanded.
*
* #define AFSDIRECTORY "/afs"
*/
/*
* PSRV_KERBEROS, if defined, means that the server will understand
* Kerberos (version 5) authentication information. This should be
* #defined if your site uses Kerberos authentication; otherwise, you
* won't have a use for it. If you #define this, then you also need
* to make the appropriate definitions in the top-level makefile.
*
* Note that most Kerberos sites still use the older version 4,
* which is not supported by Prospero.
*
* #define PSRV_KERBEROS
*/
/*
* KERBEROS_SRVTAB, if defined, tells the server the location of the
* server's keytab file that contains its Kerberos key. Define this
* only if, firstly, you are using Kerberos (i.e. PSRV_KERBEROS is
* defined), and, secondly, if you want to keep this key in a location
* different from its default location (typically /etc/v5srvtab).
*
* #define KERBEROS_SRVTAB "/usr/pfs/v5srvtab"
*/
/*
* PSRV_P_PASSWORD, if defined, means that server will understand
* the Prospero password authentication information. It will not do you
* any harm to define this, and we have left it turned on by default.
* The passwording mechanism is described more fully in the user's manual
* (or will be after it's updated).
*
*
*/
#define PSRV_P_PASSWORD
#ifdef PSRV_P_PASSWORD
/* PSRV_PW_FILE contains the name of the servers password file used
* for P_PASSWORD authentication. Define this only if you are using
* this type of authentication.
*
* #define PSRV_PW_FILE "/usr/pfs/ppasswd"
*/
#endif
/*
* PSRV_ACCOUNT, if defined, the server will understand accounting
* information and may charge clients for services.
*
* #define PSRV_ACCOUNT
*/
/*
* DEFAULT_ACL, SYSTEM_ACL, OVERRIDE_ACL and MAINT_ACL are access
* control lists used to control access to Prospero directories.
* DEFAULT_ACL applies to those directories for which no individual
* access control list has been specified. All access control lists
* initially include SYSTEM_ACL, but the entry may be explicitly
* removed by the administrator of a directory or link. OVERRIDE_ACL
* grants rights to a directory regardless of the contents of any
* other access control list. MAINT_ACL is an access control list
* for performing remote maintenance on the server.
*/
#define DEFAULT_ACL {{ACL_ANY, NULL, "YvlGgr" }}
#define SYSTEM_ACL {{ACL_ASRTHOST, NULL, "ALRWD", "pfs@%.%.%.%"}, \
{ACL_ASRTHOST, NULL, "ALRWD", "pfs@128.9.*.*"}}
#define OVERRIDE_ACL {{ACL_TRSTHOST, NULL, "A", "root@%.%.%.%"},\
{ACL_OWNER, NULL, "A"}}
#define MAINT_ACL {{ACL_ASRTHOST, NULL, "STUP", "root@%.%.%.%"},\
{ACL_ANY, NULL, "Y"}}
/*
* PSRV_ARCHIE, if defined, indicates that your server is to
* make available information from the archie database. You
* must already have the archie database installed on your
* machine and you must follow the additional directions in
* lib/psrv/archie2 or lib/psrv/archie3 to configure the server.
*
* #define PSRV_ARCHIE
*/
/* PSRV_GOPHER_GW, if defined, indicates that this server will have
* the capability to make Gopher protocol queries in response to
* Prospero protocol queries. If you install this option, you must
* uncomment the line reading
* #SUBDIR=gopher_gw.dir
* in lib/psrv/Makefile, and uncomment the line reading:
* #DB_LIBS= ../lib/psrv/gopher_gw/libpgoph_gw.a
* in server/Makefile. This option *is* presently supported.
*
* #define PSRV_GOPHER_GW
*/
/*
* Gopher servers frequently gateway queries to anonymous FTP sites. When
* they return links in this form, all retrievals then proceed through
* that server. This is inefficient.
*
* You can set GOPHER_GW_NEARBY_GOPHER_SERVER to be a
* Gopher server at your site or nearby that you want the gopher
* gateway to to gateway Gopher AFTP queries through
* instead of the GOPHER server that returned the AFTP links. Thanks to
* mitra@path.net for this optimization.
*
* If you don't define this, things will still work OK; the gopher server
* just won't rewrite such links. In other words, if you don't define this,
* the gopher gateway will exhibit the default behavior for most Gopher
* clients, as distributed.
*
* #define GOPHER_GW_NEARBY_GOPHER_SERVER "gopher.your.net(70)"
*/
/* PSRV_WAIS_GW, if defined, indicates that this server will have
* the capability to make Wais protocol queries in response to
* Prospero protocol queries. If you install this option, you must
* uncomment the line reading
* #SUBDIR=wais_gw.dir
* in lib/psrv/Makefile, and uncomment the line reading:
* #DB_LIBS= ../lib/psrv/wais_gw/libwais_gw.a
* in server/Makefile. This option *is* presently supported.
* #define PSRV_WAIS_GW
*/
/*
* PSRV_GOPHER, if defined, indicates that your server is to make
* available information from gopher files locally stored on your
* machine. You must already have gopher installed on your machine and
* you must follow the additional directions in lib/psrv/gopher to
* configure the server. This option is not presently supported.
*
* XXX This might not ever be a supported part of the distribution, if it
* turns out that the existing GOPHER_GW code meets the needs this
* was intended to fulfill. Please send feedback to
* info-prospero@isi.edu.
*
* #define PSRV_GOPHER
*/
/*
* SHARED_PREFIXES, if defined, indicates that the host on which your
* server runs shares some part of its filesystem with other specified
* hosts (perhaps via an NFS auto-mounter). If you define
* SHARED_PREFIXES appropriately, then Prospero clients on machines
* with access to the shared part of the filesystem will be able to
* retrieve files on the server that might be unreachable via another
* access method.
*
* You should specify SHARED_PREFIXES only if you want the server to
* return a LOCAL access-method for files in these areas on your
* server. If you don't understand this definition, just leave it
* undefined.
*
* The format of the SHARED_PREFIXES definition is a concatenated series of
* entries, each one describing a particular subtree of the filesystem
* that is exported. Each entry is composed of 4 subitems. The subitems
* are:
*
* a) Name (or names, if alternate names for directories are present) of
* the subtree on the server host. The last name is followed by a NULL
* b) Name of the subtree on the client host(s). There must be no more
* than one of these entries. This subitem is followed by a NULL.
* c) Internet addresses of the hosts which have this subtree as part
* of the local filesystem namespace. These can be wildcarded;
* - any octet may be replaced with a '*' (indicating match any).
* - any octet may be replaced with a '%' (indicating to match
* with the value of this octet in the server host's address)
* This subitem is followed by a NULL.
* d) exception list: a list of hosts which do NOT have this subtree
* as part of the local filesystem namespace. This lets one exclude
* special hosts or subnets that don't share in an organization's
* overall networked filesystem. This subitem is followed by a NULL.
*
*
* An example may make this clearer. Here is the entry we use on the
* server on PROSPERO.ISI.EDU:
*
* #define SHARED_PREFIXES { \
* "/nfs", NULL, "/nfs", NULL, "128.9.*.*", NULL, NULL, \
* "/ftp", NULL, "/auto/gum/gum/ftp", NULL, "128.9.*.*", NULL, NULL, \
* "/afs", NULL, "/nfs/afs", NULL, "128.9.*.*", NULL, NULL }
*/
#define SHARED_PREFIXES { \
"/nfs", NULL, "/nfs", NULL, "128.9.*.*", NULL, NULL }
/******************************************************************
* You should not need to change any definitions below this line. *
******************************************************************/
/*
* DSHADOW and DCONTENTS are the names of the file in the shadow
* directory used to store information about directories. There
* should be no need to change them.
*/
#define DSHADOW ".directory#shadow"
#define DCONTENTS ".directory#contents"
/*
* ARCHIE_PREFIX is an entry for archie that will appear
* in the DATABASE_PREFIXES definition. It should not be set
* directly but is instead set automatically if PSRV_ARCHIE is
* defined. If not, it will be empty. If set, it must be
* followed by a ,.
*/
#ifdef PSRV_ARCHIE
#define ARCHIE
#define ARCHIE_PREFIX {"ASCII", "ARCHIE", arch_dsdb, NULL, "ARCHIE"},
#ifdef SERVER_SUPPORT_V1
#define DATABASE_PREFIX "ARCHIE" /* Backwards compatability; v1 stuff */
#endif
#else
#define ARCHIE_PREFIX
#endif
/* GOPHER_GW_PREFIX is an entry for GOPHER that will appear in the
* DATABASE_PREFIXES definition. It should not be set
* directly but is instead set automatically if PSRV_GOPHER_GW is
* defined. If not, it will be empty. If set, it must be
* followed by a ,.
*/
#ifdef PSRV_GOPHER_GW
#define GOPHER_GW_PREFIX {"ASCII", "GOPHER-GW", gopher_gw_dsdb, NULL, "GOPHER-GW"},
#else
#define GOPHER_GW_PREFIX
#endif
/* WAIS_GW_PREFIX is an entry for WAIS that will appear in the
* DATABASE_PREFIXES definition. It should not be set
* directly but is instead set automatically if PSRV_WAIS_GW is
* defined. If not, it will be empty. If set, it must be
* followed by a ,.
*/
#ifdef PSRV_WAIS_GW
#define WAIS_GW_PREFIX {"ASCII", "WAIS-GW", wais_gw_dsdb, NULL, "WAIS-GW"},
#else
#define WAIS_GW_PREFIX
#endif
/*
* GOPHER_PREFIXES are the entries for gopher that will appear
* in the DATABASE_PREFIXES definition. It should not be set
* directly but is instead set automatically if PSRV_GOPHER is
* defined. If not, it will be empty. If set, it must be
* followed by a ,.
*
* XXX This is not yet a supported part of the distribution.
* XXX This might not ever be a supported part of the distribution, if it
* turns out that the existing GOPHER_GW code meets the needs this
* was intended to fulfill.
*
* If you run a Gopher server, define GOPHER to be a list of
* pairs of Gopher hierarchy root directories and TCP ports. This list
* must be terminated with the record {"", 0}.
*
* #define GOPHER {{"/nfs/pfs/gopherroot", 70}, {"", 0}}
*
*/
#ifdef PSRV_GOPHER
#define GOPHER_PREFIX {"ASCII", "GOPHER", gopher_dsdb, NULL, "GOPHER"},
#else
#define GOPHER_PREFIX
#endif
/*
* DATABASE_PREFIXES is an array of structures, each representing
* a particular database prefix and its acompanying prospero query
* function. It is for use when the Prospero server provides information
* from sources other than the file system. It should be set
* automatically if the appropriate database has been configured.
* you should not need to set it directly. The last element in the
* array must be a NULL pointer.
*
* DATABASE_PREFIXES supersedes the old DATABASE_PREFIX option.
*
*/
#define DATABASE_PREFIXES { ARCHIE_PREFIX GOPHER_GW_PREFIX GOPHER_PREFIX \
WAIS_GW_PREFIX }
/*
* If DIRSRV_EXPLAIN_LAST_RESTART is defined and the server detects an
* internal error and restarts itself, the message that caused the
* error will be explained in the logfile and in the message returned
* by pstatus.
*/
#define DIRSRV_EXPLAIN_LAST_RESTART
/*
* If PSRV_CACHE_NATIVE is defined, the server will cache directories which
* are entirely native (e.g., directories in the anonymous FTP area which
* contain no links with special attributes defined on them.)
* This option is unset by default because otherwise the prospero server
* running on a big anonymous FTP site would consume too much disk space.
*
* #define PSRV_CACHE_NATIVE
*/
/*
* If DNSCACHE_MAX is defined, then dirsrv will cache up to that many
* DNS addresses. "undef" this for no caching at all.
*
*/
#define DNSCACHE_MAX 300
/*
* If DIRECTORYCACHING is defined, then dirsrv will cache directories
* on disk under /usr/pfs/shadow/{GOPHER-GW,WAIS-GW,<other-database-name>}
* Note that this isn't a GREAT way of structuring the database, in case there
* really is a directory named /GOPHER-GW on the machine (confusion). This is
* a risk we currently take.
*
* #define DIRECTORYCACHING
*/
/* These following definitions override those in plog.h
*
* Place any definitions you like here that should override those in plog.h
* By changing this file instead of <plog.h>, we can keep down the number of
* files that must be changed in order to configure Prospero.
*/
#define L_WTTIME_THRESHOLD 1
#define L_SVCTIME_THRESHOLD 1
#define L_SYSTIME_THRESHOLD 9999
#define L_COMP_THRESHOLD 1
#define INITIAL_LOG_VECTOR { \
L_FIELDS_USER|L_FIELDS_HADDR|L_FIELDS_SW_ID|L_FIELDS_STIME, /* L_FIELDS */ \
LOG_PROSPERO|LOG_NOTICE|PLOG_TOFILE, /* L_STATUS */ \
LOG_PROSPERO|LOG_CRIT|PLOG_TOFILE, /* L_FAILURE */ \
PLOG_TOFILE, /* L_STATS */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_NET_ERR */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_NET_RDPERR */ \
0, /* L_NET_INFO */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE, /* L_QUEUE_INFO */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE, /* L_QUEUE_COMP */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_DIR_PERR */ \
LOG_PROSPERO|LOG_WARNING|PLOG_TOFILE, /* L_DIR_PWARN */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE, /* L_DIR_PINFO */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_DIR_ERR */ \
LOG_PROSPERO|LOG_WARNING|PLOG_TOFILE, /* L_DIR_WARN */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE, /* L_DIR_REQUEST */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE, /* L_DIR_UPDATE */ \
LOG_PROSPERO|LOG_WARNING|PLOG_TOFILE, /* L_AUTH_ERR */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_DATA_FRM_ERR */ \
LOG_PROSPERO|LOG_ERR|PLOG_TOFILE, /* L_DB_ERROR */ \
LOG_PROSPERO|LOG_INFO|PLOG_TOFILE /* L_DB_INFO */ \
}

332
prospero/include/psite.h Normal file
View File

@@ -0,0 +1,332 @@
/*
* Copyright (c) 1992, 1993, 1994 by the University of Southern California
*
* For copying and distribution information, please see the file
* <usc-license.h>
*
* Written by bcn 1989 modified 1989-1992
* Modified by bcn 1/19/93 to eliminate server specific definitions
* Modified by swa 5/2/94 to add section 3 and reorder things to be less
* intimidating to neophytes.
*/
#include <usc-license.h>
/*
* psite.h - site selected parameters for Prospero
*
* This file contains local definitions for the Prospero utilities.
* It is expected that it will be different on different systems.
*/
/*
* Section 1: Installation specifc definitions for the Prospero Applications
*
* The definitions in the following section provide information about
* the proper configuration of Prospero clients on your system.
* They may change from system to system.
*/
/*
* If P_BINARIES is defined and not empty, it defines the directory
* in which the Prospero clients will look for executables. If set in
* the users environment, P_BINARIES will override the definition
* here. If neither are defined, or if the definition is the empty
* string, then the clients will use the user's search path to find
* the binaries.
*
* The only executable program that the prospero clients and compatability
* library call currently is VCACHE.
*/
#define P_BINARIES "/pfs/bin"
/*
* If P_PATH, if defined, is a directory that will be added to the
* user's search path by the Prospero initialization script
* (vfsetup.source for CSH users, vfsetup.profil for SH users).
* It only needs to be defined if the Prospero binaries will not already be
* in the user's search path. Multiple directories separated by spaces may
* be specified.
*/
#define P_PATH P_BINARIES
/*
* P_AFS is the name of the directory under which AFS files are found.
* If should be set only if your system supports the Andrew File System.
*
* #define P_AFS "/afs"
*/
#define P_AFS "/nfs/afs"
/*
* P_KERBEROS, if defined, means that the clients will transmit Kerberos
* (version 5) authentication information and that the server will understand
* such information. This should be #defined if your site uses Kerberos
* authentication; otherwise, you won't have a use for it. If you #define
* this, then you also need to configure the top-level Makefile with the
* location of the Kerberos libraries and include directory.
*
* Note that most Kerberos sites out there are still using the older version 4,
* which is not compatible with the new version 5.
*
* #define P_KERBEROS
*/
/*
* P_P_PASSWORD, if defined, means that the clients will transmit password
* authentication information.
*
* #define P_P_PASSWORD
*/
#define P_P_PASSWORD
/*
* P_ACCOUNT, if defined, means that the clients will transmit
* accounting information.
*
* #define P_ACCOUNT
*/
/*
* Section 2: Site Definitions for the Prospero Applications
*
* The definitions in the following section define the Prospero site.
* They will not necessarily change from system to system. These definitions
* should only be changed if you are setting up your own prospero site.
* Setting up a site is different than installing the software on a new
* system. Unless your site supports storage of new virtual systems,
* do not change these definitions.
*/
/* Section 2a: Site definitions we expect you might need to change
* for your site.
*/
/*
* P_SITE_HOST and DIRECTORY define the system level name of the
* virtual directory under which site data and meta-data are stored.
* It will vary from site to site.
*/
#define P_SITE_HOST "PROSPERO.ISI.EDU"
#define P_SITE_DIRECTORY "/pfs/pfsdat"
/*
* P_SITE_MASTER_VSLIST is the name of the virtual directory (relative
* to P_SITE) under which reference to local virtual systems can be
* found. When setting up a new site, choose a one component name
* that seems appropriate.
*/
#define P_SITE_MASTER_VSLIST "vs_root_isi"
/*
* Section 2b: Site Definitions we expect you to not change except in unusual
* circumstances.
*/
/*
* P_GLOBAL_VS_ROOT* is a reference to the global root for the
* underlying ugly-names of virtual systems. These definitions should not
* be changed unless your site is not connected to the Internet.
*/
#define P_GLOBAL_VS_ROOT_HOST "PROSPERO.ISI.EDU"
#define P_GLOBAL_VS_ROOT_FILE "/pfs/pfsdat/vs_root_g"
/*
* Section 2c: Site definitions you should never have a need to change
* (they can be reconfigured because we did not want
* Prospero to have any particular directory names hardcoded
* into it, and it will not hurt Prospero in any way if you
* change them, but we think it is unlikely you would want to..)
*/
/*
* P_MASTER_VS is the name (relative to MASTER_VSLIST) of the virtual
* system to be used when creating new virtual systems with newvs.
* There should be no need to change these definitions.
*/
#define P_MASTER_VS "master"
#define P_PROTOTYPE_VS "prototype"
/*
* P_SITE_STORAGE is the name (relative to master) of a directory
* with references to the storage areas of the individual systems that
* compose a site. There should be no need to change this
* definitions.
*/
#define P_SITE_STORAGE "pfs_storage"
/*
* P_VS_STORAGE is the name (relative to the directories named in
* P_SITE_STORAGE) of the directory under which new virtual systems
* may be stored. There should be no need to change this definition.
*/
#define P_VS_STORAGE "local_vsystems"
/*
* Section 3: Special-purpose configuration options for the Prospero
* Applications
*
*
* The configuration options in this section are used only to meet special
* needs. They have been added to meet the special needs of particular
* Prospero commercial and research users. They have general utility, but they
* are more in the nature of optimizations and tuning. Prospero will function
* just fine if you leave them alone, although not as efficiently in some
* applications.
*
* Unless you are an experienced Prospero user, you do not want to
* alter any of these definitions.
*/
/*
* If NFS is supported P_NFS can defined. If set, the clients will attempt
* to use NFS to retrieve files from remote systems.
*
* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*
*
* If you will be using this option, you need to modify the
* function pmap_nfs() in the file lib/psrv/pmap_nfs.c to do proper NFS
* retrievals from the server. You also will need to modify the function
* check_nfs() in the file lib/psrv/check_nfs.c to make sure that your
* server publishes NFS data only for exportable filesystems, and that it
* publishes the data with the correct NFS filesystem names. The version of
* lib/psrv/check_nfs.c we provide is only a stub, and does not perform
* this function appropriately for most environments.
*
* This option is growing obsolescent with the existence of automounters.
* It's still useful for using sites such as WU-ARCHIVE, which allow one to
* anonymously mount NFS partitions, and you are welcome to experiment with it
* for those purposes.
*
* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*
*
* Until you customize lib/psrv/check_nfs.c and lib/psrv/pmap_nfs.c, do NOT
* #define P_NFS. If your clients run an NFS automounter,
* you can accomplish the same result by defining SHARED_PREFIXES in the
* pserver.h file.
*
*
* #define P_NFS
*/
/*
* P_CACHE_* define locations for files associated with the caching on
* the client.
*
* P_CACHE_TMP is for temporary files during transfer,
* P_CACHE_VC is for the cache itself
* P_CACHE_P is for personal copies of files to ensure they don't change
*
* Allthough these can be symbolic links, they MUST all be in the same
* filesystem since hard-links are used to move them around
*
* They must also match the definitions at the top of Makefile
*
* Note that each of these directories needs to be writable by whatever ids
* are running Prospero clients. Directories under P_CACHE_P can be restricted
* to specific users, and if "vcache" was to run setuid "pfs" then
* P_CACHE_VC could be restricted to that user, although code would
* then be needed in vcache to chown files to the particular user -- and
* that won't be possible on some (e.g. Sun) unixes.
* (swa: I don't understand why mitra made the comment above. This can be
* accomplished by setting the sticky bit on directories.)
*
* This caching code was provided by mitra@path.net and is still experimental.
* It is not a supported part of this release.
*
* It lacks a number of facilities that willl have to be present before this
* becomes a supported part of the release. Send email to
* info-prospero@ISI.EDU if you want to know what changes need to be made.
*
* The strategy for expiring items from the cache is in lib/pfs/pmap_cache.c.
*
* #define P_CACHE_ENABLED
*/
/* These definitions will have no effect unless P_CACHE_ENABLED is defined. */
#define P_CACHE_P "/nfs/u5/divirs/vcache/p"
#define P_CACHE_VC "/nfs/u5/divirs/vcache/vc"
#define P_CACHE_TMP "/nfs/u5/divirs/vcache/tmp"
/*
* This option is not currently supported in the release, because it needs
* cleanup; notes available from SWA on what steps need to be taken to clean
* it up to be of production quality.
*
* It lacks a number of facilities that will have to be present before this
* becomes a supported part of the release. Send email to
* info-prospero@ISI.EDU if you want to know what changes need to be made.
*
* You can have the ACCESS-METHOD interpreting code that does retrievals
* linked directly with your client executables. This significantly bloats
* executable size, but gains you more speed on the retrievals (as long as you
* manage to avoid thrashing.) This optimization is useful in circumstances
* where the cost of slower response is greater than the cost of buying some
* more RAM for your machine.
*
* N.B.: if your machine is paging or swapping
* under these usage conditions, this optimization will cost
* you time rather than saving it, unless you are able to configure
* libpvcache on your system to be a shared library where only one copy of the
* library exists in RAM for all of the clients.
*
* This is a traditional space/time tradeoff.
* To set the tradeoff in favor of reducing time and increasing space,
* define INCREASE_CLIENT_EXECUTABLE_SIZE_DO_NOT_EXEC_VCACHE. By default,
* a separate executable named 'vcache' is run to perform some types of
* retrievals.
*
* If you define this, then also edit VCACHE_LIBS in the top-level Prospero
* Makefile. You will need to link VCACHE_LIBS with all the client programs
* that want to use the VCACHE library.
*
* #define INCREASE_CLIENT_EXECUTABLE_SIZE_DO_NOT_EXEC_VCACHE
*/
/* Location of wais sources, note trailing slash. MITRAism.
*
* Note that it is not clear to me (swa) why this is useful to have for the
* clients. Isn't this a server-specific thing? It's on my TODO list.
*/
#define WAIS_SOURCE_DIR "/usr/local/wais/wais-sources/"
/*
* Filters are not supported in the default distribution because they
* currently only work on the VAX. We are working on resolving these
* problems.
*/
#define P_NO_FILTERS
/* If you want to use the UNIX compatability library (documented in the
* Prospero Library Reference Manual), remove the definition of
* P_NO_PCOMPAT and follow the additional directions in the INSTALLATION file.
* This option is currently slightly broken, because Prospero has undergone
* a number of changes. it can easily be reported.
*
*/
#ifdef AIX /* lucb */
#define P_NO_PCOMPAT /**/
#else
/* #define P_NO_PCOMPAT */
#endif
/*
* This option exists for sites that have special applications. If this option
* is defined, the pcompat library's open() routines will prompt for an FTP
* username and password to retrieve files, if necessary. This may increase
* the amount of information available through applications linked with the
* compatability library, but at the cost of changing the user interface
* to applications such as 'cat' which never normally prompt for a password.
* Only #define this if you have a special application.
*
* #define PCOMPAT_SUPPORT_FTP
*/

View File

@@ -0,0 +1,328 @@
/*
* Copyright (c) 1992, 1993, 1994 by the University of Southern California
*
* For copying and distribution information, please see the file
* <usc-license.h>
*
* Written by bcn 1989 modified 1989-1992
* Modified by bcn 1/19/93 to eliminate server specific definitions
* Modified by swa 5/2/94 to add section 3 and reorder things to be less
* intimidating to neophytes.
*/
#include <usc-license.h>
/*
* psite.h - site selected parameters for Prospero
*
* This file contains local definitions for the Prospero utilities.
* It is expected that it will be different on different systems.
*/
/*
* Section 1: Installation specifc definitions for the Prospero Applications
*
* The definitions in the following section provide information about
* the proper configuration of Prospero clients on your system.
* They may change from system to system.
*/
/*
* If P_BINARIES is defined and not empty, it defines the directory
* in which the Prospero clients will look for executables. If set in
* the users environment, P_BINARIES will override the definition
* here. If neither are defined, or if the definition is the empty
* string, then the clients will use the user's search path to find
* the binaries.
*
* The only executable program that the prospero clients and compatability
* library call currently is VCACHE.
*/
#define P_BINARIES "/usr/pfs/bin"
/*
* If P_PATH, if defined, is a directory that will be added to the
* user's search path by the Prospero initialization script
* (vfsetup.source for CSH users, vfsetup.profil for SH users).
* It only needs to be defined if the Prospero binaries will not already be
* in the user's search path. Multiple directories separated by spaces may
* be specified.
*/
#define P_PATH P_BINARIES
/*
* P_AFS is the name of the directory under which AFS files are found.
* If should be set only if your system supports the Andrew File System.
*
* #define P_AFS "/afs"
*/
/*
* P_KERBEROS, if defined, means that the clients will transmit Kerberos
* (version 5) authentication information and that the server will understand
* such information. This should be #defined if your site uses Kerberos
* authentication; otherwise, you won't have a use for it. If you #define
* this, then you also need to configure the top-level Makefile with the
* location of the Kerberos libraries and include directory.
*
* Note that most Kerberos sites out there are still using the older version 4,
* which is not compatible with the new version 5.
*
* #define P_KERBEROS
*/
/*
* P_P_PASSWORD, if defined, means that the clients will transmit password
* authentication information.
*
* #define P_P_PASSWORD
*/
/*
* P_ACCOUNT, if defined, means that the clients will transmit
* accounting information.
*
* #define P_ACCOUNT
*/
/*
* Section 2: Site Definitions for the Prospero Applications
*
* The definitions in the following section define the Prospero site.
* They will not necessarily change from system to system. These definitions
* should only be changed if you are setting up your own prospero site.
* Setting up a site is different than installing the software on a new
* system. Unless your site supports storage of new virtual systems,
* do not change these definitions.
*/
/* Section 2a: Site definitions we expect you might need to change
* for your site.
*/
/*
* P_SITE_HOST and DIRECTORY define the system level name of the
* virtual directory under which site data and meta-data are stored.
* It will vary from site to site.
*/
#define P_SITE_HOST "PROSPERO.ISI.EDU"
#define P_SITE_DIRECTORY "/pfs/pfsdat/guest"
/*
* P_SITE_MASTER_VSLIST is the name of the virtual directory (relative
* to P_SITE) under which reference to local virtual systems can be
* found. When setting up a new site, choose a one component name
* that seems appropriate.
*/
#define P_SITE_MASTER_VSLIST "vs_root_isi-guest"
/*
* Section 2b: Site Definitions we expect you to not change except in unusual
* circumstances.
*/
/*
* P_GLOBAL_VS_ROOT* is a reference to the global root for the
* underlying ugly-names of virtual systems. These definitions should not
* be changed unless your site is not connected to the Internet.
*/
#define P_GLOBAL_VS_ROOT_HOST "PROSPERO.ISI.EDU"
#define P_GLOBAL_VS_ROOT_FILE "/pfs/pfsdat/vs_root_g"
/*
* Section 2c: Site definitions you should never have a need to change
* (they can be reconfigured because we did not want
* Prospero to have any particular directory names hardcoded
* into it, and it will not hurt Prospero in any way if you
* change them, but we think it is unlikely you would want to..)
*/
/*
* P_MASTER_VS is the name (relative to MASTER_VSLIST) of the virtual
* system to be used when creating new virtual systems with newvs.
* There should be no need to change these definitions.
*/
#define P_MASTER_VS "master"
#define P_PROTOTYPE_VS "prototype"
/*
* P_SITE_STORAGE is the name (relative to master) of a directory
* with references to the storage areas of the individual systems that
* compose a site. There should be no need to change this
* definitions.
*/
#define P_SITE_STORAGE "pfs_storage"
/*
* P_VS_STORAGE is the name (relative to the directories named in
* P_SITE_STORAGE) of the directory under which new virtual systems
* may be stored. There should be no need to change this definition.
*/
#define P_VS_STORAGE "local_vsystems"
/*
* Section 3: Special-purpose configuration options for the Prospero
* Applications
*
*
* The configuration options in this section are used only to meet special
* needs. They have been added to meet the special needs of particular
* Prospero commercial and research users. They have general utility, but they
* are more in the nature of optimizations and tuning. Prospero will function
* just fine if you leave them alone, although not as efficiently in some
* applications.
*
* Unless you are an experienced Prospero user, you do not want to
* alter any of these definitions.
*/
/*
* If NFS is supported P_NFS can defined. If set, the clients will attempt
* to use NFS to retrieve files from remote systems.
*
* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*
*
* If you will be using this option, you need to modify the
* function pmap_nfs() in the file lib/psrv/pmap_nfs.c to do proper NFS
* retrievals from the server. You also will need to modify the function
* check_nfs() in the file lib/psrv/check_nfs.c to make sure that your
* server publishes NFS data only for exportable filesystems, and that it
* publishes the data with the correct NFS filesystem names. The version of
* lib/psrv/check_nfs.c we provide is only a stub, and does not perform
* this function appropriately for most environments.
*
* This option is growing obsolescent with the existence of automounters.
* It's still useful for using sites such as WU-ARCHIVE, which allow one to
* anonymously mount NFS partitions, and you are welcome to experiment with it
* for those purposes.
*
* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*
*
* Until you customize lib/psrv/check_nfs.c and lib/psrv/pmap_nfs.c, do NOT
* #define P_NFS. If your clients run an NFS automounter,
* you can accomplish the same result by defining SHARED_PREFIXES in the
* pserver.h file.
*
*
* #define P_NFS
*/
/*
* P_CACHE_* define locations for files associated with the caching on
* the client.
*
* P_CACHE_TMP is for temporary files during transfer,
* P_CACHE_VC is for the cache itself
* P_CACHE_P is for personal copies of files to ensure they don't change
*
* Allthough these can be symbolic links, they MUST all be in the same
* filesystem since hard-links are used to move them around
*
* They must also match the definitions at the top of Makefile
*
* Note that each of these directories needs to be writable by whatever ids
* are running Prospero clients. Directories under P_CACHE_P can be restricted
* to specific users, and if "vcache" was to run setuid "pfs" then
* P_CACHE_VC could be restricted to that user, although code would
* then be needed in vcache to chown files to the particular user -- and
* that won't be possible on some (e.g. Sun) unixes.
* (swa: I don't understand why mitra made the comment above. This can be
* accomplished by setting the sticky bit on directories.)
*
* This caching code was provided by mitra@path.net and is still experimental.
* It is not a supported part of this release.
*
* It lacks a number of facilities that willl have to be present before this
* becomes a supported part of the release. Send email to
* info-prospero@ISI.EDU if you want to know what changes need to be made.
*
* The strategy for expiring items from the cache is in lib/pfs/pmap_cache.c.
*
* #define P_CACHE_ENABLED
*/
/* These definitions will have no effect unless P_CACHE_ENABLED is defined. */
#ifdef P_CACHE_ENABLED
#define P_CACHE_P "/nfs/u5/divirs/vcache/p"
#define P_CACHE_VC "/nfs/u5/divirs/vcache/vc"
#define P_CACHE_TMP "/nfs/u5/divirs/vcache/tmp"
#endif
/*
* This option is not currently supported in the release, because it needs
* cleanup; notes available from SWA on what steps need to be taken to clean
* it up to be of production quality.
*
* It lacks a number of facilities that will have to be present before this
* becomes a supported part of the release. Send email to
* info-prospero@ISI.EDU if you want to know what changes need to be made.
*
* You can have the ACCESS-METHOD interpreting code that does retrievals
* linked directly with your client executables. This significantly bloats
* executable size, but gains you more speed on the retrievals (as long as you
* manage to avoid thrashing.) This optimization is useful in circumstances
* where the cost of slower response is greater than the cost of buying some
* more RAM for your machine.
*
* N.B.: if your machine is paging or swapping
* under these usage conditions, this optimization will cost
* you time rather than saving it, unless you are able to configure
* libpvcache on your system to be a shared library where only one copy of the
* library exists in RAM for all of the clients.
*
* This is a traditional space/time tradeoff.
* To set the tradeoff in favor of reducing time and increasing space,
* define INCREASE_CLIENT_EXECUTABLE_SIZE_DO_NOT_EXEC_VCACHE. By default,
* a separate executable named 'vcache' is run to perform some types of
* retrievals.
*
* If you define this, then also edit VCACHE_LIBS in the top-level Prospero
* Makefile. You will need to link VCACHE_LIBS with all the client programs
* that want to use the VCACHE library.
*
* #define INCREASE_CLIENT_EXECUTABLE_SIZE_DO_NOT_EXEC_VCACHE
*/
/* Location of wais sources, note trailing slash. MITRAism.
*
* Note that it is not clear to me (swa) why this is useful to have for the
* clients. Isn't this a server-specific thing? It's on my TODO list.
*/
#define WAIS_SOURCE_DIR "/usr/local/wais/wais-sources/"
/*
* Filters are not supported in the default distribution because they
* currently only work on the VAX. We are working on resolving these
* problems.
*/
#define P_NO_FILTERS
/* If you want to use the UNIX compatability library (documented in the
* Prospero Library Reference Manual), remove the definition of
* P_NO_PCOMPAT and follow the additional directions in the INSTALLATION file.
* This option is currently slightly broken, because Prospero has undergone
* a number of changes. it can easily be reported.
*
*/
#define P_NO_PCOMPAT
/*
* This option exists for sites that have special applications. If this option
* is defined, the pcompat library's open() routines will prompt for an FTP
* username and password to retrieve files, if necessary. This may increase
* the amount of information available through applications linked with the
* compatability library, but at the cost of changing the user interface
* to applications such as 'cat' which never normally prompt for a password.
* Only #define this if you have a special application.
*
* #define PCOMPAT_SUPPORT_FTP
*/

360
prospero/include/psrv.h Normal file
View File

@@ -0,0 +1,360 @@
/* psrv.h */
/*
* Copyright (c) 1992, 1993 by the University of Southern California
*
* For copying and distribution information, please see the file
* <usc-license.h>
*/
#include <usc-license.h>
/* Cranked out by swa@isi.edu */
#ifndef PSRV_H
#define PSRV_H
#ifndef PPARSE_H_INCLUDED /* needed for INPUT */
#include <pparse.h>
#endif
#if 0 /* This is ridiculous; I don't need it right now. */
/* Return values for the optquery() function. */
#define OPT_UNSET 0 /* Option not set. */
#define OPT_ARGS 1 /* Option set with arguments */
#define OPT_NOARGS 2 /* Option set with no arguments. */
struct opt {
char *name;
int used; /* reference if used. */
struct opt *args; /* The parsed argument string, set by the
application. */
char *argstring; /* The unparsed arguments. Not necessarily
useful once the args have been generated. */
struct opts *next;
};
typedef struct opt *OPT;
typedef struct opt OPT_ST;
extern OPT optalloc(char *name);
extern void optlfree(OPT);
extern OPT optparse(char * optionstr, char separator);
extern int optquery(OPT opts, char * optname);
extern OPT optargs(OPT opts, char * optname); /* Returns a list of tokens that
are the option's arguments. */
extern int optnargs(OPT opts, char *); /* # of arguments to the option. 0
if none specified. */
extern OPT optremaining(OPT opts); /* Any options which haven't been queried
yet. Check for leftovers! */
#endif /* 0 */
/* Temporary hack to get this going. Don't want to waste the time to do more.
The only option that currently takes arguments is "attributes". And sending
too much stuff back is never wrong, only slightly inefficient. So we will
Not Worry About It.
*/
#define optdecl char *optset_options
#define optstart(optstr) (optset_options = optstr)
#define opttest(optname) (sindex(optset_options, optname))
/* Flags for srv_change_acl */
#define SCA_LINK 0
#define SCA_DIRECTORY 1
#define SCA_LINKDIR 2
#define SCA_OBJECT 3
#define SCA_MISC 4
#define SCA_CONTAINER 4
#define reply(req, mesg) ardp_breply((req), ARDP_R_INCOMPLETE, (mesg), 0)
#define creply(req, mesg) ardp_breply((req), ARDP_R_COMPLETE, (mesg), 0)
extern int vcreplyf(RREQ req, const char *format, va_list ap);
extern int vreplyf(RREQ req, const char *format, va_list ap);
extern int creplyf(RREQ req, const char *format, ...);
extern int replyf(RREQ req, const char *format, ...);
int error_reply(RREQ req, char formatstring[], ...);
extern int dsrfinfo(char *nm, long magic, PFILE fi);
extern int dswfinfo(char *nm, PFILE fi);
/* This structure defines how you request attributes, whether they be
associated with the object or with the link. */
struct requested_attributes {
TOKEN specific; /* This is a list of TOKENs. They are the
names of specific attributes that have been
requested by name. */
/* These are BITfields that specify various classes or sets of attributes
that you are looking for. */
int all:1;
int interesting:1;
/* Others to be implemented later on an as-needed basis. 'all' is a
surrogate for them right now. */
/* int object:1; */
/* int field:1; */
};
/* This is called by dsrfinfo(), internally. */
extern int
dsrfinfo_with_attribs(char *nm,long magic,PFILE fi,
struct requested_attributes *req_obj_ats);
/* Special options given to dsrobject() when it's called with the LIST or
GET-OBJECT-INFO protocol messages on a directory. */
struct dsrobject_list_options {
char **thiscompp; /* This option only valid for LIST ..
COMPONENTS */
/* if '*' and no remcomp, then exactly
equivalent to empty. */
TOKEN *remcompp; /* This option only valid for LIST ..
COMPONENTS */
/* If last one '*', exactly equivalent to being
empty. */
struct requested_attributes
req_link_ats; /* Requested attributes associated with the
links contained by this object (i.e., LINK,
CACHED, REPLACEMENT, or ADDITIONAL, and
OBJECT iff very convenient). */
struct requested_attributes
req_obj_ats; /* Requested attributes associated with this
object itself. (only OBJECT precedence).
*/
FILTER filters; /* This option currently only valid for LIST
... COMPONENTS. OBJECT filters, when
implemented, will need this option for
GET-OBJECT-INFO. */
/* Get rid of the following definition as soon as all the databases are
updated. It is set by dirsrv() and looked at only by some older databases.
(The older databases will be unable to compile if they are using this. So
you'll know.) */
#define DSROBJECT_LIST_OPTIONS_REQUESTED_ATTRS_BACK_COMPATIBILITY
#ifdef DSROBJECT_LIST_OPTIONS_REQUESTED_ATTRS_BACK_COMPATIBILITY
const char *requested_attrs; /* this is now nearly obsolete. It will be
obsolete as soon as all the databases are
updated. It is an unholy combination of
req_link_ats and req_obj_ats. It is either
NULL or consists of a concatenated series
of attribute names, separated by the '+'
character. Every attribute name is
preceded and followed by a '+' (in other
words, the string starts and
ends with a '+' character.) */
#endif /* DSROBJECT_LIST_OPTIONS_REQUESTED_ATTRS_BACK_COMPATIBILITY */
};
#ifdef DSROBJECT_SPEEDUP_IS_EXPERIMENTAL
#define dsrobject_list_options_init(dlo) do { \
ZERO(dlo); \
if (!dsrobject_speedup) \
(dlo)->all = 1; /* emulate old inefficient behavior */ \
} while(0)
#else
#define dsrobject_list_options_init(dlo) \
ZERO(dlo);
#endif
/* Used by get_obj_info() and by list(). */
extern void
p__parse_requested_attrs(const char *requested_atlist_unparsed,
struct requested_attributes * parsed);
extern int
was_attribute_requested(char *atname, struct requested_attributes *parsed);
extern int dsrobject(RREQ req, char hsoname_type[], char hsoname[],
long version, long magic_no, int flags,
struct dsrobject_list_options *listopts, P_OBJECT ob);
#define DRO_NULLOPT (struct dsrobject_list_options *) 0
/* Flags for DSROBJECT */
#define DRO_ACCESS_METHOD_ONLY 0x1 /* only want access-method attribute. */
#define DRO_VERIFY 0x2 /* Verify that the object exists.
This is implemented for
ARCHIE and GOPHER-GW; otherwise, still a
full cost call. */
#define DRO_VERIFY_DIR 0x4 /* Verify that the object exists and that it
is a directory. This is implemented for
the local PFSDAT directories. If this is
given to a call that is eventually passed
to a call to a DSDB function, then
whether it is noticed depends upon the
individual DSDB function; might still be
a full-cost call. */
/* --- */
/* From lib/psrv/dsrdir.c */
/* DSRDIR will die soon, superseded by dsrobject(). --swa */
extern int dsrdir(char *name,int magic,VDIR dir,VLINK ul,int flags);
/* Flags for dsrdir() */
#define DSRD_ATTRIBUTES 0x1 /* Fill in attributes for links */
#define DSRD_VERIFY_DIR 0x2 /* Verify that the directory exists
and is a directory. Returns
PSUCCESS upon SUCCESS, PFAILURE
upon FAILURE. This flag implies
that the DIR option to dsrdir()
could be set to NULL with no ill
consequences. In fact, dsrdir()
does just that, as a safety
check. */
/* ---- */
/* The following is unimplemented. */
extern void dswobject(char hsonametype[], char hsoname[], P_OBJECT ob);
extern void set_client_addr(long addr); /* short-term hack */
extern size_t nativize_prefix(char *hsoname, char native_buf[],
size_t native_bufsiz);
extern int dswdir(char *name, VDIR dir);
extern int fdswdir_v5(FILE *vfs_dir, VDIR dir);
TOKEN check_nfs(char filename[], long client_addr);
char *check_localpath(char filename[], long client_addr);
extern int srv_check_acl(ACL pacl,ACL sacl,RREQ req,char *op,int flags,char *objid,char *itemid);
extern int change_acl(ACL *aclp, ACL ae, RREQ req, int flags, ACL diracl);
extern ACL get_container_acl(char *path);
extern ACL maint_acl;
extern int delete_matching_at(PATTRIB key, PATTRIB *headp,
int (*equal)(PATTRIB, PATTRIB));
extern int delete_matching_fl(FILTER key, FILTER *headp);
#ifdef PSRV_ARCHIE /* This is still old format. */
extern int arch_dsdb(RREQ req, /* Request pointer (unused) */
char *hsoname, /* Name of the directory */
long version, /* Version #; currently ignored */
long magic_no, /* Magic #; currently ignored */
int flags, /* Currently only recognize DRO_VERIFY */
struct dsrobject_list_options *listopts, /* options (use *remcompp
and *thiscompp)*/
P_OBJECT ob); /* Object to be filled in */
#endif
#ifdef PSRV_GOPHER /* Currently unused. Probably never used. */
#error this is unimplemented
int gopher_dsdb(RREQ req, char name[], char **componentsp, TOKEN *rcompp,
VDIR dir, int options, const char *rattrib, FILTER filters);
#endif
#ifdef PSRV_GOPHER_GW
int gopher_gw_dsdb(RREQ req, char hsoname[], long version, long magic_no,
int flags, struct dsrobject_list_options *listopts,
P_OBJECT ob);
void gopher_gw_init_mutexes(void);
#ifndef NDEBUG
void gopher_gw_diagnose_mutexes(void);
#endif /*NDEBUG*/
/* Memory allocators used inside GOPHER_GW library. */
extern int glink_count, glink_max;
#endif
#ifdef PSRV_WAIS_GW
int wais_gw_dsdb(RREQ req, char hsoname[], long version, long magic_no,
int flags, struct dsrobject_list_options *listopts,
P_OBJECT ob);
void wais_gw_init_mutexes(void);
/* Memory allocators used inside WAIS library. */
extern int waismsgbuff_count, waismsgbuff_max;
extern int ietftype_count, ietftype_max;
extern int waissource_count, waissource_max;
#ifndef NDEBUG
void wais_gw_diagnose_mutexes(void);
#endif /*NDEBUG*/
#endif
#ifdef PSRV_KERBEROS
extern int
check_krb_auth(char *auth, struct sockaddr_in client, char **ret_client_name);
#endif
extern char shadow[];
extern char pfsdat[];
extern char dirshadow[];
extern char dircont[];
extern char security[];
extern char root[];
extern char aftpdir[];
extern char afsdir[];
extern char *db_prefix; /* For old v1 support. */
extern char hostname[]; /* Server's host name */
extern char hostwport[]; /* Host name w/ port if non-standard
*/
extern char *logfile_arg;
struct db_entry {
char *hsoname_type; /* hsoname type for database; should always
be ASCII */
char *prefix; /* Prefix for database */
/* Hsonametype is already known; doesn't need to be passed. */
int (*read_function)(RREQ req, char hsoname[], long version,
long magic_no, int flags,
struct dsrobject_list_options *listopts,
P_OBJECT ob);
int (*write_function)(char hsoname[], P_OBJECT ob);
char *named_acl; /* name of the NAMED ACL that the database
reads as a pre-filter. If no such ACL or if
NULL, unused. Normally same as db_prefix.
*/
};
extern struct db_entry db_prefixes[];
extern int db_num_ents;
#define OBJECT_VNO 5 /* version # of the object format. */
/* Used internally by dswobject() and
dsrobject(). */
extern int get_named_acl(char *t_name, ACL *wacl);
extern int set_named_acl(char *t_name, ACL wacl);
/* lib/psrv/magic.c */
extern long generate_magic(VLINK vl);
extern int magic_no_in_list(long magic, VLINK links);
/* lib/psrv/dsrobject.c */
extern int requested_contents(struct dsrobject_list_options *listopts);
/* lib/psrv/psrv_mutexes.c */
extern void psrv_init_mutexes(void);
#ifndef NDEBUG
extern void psrv_diagnose_mutexes(void);
#endif
extern void p_init_shared_prefixes(void);
extern void p_srv_check_acl_initialize_defaults(void);
#ifdef PFS_THREADS
p_th_mutex p_th_mutexPSRV_CHECK_ACL_INET_DEF_LOCAL;
p_th_mutex p_th_mutexPSRV_CHECK_NFS_MYADDR;
p_th_mutex p_th_mutexPSRV_LOG;
#endif
extern void get_access_method(char filename[], long caddr, PATTRIB *retval);
extern int set_logfile(char *filename);
extern int check_handle(char *handle);
extern void srv_add_client_to_acl(char *rights, RREQ r, ACL *a, int f);
extern int check_prvport(RREQ req);
extern void close_plog(void);
extern retrieve_fp(VLINK l);
extern int stat_object(P_OBJECT ob); /* not yet defined. */
#ifdef DIRECTORYCACHING
extern int dsrobject_fail; /* How many times did DSROBJECT fail? Used
only in a DIRECTORYCACHING context. */
#endif /* DIRECTORYCACHING */
#endif /*PSRV_H*/

View File

@@ -0,0 +1,43 @@
/* These definitions are destined for pmachine.h, they are herer to
prevent LONG recompile's and can be moved when stable */
/*
* This file determines how we handle various approaches to multithreading
* or timing out on TCP opens.
* The appropriate approaches for the single-threaded and multi-threaded
* cases are different.
*/
/* Several different approaches to handling timeouts
1. Do nothing - (old prospero) - problems occur when prospero is used
mostly for gatewaying since connect could take 2 mins to time out,
leaving hte gateway program to wait - or even worse, timeout itself.
2. Use SIGALRM - this works on SCOUNIX, and probably on most others
it does NOT work on SOLARIS2.3 mutli-threaded, probably due to
problems in the call to signal (at least that is where it crashes).
3. Non-blocking, works fast, since it doesnt need to wait for connects,
but this is probably not relevant on gateways. It still has the problems
of (1). SWA reports problems with this in opentcp.c
4. Non-blocking and waiting, run non-blocking, but wait (using select) at
crucial points. - Currently used by Mitra for AOL
*/
/* For Approach 1 - undef all of these */
#undef TIMEOUT_APPROACH /*Approach 2*/
#undef NONBLOCKING_APPROACH /*Approach 3*/
#define SELECT_APPROACH /*Approach 4*/
/* SETSOCKOPTS are generally usefull, but they will fail under SOLARIS 2.3
setting Errno to the ambiguous "0" */
#ifndef SOLARIS
#define SETSOCKOPTS /* Set various socket options */
#endif
/* This should go in pfs.h */
extern wait_till_readable(int fd, int timeout);
/* Open a stream (or start an opening of a stream). Returns a filedescriptor
* or -1.
*/
extern int p_open_tcp_stream(const char host[], int port);

View File

@@ -0,0 +1,17 @@
/* This is for SOLARIS, but may be usefull elsewhere */
/* SOLARIS and GCC conspire to exclude putenv */
#ifdef _XOPEN_SOURCE
#define OLD_XOPEN_SOURCE _XOPEN_SOURCE
#else
#undef OLD_XOPEN_SOURCE
#endif
#define _XOPEN_SOURCE 1
#include "/usr/include/stdlib.h"
#ifdef OLD_XOPEN_SOURCE
#define _XOPEN_SOURCE OLD_XOPEN_SOURCE
#undef OLD_XOPEN_SOURCE
#else
#undef _XOPEN_SOURCE
#endif

View File

@@ -0,0 +1,26 @@
/*
* <string_with_strcasecmp.h>
* Includes standard POSIX/ANSI C <string.h>, plus
* strcasecmp() prototype.
*/
#ifdef SOLARIS
/* This is for SOLARIS, but may be usefull elsewhere */
/* SOLARIS and GCC conspire to exclude strcasecmp */
#ifdef _XOPEN_SOURCE
#define OLD_XOPEN_SOURCE _XOPEN_SOURCE
#else
#undef OLD_XOPEN_SOURCE
#endif
#define _XOPEN_SOURCE 1
#include "/usr/include/string.h"
#ifdef OLD_XOPEN_SOURCE
#define _XOPEN_SOURCE OLD_XOPEN_SOURCE
#undef OLD_XOPEN_SOURCE
#else
#undef _XOPEN_SOURCE
#endif
#else /* SOLARIS */
#include <string.h>
#endif /* SOLARIS */

View File

@@ -0,0 +1 @@
#include "pfs_threads.h"

View File

@@ -0,0 +1,33 @@
/*
Copyright (c) 1991, 1992, 1993 by the University of Southern California
All rights reserved.
Permission to use, copy, modify, and distribute this software and its
documentation in source and binary forms for non-commercial purposes
and without fee is hereby granted, provided that the above copyright
notice appear in all copies and that both the copyright notice and
this permission notice appear in supporting documentation. and that
any documentation, advertising materials, and other materials related
to such distribution and use acknowledge that the software was
developed by the University of Southern California, Information
Sciences Institute. The name of the University may not be used to
endorse or promote products derived from this software without
specific prior written permission.
THE UNIVERSITY OF SOUTHERN CALIFORNIA makes no representations about
the suitability of this software for any purpose. THIS SOFTWARE IS
PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Other copyrights might apply to parts of the Prospero distribution
and are so noted when applicable.
Prospero was originally written by Clifford Neuman (bcn@isi.edu).
Contributors include Steven Seger Augart (swa@isi.edu), Benjamin Britt
(britt@isi.edu) and others identified in individual modules.
Questions concerning this software should be directed to
info-prospero@isi.edu.
*/

View File

@@ -0,0 +1,125 @@
/*
* Copyright (c) 1991-1994 by the University of Southern California
* All rights reserved.
*
* PROSPERO(TM) LICENSE AGREEMENT
*
* 1. COPYRIGHT. The Prospero software is owned by the University of
* Southern California and is protected by the United States copyright
* laws and international treaty provisions. Other copyrights may
* apply to parts of the Prospero distribution and are so noted when
* known to be applicable.
*
* 2. DISCLAIMER OF WARRANTY. THIS SOFTWARE IS PROVIDED "AS IS". The
* University of Southern California MAKES NO REPRESENTATIONS OR
* WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not
* limitation, the University of Southern California MAKES NO
* REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
* PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE
* COMPONENTS OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS,
* COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. The University of Southern
* California shall not be held liable for any liability nor for any
* direct, indirect, or consequential damages with respect to any
* claim by the user or distributor of the Prospero software or any
* third party on account of or arising from this Agreement or the use
* or distribution of the Prospero software.
*
* 3. GRANT OF LICENSE.
*
* a) Permission to use, copy, modify, and distribute this software and
* its documentation in source and binary forms is hereby granted,
* provided that:
*
* i) the use, copying, or distribution is not done for direct
* commercial advantage;
*
* ii) any distribution of the software is on the same terms as in
* this Prospero License Agreement, and each copy contains the
* copyright notices and the license agreement that appear in
* this software and supporting documentation; and
*
* iii) any documentation or other materials related to such
* distribution or use acknowledge that the software was developed
* by the University of Southern California.
*
* b) Permission to copy, modify, and distribute this software and its
* documentation in source and binary forms AS PART OF ANOTHER
* PRODUCT for commercial advantage is hereby granted, provided that:
*
* i) notice is provided to the University of Southern California
* describing the use of Prospero in the product;
*
* ii) any distribution of the software is on the same terms as in
* this Prospero License Agreement, and those terms apply also to
* the distribution and use of that part of the product derived
* from the Prospero distribution (it is acceptable to
* impose additional restrictions on other parts of the product),
* and each copy contains the copyright notices and the license
* agreement that appear in this software and supporting
* documentation;
*
* iii) any documentation or other materials related to such
* distribution or use acknowledge that the software was developed
* by the University of Southern California; and
*
* iv) one of the following three conditions is met:
*
* a. The product so distributed has been developed
* independently and it incorporates only files and related
* functions (e.g. allocators) from the Prospero distribution
* needed to providing compatibility with the Prospero
* distribution; or
*
* b. the product so distributed has been developed independently
* and the parts of the Prospero distribution included
* constitute less than 25% of the product, and the total annual
* sales of products incorporating Prospero does not exceed
* $100,000 (U.S. Dollars); or
*
* c. parties to which the product is sold or distributed are
* allowed to use or distribute the product in source and binary
* forms without fee if the party's use or distribution of the
* product is not for direct commercial advantage.
*
* c) Permission to use this software to provide a service for a fee is
* granted provided that notice is provided to the University of
* Southern California describing the nature of the service and
* provided that the total annual revenues for the service provided
* using Prospero does not exceed $250,000 (U.S. dollars).
*
* d) Any use, copying, modification, or distribution other than as
* provided for above requires an additional license from the
* University of Southern California. The University of Southern
* California is prepared to license this software for such use on
* reasonable terms.
*
* 4. OTHER RESTRICTIONS. Nothing in this Agreement shall be construed
* as conferring rights to use in advertising, publicity, or
* otherwise, the name of the University of Southern California, or
* any trademark thereof.
*
* This agreement shall be construed, interpreted, and applied in
* accordance with the laws of the State of California, United States of
* America. If any part of this Agreement is held illegal or
* unenforceable, the remaining portions shall not be affected.
*
* Any notice required under this agreement shall be sent to the Prospero
* Project; Information Sciences Institute; University of Southern
* California; 4676 Admiralty Way; Marina del Rey, California 90292-6695
* USA. Any questions concerning the Prospero distribution should be
* directed to info-prospero@isi.edu.
*
* Prospero was originally written by Clifford Neuman (bcn@isi.edu) while
* a graduate student at the University of Washington, and subsequently at
* the Information Sciences Institute of the University of Southern
* California. Contributors include Steven Seger Augart (swa@isi.edu),
* Santosh Rao (srao@isi.edu), and other individuals identified in the
* software distribution and accompanying documentation.
*
* Prospero, the Prospero Directory Service, the Prospero File System,
* and the Prospero Resource Manager are trademarks of the
* University of Southern California.
*
*/
extern char *usc_license_string;

View File

@@ -0,0 +1,20 @@
/*
Copyright (c) 1989, 1990, 1991 by the University of Washington
Permission to use, copy, modify, and distribute this software and its
documentation for non-commercial purposes and without fee is hereby
granted, provided that the above copyright notice appear in all copies
and that both the copyright notice and this permission notice appear in
supporting documentation, and that the name of the University of
Washington not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission. The University of Washington makes no representations
about the suitability of this software for any purpose. It is
provided "as is" without express or implied warranty.
Prospero was written by Clifford Neuman (bcn@isi.edu).
Questions concerning this software should be directed to
info-prospero@isi.edu.
*/

10
prospero/include/vcache.h Normal file
View File

@@ -0,0 +1,10 @@
/* Internal commands used in user/vcache */
void setpeer(char *hostn);
void set_type(char *t);
int recvrequest(char *cmd, char *local, char *remote, char *amode);
int ruserpass(char *host, char **aname, char **apass, char **aacct);
void lostpeer(void);
int login(char *host);
/* Dont define command - it should use vargs, but doesnt */
void pswitch(int flag);

View File

@@ -0,0 +1,2 @@
#include "../lib/psrv/wais_gw/source.h"