Lines 8-14
Link Here
|
8 |
|
8 |
|
9 |
/* Structure to describe one communications endpoint. */ |
9 |
/* Structure to describe one communications endpoint. */ |
10 |
|
10 |
|
11 |
#define STRING_LENGTH 128 /* hosts, users, processes */ |
11 |
#define STRING_LENGTH 128 /* hosts, users, processes */ |
12 |
|
12 |
|
13 |
struct host_info { |
13 |
struct host_info { |
14 |
char name[STRING_LENGTH]; /* access via eval_hostname(host) */ |
14 |
char name[STRING_LENGTH]; /* access via eval_hostname(host) */ |
Lines 31-51
Link Here
|
31 |
char pid[10]; /* access via eval_pid(request) */ |
31 |
char pid[10]; /* access via eval_pid(request) */ |
32 |
struct host_info client[1]; /* client endpoint info */ |
32 |
struct host_info client[1]; /* client endpoint info */ |
33 |
struct host_info server[1]; /* server endpoint info */ |
33 |
struct host_info server[1]; /* server endpoint info */ |
34 |
void (*sink) (); /* datagram sink function or 0 */ |
34 |
void (*sink) (int); /* datagram sink function or 0 */ |
35 |
void (*hostname) (); /* address to printable hostname */ |
35 |
void (*hostname) (struct host_info *); /* address to printable hostname */ |
36 |
void (*hostaddr) (); /* address to printable address */ |
36 |
void (*hostaddr) (struct host_info *); /* address to printable address */ |
37 |
void (*cleanup) (); /* cleanup function or 0 */ |
37 |
void (*cleanup) (struct request_info *); /* cleanup function or 0 */ |
38 |
struct netconfig *config; /* netdir handle */ |
38 |
struct netconfig *config; /* netdir handle */ |
39 |
}; |
39 |
}; |
40 |
|
40 |
|
41 |
/* Common string operations. Less clutter should be more readable. */ |
41 |
/* Common string operations. Less clutter should be more readable. */ |
42 |
|
42 |
|
43 |
#define STRN_CPY(d,s,l) { strncpy((d),(s),(l)); (d)[(l)-1] = 0; } |
43 |
#define STRN_CPY(d,s,l) { strncpy((d),(s),(l)); (d)[(l)-1] = 0; } |
44 |
|
44 |
|
45 |
#define STRN_EQ(x,y,l) (strncasecmp((x),(y),(l)) == 0) |
45 |
#define STRN_EQ(x,y,l) (strncasecmp((x),(y),(l)) == 0) |
46 |
#define STRN_NE(x,y,l) (strncasecmp((x),(y),(l)) != 0) |
46 |
#define STRN_NE(x,y,l) (strncasecmp((x),(y),(l)) != 0) |
47 |
#define STR_EQ(x,y) (strcasecmp((x),(y)) == 0) |
47 |
#define STR_EQ(x,y) (strcasecmp((x),(y)) == 0) |
48 |
#define STR_NE(x,y) (strcasecmp((x),(y)) != 0) |
48 |
#define STR_NE(x,y) (strcasecmp((x),(y)) != 0) |
49 |
|
49 |
|
50 |
/* |
50 |
/* |
51 |
* Initially, all above strings have the empty value. Information that |
51 |
* Initially, all above strings have the empty value. Information that |
Lines 54-68
Link Here
|
54 |
* that we do not believe in is set to "paranoid". |
54 |
* that we do not believe in is set to "paranoid". |
55 |
*/ |
55 |
*/ |
56 |
|
56 |
|
57 |
#define STRING_UNKNOWN "unknown" /* lookup failed */ |
57 |
#define STRING_UNKNOWN "unknown" /* lookup failed */ |
58 |
#define STRING_PARANOID "paranoid" /* hostname conflict */ |
58 |
#define STRING_PARANOID "paranoid" /* hostname conflict */ |
59 |
|
59 |
|
60 |
extern char unknown[]; |
60 |
extern char unknown[]; |
61 |
extern char paranoid[]; |
61 |
extern char paranoid[]; |
62 |
|
62 |
|
63 |
#define HOSTNAME_KNOWN(s) (STR_NE((s),unknown) && STR_NE((s),paranoid)) |
63 |
#define HOSTNAME_KNOWN(s) (STR_NE((s),unknown) && STR_NE((s),paranoid)) |
64 |
|
64 |
|
65 |
#define NOT_INADDR(s) (s[strspn(s,"01234567890./")] != 0) |
65 |
#define NOT_INADDR(s) (s[strspn(s,"01234567890./")] != 0) |
66 |
|
66 |
|
67 |
/* Global functions. */ |
67 |
/* Global functions. */ |
68 |
|
68 |
|
Lines 69-75
Link Here
|
69 |
#if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT) |
69 |
#if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT) |
70 |
extern void fromhost(); /* get/validate client host info */ |
70 |
extern void fromhost(); /* get/validate client host info */ |
71 |
#else |
71 |
#else |
72 |
#define fromhost sock_host /* no TLI support needed */ |
72 |
#define fromhost sock_host /* no TLI support needed */ |
73 |
#endif |
73 |
#endif |
74 |
|
74 |
|
75 |
extern int hosts_access(); /* access control */ |
75 |
extern int hosts_access(); /* access control */ |
Lines 105-119
Link Here
|
105 |
extern struct request_info *request_set(); /* update request structure */ |
105 |
extern struct request_info *request_set(); /* update request structure */ |
106 |
#endif |
106 |
#endif |
107 |
|
107 |
|
108 |
#define RQ_FILE 1 /* file descriptor */ |
108 |
#define RQ_FILE 1 /* file descriptor */ |
109 |
#define RQ_DAEMON 2 /* server process (argv[0]) */ |
109 |
#define RQ_DAEMON 2 /* server process (argv[0]) */ |
110 |
#define RQ_USER 3 /* client user name */ |
110 |
#define RQ_USER 3 /* client user name */ |
111 |
#define RQ_CLIENT_NAME 4 /* client host name */ |
111 |
#define RQ_CLIENT_NAME 4 /* client host name */ |
112 |
#define RQ_CLIENT_ADDR 5 /* client host address */ |
112 |
#define RQ_CLIENT_ADDR 5 /* client host address */ |
113 |
#define RQ_CLIENT_SIN 6 /* client endpoint (internal) */ |
113 |
#define RQ_CLIENT_SIN 6 /* client endpoint (internal) */ |
114 |
#define RQ_SERVER_NAME 7 /* server host name */ |
114 |
#define RQ_SERVER_NAME 7 /* server host name */ |
115 |
#define RQ_SERVER_ADDR 8 /* server host address */ |
115 |
#define RQ_SERVER_ADDR 8 /* server host address */ |
116 |
#define RQ_SERVER_SIN 9 /* server endpoint (internal) */ |
116 |
#define RQ_SERVER_SIN 9 /* server endpoint (internal) */ |
117 |
|
117 |
|
118 |
/* |
118 |
/* |
119 |
* Routines for delayed evaluation of request attributes. Each attribute |
119 |
* Routines for delayed evaluation of request attributes. Each attribute |
Lines 129-136
Link Here
|
129 |
extern char *eval_hostinfo(); /* host name or address */ |
129 |
extern char *eval_hostinfo(); /* host name or address */ |
130 |
extern char *eval_client(); /* whatever is available */ |
130 |
extern char *eval_client(); /* whatever is available */ |
131 |
extern char *eval_server(); /* whatever is available */ |
131 |
extern char *eval_server(); /* whatever is available */ |
132 |
#define eval_daemon(r) ((r)->daemon) /* daemon process name */ |
132 |
#define eval_daemon(r) ((r)->daemon) /* daemon process name */ |
133 |
#define eval_pid(r) ((r)->pid) /* process id */ |
133 |
#define eval_pid(r) ((r)->pid) /* process id */ |
134 |
|
134 |
|
135 |
/* Socket-specific methods, including DNS hostname lookups. */ |
135 |
/* Socket-specific methods, including DNS hostname lookups. */ |
136 |
|
136 |
|
Lines 137-143
Link Here
|
137 |
extern void sock_host(); /* look up endpoint addresses */ |
137 |
extern void sock_host(); /* look up endpoint addresses */ |
138 |
extern void sock_hostname(); /* translate address to hostname */ |
138 |
extern void sock_hostname(); /* translate address to hostname */ |
139 |
extern void sock_hostaddr(); /* address to printable address */ |
139 |
extern void sock_hostaddr(); /* address to printable address */ |
140 |
#define sock_methods(r) \ |
140 |
#define sock_methods(r) \ |
141 |
{ (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; } |
141 |
{ (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; } |
142 |
|
142 |
|
143 |
/* The System V Transport-Level Interface (TLI) interface. */ |
143 |
/* The System V Transport-Level Interface (TLI) interface. */ |
Lines 173-181
Link Here
|
173 |
* (-1) returns are here because zero is already taken by longjmp(). |
173 |
* (-1) returns are here because zero is already taken by longjmp(). |
174 |
*/ |
174 |
*/ |
175 |
|
175 |
|
176 |
#define AC_PERMIT 1 /* permit access */ |
176 |
#define AC_PERMIT 1 /* permit access */ |
177 |
#define AC_DENY (-1) /* deny_access */ |
177 |
#define AC_DENY (-1) /* deny_access */ |
178 |
#define AC_ERROR AC_DENY /* XXX */ |
178 |
#define AC_ERROR AC_DENY /* XXX */ |
179 |
|
179 |
|
180 |
/* |
180 |
/* |
181 |
* In verification mode an option function should just say what it would do, |
181 |
* In verification mode an option function should just say what it would do, |
Lines 190-225
Link Here
|
190 |
/* Bug workarounds. */ |
190 |
/* Bug workarounds. */ |
191 |
|
191 |
|
192 |
#ifdef INET_ADDR_BUG /* inet_addr() returns struct */ |
192 |
#ifdef INET_ADDR_BUG /* inet_addr() returns struct */ |
193 |
#define inet_addr fix_inet_addr |
193 |
#define inet_addr fix_inet_addr |
194 |
extern long fix_inet_addr(); |
194 |
extern long fix_inet_addr(); |
195 |
#endif |
195 |
#endif |
196 |
|
196 |
|
197 |
#ifdef BROKEN_FGETS /* partial reads from sockets */ |
197 |
#ifdef BROKEN_FGETS /* partial reads from sockets */ |
198 |
#define fgets fix_fgets |
198 |
#define fgets fix_fgets |
199 |
extern char *fix_fgets(); |
199 |
extern char *fix_fgets(); |
200 |
#endif |
200 |
#endif |
201 |
|
201 |
|
202 |
#ifdef RECVFROM_BUG /* no address family info */ |
202 |
#ifdef RECVFROM_BUG /* no address family info */ |
203 |
#define recvfrom fix_recvfrom |
203 |
#define recvfrom fix_recvfrom |
204 |
extern int fix_recvfrom(); |
204 |
extern int fix_recvfrom(); |
205 |
#endif |
205 |
#endif |
206 |
|
206 |
|
207 |
#ifdef GETPEERNAME_BUG /* claims success with UDP */ |
207 |
#ifdef GETPEERNAME_BUG /* claims success with UDP */ |
208 |
#define getpeername fix_getpeername |
208 |
#define getpeername fix_getpeername |
209 |
extern int fix_getpeername(); |
209 |
extern int fix_getpeername(); |
210 |
#endif |
210 |
#endif |
211 |
|
211 |
|
212 |
#ifdef SOLARIS_24_GETHOSTBYNAME_BUG /* lists addresses as aliases */ |
212 |
#ifdef SOLARIS_24_GETHOSTBYNAME_BUG /* lists addresses as aliases */ |
213 |
#define gethostbyname fix_gethostbyname |
213 |
#define gethostbyname fix_gethostbyname |
214 |
extern struct hostent *fix_gethostbyname(); |
214 |
extern struct hostent *fix_gethostbyname(); |
215 |
#endif |
215 |
#endif |
216 |
|
216 |
|
217 |
#ifdef USE_STRSEP /* libc calls strtok() */ |
217 |
#ifdef USE_STRSEP /* libc calls strtok() */ |
218 |
#define strtok fix_strtok |
218 |
#define strtok fix_strtok |
219 |
extern char *fix_strtok(); |
219 |
extern char *fix_strtok(); |
220 |
#endif |
220 |
#endif |
221 |
|
221 |
|
222 |
#ifdef LIBC_CALLS_STRTOK /* libc calls strtok() */ |
222 |
#ifdef LIBC_CALLS_STRTOK /* libc calls strtok() */ |
223 |
#define strtok my_strtok |
223 |
#define strtok my_strtok |
224 |
extern char *my_strtok(); |
224 |
extern char *my_strtok(); |
225 |
#endif |
225 |
#endif |