NameTrans Example
Chapter
6
Examples of Custom SAFs
219
/* Verify password */
if(strcmp(pw, user_set[x].pw)) {
log_error(LOG_SECURITY, "hardcoded-auth", sn, rq,
"user %s entered wrong password", user);
/* This will cause the enforcement function to ask */
/* user again */
return REQ_NOACTION;
}
/* If we return REQ_PROCEED, the username will be accepted */
return REQ_PROCEED;
}
/* No match, have it ask them again */
log_error(LOG_SECURITY, "hardcoded-auth", sn, rq,
"unknown user %s", user);
return REQ_NOACTION;
}
NameTrans Example
The
ntrans.c
file in the
nsapi/examples/
or
plugins/nsapi/examples
subdirectory of the server root directory contains source code for two example
NameTrans
functions:
•
explicit_pathinfo
This example allows the use of explicit extra path information in a URL.
•
https_redirect
This example redirects the URL if the client is a particular version of Netscape
Navigator.
This section discusses the first example. Look at the source code in
ntrans.c
for
the second example.
NOTE
The main thing that a
NameTrans
function usually does is to convert
the logical URL in
ppath
in
rq->vars
to a physical pathname.
However, the example discussed here,
explicit_pathinfo
, does
not translate the URL into a physical pathname, it changes the
value of the requested URL. See the second example,
https_redirect
, in
ntrans.c
for an example of a
NameTrans
function that converts the value of
ppath
in
rq->vars
from a URL
to a physical pathname.
Summary of Contents for ENTERPRISE SERVER 6.1
Page 1: ...NSAPI Programmer s Guide Netscape Enterprise Server Version6 1 April 2002 Draft...
Page 290: ...Miscellaneous 290 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Page 318: ...cinfo 318 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Page 336: ...Buffered Streams 336 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Page 344: ...344 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Page 350: ...350 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Page 356: ...356 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...