NameTrans Example
Chapter
6
Examples of Custom SAFs
215
/* 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.0
Page 1: ...NSAPI Programmer s Guide Netscape Enterprise Server Version6 0 November 2001...
Page 134: ...CGI to NSAPI Conversion 134 Netscape Enterprise Server NSAPI Programmer s Guide November 2001...
Page 306: ...cinfo 306 Netscape Enterprise Server NSAPI Programmer s Guide November 2001...
Page 312: ...Sample MIME Types File 312 Netscape Enterprise Server NSAPI Programmer s Guide November 2001...
Page 324: ...Buffered Streams 324 Netscape Enterprise Server NSAPI Programmer s Guide November 2001...
Page 332: ...332 Netscape Enterprise Server NSAPI Programmer s Guide November 2001...
Page 340: ...340 Netscape Enterprise Server NSAPI Programmer s Guide November 2001...
Page 346: ...346 Netscape Enterprise Server NSAPI Programmer s Guide November 2001...
Page 352: ...352 Netscape Enterprise Server NSAPI Programmer s Guide November 2001...