Netscape ENTERPRISE SERVER 6.0 - NSAPI PROGRAMMER GUIDE Manual page 221

Nsapi
Table of Contents

Advertisement

/* Check usage. Note that Init functions have special
error logging */
if(!acf_file) {
util_sprintf(err, "missing parameter to acf_init
(need file)");
pblock_nvinsert("error", err, pb);
return REQ_ABORTED;
}
f = fopen(acf_file, "r");
/* Did we open it? */
if(!f) {
util_sprintf(err, "can't open access control file %s (%s)",
acf_file, system_errmsg());
pblock_nvinsert("error", err, pb);
return REQ_ABORTED;
}
/* Initialize hosts array */
num_hosts = 0;
hosts = (char **) MALLOC(1 * sizeof(char *));
hosts[0] = NULL;
while(fgets(buf, MAX_ACF_LINE, f)) {
/* Blast linefeed that stdio helpfully leaves on there */
buf[strlen(buf) - 1] = '\0';
hosts = (char **) REALLOC(hosts, (num_hosts + 2) *
sizeof(char *));
hosts[num_hosts++] = STRDUP(buf);
hosts[num_hosts] = NULL;
}
fclose(f);
/* At restart, free hosts array */
daemon_atrestart(acf_free, NULL);
return REQ_PROCEED
}
#ifdef __cplusplus
extern "C"
#endif
NSAPI_PUBLIC int restrict_by_acf(pblock *pb, Session *sn, Request
*rq)
{
/* No parameters */
PathCheck Example
Chapter 6
Examples of Custom SAFs
221

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise server 6.0

Table of Contents