Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

Ticket Validation
[Authentication]


Files

file  validate.c
file  validate.h

Data Structures

struct  cas_url_buffer

Defines

#define END(res, msg)   { result=(res); *err_msg = msg; goto end; }
#define FAILURE(msg)   END(0,msg)
#define CURL_FAILURE   END(0,err_buf)
#define SUCCESS   END(1,NULL)
#define SET_CURL_OPTION(option, value)   { if (curl_easy_setopt(curl_handle,(option),(value))!=CURLE_OK) CURL_FAILURE; }
#define DEFAULT_CASServerVersion   2
#define DEFAULT_CASServerHostname   "secure.its.yale.edu"
#define DEFAULT_CASServerPort   "443"
#define DEFAULT_CASServerBaseUri   "/cas/servlet"
#define DEFAULT_CASServerCACertFile   "/usr/local/etc/verisignserverca.pem"

Functions

const char * cas_read_CASServerVersion (cmd_parms *cmd, void *dummy, const char *word)
const char * cas_read_CASServerHostname (cmd_parms *cmd, void *dummy, const char *word)
const char * cas_read_CASServerPort (cmd_parms *cmd, void *dummy, const char *word)
const char * cas_read_CASServerBaseUri (cmd_parms *cmd, void *dummy, const char *word)
const char * cas_read_CASServerCACertFile (cmd_parms *cmd, void *dummy, const char *word)
void cas_url_buffer_init (cas_url_buffer *cub, char *buf, int len, int *full)
size_t cas_url_buffer_write (cas_url_buffer *cub, void *ptr, int size)
void cas_url_buffer_close (cas_url_buffer *cub)
size_t cas_write_data (void *ptr, size_t size, size_t nmemb, void *cub)
int cas_read_url (char *url, char *ca_cert_filename, char *header_buf, int header_buf_len, int *header_buf_full, char *body_buf, int body_buf_len, int *body_buf_full, char **err_msg)
int cas_read_url_body (char *url, char *ca_cert_filename, char *body_buf, int body_buf_len, int *body_buf_full, char **err_msg)
int main (int argc, char **argv)
int cas_validate (request_rec *r, char *ticket, char *service, char *outbuf, int outbuflen)

Define Documentation

#define CURL_FAILURE   END(0,err_buf)
 

#define DEFAULT_CASServerBaseUri   "/cas/servlet"
 

#define DEFAULT_CASServerCACertFile   "/usr/local/etc/verisignserverca.pem"
 

#define DEFAULT_CASServerHostname   "secure.its.yale.edu"
 

#define DEFAULT_CASServerPort   "443"
 

#define DEFAULT_CASServerVersion   2
 

#define END res,
msg   )     { result=(res); *err_msg = msg; goto end; }
 

#define FAILURE msg   )     END(0,msg)
 

#define SET_CURL_OPTION option,
value   )     { if (curl_easy_setopt(curl_handle,(option),(value))!=CURLE_OK) CURL_FAILURE; }
 

#define SUCCESS   END(1,NULL)
 


Function Documentation

const char* cas_read_CASServerBaseUri cmd_parms *  cmd,
void *  dummy,
const char *  word
 

Command handler for the CASServerBaseUri directive.

Parameters:
cmd the directive given by the configuration file
dummy not used.
word the parameter of the directive
Returns:
always NULL (success)

const char* cas_read_CASServerCACertFile cmd_parms *  cmd,
void *  dummy,
const char *  word
 

Command handler for the CASServerCACertFile directive.

Parameters:
cmd the directive given by the configuration file
dummy not used.
word the parameter of the directive
Returns:
always NULL (success)

const char* cas_read_CASServerHostname cmd_parms *  cmd,
void *  dummy,
const char *  word
 

Command handler for the CASServerHostname directive.

Parameters:
cmd the directive given by the configuration file
dummy not used.
word the parameter of the directive
Returns:
always NULL (success)

const char* cas_read_CASServerPort cmd_parms *  cmd,
void *  dummy,
const char *  word
 

Command handler for the CASServerPort directive.

Parameters:
cmd the directive given by the configuration file
dummy not used.
word the parameter of the directive
Returns:
always NULL (success)

const char* cas_read_CASServerVersion cmd_parms *  cmd,
void *  dummy,
const char *  word
 

Command handler for the CASServerVersion directive.

Parameters:
cmd the directive given by the configuration file
dummy not used.
word the parameter of the directive
Returns:
always NULL (success)

int cas_read_url char *  url,
char *  ca_cert_filename,
char *  header_buf,
int  header_buf_len,
int *  header_buf_full,
char *  body_buf,
int  body_buf_len,
int *  body_buf_full,
char **  err_msg
[static]
 

This function is used to retrieve remote URLs.

Parameters:
url the URL to retrieve.
ca_cert_filename a file containing a PEM certificate that will be used to check the server's certificate (not used when NULL).
header_buf a buffer to get the header of the response. If header_buf is NULL, nothing will be written to it.
header_buf_len the length of the header buffer.
header_buf_full a pointer to a flag that will be set to 1 if the header of the response is not large enough to fit into header_buf.
body_buf a buffer to get the body of the response.If body_buf is NULL, nothing will be written to it.
body_buf_len the length of the body buffer.
body_buf_full a pointer to a flag that will be set to 1 if the body of the response is not large enough to fit into body_buf.
err_msg a pointer to a string set on failure (NULL otherwise)
Returns:
1 on success, 0 otherwise (in this later case, err_msg points to an error message.
Note:
this function follows redirections. In this case, all the headers recieved at each request are added to the previous ones!

int cas_read_url_body char *  url,
char *  ca_cert_filename,
char *  body_buf,
int  body_buf_len,
int *  body_buf_full,
char **  err_msg
[static]
 

This function is used to retrieve the body of a remote URL.

Parameters:
url the URL to retrieve.
ca_cert_filename a file containing a PEM certificate that will be used to check the server's certificate (not used when NULL).
body_buf a buffer to get the body of the response.If body_buf is NULL, nothing will be written to it.
body_buf_len the length of the body buffer.
body_buf_full a pointer to a flag that will be set to 1 if the body of the response is not large enough to fit into body_buf.
err_msg a pointer to a string set on failure (NULL otherwise)
Returns:
1 on success, 0 otherwise (in this later case, err_msg points to an error message.

void cas_url_buffer_close cas_url_buffer cub  ) 
 

close a cas_url_buffer structure by adding a trailing '\0' to its internal buffer..

Parameters:
cub a pointer to the structure to initialize.
Note:
if cub is NULL, nothing is done.

void cas_url_buffer_init cas_url_buffer cub,
char *  buf,
int  len,
int *  full
 

initialize a cas_url_buffer structure.

Parameters:
cub a pointer to the structure to initialize.
buf a pointer to what should be used as an internal buffer for the cub structure.
len the length of the the buffer.
full a pointer to a flag that will be set when the buffer is full (this flag will be used for error handling).
Note:
if buf is NULL, the structure is initialized, but nothing will be written to it afterward.

size_t cas_url_buffer_write cas_url_buffer cub,
void *  ptr,
int  size
[static]
 

writes to a cas_url_buffer structure.

Parameters:
cub a pointer to the structure to write to.
*ptr a pointer do the adta to write to b
size the number of bytes to write.
Returns:
the number of bytes written
Note:
if cub->buffer is NULL, nothing is done, but the function returns the number of bytes that should have been written just as if everything had gone right.

int cas_validate request_rec *  r,
char *  ticket,
char *  service,
char *  outbuf,
int  outbuflen
 

Returns status of ticket by filling 'outbuf' with a NetID if the ticket is valid and outbuf is large enough.

Parameters:
r the request.
ticket the ticket to validate.
service the URL to reach
outbuf the buffer to be filled with the NetID.
outbuflen the length of the buffer.
Returns:
1 if outbuf has been filled with the NetID, 0 otherwise.

size_t cas_write_data void *  ptr,
size_t  size,
size_t  nmemb,
void *  cub
[static]
 

This function is used by cas_read_url() to write incoming data. In our scheme, we fill the internal buffer of a cas_url_buffer structure provided thanks to the stream parameter.

Parameters:
ptr the address of the data to write.
size the size of an element to write.
nmemb the number of elements to write.
cub a pointer to the cas_url_buffer where to write.
Returns:
the number of bytes written.
Note:
if cub is NULL, nothing is written but the function return the number of bytes that should have been written.

int main int  argc,
char **  argv
 


Generated on Thu Jun 26 14:33:06 2003 for mod_cas by doxygen1.3