OSI/MHS Management Programming Manual
Examples
OSI/MHS Management Programming Manual—424824-001
C-46
Example in C
* row into the response password.
*/
switch (passw_command)
{
case ZMHS_VAL_PASSW_MTA_REQUEST :
rsp_passw_out->zlength = sizeof (rsp_passw_out->zstring);
memcpy (rsp_passw_out->zstring,
mtpwtabl_row.our_password,
rsp_passw_out->zlength);
break;
case ZMHS_VAL_PASSW_MTA_INDICATION :
*req_valid = STRNEQUAL (mtpwtabl_row.their_password,
req_password.zstring);
break;
case ZMHS_VAL_PASSW_MTA_RESPONSE :
rsp_passw_out->zlength = sizeof (rsp_passw_out->zstring);
memcpy (rsp_passw_out->zstring,
mtpwtabl_row.our_password_rsp,
rsp_passw_out->zlength);
break;
case ZMHS_VAL_PASSW_MTA_CONFIRM :
*req_valid = STRNEQUAL (mtpwtabl_row.their_password_rsp,
req_password.zstring);
break;
} /* end switch (passw_command) */
return (sql_error);
} /* validate_mta_request */
/***************************************************************************/
/* Function: alter_mspwtabl_row_passw */
/* Usage : error = alter_mspwtabl_row_passw (appl_name, */
/* new_passw_in, */
/* old_passw_in, */
/* passw_updated) */
/* Parameters: appl_name INPUT */
/* new_passw_in INPUT */
/* old_passw_in INPUT */
/* passw_updated OUTPUT */
/*-------------------------------------------------------------------------*/
/* Alter the password in a MSPWTABL row in response to a Register-MS */
/* request. Select the row corresponding to the APPL name. If the password */
/* in the row matches the old password, update the password and set */
/* passw_updated to TRUE. If the password does not match or there is an */
/* error, set pass_updated to FALSE. Return any SQL error (except row not */
/* found) as the error code. */
/***************************************************************************/
int alter_mspwtabl_row_passw (zmhs_ddl_appl_name_def *appl_name,
zmhs_ddl_passw_def *new_passw_in,
zmhs_ddl_old_passw_def *old_passw_in,
bool *passw_updated)
{
int sql_error;
zmhs_ddl_passw_def new_password;
zmhs_ddl_old_passw_def old_password;
sql_error = 0;
*passw_updated = FALSE;
memset (&mspwtabl_row, BLANKS, sizeof (mspwtabl_row));
memcpy (mspwtabl_row.appl_name, appl_name, sizeof
(zmhs_ddl_appl_name_def));
memset (&new_password, BLANKS, sizeof (zmhs_ddl_passw_def));