Source Code - Netscape ENTERPRISE SERVER 6.0 - NSAPI PROGRAMMER GUIDE Manual

Nsapi
Table of Contents

Advertisement

AuthTrans Example
Note that this function does not actually enforce authorization requirements, it
only takes given information and tells the server if it's correct or not. The
PathCheck
following
PathCheck fn=require-auth realm="test realm" auth-type="basic"

Source Code

The source code for this example is in the
plugins/nsapi/examples
#include "nsapi.h"
typedef struct {
char *name;
char *pw;
} user_s;
static user_s user_set[] = {
{"joe", "shmoe"},
{"suzy", "creamcheese"},
{NULL, NULL}
};
#include "frame/log.h"
#ifdef __cplusplus
extern "C"
#endif
NSAPI_PUBLIC int hardcoded_auth(pblock *param, Session *sn, Request
*rq)
{
/* Parameters given to us by auth-basic */
char *pwfile = pblock_findval("userdb", param);
char *user = pblock_findval("user", param);
char *pw = pblock_findval("pw", param);
/* Temp variables */
register int x;
for(x = 0; user_set[x].name != NULL; ++x) {
214
Netscape Enterprise Server NSAPI Programmer's Guide • November 2001
function
require-auth
directive also:
PathCheck
subdirectory of the server root directory.
/* If this isn't the user we want, keep going */
if(strcmp(user, user_set[x].name) != 0) continue;
performs the enforcement, so add the
file in the
auth.c
or
nsapi/examples/

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise server 6.0

Table of Contents