Example: ILE C/400 user exit program for exit point QIBM_QZDA_INIT

The following ILE C/400 program handles IBM® i Access ODBC security by rejecting requests from certain users. It can be used as a shell for developing exit programs tailored for your operating environment.

/******************************************************************/
/*             Sample Exit Program                                */
/*                                                                */
/*     Exit Point Name         : QIBM_QZDA_INIT                   */
/*                                                                */
/*     Description      : The following ILE C Language program    */
/*                        handles ODBC security by rejecting      */
/*                        requests from users who use ODBC and    */
/*                        signon using a user profile of 'GUEST'. */
/*                        It can be used as a shell  program      */
/*                        for developing exit programs tailored   */
/*                        for your environment.                   */
/******************************************************************/
#include <stdio.h> 
#include <string.h> 
#include <ezdaep.h>           /* ZDA exit program formats */
main(int argc, char *argv[])
  {
   Qzda_Init_Format_t input;           /* input format          */


  /**************************************************************/
  /* Copy format parameter to local storage                     */
  /**************************************************************/
  memcpy(&amp;input,(Qzda_Init_Format_t *) argv[2],
             sizeof(Qzda_Init_Format_t));

  /**************************************************************/
  /* If user profile is 'GUEST' and interface type is 'ODBC'    */
  /* reject the connection.                                     */
  /**************************************************************/
  if (memcmp(input.User_Profile,"GUEST     ",10)==0 &&
       memcmp(input.Interface_Type,"ODBC",4) == 0)
  /**************************************************************/
  /* Reject the connection.                                     */
  /**************************************************************/
    strcpy(argv[1],"0");
  else
  /**************************************************************/
  /* Allow the connection.                                      */
  /**************************************************************/
    strcpy(argv[1],"1");
  return;
  }