OSI/MHS Management Programming Manual
Examples
OSI/MHS Management Programming Manual—424824-001
C-32
Example in C
 * It illustrates the use of the MTA password server interface and the
 * MS password server interface to maintain and authenticate passwords.
 *
 * This example mainly illustrates the tasks involved in decoding the SPI
 * formatted requests, in validating the requests and in formatting the
 * SPI responses. It does not include any additional recommended features,
 * for example, validating the security of processes that open this process.
 *
 * This program performs the validation of OSI addresses for Bind
 * requests from MS appls, irrespective of whether they come via the LO
 * or the RS groups.
 *
 * Error Handling: There are two types of errors - fatal and non-fatal.
 * Errors involving any operation on $RECEIVE are considered fatal. Errors
 * in the SPI requests or in accessing the SQL tables are considered
 * non-fatal. An error message is written to the STDOUT file for all errors.
 * Fatal errors also cause the program to abend.
 *
 * This program uses the following two SQL tables:
 * MSPWTABL - MS password authentication table
 * MTPWTABL - MTA password authentication table
 *
 * These tables must be created before running this example. An example
 * macro for creating them is in EXPSWTL1.
 *
 * All accesses to these tables are bounded by TMF transactions.
 *
 * All passwords are stored blank filled. Incoming passwords are copied
 * into a blank filled temporary variable before comparison. Passwords
 * sent out in responses are also blank filled.
*/
#pragma inspect, symbols, runnable, nowarn (93)
#pragma nolist
#pragma sql wheneverlist
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>
#pragma list
#pragma nolist
#include "$system.zspidef.zspic"
#include "$system.zspidef.zmhsc"
#pragma list
#pragma nolist
#include "$system.system.cextdecs"
#pragma list
/***************************************************************************/
/* DATA DECLARATIONS */
/***************************************************************************/
typedef enum {FALSE, TRUE} bool;
#define RCV_DEPTH 10
#define VALID_REQUEST 1
#define PASSW_CMD 0
#define TKN_NOT_PRESENT_ERROR -8
#define BLANKS 0x2020
#define SQL_ROW_NOT_FOUND_ERROR 100
#define STRNEQUAL(a,b) (strncmp ((a), (b), sizeof ((b))) == 0)
#define PASSW_ERROR_RSP 0
#define PASSW_OK_RSP 1










