[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::axp-developer

Title:Alpha Developer Support
Notice:[email protected], 800-332-4786
Moderator:HYDRA::SYSTEM
Created:Mon Jun 06 1994
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3722
Total number of notes:11359

3333.0. "ESI Technology" by HYDRA::DORHAMER () Mon Mar 17 1997 16:58

    Company Name :  ESI Technology
    Contact Name :  Steven Popkes
    Phone        :  508-651-1400
    Fax          :  
    Email        :  [email protected]  (one e-mail account for whole company
    Date/Time in :  17-MAR-1997 16:54:55
    Entered by   :  Karen Dorhamer
    SPE center   :  MRO

    Category     :  VMS
    OS Version   :  6.2
    System H/W   :  


    Brief Description of Problem:
    -----------------------------

Steve is using DCE v1.4 and his code is getting an access violation when
making a DCE call.  He believes that the parameters that he is passing
are all correct.
T.RTitleUserPersonal
Name
DateLines
3333.1please send e-mail with code fragmentHYDRA::DORHAMERMon Mar 17 1997 17:065
    I asked Steve to send (e-mail) a code fragment plus the error message that 
    he is receiving so that I can ask DCE engineering for help with this
    problem.
    
    Karen
3333.2ESI TechnologyHYDRA::TALATINIANTue Mar 18 1997 09:23830
Date:	17-MAR-1997 17:42:34.70
From:	SMTP%"[email protected]"
Subj:	dce problem
To:	Karen Dorhamer <[email protected]>
CC:	
790 records, external message id MAIL$16830F850005009B.MAI
Attributes: None
Return-Path: [email protected]
Received: by asimov.mro.dec.com (UCX V4.1-12, OpenVMS V6.2 VAX);
	Mon, 17 Mar 1997 17:42:31 -0500
Received: from pobox1.pa.dec.com by fluid.mro.dec.com
(5.65v4.0/1.1.8.2/19Nov96-0448PM)
	id AA07066; Mon, 17 Mar 1997 17:42:43 -0500
Received: by pobox1.pa.dec.com; id AA02353; Mon, 17 Mar 97 14:42:43 -0800
Received: from arl-img-5.compuserve.com by mail1.digital.com (5.65 EXP 4/12/95
for V3.2/1.0/WV)
	id AA27955; Mon, 17 Mar 1997 14:36:20 -0800
Received: by arl-img-5.compuserve.com (8.6.10/5.950515)
	id RAA14929; Mon, 17 Mar 1997 17:36:19 -0500
Date: 17 Mar 97 17:32:57 EST
From: Esi Technology Corp <[email protected]>
To: Karen Dorhamer <[email protected]>
Subject: dce problem
Message-Id: <[email protected]>

TO:     Karen Dorhamer, Digital, [email protected]

FROM:   Steven Popkes, Esi Technology
        508 651 1400, voice
        508 651 0708, fax
        [email protected]

RE:     dce problem

Karen:

Enclosed is the .h and .cpp file of the security object I am trying to get to
work. I've
included it in the mail directly instead of as an attachment. We've had some
trouble with
attachments over Compuserve. The behavior is as follows:

   1) the calling object creates the CRpcSecurity object, passing in a callback
address

   2) the calling object calls into CRpcSecurity via the InitSecurity call. The
parameters
      are shown. If no name is passed in, then no security is initialized.
However,
      if a principle name is passed in, the login process is initialized as
shown in the
      code. Currently, I'm using the following parameters:
         protection level    connect
         authentication      dce_secret
         authorization       dce

   3) the calling object is the actual server code. After CRpcSecurity is
initialized,
      the calling object sets up the listen (see code at bottom)

   4) the initialization of security by the CRpcSecurity object spins off two
threads:
      1) SecurityRefreshIdentity, which refreshes the login context
appropriately. This
         seems to operate effectively
      2) SecurityRefreshKey, which changes the secret key.

   5) shortly after SecurityRefreshKey starts up, but usually after the listen
is started
      by the server code, the process aborts with the following message:
          %CMA-F-EXCCOP, exception raised; VMS condition code follows
          -SYSTEM-F-ACCVIO, access violation, reason mask=04, virtual
address=00920000, PC
          =8048EC98, PS=0000001B

   6) I've narrowed it down to the call in SecurityRefreshKey by the last
components
      of the trace. Also, if the call to sec_key_mgmt_manage_key is commented
out and
      the rest of the code remains the same the server operates correctly. The
last
      section of the trace reads:
         s0:ss0 registering authorization information
         s0:ss0:s0 security name = EsiServer0
         s0:ss0:s0 authn service = 1
         s0:ss0: authorization status = 0
         s0:ss0:max calls = 25
         s0: ss0: starting listen
         crs:sri: entering security refresh id thread
         crs:sri: getting expiration date
         crs:gedt: entering get expiration date
         crs:sg: security gate value/status = 1/0
         crs:sri: waiting 46197 seconds
         crs:srk:entering security refresh key
         crs:srk:security name = EsiServer0
         crs:srk:security keytab = (null)
         crs:srk:waiting 10 seconds
         crs:srk:wait ended
         crs:srk: making key management call
 
   7) I suspect there's something I'm not doing correctly. If you want me to
I'll be
      happy to walk you through what I'm doing in the code. The DCE state of the
system
      is:
          DCE is up and running
          dce_login was executed and the principal logged on
          the principal was empowered handle these procedures


Steven Popkes

================================================================================
========
================================================================================
========
=================== .H INCLUDE FILE OF RPC_SEC OBJECT
==================================
================================================================================
========
================================================================================
========

#ifndef _RPC_SEC_H_
#define _RPC_SEC_H_

#include <pthread.h>
#include <time.h>
#include <timeb.h>
#include "esitype.h"
#include "esirpc.h"

typedef void (*ESIRETFUNC)(BOOL);

extern "C" void* SecurityRefreshIdentity(pthread_addr_t pTemp);
extern "C" void* SecurityRefreshKey(pthread_addr_t pTemp);

class CRpcSecurity{
public:
  CRpcSecurity(ESIRETFUNC pReturn = NULL);
  ~CRpcSecurity();

  BOOL       SecurityCheck();
  BOOL       InitSecurity(char** gv);

private:
  void       SecurityGate(BOOL bState,ESISTATUS status);
  BOOL       ProcessSecurityLogin(char*               pName,
                                  sec_login_handle_t* pLoginContext);
  char*      CopyString(char* pszText);
  void       DeleteString(char** pszText);
  ESISTATUS  GetExpirationDelayTime(signed32 *delay_time);
  ESISTATUS  RefreshIdentity();
  BOOL       StartThreads();
  void       StopThreads();
  void       SecurityFail();

  pthread_t          m_IdRefreshThread;
  pthread_t          m_KeyRefreshThread;

  BOOL               m_bRefreshId;
  BOOL               m_bRefreshKey;
  BOOL               m_bSecurityGate;

  ESISTATUS          m_esSecurityStatus;

  unsigned32         m_iAuthnService;
  unsigned32         m_iAuthzService;
  unsigned32         m_iProtLevel;

  sec_login_handle_t m_login_context;

  char*              m_pszAuthnService;
  char*              m_pszAuthzService;
  char*              m_pszKeyTab;
  char*              m_pszProtLevel;
  char*              m_pszSecurityName;
  ESIRETFUNC         m_pSecurityFailReturn;

  friend void* SecurityRefreshIdentity(pthread_addr_t pTemp);
  friend void* SecurityRefreshKey(pthread_addr_t pTemp);
};

#endif


================================================================================
========
================================================================================
========
=================== EXECUTING CODE OF RPC_SEC OBJECT
===================================
================================================================================
========
================================================================================
========
#include "esivms.h"
#include "esimacro.h"

#include "RPC_SEC.H"

extern "C" {
//=============================================================
void* SecurityRefreshIdentity(pthread_addr_t pTemp)
{
   signed32         delay_time;
   timespec         t_val;
   error_status_t   status;
   CRpcSecurity    *pRpcSec;

   ESITRACE0("crs:sri: entering security refresh id thread\n");
   pRpcSec = (CRpcSecurity*)pTemp;

   pRpcSec->m_bRefreshId = FALSE;
   while (1)
   {
     ESITRACE0("crs:sri: getting expiration date\n");
     status = pRpcSec->GetExpirationDelayTime(&delay_time);
     if (status)
     {
       break;
     }
     else
     {
       pRpcSec->m_bRefreshId = TRUE;
        ESITRACE1("crs:sri: waiting %i seconds\n",delay_time);
       t_val.tv_sec = delay_time;
       t_val.tv_nsec = 0;
       pthread_delay_np(&t_val);
       ESITRACE0("crs:src: wait complete. refreshing identity\n");
       status = pRpcSec->RefreshIdentity();
       if (status)
         break;
     }
   }

   pRpcSec->SecurityGate(FALSE,status);
   pRpcSec->SecurityFail();
   return (void*) status;
}

//=============================================================
void* SecurityRefreshKey(pthread_addr_t pTemp)
{
  timespec            t_val;
  error_status_t      status;
  CRpcSecurity       *pRpcSec;

  ESITRACE0("crs:srk:entering security refresh key\n");
  pRpcSec = (CRpcSecurity*)pTemp;
  pRpcSec->m_bRefreshKey = TRUE;

  ESITRACE1("crs:srk:security name = %s\n",pRpcSec->m_pszSecurityName);
  ESITRACE1("crs:srk:security keytab = %s\n",pRpcSec->m_pszKeyTab);
  ESITRACE0("crs:srk:waiting 10 seconds\n");
  t_val.tv_sec = 10;
  t_val.tv_nsec = 0;
  pthread_delay_np(&t_val);
  ESITRACE0("crs:srk:wait ended\n");

  while (1)
  {
//    TRY
//    {
//      ESITRACE0("crs:srk: making key management call\n");
      sec_key_mgmt_manage_key(rpc_c_authn_dce_secret,
                              NULL,
                              (idl_char*)pRpcSec->m_pszSecurityName,
                              &status);
      ESITRACE0("crs:srk: successful key management call\n");
//    }
//    CATCH_ALL
//    {
//      ESITRACE0("crs:srk:exception from sec call\n");
//      status = ESISTAT_GENFAILURE;
//    }
//    ENDTRY

    ESITRACE1("crs:srk: status check = %i\n",status);

    if (!CHECK_STATUS(status))
    {
      if (status != ESISTAT_GENFAILURE)
        PRINT_STATUS(status,"crs:srk:problem with key refresh:");
      break;
    }
  }

  pRpcSec->SecurityGate(FALSE,status);
  pRpcSec->SecurityFail();
  return (void*) status;
}
} //end extern
//=============================================================
CRpcSecurity::CRpcSecurity(ESIRETFUNC pReturn)
{
  SecurityGate(FALSE,0);
  m_pszSecurityName = NULL;
  m_bRefreshId = FALSE;
  m_bRefreshKey = FALSE;
  m_pszProtLevel = NULL;
  m_pszAuthnService = NULL;
  m_pszAuthzService = NULL;
  m_pszKeyTab = NULL;
  m_iProtLevel = rpc_c_protect_level_none;
  m_iAuthnService =  rpc_c_authn_none;
  m_iAuthzService = rpc_c_authz_none;
  m_pSecurityFailReturn = pReturn;
}

//=============================================================
CRpcSecurity::~CRpcSecurity()
{
   StopThreads();
   DeleteString(&m_pszProtLevel);
   DeleteString(&m_pszAuthnService);
   DeleteString(&m_pszAuthzService);
   DeleteString(&m_pszKeyTab);
   SecurityFail();
}
//=============================================================
void CRpcSecurity::SecurityFail()
{
   if (m_pSecurityFailReturn != NULL)
   {
     (*m_pSecurityFailReturn)(m_bSecurityGate);
   }
}
//=============================================================
void CRpcSecurity::SecurityGate(BOOL bState,ESISTATUS status)
{
  ESITRACE2("crs:sg: security gate value/status = %i/%i\n",bState,status);
  m_bSecurityGate = bState;
  m_esSecurityStatus = status;
}
//=============================================================
BOOL CRpcSecurity::SecurityCheck()
{
  return m_bSecurityGate;
}
//=============================================================
BOOL CRpcSecurity::InitSecurity(char** gv)
{
    //gv[0]:Security Name
    //gv[1]:protection level
    //gv[2]:authentication service
    //gv[3]:authorization service
    //gv[4]:keytab directory

    BOOL                bRV = TRUE;
    
    ESITRACE0("crs:is:entering init security\n");
    m_pszSecurityName = NULL;

    if (strcmp(gv[0],"0") != 0)
    {
      m_pszSecurityName = CopyString(gv[0]);
    }
    else
    {
      ESITRACE0("crs:is: no security requested\n");
      SecurityGate(TRUE,ESISTAT_SUCCESS);
      return m_bSecurityGate;
    }

    ESITRACE1("crs:is: security name = %s\n",m_pszSecurityName);
    ESITRACE1("crs:is: prot level = %s\n",gv[1]);
    ESITRACE1("crs:is: authentication service = %s\n",gv[2]);
    ESITRACE1("crs:is: authorization service = %s\n",gv[3]);
    ESITRACE1("crs:is: key tab = %s\n",gv[4]);

    m_pszProtLevel =    CopyString(gv[1]);
    m_pszAuthnService = CopyString(gv[2]);
    m_pszAuthzService = CopyString(gv[3]);
    if (strcmp(gv[4],"0") == 0)
    {
      m_pszKeyTab = NULL;
    }
    else
    {
      m_pszKeyTab = CopyString(gv[4]);
    }
    sscanf(gv[1],"%i",&m_iProtLevel);
    sscanf(gv[2],"%i",&m_iAuthnService);
    sscanf(gv[3],"%i",&m_iAuthzService);

    bRV = ProcessSecurityLogin(m_pszSecurityName,&m_login_context);

    ESITRACE1("crs:is: psl returned boolean = %i\n",bRV);
    if (bRV)
    {
      bRV = StartThreads();
    }

    return bRV;
}    
//=============================================================
BOOL CRpcSecurity::ProcessSecurityLogin(char*               pName,
                                    sec_login_handle_t* pLoginContext)
{
  sec_login_auth_src_t      auth_src;
  void*                     server_key;
  error_status_t            status,status2;
  boolean32                 identity_valid;
  boolean32                 reset_passwd;
  BOOL                      bRV = FALSE;
  sec_login_handle_t        login_context;
 
  if (pName == NULL)
  {
    *pLoginContext = NULL;
    ESITRACE0("crs:psl: no security\n");
    return TRUE;
  }

  *pLoginContext = NULL;

  ESITRACE0("crs:psl: security attempted\n");
  bRV = FALSE;

  sec_login_setup_identity((unsigned char*)pName,
                           sec_login_no_flags,
                           &login_context,
                           &status);

  if (CHECK_STATUS(status))
  {
    sec_key_mgmt_get_key(rpc_c_authn_dce_secret,
                         m_pszKeyTab,
                         (unsigned char*)pName,
                         0,
                         &server_key,
                         &status);
    if (CHECK_STATUS(status))
    {
//      identity_valid = sec_login_validate_identity(login_context,
//                                          (sec_passwd_rec_t *)server_key,
//                                          &reset_passwd,
//                                          &auth_src,
//                                          &status);
      identity_valid = sec_login_valid_and_cert_ident(login_context,
                                          (sec_passwd_rec_t *)server_key,
                                          &reset_passwd,
                                          &auth_src,
                                          &status);
      sec_key_mgmt_free_key(&server_key,&status2);
      if (CHECK_STATUS(status2))
      {
        if (identity_valid)
        {
          if (auth_src == sec_login_auth_src_network)
          {
            sec_login_set_context(login_context,&status);
            if (CHECK_STATUS(status))
            {
              bRV = TRUE;
              *pLoginContext = login_context;
            }
          }
          else
          {
            PRINT_STATUS(status,"crs:psl:unable to set login context,");
          }
        }
        else
        {
          PRINT_STATUS(status,"crs:psl:identity not valid,");
        }
      }
      else
      {
        PRINT_STATUS(status2,"crs:psl:unable to free key,");
      }
    }
    else
    {
      PRINT_STATUS(status,"crs:psl:unable to get key,");
    }
  }
  else
  {
    PRINT_STATUS(status,"crs:psl:unable to set up identity,");
  }

  ESITRACE1("crs:psl: server startup status = %i\n",bRV);

  SecurityGate(bRV,status);
  return bRV;
}

//=============================================================
char* CRpcSecurity::CopyString(char* pszText)
{
  char*    pszRV = NULL;

  if (pszText != NULL)
  {
    pszRV = (char*) malloc(strlen(pszText) + 1);
    strcpy(pszRV,pszText);
  }

  return pszRV;
}
//=============================================================
void CRpcSecurity::DeleteString(char** pszText)
{
  char*    pszChar;

  pszChar = *pszText;

  if (pszChar != NULL)
  {
    delete(pszChar);
    pszChar = NULL;
    *pszText = pszChar;
  }
}
//=============================================================
ESISTATUS  CRpcSecurity::GetExpirationDelayTime(signed32 *delay_time)
{
  signed32        expiration;
  timeb_t         current_time;
  signed32        difftime;
  signed32        lDelay = 0;
  ESISTATUS       status;

  ESITRACE0("crs:gedt: entering get expiration date\n");
  sec_login_get_expiration(m_login_context,&expiration,&status);

  if (CHECK_STATUS(status))
  {
    ftime(&current_time);
    difftime = expiration - current_time.time;
    if (difftime > 0)
    {
      lDelay = difftime - 600;
      if (lDelay < 0)
        lDelay = 0;
    }
    else
    {
      lDelay = 0;
    }
  }
  else
  {
    PRINT_STATUS(status,"crs:gedt:problem getting expiration time:")
  }

  if (CHECK_STATUS(status))
  {
    SecurityGate(TRUE,status);
  }
  else
  {
    SecurityGate(FALSE,status);
  }

  *delay_time = lDelay;
  return status;
}
//=============================================================
ESISTATUS  CRpcSecurity::RefreshIdentity()
{
  sec_login_auth_src_t      auth_src;
  void*                     server_key;
  error_status_t            status;
  error_status_t            status2;
  boolean32                 identity_valid;
  boolean32                 reset_passwd;
  

  ESITRACE0("crs:ri: entering refresh identity\n");
  sec_login_refresh_identity(m_login_context,&status);
  
  if (CHECK_STATUS(status))
  {
    sec_key_mgmt_get_key(rpc_c_authn_dce_secret,
                         m_pszKeyTab,
                         (unsigned char*)m_pszSecurityName,
                         0,
                         &server_key,
                         &status);
    if (CHECK_STATUS(status))
    {
      identity_valid = sec_login_validate_identity(m_login_context,
                                          (sec_passwd_rec_t *)server_key,
                                          &reset_passwd,
                                          &auth_src,
                                          &status);
      
      sec_key_mgmt_free_key(&server_key,&status2);

      if (!CHECK_STATUS(status))
      {
        PRINT_STATUS(status,"crs:ri: problem validating login:");
      }
      else
      {
        if (!CHECK_STATUS(status2))
        {
          status = status2;
          PRINT_STATUS(status,"crs:ri: problem freeing management key:");
        }
      }
    }
    else
    {
      PRINT_STATUS(status,"crs:ri: problem getting management key:");
    }
  }
  else
  {
    PRINT_STATUS(status,"crs:ri: problem refreshing identity:");
  }

  if (CHECK_STATUS(status))
  {
    SecurityGate(TRUE,status);
  }
  else
  {
    SecurityGate(FALSE,status);
  }

  return status;
}

//=============================================================
BOOL CRpcSecurity::StartThreads()
{
  int            stts;
  BOOL           bRV = TRUE;

  ESITRACE0("crs:st:starting threads\n");
  stts = pthread_create(
                   &m_IdRefreshThread,
                   pthread_attr_default,
                   SecurityRefreshIdentity,
                   (void*)this);
  if (!stts)
  {
    stts = pthread_create(
                     &m_KeyRefreshThread,
                     pthread_attr_default,
                     SecurityRefreshKey,
                     (void*)this);
    ESITRACE1("crs:st:key refresh thread start status = %i\n",stts);
    if (!stts)
    {
      bRV = TRUE;
    }
  }
  
  return bRV;
}
//=============================================================
void CRpcSecurity::StopThreads()
{
  ESITRACE0("crs:st: stopping threads\n");
  if (m_bRefreshId)
    pthread_cancel(m_IdRefreshThread);

  if (m_bRefreshKey)
    pthread_cancel(m_KeyRefreshThread);
}

================================================================================
========
================================================================================
========
=================== EXECUTING CODE CALLING RPC_SEC OBJECT
==============================
================================================================================
========
================================================================================
========
//=============================================================
void CServer0::StartServer0(int gc, char **gv)
{
  RPC_STATUS      status;
  unsigned char * SecurityDescript   = NULL;

  ESITRACE0("s0:ss0: initating security\n");
  m_bAllowServer = InitSecurity(gv);

  if (m_bAllowServer == FALSE)
  {
    ESITRACE0("s0:ss0: security failed\n");
    ESITRACE0("s0:ss0: server startup not allowed\n");
    return;
  }

  ESITRACE1("s0: ss0: ProtSeq =  |%s|\n",(char*)m_pszProtocol);
  ESITRACE1("s0: ss0: Endpoint = |%s|\n",(char*)m_server0Port);
  ESITRACE1("s0: ss0: Address =  |%s|\n",(char*)m_server0Address);
  ESITRACE1("s0: ss0: maxcalls = |%i|\n",m_iS0MaxCalls); 

  ESITRACE0("s0: ss0: server use\n");
  rpc_server_use_protseq_ep( m_pszProtocol,
                             (unsigned int)m_iS0MaxCalls,
                             (unsigned char*)m_server0Port,
                             &status);

  if (CHECK_STATUS(status))
  {
    ESITRACE0("s0: ss0: register\n");
    rpc_server_register_if( Server0_v1_0_s_ifspec,  //chek after producing .h
                            NULL,
                            NULL,
                            &status);

    if (CHECK_STATUS(status))
    {
      if (m_S0SecurityName != NULL)
      {
        ESITRACE0("s0:ss0 registering authorization information\n");
        ESITRACE1("s0:ss0:s0 security name = %s\n",m_S0SecurityName);
        ESITRACE1("s0:ss0:s0 authn service = %i\n",m_iS0AuthnService);
        rpc_server_register_auth_info((unsigned char *) m_S0SecurityName,
                                      m_iS0AuthnService,
                                      NULL,
                                      NULL,
                                      &status);
        ESITRACE1("s0:ss0: authorization status = %i\n",status);
        if (!CHECK_STATUS(status))
        {
          PRINT_STATUS(status,"s0:ss0: failure of authorization,");
        }
      }
      else
      {
        ESITRACE0("s0:ss0: running without security\n");
      }
 
      if (CHECK_STATUS(status))
      {
        m_bOperational = TRUE;
        ESITRACE1("s0:ss0:max calls = %i\n",m_iS0MaxCalls);
        ESITRACE0("s0: ss0: starting listen\n");
        rpc_server_listen(m_iS0MaxCalls, &status);
        ESITRACE0("s0:ss0:listen exited\n");
        m_bOperational = FALSE;
        if (!CHECK_STATUS(status))
          PRINT_STATUS(status,"s0:ss0:listen problem:\n");
      } 
    }
    else
    {
      PRINT_STATUS(status,"s0:ss0:problem with reg. if:");
    }
  }
  else
  {
    PRINT_STATUS(status,"s0:ss0: problem with use: ");
  }
}

//=============================================================
BOOL CServer0::InitSecurity(char** gv)
{
    //gv[9]: S0 Security Name
    //gv[10]:S0 protection level
    //gv[11]:S0 authentication service
    //gv[12]:S0 authorization service
    //gv[13]:GT Security Name
    //gv[14]:GT protection level
    //gv[15]:GT authentication service
    //gv[16]:GT authorization service
    //gv[17]:keytab directory
    //gv[18]:interval
    //gv[19]:lifespan

    BOOL                      bRV = TRUE;
    char*                    xgv[5];

    xgv[0] = gv[9];    //security name
    xgv[1] = gv[10];   //protection level
    xgv[2] = gv[11];   //authentication level
    xgv[3] = gv[12];   //authorization level
    xgv[4] = "0";     //key tab

    m_pRpcSecurity = new CRpcSecurity(SecurityFailNotify);

    bRV = m_pRpcSecurity->InitSecurity(xgv);

    if (!bRV)
    {
      return bRV;
    }

    m_S0SecurityName = NULL;

    if (strcmp(gv[9],"0") != 0)
    {
      m_S0SecurityName = gv[9];
    }
    ESITRACE1("s0:is: s0 security name = %s\n",m_S0SecurityName);
    ESITRACE1("s0:is: s0 prot level = %s\n",gv[10]);
    ESITRACE1("s0:is: s0 authentication service = %s\n",gv[11]);
    ESITRACE1("s0:is: s0 authorization service = %s\n",gv[12]);

    m_cS0ProtLevel =    gv[10];
    m_cS0AuthnService = gv[11];
    m_cS0AuthzService = gv[12];
    sscanf(gv[10],"%i",&m_iS0ProtLevel);
    sscanf(gv[11],"%i",&m_iS0AuthnService);
    sscanf(gv[12],"%i",&m_iS0AuthzService);

    m_GTSecurityName = NULL;
    if (strcmp(gv[13],"0") != 0)
    {
      m_GTSecurityName = gv[13];
    }
    ESITRACE1("s0:is: GT security name = %s\n",m_GTSecurityName);
    ESITRACE1("s0:is: GT prot level = %s\n",gv[14]);
    ESITRACE1("s0:is: GT authentication service = %s\n",gv[15]);
    ESITRACE1("s0:is: GT authorization service = %s\n",gv[16]);

    m_cGTProtLevel =    gv[14];
    m_cGTAuthnService = gv[15];
    m_cGTAuthzService = gv[16];

    sscanf(gv[14],"%i",&m_iGTProtLevel);
    sscanf(gv[15],"%i",&m_iGTAuthnService);
    sscanf(gv[16],"%i",&m_iGTAuthzService);

    return bRV;
}    

3333.3asking for help in DCE notes fileHYDRA::DORHAMERWed Mar 19 1997 10:094
    I've entered a note (2193) in the DCE-PRODUCTS notes file asking for
    help with Steve's DCE problem.
    
    Karen
3333.4no response from DCE notes fileHYDRA::DORHAMERFri Mar 28 1997 09:336
    I have not received any response from the DCE notes file, so I asked
    Steve to send the full source to reproduce the problem.  The next
    two notes contain the source and command file to build an image that
    demonstrates the problem.
    
    Karen
3333.5source code, 1 of 2HYDRA::DORHAMERFri Mar 28 1997 09:331105
From:	HYDRA::AXPDEVELOPER "[email protected]" 27-MAR-1997 15:09:09.31
To:	DORHAMER
CC:	AXPDEVELOPER
Subj:	DCE info

From:	SMTP%"[email protected]" 27-MAR-1997 14:21:24.33
To:	karen dorhamer <[email protected]>
CC:	
Subj:	dce problem, letter #1 of 2

Return-Path: [email protected]
Received: by asimov.mro.dec.com (UCX V4.1-12, OpenVMS V6.2 VAX);
	Thu, 27 Mar 1997 14:21:20 -0500
Received: from mail12.digital.com by fluid.mro.dec.com (5.65v4.0/1.1.8.2/19Nov96-0448PM)
	id AA02307; Thu, 27 Mar 1997 14:21:23 -0500
Received: from pobox1.pa.dec.com by mail12.digital.com (8.7.5/UNX 1.5/1.0/WV)
	id MAA04990; Thu, 27 Mar 1997 12:33:02 -0500 (EST)
Received: by pobox1.pa.dec.com; id AA20033; Thu, 27 Mar 97 09:31:46 -0800
Received: from dub-img-5.compuserve.com by mail2.digital.com (5.65 EXP 4/12/95 for V3.2/1.0/WV)
	id AA01643; Thu, 27 Mar 1997 09:21:27 -0800
Received: by dub-img-5.compuserve.com (8.6.10/5.950515)
	id MAA24365; Thu, 27 Mar 1997 12:21:22 -0500
Date: 27 Mar 97 12:19:22 EST
From: Esi Technology Corp <[email protected]>
To: karen dorhamer <[email protected]>
Subject: dce problem, letter #1 of 2
Message-Id: <[email protected]>

TO:     Karen Dorhamer, Digital, [email protected]

FROM:   Steven Popkes, Esi Technology
        508 651 1400, voice
        508 651 0708, fax
        [email protected]

RE:     dce problem, letter 1 of 2

Karen:

I'm sending this in two letters.
Enclosed in this note are several files, each separated by uncommented "=="
lines. (See below this text.) They are:
  RPC_SEC.CPP
  RPC_SEC.H
  ESIRPC.H
  ESITYPE.H
  ESIMACRO.H
  ESIVMS.H
  SERVER0.IDL
  SERVER0.ACF
  RPCESITYPE.IDL
  REPESITYPE.ACF
  MAIN.CPP
  COMPILE.COM

Separate them out and use compile.com to build main. We are using the name
EsiServer0 to be registered with dce. The name should be added to the
cell.

Running MAIN should cause the problem.

stevep

========================================================================
====
======================= RPC_SEC.CPP
========================================
========================================================================
====
#include "esivms.h"
#include "esimacro.h"

#include "RPC_SEC.H"

extern "C" {
//=============================================================
void* SecurityRefreshIdentity(pthread_addr_t pTemp)
{
   signed32         delay_time;
   timespec         t_val;
   error_status_t   status;
   CRpcSecurity    *pRpcSec;

   ESITRACE0("crs:sri: entering security refresh id thread\n");
   pRpcSec = (CRpcSecurity*)pTemp;

   pRpcSec->m_bRefreshId = FALSE;
   while (1)
   {
     ESITRACE0("crs:sri: getting expiration date\n");
     status = pRpcSec->GetExpirationDelayTime(&delay_time);
     if (status)
     {
       break;
     }
     else
     {
       pRpcSec->m_bRefreshId = TRUE;
        ESITRACE1("crs:sri: waiting %i seconds\n",delay_time);
       t_val.tv_sec = delay_time;
       t_val.tv_nsec = 0;
       pthread_delay_np(&t_val);
       ESITRACE0("crs:src: wait complete. refreshing identity\n");
       status = pRpcSec->RefreshIdentity();
       if (status)
         break;
     }
   }

   pRpcSec->SecurityGate(FALSE,status);
   pRpcSec->SecurityFail();
   return (void*) status;
}

//=============================================================
void* SecurityRefreshKey(pthread_addr_t pTemp)
{
  timespec            t_val;
  error_status_t      status;
  CRpcSecurity       *pRpcSec;

  ESITRACE0("crs:srk:entering security refresh key\n");
  pRpcSec = (CRpcSecurity*)pTemp;
  pRpcSec->m_bRefreshKey = TRUE;

  ESITRACE1("crs:srk:security name = %s\n",pRpcSec->m_pszSecurityName);
  ESITRACE1("crs:srk:security keytab = %s\n",pRpcSec->m_pszKeyTab);
  ESITRACE0("crs:srk:waiting 10 seconds\n");
  t_val.tv_sec = 10;
  t_val.tv_nsec = 0;
  pthread_delay_np(&t_val);
  ESITRACE0("crs:srk:wait ended\n");

  while (1)
  {
//    TRY
//    {
      ESITRACE0("crs:srk: making key management call\n");
      sec_key_mgmt_manage_key(rpc_c_authn_dce_secret,
                              NULL,
                              (idl_char*)pRpcSec->m_pszSecurityName,
                              &status);
      ESITRACE0("crs:srk: successful key management call\n");
//    }
//    CATCH_ALL
//    {
//      ESITRACE0("crs:srk:exception from sec call\n");
//      status = ESISTAT_GENFAILURE;
//    }
//    ENDTRY

    ESITRACE1("crs:srk: status check = %i\n",status);

    if (!CHECK_STATUS(status))
    {
      if (status != ESISTAT_GENFAILURE)
        PRINT_STATUS(status,"crs:srk:problem with key refresh:");
      break;
    }
  }

  pRpcSec->SecurityGate(FALSE,status);
  pRpcSec->SecurityFail();
  return (void*) status;
}
} //end extern
//=============================================================
CRpcSecurity::CRpcSecurity(ESIRETFUNC pReturn)
{
  SecurityGate(FALSE,0);
  m_pszSecurityName = NULL;
  m_bRefreshId = FALSE;
  m_bRefreshKey = FALSE;
  m_pszProtLevel = NULL;
  m_pszAuthnService = NULL;
  m_pszAuthzService = NULL;
  m_pszKeyTab = NULL;
  m_iProtLevel = rpc_c_protect_level_none;
  m_iAuthnService =  rpc_c_authn_none;
  m_iAuthzService = rpc_c_authz_none;
  m_pSecurityFailReturn = pReturn;
}

//=============================================================
CRpcSecurity::~CRpcSecurity()
{
   StopThreads();
   DeleteString(&m_pszProtLevel);
   DeleteString(&m_pszAuthnService);
   DeleteString(&m_pszAuthzService);
   DeleteString(&m_pszKeyTab);
   SecurityFail();
}
//=============================================================
void CRpcSecurity::SecurityFail()
{
   if (m_pSecurityFailReturn != NULL)
   {
     (*m_pSecurityFailReturn)(m_bSecurityGate);
   }
}
//=============================================================
void CRpcSecurity::SecurityGate(BOOL bState,ESISTATUS status)
{
  ESITRACE2("crs:sg: security gate value/status = %i/%i\n",bState,status);
  m_bSecurityGate = bState;
  m_esSecurityStatus = status;
}
//=============================================================
BOOL CRpcSecurity::SecurityCheck()
{
  return m_bSecurityGate;
}
//=============================================================
BOOL CRpcSecurity::InitSecurity(char** gv)
{
    //gv[0]:Security Name
    //gv[1]:protection level
    //gv[2]:authentication service
    //gv[3]:authorization service
    //gv[4]:keytab directory

    BOOL                bRV = TRUE;

    ESITRACE0("crs:is:entering init security\n");
    m_pszSecurityName = NULL;

    if (strcmp(gv[0],"0") != 0)
    {
      m_pszSecurityName = CopyString(gv[0]);
    }
    else
    {
      ESITRACE0("crs:is: no security requested\n");
      SecurityGate(TRUE,ESISTAT_SUCCESS);
      return m_bSecurityGate;
    }

    ESITRACE1("crs:is: security name = %s\n",m_pszSecurityName);
    ESITRACE1("crs:is: prot level = %s\n",gv[1]);
    ESITRACE1("crs:is: authentication service = %s\n",gv[2]);
    ESITRACE1("crs:is: authorization service = %s\n",gv[3]);
    ESITRACE1("crs:is: key tab = %s\n",gv[4]);

    m_pszProtLevel =    CopyString(gv[1]);
    m_pszAuthnService = CopyString(gv[2]);
    m_pszAuthzService = CopyString(gv[3]);
    if (strcmp(gv[4],"0") == 0)
    {
      m_pszKeyTab = NULL;
    }
    else
    {
      m_pszKeyTab = CopyString(gv[4]);
    }
    sscanf(gv[1],"%i",&m_iProtLevel);
    sscanf(gv[2],"%i",&m_iAuthnService);
    sscanf(gv[3],"%i",&m_iAuthzService);

    bRV = ProcessSecurityLogin(m_pszSecurityName,&m_login_context);

    ESITRACE1("crs:is: psl returned boolean = %i\n",bRV);
    if (bRV)
    {
      bRV = StartThreads();
    }

    return bRV;
}
//=============================================================
BOOL CRpcSecurity::ProcessSecurityLogin(char*               pName,
                                    sec_login_handle_t* pLoginContext)
{
  sec_login_auth_src_t      auth_src;
  void*                     server_key;
  error_status_t            status,status2;
  boolean32                 identity_valid;
  boolean32                 reset_passwd;
  BOOL                      bRV = FALSE;
  sec_login_handle_t        login_context;

  if (pName == NULL)
  {
    *pLoginContext = NULL;
    ESITRACE0("crs:psl: no security\n");
    return TRUE;
  }

  *pLoginContext = NULL;

  ESITRACE0("crs:psl: security attempted.\n");
  ESITRACE1("crs:psl: name = %s\n",pName);
  bRV = FALSE;

  ESITRACE0("crs:psl: setup identity call\n");
  sec_login_setup_identity((unsigned char*)pName,
                           sec_login_no_flags,
                           &login_context,
                           &status);
  ESITRACE0("crs:psl: setup identity complete\n");

  if (CHECK_STATUS(status))
  {
    sec_key_mgmt_get_key(rpc_c_authn_dce_secret,
                         m_pszKeyTab,
                         (unsigned char*)pName,
                         0,
                         &server_key,
                         &status);
    if (CHECK_STATUS(status))
    {
//      identity_valid = sec_login_validate_identity(login_context,
//                                          (sec_passwd_rec_t *)server_key,
//                                          &reset_passwd,
//                                          &auth_src,
//                                          &status);
      identity_valid = sec_login_valid_and_cert_ident(login_context,
                                          (sec_passwd_rec_t *)server_key,
                                          &reset_passwd,
                                          &auth_src,
                                          &status);
      sec_key_mgmt_free_key(&server_key,&status2);
      if (CHECK_STATUS(status2))
      {
        if (identity_valid)
        {
          if (auth_src == sec_login_auth_src_network)
          {
            sec_login_set_context(login_context,&status);
            if (CHECK_STATUS(status))
            {
              bRV = TRUE;
              *pLoginContext = login_context;
            }
          }
          else
          {
            PRINT_STATUS(status,"crs:psl:unable to set login context,");
          }
        }
        else
        {
          PRINT_STATUS(status,"crs:psl:identity not valid,");
        }
      }
      else
      {
        PRINT_STATUS(status2,"crs:psl:unable to free key,");
      }
    }
    else
    {
      PRINT_STATUS(status,"crs:psl:unable to get key,");
    }
  }
  else
  {
    PRINT_STATUS(status,"crs:psl:unable to set up identity,");
  }

  ESITRACE1("crs:psl: server startup status = %i\n",bRV);

  SecurityGate(bRV,status);
  return bRV;
}

//=============================================================
char* CRpcSecurity::CopyString(char* pszText)
{
  char*    pszRV = NULL;

  if (pszText != NULL)
  {
    pszRV = (char*) malloc(strlen(pszText) + 1);
    strcpy(pszRV,pszText);
  }

  return pszRV;
}
//=============================================================
void CRpcSecurity::DeleteString(char** pszText)
{
  char*    pszChar;

  pszChar = *pszText;

  if (pszChar != NULL)
  {
    delete(pszChar);
    pszChar = NULL;
    *pszText = pszChar;
  }
}
//=============================================================
ESISTATUS  CRpcSecurity::GetExpirationDelayTime(signed32 *delay_time)
{
  signed32        expiration;
  timeb_t         current_time;
  signed32        difftime;
  signed32        lDelay = 0;
  ESISTATUS       status;

  ESITRACE0("crs:gedt: entering get expiration date\n");
  sec_login_get_expiration(m_login_context,&expiration,&status);

  if (CHECK_STATUS(status))
  {
    ftime(&current_time);
    difftime = expiration - current_time.time;
    if (difftime > 0)
    {
      lDelay = difftime - 600;
      if (lDelay < 0)
        lDelay = 0;
    }
    else
    {
      lDelay = 0;
    }
  }
  else
  {
    PRINT_STATUS(status,"crs:gedt:problem getting expiration time:")
  }

  if (CHECK_STATUS(status))
  {
    SecurityGate(TRUE,status);
  }
  else
  {
    SecurityGate(FALSE,status);
  }

  *delay_time = lDelay;
  return status;
}
//=============================================================
ESISTATUS  CRpcSecurity::RefreshIdentity()
{
  sec_login_auth_src_t      auth_src;
  void*                     server_key;
  error_status_t            status;
  error_status_t            status2;
  boolean32                 identity_valid;
  boolean32                 reset_passwd;


  ESITRACE0("crs:ri: entering refresh identity\n");
  sec_login_refresh_identity(m_login_context,&status);

  if (CHECK_STATUS(status))
  {
    sec_key_mgmt_get_key(rpc_c_authn_dce_secret,
                         m_pszKeyTab,
                         (unsigned char*)m_pszSecurityName,
                         0,
                         &server_key,
                         &status);
    if (CHECK_STATUS(status))
    {
      identity_valid = sec_login_validate_identity(m_login_context,
                                          (sec_passwd_rec_t *)server_key,
                                          &reset_passwd,
                                          &auth_src,
                                          &status);

      sec_key_mgmt_free_key(&server_key,&status2);

      if (!CHECK_STATUS(status))
      {
        PRINT_STATUS(status,"crs:ri: problem validating login:");
      }
      else
      {
        if (!CHECK_STATUS(status2))
        {
          status = status2;
          PRINT_STATUS(status,"crs:ri: problem freeing management key:");
        }
      }
    }
    else
    {
      PRINT_STATUS(status,"crs:ri: problem getting management key:");
    }
  }
  else
  {
    PRINT_STATUS(status,"crs:ri: problem refreshing identity:");
  }

  if (CHECK_STATUS(status))
  {
    SecurityGate(TRUE,status);
  }
  else
  {
    SecurityGate(FALSE,status);
  }

  return status;
}

//=============================================================
BOOL CRpcSecurity::StartThreads()
{
  int            stts;
  BOOL           bRV = TRUE;

  ESITRACE0("crs:st:starting threads\n");
  stts = pthread_create(
                   &m_IdRefreshThread,
                   pthread_attr_default,
                   SecurityRefreshIdentity,
                   (void*)this);
  if (!stts)
  {
    stts = pthread_create(
                     &m_KeyRefreshThread,
                     pthread_attr_default,
                     SecurityRefreshKey,
                     (void*)this);
    ESITRACE1("crs:st:key refresh thread start status = %i\n",stts);
    if (!stts)
    {
      bRV = TRUE;
    }
  }

  return bRV;
}
//=============================================================
void CRpcSecurity::StopThreads()
{
  ESITRACE0("crs:st: stopping threads\n");
  if (m_bRefreshId)
    pthread_cancel(m_IdRefreshThread);

  if (m_bRefreshKey)
    pthread_cancel(m_KeyRefreshThread);
}

========================================================================
====
======================= RPC_SEC.H
==========================================
========================================================================
====
#ifndef _RPC_SEC_H_
#define _RPC_SEC_H_

#include <pthread.h>
#include <time.h>
#include <timeb.h>
#include "esitype.h"
#include "esirpc.h"

typedef void (*ESIRETFUNC)(BOOL);

extern "C" void* SecurityRefreshIdentity(pthread_addr_t pTemp);
extern "C" void* SecurityRefreshKey(pthread_addr_t pTemp);

class CRpcSecurity{
public:
  CRpcSecurity(ESIRETFUNC pReturn = NULL);
  ~CRpcSecurity();

  BOOL       SecurityCheck();
  BOOL       InitSecurity(char** gv);

private:
  void       SecurityGate(BOOL bState,ESISTATUS status);
  BOOL       ProcessSecurityLogin(char*               pName,
                                  sec_login_handle_t* pLoginContext);
  char*      CopyString(char* pszText);
  void       DeleteString(char** pszText);
  ESISTATUS  GetExpirationDelayTime(signed32 *delay_time);
  ESISTATUS  RefreshIdentity();
  BOOL       StartThreads();
  void       StopThreads();
  void       SecurityFail();

  pthread_t          m_IdRefreshThread;
  pthread_t          m_KeyRefreshThread;

  BOOL               m_bRefreshId;
  BOOL               m_bRefreshKey;
  BOOL               m_bSecurityGate;

  ESISTATUS          m_esSecurityStatus;

  unsigned32         m_iAuthnService;
  unsigned32         m_iAuthzService;
  unsigned32         m_iProtLevel;

  sec_login_handle_t m_login_context;

  char*              m_pszAuthnService;
  char*              m_pszAuthzService;
  char*              m_pszKeyTab;
  char*              m_pszProtLevel;
  char*              m_pszSecurityName;
  ESIRETFUNC         m_pSecurityFailReturn;

  friend void* SecurityRefreshIdentity(pthread_addr_t pTemp);
  friend void* SecurityRefreshKey(pthread_addr_t pTemp);
};

#endif
========================================================================
====
======================= ESIRPC.H
===========================================
========================================================================
====
#ifndef _ESIRPC_H
#define _ESIRPC_H

//===============================================================
//======================== GRADIENT RPC =========================
//===============================================================
#ifdef ESIRPC_GRADIENT
#include <dce/rpc.h>
#include <pthread.h>
#include <dce/sec_login.h>
#include <dce/keymgmt.h>
#include <dce/dce_error.h>
#include "esimacro.h"

#define _RPC_H_

#define CHECK_STATUS(input_status) input_status == rpc_s_ok

#ifdef ESIDEBUG
#define PRINT_STATUS(input_status,comment) \
{ \
  if (input_status != rpc_s_ok) \
  {\
  dce_error_inq_text(input_status,\
                     ESIRPCG_error_string,\
                     &ESIRPCG_error_stat);\
  ESITRACE2("%s %s\n",comment,ESIRPCG_error_string);\
  }\
}
#endif

#ifndef ESIDEBUG
#define PRINT_STATUS(input_status,comment)
#endif

#define GET_STATUS(input_status,error_string,error_stat) \
  dce_error_inq_text(input_status,\
                     error_string,\
                     &error_stat);

static int ESIRPCG_error_stat;
static unsigned char ESIRPCG_error_string[dce_c_error_string_len];

typedef unsigned long    RPC_STATUS;
#endif

//===============================================================
//======================== DEC RPC ==============================
//===============================================================
#ifdef ESIRPC_DEC
#include <rpc.h>
#include <sec_login.h>
#include <keymgmt.h>
#include <dce_error.h>
typedef unsigned int    RPC_STATUS;
#define ESIS0_CONFIGFILE    "ESI$RPC_CONFIGFILE"
#define CHECK_STATUS(input_status) input_status == 0

#ifdef ESIDEBUG
#define PRINT_STATUS(input_status,comment) \
{ \
  if (input_status != rpc_s_ok) \
  {\
  dce_error_inq_text(input_status,\
                     ESIRPCG_error_string,\
                     &ESIRPCG_error_stat);\
  ESITRACE2("%s %s\n",comment,ESIRPCG_error_string);\
  }\
}
#endif

#ifndef ESIDEBUG
#define PRINT_STATUS(input_status,comment)
#endif

#define GET_STATUS(input_status,error_string,error_stat) \
  dce_error_inq_text(input_status,\
                     error_string,\
                     &error_stat);

static int ESIRPCG_error_stat;
static unsigned char ESIRPCG_error_string[dce_c_error_string_len];

#endif

//===============================================================
//======================== MICROSOFT RPC ========================
//===============================================================
#ifdef ESIRPC_MS
#include <rpc.h>
typedef unsigned int    unsigned32;
#endif

//===============================================================
//======================== GENERAL RPC ==========================
//===============================================================
#define   ESI_MSGBUFFERSIZE     1024
#define   ESI_MAXCALLS            20
#define   ESI_PARMLIMIT           30
#define   ESI_MAXCALLS            20
#define   ESI_ENDPTBUFF          100
#define   ESI_PROTSEQBUFF        100
#define   ESI_STACKSIZE       100000

#endif
========================================================================
====
======================= ESITYPE.H
==========================================
========================================================================
====
#ifndef ESITYPE_H
#define ESITYPE_H
#include <string.h>
//include ESIOBJ.H
//===================================================================
#ifndef BOOL
#define BOOL int
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef ESILPTSTR
#define ESILPTSTR char*
#endif
#ifndef LPCVARIANT
#define LPCVARIANT ESIVARIANT *
#endif
#ifndef ESIDWORD
#define ESIDWORD unsigned long
#endif
#ifndef ESIBSTR
#define ESIBSTR char*
#endif

//===================================================================

//STATUS DEFINITIONS
#define ESISTAT_SUCCESS         0
#define ESISTAT_GENFAILURE      1001
#define ESISTAT_GTFAILURE       1002
#define ESISTAT_MXTIMEOUT       1003
#define ESISTAT_MTIMEOUT        1004
#define ESISTAT_INVALIDMIXED    1005
//SECURITY DEFINITIONS
#define ESISTAT_NOAUTH          5000

//TEXT OF STATUS DEFINITIONS
#define ESITXT_SUCCESS         "operation successful"
#define ESITXT_GENFAILURE      "general failure"
#define ESITXT_GTFAILURE       "gateway failure"
#define ESITXT_MXTIMEOUT       "mutex timeout error"
#define ESITXT_NOAUTH          "no authorization for operation"
#define ESITXT_MTIMEOUT        "M timeout"
#define ESITXT_INVALIDMIXED    "positional parm's must preced key parms"

//variable handling definitions
#define ESIVARTYPE              unsigned short
#define ESIPARAMCOUNT           unsigned short
#define ESIEVTOKEN              long
#define ESISESSIONID            long
#define ESIEV_MAXPARMS          15
#define ESIEV_CELLINCR          50

//===================================================================
//general typedefs
typedef unsigned int  UINT;

typedef short         ESIDIRECTION;

typedef struct tagSession
{
    unsigned long SessionID;
}SESSION;

typedef struct tagBSTR { void * buffer; }ESIBSTRSTRUCT;

typedef struct tagESICY
{
    unsigned long lo;
    long hi;
}ESICY;

enum ESIVTNUM {
    ESIVT_EMPTY             = 0,
    ESIVT_NULL              = 1,
    ESIVT_I2                = 2,
    ESIVT_I4                = 3,
    ESIVT_R4                = 4,
    ESIVT_R8                = 5,
    ESIVT_CY                = 6,
    ESIVT_DATE              = 7,
    ESIVT_BSTR              = 8,
    ESIVT_DISPATCH          = 9,
    ESIVT_ERROR             = 10,
    ESIVT_BOOL              = 11,
    ESIVT_VARIANT           = 12,
    ESIVT_UNKNOWN           = 13,
    ESIVT_DECIMAL           = 14,
    ESIVT_I1                = 16,
    ESIVT_UI1               = 17,
    ESIVT_UI2               = 18,
    ESIVT_UI4               = 19,
    ESIVT_I8                = 20,
    ESIVT_UI8               = 21,
    ESIVT_INT               = 22,
    ESIVT_UINT              = 23,
    ESIVT_VOID              = 24,
    ESIVT_HRESULT           = 25,
    ESIVT_PTR               = 26,
    ESIVT_SAFEARRAY         = 27,
    ESIVT_CARRAY            = 28,
    ESIVT_USERDEFINED       = 29,
    ESIVT_LPSTR             = 30,
    ESIVT_LPWSTR            = 31,
    ESIVT_EOOBJECT          = 48,
    ESIVT_FILETIME          = 64,
    ESIVT_BLOB              = 65,
    ESIVT_STREAM            = 66,
    ESIVT_STORAGE           = 67,
    ESIVT_STEAMED_OBJECT    = 68,
    ESIVT_STORED_OBJECT     = 69,
    ESIVT_BLOB_OBJECT       = 70,
    ESIVT_CF                = 71,
    ESIVT_CLSID             = 72
};




typedef struct tagESISAFEARRAYBOUND {
   long    cElements;
   long    lLbound;
}ESISAFEARRAYBOUND;


typedef struct tagESIVTARRAY {
  void * pData;              //the pointer to the data
                             //ESIVARIANT * PData;
  ESISAFEARRAYBOUND       rgsabound[1];  //struct array that include up and low bounds
  unsigned long           cLocks ;       //count of the array has been locked
  unsigned short          cDims ;        //count of dimensions in this array
  unsigned short          fFeatures ;    //Flags for data contants
  unsigned long           cbElements ;   //default size of an element of the array                    //dose
not include size of pointed to data
}ESISAFEARRAY;

//#define ESIVARIANT struct tagESIVARIANT

typedef struct tagESIVARIANT ESIVARIANT;

typedef char * ESIOBJCT;

struct tagESIVARIANT {
  ESIVTNUM       vt;
  unsigned short wReserved1;
  unsigned short wReserved2;
  unsigned short wReserved3;
  union {
    long            bEmpty;      //ESIVT_EMPTY
    //              bNull;       //ESIVT_NULL
    short           iVal;        //ESIVT_I2
    long            lVal;        //ESIVT_I4
    float           fltlVal;     //ESIVT_R4
    double          dblVal;      //ESIVT_R8
    ESICY           cyVal;       //ESIVT_CY
    double          date;        //ESIVT_DATE
    ESIBSTR         bstrVal;     //ESIVT_BSTR
    //Idispatch     pdispVal;    //ESIVT_DISPATCH
    //ESIERRO       preturn;     //ESIVT_ERROR
    BOOL            bVal;        //ESIVT_BOOL
    ESIVARIANT *    pvarVal;     //ESIVT_VARIANT
    //Iunknown      punkVal;     //ESIVT_UNKNOWN
    //ESIVT_DECIMAL
    //ESIVT_I1
    //ESIVT_UI1
    //ESIVT_UI2
    ESIDWORD        dVal;        //ESIVT_UI4
    //ESIVT_I8
    //ESIVT_UI8
    int             plVal;       //ESIVT_INT
    unsigned int    puVal;       //ESIVT_UINT
    void *          pvoid;       //ESIVT_VOID
    //ESIVT_HRESULT
    //ESIVT_PTR
    ESISAFEARRAY*   parrVal;     //ESIVT_SAFEARRAY
    //ESIVT_CARRAY
    //ESIVT_USERDEFINED
    ESILPTSTR       plstrVal;    //ESIVT_LPSTR
    //ESILPWSTR     plpwstrVal;  //ESIVT_LPWSTR
    ESIOBJCT        pobjVal;     //ESIVT_EOOBJECT
    //ESIFILETIME   pftVal;      //ESIVT_FILETIME
    //ESIVT_BLOB
    //ESIVT_STREAM
    //ESIVT_STORAGE
    //ESIVT_STEAMED_OBJECT
    //ESIVT_STORED_OBJECT
    //ESIVT_BLOB_OBJECT
    //ESIVT_CF
    //UUID          puidVal;     //ESIVT_CLSID
  };
};

//===================================================================
//-------------------  Structures used in client/server calls --------------//

typedef ESIVARIANT  ESIVARVAR[];

typedef struct tagESIPARAMETER {
   ESIVARIANT* pParam;
   short       IsNamed;
   char*       pName;
} ESIPARAMETER;

typedef ESIPARAMETER ESIPARAMETERARRAY[];

typedef UINT ESISTATUS;

typedef struct tagINVOCATIONFRAME {
    ESILPTSTR           szTarget;
    ESILPTSTR           szService;
    ESIVARIANT          vaReturn;
    short               nParamCount;
    ESISTATUS           eStatus;
    ESIPARAMETER*       pParamArray;
} INVOCATIONFRAME;

typedef struct tagSTATUSSUBBLOCK{
    ESISTATUS           eStatus;
}STATUS_SUBBLOCK;

typedef struct tagSTATUSFRAME {
    char*              cIssuer;
    char*              cMessage;
    ESISTATUS          eSuccess;
    UINT               eSubCode;
    STATUS_SUBBLOCK*   pSubBlock;
}STATUSFRAME;

#define LPCSTATUS  STATUSFRAME *


//===================================================================

//CREATE FRAME

#define ESICR_PARMLIMIT  20
#define ESICR_PARMPOS            0
#define ESICR_PARMKEY            1

enum ESICREATETYPE{
                 ESICR_KEYPARM          =0,
                 ESICR_POSPARM          =1,
                 ESICR_PRPPARM          =2,
                 ESICR_PRPVAL           =3,
                 ESICR_CREATEKEYWORDS   =4
     };

typedef struct tagESICREATEKEYWORDPARM{
   char*          Name;             //name of keyword parameter
   ESIVARIANT     Value;            //value of keyword parameter
}ESICREATEKEYWORDPARM;

typedef struct tagESICREATEPOSPARM{
   short          Pos;              //position of parameter
   ESIVARIANT     Value;            //value of positional parameter
}ESICREATEPOSPARM;

typedef struct tagESICREATEKEYWORD{
   char*          Name;             //name of create keyword
   ESIVARIANT     Value;            //value of create keyword
}ESICREATEKEYWORD;

typedef struct tagESICREATEPROPSPARM{
   short          PropParmType;     //property calling type
   short          PropParmPos;      //property parameter position
   ESIVARIANT     Value;            //value of property parameter
   short          PropPos;          //property position
   char*          PropKeyWord;      //prop keyword
}ESICREATEPROPSPARM;

typedef struct tagESICREATEPROPSVAL{
  char*           Name;             //property name
  short           Pos;              //property position
  ESIVARIANT      Value;            //property value
}ESICREATEPROPSVAL ;

typedef struct tagESICREATEPARM {
   ESICREATETYPE  ParmType;         //structure type
   union {
      ESICREATEKEYWORD          KeyWord; //keyword on create
      ESICREATEKEYWORDPARM      KeyParm; //keyword parm on create
      ESICREATEPOSPARM          PosParm; //position parm on create
      ESICREATEPROPSPARM        PropParm;//parameters on property
      ESICREATEPROPSVAL         PropVal; //value of prop param's
  };
} ESICREATEPARM;

typedef  ESICREATEPARM ESICREATEPARMARRAY[];

typedef struct tagESICREATEFRAME {
      ESILPTSTR                 className;
      short                     iNumElements;
      ESICREATEPARM*             createArray;
}ESICREATEFRAME;


typedef struct tagCREATE_LOCALKEYPARM{
   char*       Name;
   ESIVARIANT  Value;
}CREATE_LOCALKEYPARM;

typedef struct tagCREATE_LOCALPOSPARM{
   ESIVARIANT  Value;
}CREATE_LOCALPOSPARM;

typedef struct tagCREATE_LOCALKEYWORD{
   char*       Name;
   ESIVARIANT  Value;
}CREATE_LOCALKEYWORD;


typedef struct tagCREATE_LOCALPROPS{
   char*       Name;
   ESIVARIANT  Value;
}CREATE_LOCALPROPS;

typedef struct tagCREATE_LOCALPROPPARM{
   BOOL                 Used;
   int                  NumParms;
   int                  Type;
   ESIVARIANT           Value;
   char*                Name;
   CREATE_LOCALPROPS    Parm[ESICR_PARMLIMIT];
}CREATE_LOCALPROPPARM;


//===================================================================
//event frames and logic

#define  ESIEV_EVENT        "$EVENT"
#define  ESIEV_PROPERTIES   "$PROPERTIES"
#define  ESIEV_PROPTYPE  2

typedef void*    ESIWATCHTOKEN;
typedef void*    ESIGENTOKEN;

typedef struct tagESIEVENTFRAME{
   ESIWATCHTOKEN         wToken;
   ESIOBJCT              pObject;
   ESIPARAMCOUNT         sNumParams;
   ESIVARTYPE            eType;
   char*                 cEventName;
   ESIVARIANT*           pVarArray;
}ESIEVENTFRAME;

class CClientTransportAdapter;

typedef ESISTATUS (*ESIEVFUNC)(ESIGENTOKEN,ESIEVENTFRAME*);

typedef ESISTATUS (*ESIEVROUTER)(ESIGENTOKEN,ESIEVENTFRAME*);

typedef int ESICTAWATCHID;

typedef struct tagESICTAWATCH{
 ESIEVROUTER   pRouter;
 ESICTAWATCHID  pId;
 ESIWATCHTOKEN  pSTA;
 ESISESSIONID  Session;
}ESICTAWATCH;


typedef ESICTAWATCH* ESICTATOKEN;

typedef struct tagESIWATCHSTRUCT{
 ESIEVFUNC   pProc;
 ESIOBJCT   pObject;
 char*    cEventName;
 ESICTATOKEN   wToken;
 ESICTAWATCHID  pId;
 ESISESSIONID  Session;
}ESIWATCHSTRUCT;

#endif //ESITYPE_H

    
3333.6source code, 2 of 2HYDRA::DORHAMERFri Mar 28 1997 09:34777
From:	HYDRA::AXPDEVELOPER "[email protected]" 27-MAR-1997 15:08:36.49
To:	DORHAMER
CC:	AXPDEVELOPER
Subj:	source files for DCE problem

From:	SMTP%"[email protected]" 27-MAR-1997 14:16:24.36
To:	karen dorhamer <[email protected]>
CC:	
Subj:	dce proble, letter #2 of 2

Return-Path: [email protected]
Received: by asimov.mro.dec.com (UCX V4.1-12, OpenVMS V6.2 VAX);
	Thu, 27 Mar 1997 14:16:21 -0500
Received: from mail12.digital.com by fluid.mro.dec.com (5.65v4.0/1.1.8.2/19Nov96-0448PM)
	id AA01300; Thu, 27 Mar 1997 14:16:29 -0500
Received: from pobox1.pa.dec.com by mail12.digital.com (8.7.5/UNX 1.5/1.0/WV)
	id MAA32207; Thu, 27 Mar 1997 12:32:17 -0500 (EST)
Received: by pobox1.pa.dec.com; id AA20000; Thu, 27 Mar 97 09:31:01 -0800
Received: from hil-img-5.compuserve.com by mail1.digital.com (5.65 EXP 4/12/95 for V3.2/1.0/WV)
	id AA21599; Thu, 27 Mar 1997 09:22:32 -0800
Received: by hil-img-5.compuserve.com (8.6.10/5.950515)
	id MAA26567; Thu, 27 Mar 1997 12:22:27 -0500
Date: 27 Mar 97 12:20:49 EST
From: Esi Technology Corp <[email protected]>
To: karen dorhamer <[email protected]>
Subject: dce proble, letter #2 of 2
Message-Id: <[email protected]>

TO:     Karen Dorhamer, Digital, [email protected]

FROM:   Steven Popkes, Esi Technology
        508 651 1400, voice
        508 651 0708, fax
        [email protected]

RE:     dce problem, letter 2 of 2

Karen:

I'm sending this in two letters.
Enclosed in this note are several files, each separated by uncommented "=="
lines. (See below this text.) They are:
  RPC_SEC.CPP
  RPC_SEC.H
  ESIRPC.H
  ESITYPE.H
  ESIMACRO.H
  ESIVMS.H
  SERVER0.IDL
  SERVER0.ACF
  RPCESITYPE.IDL
  REPESITYPE.ACF
  MAIN.CPP
  COMPILE.COM

Separate them out and use compile.com to build main. We are using the name
EsiServer0 to be registered with dce. The name should be added to the
cell.

Running MAIN should cause the problem.

stevep


========================================================================
====
======================= ESIMACRO.H
=========================================
========================================================================
====
#ifndef _ESIMACRO_H_
#define _ESIMACRO_H_

//------------------------------------------------
#ifdef ESIDEBUG
#define ESITRACE0(string) \
  printf(string);

#define ESITRACE1(string,val1) \
  printf(string,val1);

#define ESITRACE2(string,val1,val2) \
  printf(string,val1,val2);

#define ESITRACE3(string,val1,val2,val3) \
  printf(string,val1,val2,val3);

#define ESITRACE4(string,val1,val2,val3,val4) \
  printf(string,val1,val2,val3,val4);

#define ESITRACE5(string,val1,val2,val3,val4,val5) \
  printf(string,val1,val2,val3,val4,val5);
#endif
//------------------------------------------------

#ifndef ESIDEBUG
#define ESITRACE0(string)
#define ESITRACE1(string,val1)
#define ESITRACE2(string,val1,val2)
#define ESITRACE3(string,val1,val2,val3)
#define ESITRACE4(string,val1,val2,val3,val4)
#define ESITRACE5(string,val1,val2,val3,val4,val5)
#endif
//------------------------------------------------

#endif
========================================================================
====
======================= ESIVMS.H
===========================================
========================================================================
====
#ifndef _ESIVMS_H_
#define _ESIVMS_H_
#include <starlet.h>
#include <LNMDEF.h>
#include <libdef.h>
#include <cmbdef.h>
#include <agndef.h>
#include <descrip.h>
#include <ssdef.h>
#include <iodef.h>
#include <stsdef.h>
#include <prcdef.h>
#include <stddef.h>
#include <unistd.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include <iostream.h>
#include <memory.h>
#include <ssdef.h>


#define   ESIVMS_ACCESS           0
#define   ESIVMS_USCORE           "_"
#define   ESIVMS_NULL             0
#define   ESIVMS_CHARWIDTH        512
#define   ESIVMS_CR               13
#define   ESIVMS_LF               10

#define   ESIVMS_MAILBOXROOT      "ESIMBX"
#define   ESIVMS_MBMXMSG          1024
#define   ESIVMS_MBBFQUO          0
#define   ESIVMS_MBFLPROT         0
#define   ESIVMS_MBMASK           0

#define   ESIVMS_IOEVTFLG         0
#define   ESIVMS_IOWRTFNC         IO$_WRITEVBLK|IO$M_NOW
#define   ESIVMS_IOREADFNC        IO$_READVBLK|IO$M_NOW
#define   ESIVMS_IOWASTA          0
#define   ESIVMS_IOWASTP          0
#define   ESIVMS_IOWEOF           IO$_WRITEOF|IO$M_NOW

#define   ESIVMS_DETACH           PRC$M_DETACH
#define   ESIVMS_NAMEROOT         "ESIGT"
#define   ESIVMS_S0ROOT           "ESICB"
#define   ESIVMS_BASPRI           10

#define   ESIVMS_LNMTABL          "LNM$PROCESS_TABLE"
#define   ESIVMS_LNMTLIST         "LNM$SYSTEM"
#define   ESIVMS_NULLDEV          "NL0"
#define   ESIVMS_SYSINPUT         "SYS$INPUT"
#define   ESIVMS_SYSOUTPUT        "SYS$OUTPUT"
#define   ESIVMS_SYSERROR         "SYS$ERROR"


typedef struct tagESI_IOSB {               /*   I/O status block */
   short int sStatus;
   short int sByteCount;
   int       iPID;
} ESI_IOSB;


#endif
========================================================================
====
======================= SERVER0.IDL
========================================
========================================================================
====
[
uuid(9d548fe0-40d5-11d0-afc0-e00567000000),
version(1.0)
]
interface Server0
{

import "rpcesitype.idl";

/*---------------- database definitions -----------------------*/
typedef struct tagCONNECTION {
[string,unique]       unsigned char *     IpAddress;
[string,unique]       unsigned char *     Port;
[string,unique]       unsigned char *     GTName;
[string,unique]       unsigned char *     GTProtection;
[string,unique]       unsigned char *     GTAuthnService;
[string,unique]       unsigned char *     GTAuthzService;
}CONNECTION;

typedef               short               rpcESIPOINTSTATE;

typedef struct tagRpcPortNode {
[string,unique]       char*               port;
[string,unique]       char*               coup;
[string,unique]       char*               ClientIp;
[string,unique]       char*               GatewayIp;
                      rpcESIPOINTSTATE    currentState;
                      rpcESIOPERCOUNTER   ctTotal;
                      rpcESIOPERCOUNTER   ctTimer;
                      rpcESIOPERCOUNTER   ctEO;
                      rpcESIOPERCOUNTER   ctM;
}rpcPORTNODE;

typedef [string,unique] char*   rpcPtrToChar;


/*---------------- function definitions -----------------------*/

CONNECTION * RpcServer0Connection(
[in, string, unique]  unsigned  char*     user
);

rpcESISTATUS RpcPortRestore(
[in, string, unique]  char*               rsPort
);

rpcESISTATUS RpcShutdownServerGateway(
 [in, string, unique]  char*               Port
);

rpcESISTATUS RpcServer0Shutdown();

rpcESISTATUS RpcShutdownAllGateways();

char* RpcServer0GetPortListString();

rpcESISTATUS RpcServer0SetPortList(
[in,out,unique]      char*           pSetList,
[in,out,ref]         rpcDataReturn*  pNumSet
);

void RpcServer0GetPortRange(
[in,out,unique]   rpcPtrToChar*              pStartPort,
[in,out,unique]   rpcPtrToChar*              pEndPort
);

void RpcServer0SetPortRange(
[in,out,string]   char*              pStartPort,
[in,out,string]   char*              pEndPort,
[in,out,ref]      rpcDataReturn*     pNumSet
);

rpcESISTATUS RpcServer0DeletePort(
[in,out,unique]      char*         port
);

rpcESISTATUS RpcServer0InsertPort(
[in,out,unique]      char*         port
);

void RpcServer0DeletePortRange(
[in,out,unique]      char*         sport,
[in,out,unique]      char*         eport
);

rpcESISTATUS RpcServer0InsertPortRange(
[in,out,unique]      char*         sport,
[in,out,unique]      char*         eport
);

void RpcGatewayNotify(
[in, string, unique]     char     *port
);

void RpcServer0DisableLogin();

void RpcServer0EnableLogin();

rpcBOOL RpcServer0GetLoginState();

/*the following change need to be made after demo:

        CONNECTION * RpcServer0Connection(
        [in]       unsigned  char*     user,
        [in]       unsigned  char*     passward
        [in]       unsigned  char*     clientIpAddress);

	//this struct will be return back to client by server0

        typedef struct tagCONNECTION {
        [string,unique] unsigned char * ServerIpAddress; //to one of servers
        [string,unique] unsigned char * ServerPort;      //to one of ports of
							 //servers
	[string,unique] ussigned char * SessionId;       //from M side
        }CONNECTION;
*/




void RpcServer0GetPortInfo(
[in, string, unique]  char*               Port,
[in,out,ref]          rpcPORTNODE*        rtPortNode
);


}

========================================================================
====
======================= SERVER0.ACF
========================================
========================================================================
====
/*file: Server0.acf*/
[implicit_handle (handle_t  Server0_IfHandle)
] interface Server0
{
[explicit_handle]RpcServer0Connection();
[explicit_handle]RpcPortRestore( );
[explicit_handle]RpcShutdownServerGateway( );
[explicit_handle]RpcServer0Shutdown();
[explicit_handle]RpcShutdownAllGateways();
[explicit_handle]RpcServer0GetPortListString();
[explicit_handle]RpcServer0SetPortList();
[explicit_handle]RpcServer0GetPortRange();
[explicit_handle]RpcServer0SetPortRange();
[explicit_handle]RpcServer0DeletePort();
[explicit_handle]RpcServer0InsertPort();
[explicit_handle]RpcServer0DeletePortRange();
[explicit_handle]RpcServer0InsertPortRange();
[explicit_handle]RpcGatewayNotify();
[explicit_handle]RpcServer0DisableLogin();
[explicit_handle]RpcServer0EnableLogin();
[explicit_handle]RpcServer0GetLoginState();
[explicit_handle]RpcServer0GetPortInfo();
}
========================================================================
====
======================= RPCESITYPE.IDL
=====================================
========================================================================
====
[
version(1.0),
pointer_default(unique)
]
interface RpcEsiType
{

/* -------------------------- base definitions -----------------------*/
typedef              short         rpcBOOL;
typedef              long          rpcSessionId;
typedef              short         rpcParamCount;
typedef              short         rpcDirection;
typedef              long          rpcDataReturn;
typedef              unsigned long rpcESIDWORD;
typedef              unsigned short rpcESIVARTYPE ;
typedef [string,ptr] char*         rpcESILPTSTR;
typedef [string,ptr] char*         rpcESIBSTR;
typedef [string,ptr] char*         rpcESIOBJCT;
typedef              short         rpcESIEVTYPE;
typedef              long          rpcESIEVTOKEN;

typedef              unsigned long rpcESISTATUS;

typedef              struct        rpctagSTATUSSUBBLOCK{
             rpcESISTATUS        eStatus;
}rpcSTATUS_SUBBLOCK;

typedef              struct        rpctagSTATUSFRAME {
[string,unique] char*               cIssuer;
[string,unique] char*               cMessage;
                rpcESISTATUS        eSuccess;
                rpcESISTATUS        eSubCode;
[unique]        rpcSTATUS_SUBBLOCK* pSubBlock;
}rpcSTATUSFRAME;

typedef              rpcSTATUSFRAME* rpcLPCSTATUS;

/*typedef struct tagBSTR { void * buffer; }rpcESIBSTRSTRUCT;*/

typedef struct tagrpcESICY
{
             unsigned long        lo;
             long                 hi;
}rpcESICY;

const short  rpcTRUE                = 1;
const short  rpcFALSE               = 0;

const short  rpcESIVT_EMPTY         = 0;
const short  rpcESIVT_NULL          = 1;
const short  rpcESIVT_I2            = 2;
const short  rpcESIVT_I4            = 3;
const short  rpcESIVT_R4            = 4;
const short  rpcESIVT_R8            = 5;
const short  rpcESIVT_CY            = 6;
const short  rpcESIVT_DATE          = 7;
const short  rpcESIVT_BSTR          = 8;
const short  rpcESIVT_DISPATCH      = 9;
const short  rpcESIVT_ERROR         = 10;
const short  rpcESIVT_BOOL          = 11;
const short  rpcESIVT_VARIANT       = 12;
const short  rpcESIVT_UNKNOWN       = 13;
const short  rpcESIVT_DECIMAL       = 14;
const short  rpcESIVT_I1            = 16;
const short  rpcESIVT_UI1           = 17;
const short  rpcESIVT_UI2           = 18;
const short  rpcESIVT_UI4           = 19;
const short  rpcESIVT_I8            = 20;
const short  rpcESIVT_UI8           = 21;
const short  rpcESIVT_INT           = 22;
const short  rpcESIVT_UINT          = 23;
const short  rpcESIVT_VOID          = 24;
const short  rpcESIVT_HRESULT       = 25;
const short  rpcESIVT_PTR           = 26;
const short  rpcESIVT_SAFEARRAY     = 27;
const short  rpcESIVT_CARRAY        = 28;
const short  rpcESIVT_USERDEFINED   = 29;
const short  rpcESIVT_LPSTR         = 30;
const short  rpcESIVT_LPWSTR        = 31;
const short  rpcESIVT_EOOBJECT      = 48;
const short  rpcESIVT_FILETIME      = 64;
const short  rpcESIVT_BLOB          = 65;
const short  rpcESIVT_STREAM        = 66;
const short  rpcESIVT_STORAGE       = 67;
const short  rpcESIVT_STEAMED_OBJECT= 68;
const short  rpcESIVT_STORED_OBJECT = 69;
const short  rpcESIVT_BLOB_OBJECT   = 70;
const short  rpcESIVT_CF            = 71;
const short  rpcESIVT_CLSID         = 72;



/*----------------- structure and variant definitions ---------------------*/

typedef [switch_type(rpcESIVARTYPE)]
 union {
   [case (rpcESIVT_EMPTY)]      long          bEmpty;      /*rpcESIVT_EMPTY
/* [case (rpcESIVT_NULL)]       bNull;                     /*rpcESIVT_NULL*/
   [case (rpcESIVT_I2)]         short         iVal;        /*rpcESIVT_I2*/
   [case (rpcESIVT_I4)]         long          lVal;        /*rpcESIVT_I4*/
   [case (rpcESIVT_R4)]         float         fltlVal;     /*rpcESIVT_R4*/
   [case (rpcESIVT_R8)]         double        dblVal;      /*rpcESIVT_R8*/
   [case (rpcESIVT_CY)]         rpcESICY      cyVal;       /*rpcESIVT_CY*/
   [case (rpcESIVT_DATE)]       double        date;        /*rpcESIVT_DATE*/
   [case (rpcESIVT_BSTR)]       rpcESIBSTR    bstrVal;     /*rpcESIVT_BSTR*/
/* [case (rpcESIVT_DISPATCH)]   Idispatch     pdispVal;    /*rpcESIVT_DISPATCH*/
/* [case (rpcESIVT_DISPATCH)]   ESIERRO       preturn;     /*rpcESIVT_ERROR*/
   [case (rpcESIVT_BOOL)]       rpcBOOL       bVal;        /*rpcESIVT_BOOL*/
/* [case (rpcESIVT_UNKNOWN)]    Iunknown      punkVal;     /*rpcESIVT_UNKNOWN*/
/* [case (rpcESIVT_DECIMAL)]                               /*rpcESIVT_DECIMAL*/
/* [case (rpcESIVT_I1)]                                    /*rpcESIVT_I1*/
/* [case (rpcESIVT_UI1)]                                   /*rpcESIVT_UI1*/
/* [case (rpcESIVT_UI2)]                                   /*rpcESIVT_UI2*/
   [case (rpcESIVT_UI4)]        rpcESIDWORD   dVal;        /*rpcESIVT_UI4*/
/* [case (rpcESIVT_I8)]                                    /*rpcESIVT_I8*/
/* [case (rpcESIVT_UI8)]                                   /*rpcESIVT_UI8*/
   [case (rpcESIVT_INT)]        long          plVal;       /*rpcESIVT_INT*/
   [case (rpcESIVT_UINT)]       unsigned long puVal;       /*rpcESIVT_UINT*/
/* [case (rpcESIVT_VOID)]       void *        pvoid;       /*rpcESIVT_VOID*/
/* [case (rpcESIVT_HRESULT)]                               /*rpcESIVT_HRESULT*/
/* [case (rpcESIVT_PTR)]                                   /*rpcESIVT_PTR*/
/* [case (rpcESIVT_SAFEARRAY)]  rpcESISAFEARRAY* parrVal;  /*rpcESIVT_SAFEARRAY*/
/* [case (rpcESIVT_CARRAY)]                                /*rpcESIVT_CARRAY*/
/* [case (rpcESIVT_USERDEFINED)]                           /*rpcESIVT_USERDEFINED*/
   [case (rpcESIVT_LPSTR)]      rpcESILPTSTR  plstrVal;    /*rpcESIVT_LPSTR*/
/* [case (rpcESIVT_LPWSTR)]     ESILPWSTR     plpwstrVal;  /*rpcESIVT_LPWSTR*/
   [case (rpcESIVT_EOOBJECT)]   rpcESIOBJCT   pobjVal;     /*rpcESIVT_EOOBJECT*/
/* [case (rpcESIVT_FILETIME)]   ESIFILETIME   pftVal;      /*rpcESIVT_FILETIME*/
/* [case (rpcESIVT_BLOB)]                                  /*rpcESIVT_BLOB*/
/* [case (rpcESIVT_STREAM)]                                /*rpcESIVT_STREAM*/
/* [case (rpcESIVT_STORAGE)]                               /*rpcESIVT_STORAGE*/
/* [case (rpcESIVT_STEAMED_OBJECT)]                        /*rpcESIVT_STEAMED_OBJECT*/
/* [case (rpcESIVT_STORED_OBJECT)]                         /*rpcESIVT_STORED_OBJECT*/
/* [case (rpcESIVT_BLOB_OBJECT)]                           /*rpcESIVT_BLOB_OBJECT*/
/* [case (rpcESIVT_CF)]                                    /*rpcESIVT_CF*/
/* [case (rpcESIVT_CLSID)]      UUID          puidVal;     /*rpcESIVT_CLSID*/
   [default]   ;
} rpcCasedESIVARIANT2;

typedef struct tagrpcESIVARIANT2 {
             rpcESIVARTYPE       vt;
             unsigned short      wReserved1;
             unsigned short      wReserved2;
             unsigned short      wReserved3;
[switch_is(vt)] rpcCasedESIVARIANT2 u;
}rpcESIVARIANT2;

typedef [ptr]        rpcESIVARIANT2* prpcESI2;


typedef [switch_type(rpcESIVARTYPE)]
 union {
   [case (rpcESIVT_EMPTY)]      long          bEmpty;      /*rpcESIVT_EMPTY
/* [case (rpcESIVT_NULL)]       bNull;                     /*rpcESIVT_NULL*/
   [case (rpcESIVT_I2)]         short         iVal;        /*rpcESIVT_I2*/
   [case (rpcESIVT_I4)]         long          lVal;        /*rpcESIVT_I4*/
   [case (rpcESIVT_R4)]         float         fltlVal;     /*rpcESIVT_R4*/
   [case (rpcESIVT_R8)]         double        dblVal;      /*rpcESIVT_R8*/
   [case (rpcESIVT_CY)]         rpcESICY      cyVal;       /*rpcESIVT_CY*/
   [case (rpcESIVT_DATE)]       double        date;        /*rpcESIVT_DATE*/
   [case (rpcESIVT_BSTR)]       rpcESIBSTR    bstrVal;     /*rpcESIVT_BSTR*/
/* [case (rpcESIVT_DISPATCH)]   Idispatch     pdispVal;    /*rpcESIVT_DISPATCH*/
/* [case (rpcESIVT_DISPATCH)]   ESIERRO       preturn;     /*rpcESIVT_ERROR*/
   [case (rpcESIVT_BOOL)]       rpcBOOL       bVal;        /*rpcESIVT_BOOL*/
/* [case (rpcESIVT_UNKNOWN)]    Iunknown      punkVal;     /*rpcESIVT_UNKNOWN*/
/* [case (rpcESIVT_DECIMAL)]                               /*rpcESIVT_DECIMAL*/
/* [case (rpcESIVT_I1)]                                    /*rpcESIVT_I1*/
/* [case (rpcESIVT_UI1)]                                   /*rpcESIVT_UI1*/
/* [case (rpcESIVT_UI2)]                                   /*rpcESIVT_UI2*/
   [case (rpcESIVT_UI4)]        rpcESIDWORD   dVal;        /*rpcESIVT_UI4*/
/* [case (rpcESIVT_I8)]                                    /*rpcESIVT_I8*/
/* [case (rpcESIVT_UI8)]                                   /*rpcESIVT_UI8*/
   [case (rpcESIVT_INT)]        long          plVal;       /*rpcESIVT_INT*/
   [case (rpcESIVT_UINT)]       unsigned long puVal;       /*rpcESIVT_UINT*/
/* [case (rpcESIVT_VOID)]       void *        pvoid;       /*rpcESIVT_VOID*/
/* [case (rpcESIVT_HRESULT)]                               /*rpcESIVT_HRESULT*/
/* [case (rpcESIVT_PTR)]                                   /*rpcESIVT_PTR*/
/* [case (rpcESIVT_SAFEARRAY)]  rpcESISAFEARRAY* parrVal;  /*rpcESIVT_SAFEARRAY*/
/* [case (rpcESIVT_CARRAY)]                                /*rpcESIVT_CARRAY*/
/* [case (rpcESIVT_USERDEFINED)]                           /*rpcESIVT_USERDEFINED*/
   [case (rpcESIVT_LPSTR)]      rpcESILPTSTR  plstrVal;    /*rpcESIVT_LPSTR*/
/* [case (rpcESIVT_LPWSTR)]     ESILPWSTR     plpwstrVal;  /*rpcESIVT_LPWSTR*/
   [case (rpcESIVT_EOOBJECT)]   rpcESIOBJCT   pobjVal;     /*rpcESIVT_EOOBJECT*/
   [case (rpcESIVT_VARIANT)]    prpcESI2      pvarVal;     /*rpcESIVT_VARIANT*/
/* [case (rpcESIVT_FILETIME)]   ESIFILETIME   pftVal;      /*rpcESIVT_FILETIME*/
/* [case (rpcESIVT_BLOB)]                                  /*rpcESIVT_BLOB*/
/* [case (rpcESIVT_STREAM)]                                /*rpcESIVT_STREAM*/
/* [case (rpcESIVT_STORAGE)]                               /*rpcESIVT_STORAGE*/
/* [case (rpcESIVT_STEAMED_OBJECT)]                        /*rpcESIVT_STEAMED_OBJECT*/
/* [case (rpcESIVT_STORED_OBJECT)]                         /*rpcESIVT_STORED_OBJECT*/
/* [case (rpcESIVT_BLOB_OBJECT)]                           /*rpcESIVT_BLOB_OBJECT*/
/* [case (rpcESIVT_CF)]                                    /*rpcESIVT_CF*/
/* [case (rpcESIVT_CLSID)]      UUID          puidVal;     /*rpcESIVT_CLSID*/
   [default]   ;
} rpcCasedESIVARIANT;


typedef              struct        tagrpcESIVARIANT {
             rpcESIVARTYPE       vt;
             unsigned short      wReserved1;
             unsigned short      wReserved2;
             unsigned short      wReserved3;
[switch_is(vt)] rpcCasedESIVARIANT u;
}rpcESIVARIANT;

typedef struct tagrpcESIPARAMETER {
             rpcESIVARIANT       Param;
             short               IsNamed;
[string]     char*               pName;
} rpcESIPARAMETER;

typedef              rpcESIPARAMETER rpcESIPARAMETERARRAY[];

typedef              rpcESIVARIANT*  rpcLPCVARIANT;

typedef              rpcESIVARIANT   rpcESIVARVAR[];

typedef              rpcESIVARIANT   rpcESIVARARRAY[1];
/*----------------------- CREATE FRAME --------------------------*/

const short   rpcESICR_KEYPARM          =0;
const short   rpcESICR_POSPARM          =1;
const short   rpcESICR_PRPPARM          =2;
const short   rpcESICR_PRPVAL           =3;
const short   rpcESICR_CREATEKEYWORDS   =4;
const short   rpcESI_PARMLIMIT          =30;


typedef              struct        tagrpcESICREATEKEYWORDPARM{
[string,ptr]   char*             Name;    /*name of keyword parameter*/
               rpcESIVARIANT     Value;   /*value of keyword parameter*/
}rpcESICREATEKEYWORDPARM;


typedef struct tagrpcESICREATEPOSPARM{
               rpcParamCount     Pos;     /*position of parameter*/
               rpcESIVARIANT     Value;   /*value of positional parameter*/
}rpcESICREATEPOSPARM;


typedef struct tagrpcESICREATEKEYWORD{
[string,ptr]   char*             Name;    /*name of create keyword*/
               rpcESIVARIANT     Value;   /*value of create keyword*/
}rpcESICREATEKEYWORD;


typedef struct tagrpcESICREATEPROPSPARM{
               rpcParamCount     PropParmType;  /*property calling type*/
               rpcParamCount     PropParmPos;   /*property parameter position*/
[string,ptr]   char*             PropKeyWord;   /*prop parameter keyword*/
               rpcESIVARIANT     Value;         /*value of property parameter*/
               rpcParamCount     PropPos;       /*property position*/
}rpcESICREATEPROPSPARM;


typedef struct tagrpcESICREATEPROPSVAL{
[string,ptr]  char*              Name;          /*property name*/
              rpcParamCount      Pos;           /*property position*/
              rpcESIVARIANT      Value;         /*property value*/
}rpcESICREATEPROPSVAL ;


typedef [switch_type(rpcESIVARTYPE)]
union{
[case (rpcESICR_CREATEKEYWORDS)]  rpcESICREATEKEYWORD      KeyWord; /*keyword
on create*/
[case (rpcESICR_KEYPARM)]         rpcESICREATEKEYWORDPARM  KeyParm; /*keyword
parm on create*/
[case (rpcESICR_POSPARM)]         rpcESICREATEPOSPARM      PosParm; /*position parm on
create*/
[case (rpcESICR_PRPPARM)]         rpcESICREATEPROPSPARM    PropParm;/*parameters on
property*/
[case (rpcESICR_PRPVAL)]          rpcESICREATEPROPSVAL     PropVal; /*value of prop
param's*/
[default]                         ;
} rpcCasedESICREATEPARM;


typedef struct tagrpcESICREATEPARM {
                       rpcESIVARTYPE         ParmType;         /*structure type*/
[switch_is(ParmType)]  rpcCasedESICREATEPARM u;
} rpcESICREATEPARM;


typedef  rpcESICREATEPARM rpcESICREATEPARMARRAY[];


/*---------------------- MANAGEMENT DEFINITIONS --------------------*/
typedef  long  rpcESIOPERCOUNTER;

typedef struct tagrpcESICOUNTER{
   rpcESIOPERCOUNTER      ctTotal;
   rpcESIOPERCOUNTER      ctTimer;
   rpcESIOPERCOUNTER      ctEO;
   rpcESIOPERCOUNTER      ctM;
}rpcESICOUNTER;

}
========================================================================
====
======================= RPCESITYPE.ACF
=====================================
========================================================================
====
[implicit_handle (handle_t RpcEsiType_IfHandle)
] interface RpcEsiType
{
}
========================================================================
====
======================= MAIN.CPP
===========================================
========================================================================
====
#include "esivms.h"
#include "esimacro.h"
#include "esirpc.h"
#include "rpc_sec.h"
#include "server0.h"

void returnFunction(BOOL   bValue)
{
  printf("main: this is a return function: %i\n",bValue);
}

main()
{
  CRpcSecurity*   pRpcSec;
  char*           gv[5];
  char            gv1[10];
  char            gv2[10];
  char            gv3[10];
  BOOL            bSecurity;
  RPC_STATUS      status;
  char*           pszProtocol = "ncacn_ip_tcp";
  char*           pszServer0Port = "24386";

  sprintf(gv1,"%i",rpc_c_protect_level_connect);
  sprintf(gv2,"%i",rpc_c_authn_dce_secret);
  sprintf(gv3,"%i",rpc_c_authz_dce);

  gv[0] = "EsiServer0";
  gv[1] = gv1;
  gv[2] = gv2;
  gv[3] = gv3;
  gv[4] = "0";

  pRpcSec = new CRpcSecurity(returnFunction);

  bSecurity = pRpcSec->InitSecurity(gv);
  ESITRACE1("main: security return = %i\n",bSecurity);

  ESITRACE0("s0: ss0: server use\n");
  rpc_server_use_protseq_ep( (unsigned char *)pszProtocol,
                             5,
                             (unsigned char*)pszServer0Port,
                             &status);

  if (CHECK_STATUS(status))
  {
    ESITRACE0("s0: ss0: register\n");
    rpc_server_register_if( Server0_v1_0_s_ifspec,  //chek after producing .h
                            NULL,
                            NULL,
                            &status);

    if (CHECK_STATUS(status))
    {
      if (gv[0] != NULL)
      {
        ESITRACE0("s0:ss0 registering authorization information\n");
        ESITRACE1("s0:ss0:s0 security name = %s\n",gv[0]);
        ESITRACE1("s0:ss0:s0 authn service = %s\n",gv[2]);
        rpc_server_register_auth_info((unsigned char *) gv[0],
                                      rpc_c_authn_dce_secret,
                                      NULL,
                                      NULL,
                                      &status);
        ESITRACE1("s0:ss0: authorization status = %i\n",status);
        if (!CHECK_STATUS(status))
        {
          PRINT_STATUS(status,"s0:ss0: failure of authorization,");
        }
      }
      else
      {
        ESITRACE0("s0:ss0: running without security\n");
      }

      if (CHECK_STATUS(status))
      {
        ESITRACE0("s0: ss0: starting listen\n");
        rpc_server_listen(5, &status);
        ESITRACE0("s0:ss0:listen exited\n");
        if (!CHECK_STATUS(status))
          PRINT_STATUS(status,"s0:ss0:listen problem:\n");
      }
    }
    else
    {
      PRINT_STATUS(status,"s0:ss0:problem with reg. if:");
    }
  }
  else
  {
    PRINT_STATUS(status,"s0:ss0: problem with use: ");
  }

}
========================================================================
====
======================= COMPILE.COM
========================================
========================================================================
====
$ set verify
$! note: dce logical is define on our system. should also be defined on
$! yours. Below is our define.
$! define dce ESI$DKA200:[VMS$COMMON.DCE$LIBRARY]
$ IDL RPCESITYPE.IDL/OUT/KEEP=ALL
$ IDL SERVER0.IDL /OUT/KEEP=ALL
$ cxx/inc=(dce,[])/nooptimize/list/define=(ESIRPC_DEC,ESIDEBUG)/debug RPC_SEC.CPP
$ cxx/inc=(dce,[])/nooptimize/list/define=(ESIRPC_DEC,ESIDEBUG)/debug MAIN.CPP
$ cxxlink/map/exec=maintest.exe -
main.obj,-
rpc_sec.obj,-
server0_sstub.obj, -
dce:dce_cxx.opt/opt

    
3333.7QAR enteredHYDRA::DORHAMERFri Mar 28 1997 09:343
    I've entered QAR #766 in the VMS-DCE-INT database on trifid.
    
    Karen
3333.8response to QARHYDRA::DORHAMERFri Mar 28 1997 11:3375
        #1          28-MAR-1997 11:31:22.89                                 
    NEWMAIL
    From:   HYDRA::AXPDEVELOPER "[email protected]"
    To:     SMTP%"[email protected]"
    CC:     AXPDEVELOPER
    Subj:   recommendations from DCE engineering
    
    To: Steve Popkes, ESI Technology
    
    Attached are some recommendations from our engineering organization on how
    to approach debugging this problem.
    
    Karen Dorhamer
    Alpha Developer Support
    
    From:   EVMS::SWEENEY      "Dave 381-2407, ZKO3-4/S23" 28-MAR-1997 11:24:43.60
    To:     HYDRA::DORHAMER
    CC:     SWEENEY
    Subj:   Response to VMS VMS-DCE-INT QAR 766 - SOFTWARE PARTNER WANTS
    HELP DEBUGGING APPLICATION
    
    This looks like an application debugging issue, because there is no
    indication in this QAR this is a new bug.  Can the following questions
    be answered:
    
            Is this new code ?  (I suspect it is)
            Did it work before and is broke now?
    
    Assuming it's new code...
    ---------------------------
    
    It is most likely the problem is not an ACCVIO.  ACCVIO is a status
    commonly reported by threads program on signals that are not handled
    until the last chance handler runs.  Since threads unwinds the stack,
    no useful information is available, as is the case with the ACCVIO
    message reported in this QAR.  It is not even evident that the
    refresh thread is getting the ACCVIO.  It could be another thread.
    
    .. Need more info ..
    The first problem I see is that the application is not reporting what
    DCE error calls are encountering.  Can ALL CATCH_ALL's be modified to
    report the DCE error.  A call to dce_err_inq_text to retrieve the
    text of the dce error and a printf both the error code and the text
    would be most helpful.  The status should be reported as well as the
    text.  The text for some codes is not public.  Many DCE developers
    write a common routine to be called from all DCE related catch_alls.
    I suggest writing a error reporting routine.
    
    
    Notice the catch all is a trace and the status get changed.
    
    while (1)
      {
    //    TRY
    //    {
          ESITRACE0("crs:srk: making key management call\n");
          sec_key_mgmt_manage_key(rpc_c_authn_dce_secret,
         ESITRACE0("crs:srk: successful key management call\n");
    //    }
    //    CATCH_ALL
    //    {
    //      ESITRACE0("crs:srk:exception from sec call\n");
    //      status = ESISTAT_GENFAILURE;
    //
    //    }
    //    ENDTRY
    
    
    Modifying all CATCH_ALLs to report the DCE errors will help both
    the customer and Digital understand and debug problems.
    
    Thanks,
    
    Dave Sweeney
    
3333.9ESI TechnologyHYDRA::TALATINIANFri Mar 28 1997 14:4627
To: KAREN DORHAMMER <[email protected]>
Subject: DCE PROBLEM
Message-Id: <[email protected]>

TO:     Karen Dorhamer, Digital, [email protected]

FROM:   Steven Popkes, Esi Technology
        508 651 1400, voice
        508 651 0708, fax
        [email protected]

RE:     dce problem

Karen:

Thanks for your reply and the encapsulated reply from the DCE group.
Unfortunately, it didn't address my problem. I'm fully aware I'm
intercepting the status variable before I pass it further. I'm doing that
because the call to sec_key_mgmt_manage_key is not resetting it. I'd
be more than happy to use dce_error_inq_text, but dce_error_inq_text 
requires a status. Since the problem I'm encountering does not reset
the status, dce_error_inq_text does not help.

Where do we go now?

Steven Popkes

3333.10process dump info requestedHYDRA::DORHAMERMon Mar 31 1997 10:5149
        #1          31-MAR-1997 09:47:39.99                                 
    NEWMAIL
    From:   HYDRA::AXPDEVELOPER "[email protected]"
    To:     SMTP%"[email protected]"
    CC:     AXPDEVELOPER
    Subj:   RE: DCE PROBLEM
    
    TO: Steve Popkes
    
    Steve,
    
    Our engineering group has requested some additional info to help them
    debug the DCE problem.  Please see the attached note.
    
    Thanks,
    Karen Dorhamer
    Alpha Developer Support
    
    From:   EVMS::STAR::SWEENEY      "Office ZKO03-2/s31, 381-2407"
    To:     EVMS::HYDRA::DORHAMER
    CC:     SWEENEY
    
    Subj:   RE: response from software partner regarding
    sec_key_mgmt_manage_key problem
    
    
    Hi,
    
            Can you have Steven run the server process to produce a process
    dump then the accvio occurs.  This can be achieved by putting a SET
    PROCESS/DUMP in the DCL procedure or interactive session prior to running 
    the program.  When the image terminates, we'll need a minimum of the 
    following commands processed on the process dump:
    
            $ analyze/process dump.name
            dbg> show image
            dbg> show task/all
            ... for each task listed above
                    dbg> set task %task 'number'
                    dbg> show calls
            dbg> show stack
    
    Please do not send me the process dump to do the above as it will most
    likely not be readable except on the system that produces the dump.
    
    Thanks,
    
    Dave Sweeney
    
3333.11dump analysisHYDRA::DORHAMERThu Apr 03 1997 11:0599
From:	SMTP%"[email protected]"    2-APR-1997 14:48:14.80
To:	KAREN DORHAMER <[email protected]>
CC:	
Subj:	DCE PROBLEM, LETTER #3, SECTION 3/3

TO:     Karen Dorhamer, Digital, [email protected]

FROM:   Steven Popkes, Esi Technology
        508 651 1400, voice
        508 651 0708, fax
        [email protected]

RE:     dce problem,3/3


Karen,

Thanks for the forwarded reply from David Sweeney. Here are the things he 
requested.

The reply is in three sections:
	1) COMPILE AND LINK
		this is the compile and link output so that David can see the
	 	options we linked with. The missing components of the link are
		the server functions called by the stub. The behavior we're 
having
		a problem with does not require the invocation of this code so I
		left it out to reduce the source that is required to be 
analyzed.
		The behavior is unchanged regardless of its presence or absence.

	2) DEBUG ANALYSIS
		These are the requests made in the note regarding the dbg> 
prompt.

	3) DUMP ANALYSIS
		These are the requests made in the note regarding the dump 
analysis.

Thank you for your time.

Steven Popkes

============================================================================
======================== DUMP ANALYSIS =====================================
============================================================================

$ analyze/process maintest.dmp
Condition signalled to take dump:

%SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=00000008, PC
=84449024, PS=0000001B

  Improperly handled condition, image exit forced.
    Signal arguments:   Number = 00000005
                        Name   = 0000000C
                                 00000000
                                 00000008
                                 84449024
                                 0000001B

    Register dump:
    R0  = 0000000000000005  R1  = 0000000000000001  R2  = 0000000000000003
    R3  = 000000007EE0D014  R4  = 000000000000001D  R5  = 000000007EE0D014
    R6  = 000000007EE0D730  R7  = 000000007EE0D684  R8  = 000000007EE0D170
    R9  = 000000007FF9C400  R10 = 000000007FF9D228  R11 = 000000007FFBE3E0
    R12 = 0000000000000A01  R13 = FFFFFFFF8103DBD8  R14 = 0000000000000000
    R15 = 000000007EE0C000  R16 = 000000007EDFB948  R17 = 00000000003FA5A8
    R18 = 0000000000000000  R19 = FFFFFFFF801CF1E0  R20 = 000000000000001B
    R21 = 00000000003FA5A8  R22 = 0000000000000000  R23 = 00000000003FA5A8
    R24 = 0000000000000001  R25 = 0000000000000002  R26 = 000000007FFC1060
    R27 = 0000000000000000  R28 = 0000000000000000  R29 = 000000007EDFB960
    SP  = 000000007EDFB940  PC  = FFFFFFFF84449024  PS  = 000000000000001B
%SYSTEM-F-ACCVIO, access violation, reason mask=04, virtual address=7367206E, PC
=8444A054, PS=0000001B

  Improperly handled condition, image exit forced.
    Signal arguments:   Number = 00000005
                        Name   = 0000000C
                                 00000004
                                 7367206E
                                 8444A054
                                 0000001B

    Register dump:
    R0  = FFFFFFFFFFFFFBD8  R1  = 000000000FFFFFFF  R2  = 0000000000000003
    R3  = FFFFFFFF810325C0  R4  = 000000000000001F  R5  = 0000000000340638
    R6  = 000000001000000C  R7  = 000000007FF91FC0  R8  = 000000007EE0D170
    R9  = 000000007FF9C400  R10 = 000000007FF9D228  R11 = 000000007FFBE3E0
    R12 = 0000000000000A01  R13 = FFFFFFFF8438F680  R14 = 0000000000000000
    R15 = 000000007EE0C000  R16 = 0000000000340644  R17 = 00000000004B8320
    R18 = 0000000000000004  R19 = FFFFFFFF84449D58  R20 = 000000007FF91FB8
    R21 = 0000000000018001  R22 = 000000000017AA20  R23 = 000000000017AA20
    R24 = 000000007367206E  R25 = 0000000074786574  R26 = FFFFFFFF8002B380
    R27 = FFFFFFFF8444D898  R28 = 000000007EDFB594  R29 = 000000007EDFB640
    SP  = 000000007EDFB594  PC  = FFFFFFFF8444A054  PS  = 140000000000001B


    
3333.12part 1 of 3 - compile/link infoHYDRA::DORHAMERThu Apr 03 1997 15:35181
From:	SMTP%"[email protected]"  3-APR-1997 13:24:46.74
To:	KAREN DORHAMER <[email protected]>
CC:	
Subj:	DCE PROBLEM, LETTER #3, 1/3

TO:     Karen Dorhamer, Digital, [email protected]

FROM:   Steven Popkes, Esi Technology
        508 651 1400, voice
        508 651 0708, fax
        [email protected]

RE:     dce problem, letter #3, 1/3


Karen,

Thanks for the forwarded reply from David Sweeney. Here are the things he 
requested.

The reply is in three sections:
	1) COMPILE AND LINK
		this is the compile and link output so that David can see the
	 	options we linked with. The missing components of the link are
		the server functions called by the stub. The behavior we're having
		a problem with does not require the invocation of this code so I
		left it out to reduce the source that is required to be analyzed.
		The behavior is unchanged regardless of its presence or absence.

	2) DEBUG ANALYSIS
		These are the requests made in the note regarding the dbg> prompt.

	3) DUMP ANALYSIS
		These are the requests made in the note regarding the dump analysis.

Thank you for your time.

Steven Popkes

============================================================================
======================== COMPILE AND LINK ==================================
============================================================================

$ @compile
$! note: dce logical is define on our system. should also be defined on
$! yours. Below is our define.
$! define dce ESI$DKA200:[VMS$COMMON.DCE$LIBRARY]
$! IDL RPCESITYPE.IDL/OUT/KEEP=ALL
$! IDL SERVER0.IDL /OUT/KEEP=ALL
$! cxx/inc=(dce,[])/nooptimize/list/define=(ESIRPC_DEC,ESIDEBUG)/debug RPC_SEC.C
PP
$! cxx/inc=(dce,[])/nooptimize/list/define=(ESIRPC_DEC,ESIDEBUG)/debug MAIN.CPP
$ cxxlink/debug/map/exec=maintest.exe -
main.obj,-
rpc_sec.obj,-
server0_sstub.obj, -
dce:dce_cxx.opt/opt
%LINK-W-NUDFSYMS, 18 undefined symbols:
%LINK-I-UDFSYM, void RpcGatewayNotify(rpc_handle_s_t *, unsigned char *)
 
%LINK-I-UDFSYM, unsigned int RpcPortRestore(rpc_handle_s_t *, unsigned c
har *) 
%LINK-I-UDFSYM, tagCONNECTION * RpcServer0Connection(rpc_handle_s_t *, u
nsigned char *) 
%LINK-I-UDFSYM, unsigned int RpcServer0DeletePort(rpc_handle_s_t *, unsi
gned char *) 
%LINK-I-UDFSYM, void RpcServer0DeletePortRange(rpc_handle_s_t *, unsigne
d char *, unsigned char *) 
%LINK-I-UDFSYM, void RpcServer0DisableLogin(rpc_handle_s_t *) 
%LINK-I-UDFSYM, void RpcServer0EnableLogin(rpc_handle_s_t *) 
%LINK-I-UDFSYM, short RpcServer0GetLoginState(rpc_handle_s_t *) 
%LINK-I-UDFSYM, void RpcServer0GetPortInfo(rpc_handle_s_t *, unsigned ch
ar *, tagRpcPortNode *) 
%LINK-I-UDFSYM, unsigned char * RpcServer0GetPortListString(rpc_handle_s
_t *) 
%LINK-I-UDFSYM, void RpcServer0GetPortRange(rpc_handle_s_t *, unsigned c
har **, unsigned char **) 
%LINK-I-UDFSYM, unsigned int RpcServer0InsertPort(rpc_handle_s_t *, unsi
gned char *) 
%LINK-I-UDFSYM, unsigned int RpcServer0InsertPortRange(rpc_handle_s_t *,
 unsigned char *, unsigned char *) 
%LINK-I-UDFSYM, unsigned int RpcServer0SetPortList(rpc_handle_s_t *, uns
igned char *, int *) 
%LINK-I-UDFSYM, void RpcServer0SetPortRange(rpc_handle_s_t *, unsigned c
har *, unsigned char *, int *) 
%LINK-I-UDFSYM, unsigned int RpcServer0Shutdown(rpc_handle_s_t *) 
%LINK-I-UDFSYM, unsigned int RpcShutdownAllGateways(rpc_handle_s_t *) 
%LINK-I-UDFSYM, unsigned int RpcShutdownServerGateway(rpc_handle_s_t *, 
unsigned char *) 
%LINK-W-USEUNDEF, undefined symbol tagCONNECTION * RpcServer0Connection(rpc_hand
le_s_t *, unsigned char *) referenced
in psect $DATA$ offset %X000007F0
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol unsigned int RpcPortRestore(rpc_handle_s_t *,
 unsigned char *) referenced
in psect $DATA$ offset %X000007F4
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol unsigned int RpcShutdownServerGateway(rpc_han
dle_s_t *, unsigned char *) referenced
in psect $DATA$ offset %X000007F8
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol unsigned int RpcServer0Shutdown(rpc_handle_s_
t *) referenced
in psect $DATA$ offset %X000007FC
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol unsigned int RpcShutdownAllGateways(rpc_handl
e_s_t *) referenced
in psect $DATA$ offset %X00000800
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol unsigned char * RpcServer0GetPortListString(r
pc_handle_s_t *) referenced
in psect $DATA$ offset %X00000804
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol unsigned int RpcServer0SetPortList(rpc_handle
_s_t *, unsigned char *, int *) referenced
in psect $DATA$ offset %X00000808
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol void RpcServer0GetPortRange(rpc_handle_s_t *,
 unsigned char **, unsigned char **) referenced
in psect $DATA$ offset %X0000080C
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol void RpcServer0SetPortRange(rpc_handle_s_t *,
 unsigned char *, unsigned char *, int *) referenced
in psect $DATA$ offset %X00000810
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol unsigned int RpcServer0DeletePort(rpc_handle_
s_t *, unsigned char *) referenced
in psect $DATA$ offset %X00000814
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol unsigned int RpcServer0InsertPort(rpc_handle_
s_t *, unsigned char *) referenced
in psect $DATA$ offset %X00000818
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol void RpcServer0DeletePortRange(rpc_handle_s_t
 *, unsigned char *, unsigned char *) referenced
in psect $DATA$ offset %X0000081C
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol unsigned int RpcServer0InsertPortRange(rpc_ha
ndle_s_t *, unsigned char *, unsigned char *) referenced
in psect $DATA$ offset %X00000820
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol void RpcGatewayNotify(rpc_handle_s_t *, unsig
ned char *) referenced
in psect $DATA$ offset %X00000824
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol void RpcServer0DisableLogin(rpc_handle_s_t *)
 referenced
in psect $DATA$ offset %X00000828
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol void RpcServer0EnableLogin(rpc_handle_s_t *) 
referenced
in psect $DATA$ offset %X0000082C
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol short RpcServer0GetLoginState(rpc_handle_s_t 
*) referenced
in psect $DATA$ offset %X00000830
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1
%LINK-W-USEUNDEF, undefined symbol void RpcServer0GetPortInfo(rpc_handle_s_t *, 
unsigned char *, tagRpcPortNode *) referenced
in psect $DATA$ offset %X00000834
in module SERVER0_SSTUB file ESI$DKA200:[DEODEV.SERVER0_NEW.DCE_PROB]SER
VER0_SSTUB.OBJ;1

    
3333.13part 2 of 3 - debug analysisHYDRA::DORHAMERThu Apr 03 1997 15:35559
From:	SMTP%"[email protected]"  3-APR-1997 13:30:46.04
To:	KAREN DORHAMER <[email protected]>
CC:	
Subj:	DCE PROBLEM LETTER #3, 2/3

TO:     Karen Dorhamer, Digital, [email protected]

FROM:   Steven Popkes, Esi Technology
        508 651 1400, voice
        508 651 0708, fax
        [email protected]

RE:     dce problem


Karen,

Thanks for the forwarded reply from David Sweeney. Here are the things he 
requested.

The reply is in three sections:
	1) COMPILE AND LINK
		this is the compile and link output so that David can see the
	 	options we linked with. The missing components of the link are
		the server functions called by the stub. The behavior we're having
		a problem with does not require the invocation of this code so I
		left it out to reduce the source that is required to be analyzed.
		The behavior is unchanged regardless of its presence or absence.

	2) DEBUG ANALYSIS
		These are the requests made in the note regarding the dbg> prompt.

	3) DUMP ANALYSIS
		These are the requests made in the note regarding the dump analysis.

Thank you for your time.

Steven Popkes


============================================================================
======================== DEBUG ANALYSIS ====================================
============================================================================

$ ru  set process /dump
$ ru mai    n maintest

         OpenVMS Alpha DEBUG Version V6.2-100

%DEBUG-I-INITIAL, language is C_PLUS_PLUS, module set to MAIN
%DEBUG-I-NOTATMAIN, type GO to get to start of main program
DBG> go
break at routine MAIN\main
 25660:   char*           pszProtocol = "ncacn_ip_tcp";
DBG> go
crs:sg: security gate value/status = 0/0
crs:is:entering init security
crs:is: security name = EsiServer0
crs:is: prot level = 2
crs:is: authentication service = 1
crs:is: authorization service = 2
crs:is: key tab = 0
crs:psl: security attempted.
crs:psl: name = EsiServer0
crs:psl: setup identity call
crs:psl: setup identity complete
crs:psl: server startup status = 1
crs:sg: security gate value/status = 1/0
crs:is: psl returned boolean = 1
crs:st:starting threads
crs:st:key refresh thread start status = 0
main: security return = 1
s0: ss0: server use
s0: ss0: register
s0:ss0 registering authorization information
s0:ss0:s0 security name = EsiServer0
s0:ss0:s0 authn service = 1
s0:ss0: authorization status = 0
s0: ss0: starting listen
crs:sri: entering security refresh id thread
crs:sri: getting expiration date
crs:gedt: entering get expiration date
crs:sg: security gate value/status = 1/0
crs:sri: waiting 46197 seconds
crs:srk:entering security refresh key
crs:srk:security name = EsiServer0
crs:srk:security keytab = (null)
crs:srk:waiting 10 seconds
crs:srk:wait ended
%DEBUG-E-LASTCHANCE, stack exception handlers lost, re-initializing stack
%CMA-F-EXCCOP, exception raised; VMS condition code follows
-SYSTEM-F-ACCVIO, access violation, reason mask=04, virtual address=00D5C000, PC
=8048EC98, PS=0000001B
break on unhandled exception preceding SHARE$LIBRTL_CODE0+268444 in %TASK 9
DBG> show image
 image name                      set    base address    end address

 CMA$LIB_SHR                     no     003C2000        003F2BFF
 CMA$OPEN_LIB_SHR                no     0051A000        0054A3FF
 CMA$OPEN_RTL                    no     00476000        004A79FF
 CMA$RTL                         no     003F4000        004755FF
 CMA$TIS_SHR                     no     00248000        0024C1FF
    CODE0                               8049E000        8049EDFF
    DATA1                               00248000        002489FF
    DATA2                               0024A000        0024A1FF
    DATA3                               0024C000        0024C1FF
 CXXL$011_SHR                    no     00330000        003C09FF
 CXXL$MSG_SHR.EXE                no     00996000        009971FF
 DBGTBKMSG                       no     009C0000        009CCFFF
 DCE$CDS_MSG.EXE                 no     009AE000        009BE1FF
 DCE$IDL_CXX_SHR                 no     004A8000        005187FF
 DCE$KERNEL                      no     00A7C000        00ADE068
 DCE$LIB_SHR                     no     005AE000        008045FF
 DCE$RPC_MSG                     no     00998000        0099CDFF
 DCE$SEC_MSG                     no     0099E000        009AC5FF
 DCE$SOCKSHR_DNET_IV             no     00A0A000        00A7A5FF
 DCE$SOCKSHR_DNET_OSI            no     00AF0000        00B605FF
 DCE$SOCKSHR_IP                  no     00B62000        00BB23FF
 DEBUG                           no     0087A000        0098A9FF
 DECC$MSG                        no     0098C000        0098D3FF
 DECC$SHR                        no     0005A000        001DBBFF
    CODE0                               80566000        806831FF
 DPML$SHR                        no     001DC000        00246FFF
    CODE0                               804A0000        805645FF
    DATA1                               001DC000        002125FF
    DATA2                               00214000        00225DFF
    DATA3                               00226000        002263FF
    DATA4                               00228000        002441FF
    DATA5                               00246000        00246FFF
 DTSS$SHR                        no     0054C000        005AC5FF
 LIBOTS                          no     00052000        000581FF
    CODE0                               8048E000        8049CBFF
    DATA1                               00052000        000545FF
    DATA2                               00056000        00057BFF
    DATA3                               00058000        000581FF
 LIBRTL                          no     0024E000        0032F5FF
    CODE0                               80400000        8048DFFF
*MAINTEST                        yes    00010000        000505FF
 MULTINET_SOCKET_LIBRARY         no     00C36000        00CB65FF
 SHRIMGMSG                       no     0098E000        009949FF
 SYS$SSISHR                      no     00806000        008363FF
 UCX$IPC_SHR                     no     00BC4000        00C343FF

 total images: 29                bytes allocated: 819448
DBG> show task/all

 task id     state hold  pri substate        thread_object
 %TASK     1 SUSP         11 Condition Wait  Initial thread 
 %TASK     2 SUSP         11 Timed Cond Wait SHARE$DCE$LIB_SHR+2356680
 %TASK     3 SUSP         11 Condition Wait  SHARE$DCE$LIB_SHR+2365584
 %TASK     4 SUSP         11 Condition Wait  SHARE$DCE$LIB_SHR+2348400
 %TASK     5 SUSP         11 Condition Wait  8646652
 %TASK     6 SUSP         11 Condition Wait  13386340
 %TASK     7 SUSP         11 Condition Wait  13438188
 %TASK     8 SUSP         11 Delay           8627168
*%TASK     9 RUN          11                 8627176
 %TASK    10 SUSP         11 Condition Wait  13846060
 %TASK    11 SUSP         11 Condition Wait  13846108
 %TASK    12 SUSP         11 Condition Wait  13846156
 %TASK    13 SUSP         11 Condition Wait  13846204
 %TASK    14 SUSP         11 Condition Wait  13846252
DBG> show task 1
%DEBUG-E-NOTTASKVAL, expression does not specify a valid task value
DBG> show task %TASK     1

 task id     state hold  pri substate        thread_object
 %TASK     1 SUSP         11 Condition Wait  Initial thread 
DBG> show task %TASK     2

 task id     state hold  pri substate        thread_object
 %TASK     2 SUSP         11 Timed Cond Wait SHARE$DCE$LIB_SHR+2356680
DBG> show task %TASK     3

 task id     state hold  pri substate        thread_object
 %TASK     3 SUSP         11 Condition Wait  SHARE$DCE$LIB_SHR+2365584
DBG> show task %TASK     4

 task id     state hold  pri substate        thread_object
 %TASK     4 SUSP         11 Condition Wait  SHARE$DCE$LIB_SHR+2348400
DBG> show task %TASK     5

 task id     state hold  pri substate        thread_object
 %TASK     5 SUSP         11 Condition Wait  8646652
DBG> show task %TASK     6

 task id     state hold  pri substate        thread_object
 %TASK     6 SUSP         11 Condition Wait  13386340
DBG> show task %TASK     7

 task id     state hold  pri substate        thread_object
 %TASK     7 SUSP         11 Condition Wait  13438188
DBG> show task %TASK     8

 task id     state hold  pri substate        thread_object
 %TASK     8 SUSP         11 Delay           8627168
DBG> show task %TASK     9

 task id     state hold  pri substate        thread_object
*%TASK     9 RUN          11                 8627176
DBG> show task %TASK     10

 task id     state hold  pri substate        thread_object
 %TASK    10 SUSP         11 Condition Wait  13846060
DBG> show task %TASK     11

 task id     state hold  pri substate        thread_object
 %TASK    11 SUSP         11 Condition Wait  13846108
DBG> show task %TASK     12

 task id     state hold  pri substate        thread_object
 %TASK    12 SUSP         11 Condition Wait  13846156
DBG> show task %TASK     13

 task id     state hold  pri substate        thread_object
 %TASK    13 SUSP         11 Condition Wait  13846204
DBG> show task %TASK     14

 task id     state hold  pri substate        thread_object
 %TASK    14 SUSP         11 Condition Wait  13846252
DBG> set task %TASK     1
%DEBUG-W-SCRNOSRCLIN, no source line for address 00434320 for display in SRC
DBG> show calls
 module name     routine name                     line       rel PC    abs PC
 SHARE$CMA$RTL                                              00000000  00434320
 SHARE$CMA$RTL                                              00000000  0042AA48
 SHARE$CMA$RTL                                              00000000  0043BC9C
 SHARE$CMA$OPEN_RTL 
                                                            00000000  00498404
 SHARE$DCE$LIB_SHR 
                                                            00000000  0069CBA8
*MAIN                                            25718      00000380  000304AC
*MAIN            __main                                     000000A4  000300A4
                                                            000000E8  000366E0
                                                            00000000  8444A1F8
DBG> set task %TASK     2
%DEBUG-W-SCRNOSRCLIN, no source line for address 00434320 for display in SRC
DBG> show calls
 module name     routine name                     line       rel PC    abs PC
 SHARE$CMA$RTL                                              00000000  00434320
 SHARE$CMA$RTL                                              00000000  0042A26C
 SHARE$CMA$RTL                                              00000000  0043BBFC
 SHARE$CMA$OPEN_RTL 
                                                            00000000  0049843C
 SHARE$DCE$LIB_SHR 
                                                            00000000  006E2704
 SHARE$CMA$RTL                                              00000000  00446B58
DBG> set task %TASK     3
%DEBUG-W-SCRNOSRCLIN, no source line for address 00434320 for display in SRC
DBG> show calls
 module name     routine name                     line       rel PC    abs PC
 SHARE$CMA$RTL                                              00000000  00434320
 SHARE$CMA$RTL                                              00000000  0042AA48
 SHARE$CMA$RTL                                              00000000  0043BC9C
 SHARE$CMA$OPEN_RTL 
                                                            00000000  00498404
 SHARE$DCE$LIB_SHR 
                                                            00000000  0075C48C
 SHARE$DCE$LIB_SHR 
                                                            00000000  007546F0
 SHARE$DCE$LIB_SHR 
                                                            00000000  007534D4
 SHARE$CMA$RTL                                              00000000  00446B58
DBG> set task %TASK     4
%DEBUG-W-SCRNOSRCLIN, no source line for address 00434320 for display in SRC
DBG> show calls
 module name     routine name                     line       rel PC    abs PC
 SHARE$CMA$RTL                                              00000000  00434320
 SHARE$CMA$RTL                                              00000000  0042AA48
 SHARE$CMA$RTL                                              00000000  0043BC9C
 SHARE$CMA$OPEN_RTL 
                                                            00000000  00498404
 SHARE$DCE$LIB_SHR 
                                                            00000000  0075D31C
 SHARE$DCE$LIB_SHR 
                                                            00000000  006A50D0
 SHARE$CMA$RTL                                              00000000  00446B58
DBG> set task %TASK     5
%DEBUG-W-SCRNOSRCLIN, no source line for address 00434320 for display in SRC
DBG> show calls
 module name     routine name                     line       rel PC    abs PC
 SHARE$CMA$RTL                                              00000000  00434320
 SHARE$CMA$RTL                                              00000000  0042AA48
 SHARE$CMA$RTL                                              00000000  0043BC9C
 SHARE$CMA$OPEN_RTL 
                                                            00000000  00498404
 SHARE$DCE$LIB_SHR 
                                                            00000000  0075C48C
 SHARE$DCE$LIB_SHR 
                                                            00000000  006A587C
 SHARE$DCE$LIB_SHR 
                                                            00000000  006C48B8
 SHARE$DCE$LIB_SHR 
                                                            00000000  006C3210
 SHARE$DCE$LIB_SHR 
                                                            00000000  006C2CB4
 SHARE$CMA$RTL                                              00000000  00446B58
DBG> set task %TASK     6
%DEBUG-W-SCRNOSRCLIN, no source line for address 00434320 for display in SRC
DBG> show calls
 module name     routine name                     line       rel PC    abs PC
 SHARE$CMA$RTL                                              00000000  00434320
 SHARE$CMA$RTL                                              00000000  0042AA48
 SHARE$CMA$RTL                                              00000000  0043BC9C
 SHARE$CMA$OPEN_RTL 
                                                            00000000  00498404
 SHARE$DCE$LIB_SHR 
                                                            00000000  0075C48C
 SHARE$DCE$LIB_SHR 
                                                            00000000  006A587C
 SHARE$DCE$LIB_SHR 
                                                            00000000  006C48B8
 SHARE$DCE$LIB_SHR 
                                                            00000000  006C3210
 SHARE$DCE$LIB_SHR 
                                                            00000000  006C2CB4
 SHARE$CMA$RTL                                              00000000  00446B58
DBG> set task %TASK     7
%DEBUG-W-SCRNOSRCLIN, no source line for address 00434320 for display in SRC
DBG> show calls
 module name     routine name                     line       rel PC    abs PC
 SHARE$CMA$RTL                                              00000000  00434320
 SHARE$CMA$RTL                                              00000000  0042AA48
 SHARE$CMA$RTL                                              00000000  0043BC9C
 SHARE$CMA$OPEN_RTL 
                                                            00000000  00498404
 SHARE$DCE$LIB_SHR 
                                                            00000000  0075C48C
 SHARE$DCE$LIB_SHR 
                                                            00000000  006A587C
 SHARE$DCE$LIB_SHR 
                                                            00000000  006C48B8
 SHARE$DCE$LIB_SHR 
                                                            00000000  006C3210
 SHARE$DCE$LIB_SHR 
                                                            00000000  006C2CB4
 SHARE$CMA$RTL                                              00000000  00446B58
DBG> set task %TASK     8
%DEBUG-W-SCRNOSRCLIN, no source line for address 00434320 for display in SRC
DBG> show calls
 module name     routine name                     line       rel PC    abs PC
 SHARE$CMA$RTL                                              00000000  00434320
 SHARE$CMA$RTL                                              00000000  0042A26C
 SHARE$CMA$RTL                                              00000000  0043F728
 SHARE$CMA$OPEN_RTL 
                                                            00000000  00497A2C
 RPC_SEC                                                    000000D0  0003071C
 SHARE$CMA$RTL                                              00000000  00446B58
DBG> set task %TASK     9
%DEBUG-W-SCRNOSRCLIN, no source line for address 8044189C for display in SRC
DBG> show calls
 module name     routine name                     line       rel PC    abs PC
                                                            00000000  8044189C
 SHARE$CMA$RTL                                              00000000  0044CFF8
 SHARE$CMA$RTL                                              00000000  0044D110
 SHARE$CMA$RTL                                              00000000  00446C60
DBG> set task %TASK     10
%DEBUG-W-SCRNOSRCLIN, no source line for address 00434320 for display in SRC
DBG> show calls
 module name     routine name                     line       rel PC    abs PC
 SHARE$CMA$RTL                                              00000000  00434320
 SHARE$CMA$RTL                                              00000000  0042AA48
 SHARE$CMA$RTL                                              00000000  0043BC9C
 SHARE$CMA$OPEN_RTL 
                                                            00000000  00498404
 SHARE$DCE$LIB_SHR 
                                                            00000000  0069FB24
 SHARE$CMA$RTL                                              00000000  00446B58
DBG> set task %TASK     11
%DEBUG-W-SCRNOSRCLIN, no source line for address 00434320 for display in SRC
DBG> show calls
 module name     routine name                     line       rel PC    abs PC
 SHARE$CMA$RTL                                              00000000  00434320
 SHARE$CMA$RTL                                              00000000  0042AA48
 SHARE$CMA$RTL                                              00000000  0043BC9C
 SHARE$CMA$OPEN_RTL 
                                                            00000000  00498404
 SHARE$DCE$LIB_SHR 
                                                            00000000  0069FB24
 SHARE$CMA$RTL                                              00000000  00446B58
DBG> set task %TASK     12
%DEBUG-W-SCRNOSRCLIN, no source line for address 00434320 for display in SRC
DBG> show calls
 module name     routine name                     line       rel PC    abs PC
 SHARE$CMA$RTL                                              00000000  00434320
 SHARE$CMA$RTL                                              00000000  0042AA48
 SHARE$CMA$RTL                                              00000000  0043BC9C
 SHARE$CMA$OPEN_RTL 
                                                            00000000  00498404
 SHARE$DCE$LIB_SHR 
                                                            00000000  0069FB24
 SHARE$CMA$RTL                                              00000000  00446B58
DBG> set task %TASK     13
%DEBUG-W-SCRNOSRCLIN, no source line for address 00434320 for display in SRC
DBG> show calls
 module name     routine name                     line       rel PC    abs PC
 SHARE$CMA$RTL                                              00000000  00434320
 SHARE$CMA$RTL                                              00000000  0042AA48
 SHARE$CMA$RTL                                              00000000  0043BC9C
 SHARE$CMA$OPEN_RTL 
                                                            00000000  00498404
 SHARE$DCE$LIB_SHR 
                                                            00000000  0069FB24
 SHARE$CMA$RTL                                              00000000  00446B58
DBG> set task %TASK     14
%DEBUG-W-SCRNOSRCLIN, no source line for address 00434320 for display in SRC
DBG> show calls
 module name     routine name                     line       rel PC    abs PC
 SHARE$CMA$RTL                                              00000000  00434320
 SHARE$CMA$RTL                                              00000000  0042AA48
 SHARE$CMA$RTL                                              00000000  0043BC9C
 SHARE$CMA$OPEN_RTL 
                                                            00000000  00498404
 SHARE$DCE$LIB_SHR 
                                                            00000000  0069FB24
 SHARE$CMA$RTL                                              00000000  00446B58
DBG> show stack


invocation block 0

    FP: 00D95C60
    Procedure Descriptor (003F6720):
        Flags:                  3089
          KIND:                 PDSC$K_KIND_FP_STACK (09)
          FP is Base Register
        Rsa Offset:             0010
        Signature Offset        0020
        Entry Address:          SHARE$CMA$RTL+262344
        Ireg Mask:              200000FC <R2,R3,R4,R5,R6,R7,FP>
          RA Saved @ 00D95C70:  000000000042AA48
          R2 Saved @ 00D95C78:  00000000003F4990
          R3 Saved @ 00D95C80:  0000000000D36F58
          R4 Saved @ 00D95C88:  0000000000845D50
          R5 Saved @ 00D95C90:  0000000000D37F28
          R6 Saved @ 00D95C98:  0000000000000000
          R7 Saved @ 00D95CA0:  000000000040E9B0
          FP Saved @ 00D95CA8:  0000000000D95CB0
        Freg Mask:              00000000 
        Size:                   00000050


invocation block 1

    FP: 00D95CB0
    Procedure Descriptor (003F4990):
        Flags:                  3089
          KIND:                 PDSC$K_KIND_FP_STACK (09)
          FP is Base Register
        Rsa Offset:             0008
        Signature Offset        0020
        Entry Address:          SHARE$CMA$RTL+222688
        Ireg Mask:              200007FC <R2,R3,R4,R5,R6,R7,R8,R9,R10,FP>
          RA Saved @ 00D95CB8:  000000000043BC9C
          R2 Saved @ 00D95CC0:  00000000003F8220
          R3 Saved @ 00D95CC8:  0000000000D346E8
          R4 Saved @ 00D95CD0:  000000000083AD58
          R5 Saved @ 00D95CD8:  00000000007EB520
          R6 Saved @ 00D95CE0:  0000000000000000
          R7 Saved @ 00D95CE8:  000000000040E620
          R8 Saved @ 00D95CF0:  0000000000000000
          R9 Saved @ 00D95CF8:  0000000000000000
          R10 Saved @ 00D95D00: 0000000000000000
          FP Saved @ 00D95D08:  0000000000D95D10
        Freg Mask:              00000000 
        Size:                   00000060


invocation block 2

    FP: 00D95D10
    Procedure Descriptor (003F8220):
        Flags:                  3089
          KIND:                 PDSC$K_KIND_FP_STACK (09)
          FP is Base Register
        Rsa Offset:             0008
        Signature Offset        F998
        Entry Address:          SHARE$CMA$RTL+293984
        Ireg Mask:              20000004 <R2,FP>
          RA Saved @ 00D95D18:  0000000000498404
          R2 Saved @ 00D95D20:  00000000005BC6D8
          FP Saved @ 00D95D28:  0000000000D95D30
        Freg Mask:              00000000 
        Size:                   00000020


invocation block 3

    FP: 00D95D30
    Procedure Descriptor (00476500):
        Flags:                  3089
          KIND:                 PDSC$K_KIND_FP_STACK (09)
          FP is Base Register
        Rsa Offset:             0008
        Signature Offset        FB20
        Entry Address:          SHARE$CMA$OPEN_RTL+140256
        Ireg Mask:              20000000 <FP>
          RA Saved @ 00D95D38:  000000000069FB24
          FP Saved @ 00D95D40:  0000000000D95D50
        Freg Mask:              00000000 
        Size:                   00000020


invocation block 4

    FP: 00D95D50
    Procedure Descriptor (005BC6D8):
        Flags:                  3089
          KIND:                 PDSC$K_KIND_FP_STACK (09)
          FP is Base Register
        Rsa Offset:             0008
        Signature Offset        0000
        Entry Address:          SHARE$DCE$LIB_SHR+989760
        Ireg Mask:              20000FFC <R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,FP>
          RA Saved @ 00D95D58:  0000000000446B58
          R2 Saved @ 00D95D60:  00000000003FA0C0
          R3 Saved @ 00D95D68:  0000000000D37F28
          R4 Saved @ 00D95D70:  00000000005BC6D8
          R5 Saved @ 00D95D78:  0000000000D346E8
          R6 Saved @ 00D95D80:  0000000000000002
          R7 Saved @ 00D95D88:  000000000040E620
          R8 Saved @ 00D95D90:  0000000000000001
          R9 Saved @ 00D95D98:  0000000000000000
          R10 Saved @ 00D95DA0: 0000000000000000
          R11 Saved @ 00D95DA8: 0000000000000000
          FP Saved @ 00D95DB0:  0000000000D95DC0
        Freg Mask:              00000000 
        Size:                   00000070


invocation block 5

    FP: 00D95DC0
    Procedure Descriptor (003FA0C0):
        Flags:                  30D9
          KIND:                 PDSC$K_KIND_FP_STACK (09)
          Handler Valid
          Handler Data Valid
          FP is Base Register
        Rsa Offset:             01C0
        Signature Offset        0030
        Entry Address:          SHARE$CMA$RTL+338368
        Ireg Mask:              200001FC <R2,R3,R4,R5,R6,R7,R8,FP>
          RA Saved @ 00D95F80:  00000000004240A8
          R2 Saved @ 00D95F88:  0000000000000000
          R3 Saved @ 00D95F90:  0000000000000000
          R4 Saved @ 00D95F98:  0000000000000000
          R5 Saved @ 00D95FA0:  0000000000000000
          R6 Saved @ 00D95FA8:  0000000000000000
          R7 Saved @ 00D95FB0:  0000000000000000
          R8 Saved @ 00D95FB8:  0000000000000000
          FP Saved @ 00D95FC0:  0000000000D95FD0
        Freg Mask:              00000000 
        Size:                   00000210
        Condition Handler:      1572336
        Handler Data:           0000000000000008
DBG> exit


    
3333.14problem solutionHYDRA::DORHAMERFri Apr 04 1997 10:07111
    #1           4-APR-1997 09:04:43.05                                 
    NEWMAIL
    From:   HYDRA::AXPDEVELOPER "[email protected]"
    To:     SMTP%"[email protected]"
    CC:     AXPDEVELOPER
    Subj:   DCE problem with sec_key_mgmt_manage_key
    
    TO: Steve Popkes
    
    Steve,
    
    Attached is a response from VMS Engineering regarding the DCE problem.
    It contains a suggestion on how to resolve the problem.
    
    Karen
    
    
From:	EVMS::FRECHETTE     3-APR-1997 15:55:14.22
To:	HYDRA::DORHAMER
CC:	SWEENEY,FRECHETTE
Subj:	DCE problem with sec_key_mgmt_manage_key


Karen,

The problem Steve Popkes is seeing is because threads is overflowing
the stack and causing the access violation. There are a couple of ways
to fix this problem. One way would be to hard code a thread stack size 
large enough to make the call another would be to get the current stack 
size and increase it by some factor to make it larger.

I hard coded a value just to make sure it worked but I'll show both ways.

Here's what I did. Look for the >. Notice I only did it for the thread calling 
SecurityRefreshKey, that was the one causing the overflow.

BOOL CRpcSecurity::StartThreads()
{
  int            stts;
  BOOL           bRV = TRUE;
>  pthread_attr_t thread_attribute;

  ESITRACE0("crs:st:starting threads\n");

>  pthread_attr_create(&thread_attribute);
>  pthread_attr_setstacksize(&thread_attribute, 64000);

  stts = pthread_create(
                   &m_IdRefreshThread,
                   pthread_attr_default,
                   SecurityRefreshIdentity,
                   (void*)this);
  if (!stts)
  {
    stts = pthread_create(
                     &m_KeyRefreshThread,
>                     thread_attribute,
                     SecurityRefreshKey,
                     (void*)this);
    ESITRACE1("crs:st:key refresh thread start status = %i\n",stts);
    if (!stts)
    {
      bRV = TRUE;
    }
  }

  return bRV;
}

I could have done something like the following. Anyway you can forward this off
to Steve Popkes.

BOOL CRpcSecurity::StartThreads()
{
  int            stts;
  BOOL           bRV = TRUE;
>  pthread_attr_t thread_attribute;
>  int            stack_size,new_stack_size;

  ESITRACE0("crs:st:starting threads\n");

>  pthread_attr_create(&thread_attribute);
>  stack_size = pthread_attr_getstacksize (thread_attribute);
>  new_stack_size = stack_size * 2;
>  pthread_attr_setstacksize(&thread_attribute, new_stack_size);

  stts = pthread_create(
                   &m_IdRefreshThread,
                   pthread_attr_default,
                   SecurityRefreshIdentity,
                   (void*)this);
  if (!stts)
  {
    stts = pthread_create(
                     &m_KeyRefreshThread,
>                     thread_attribute,
                     SecurityRefreshKey,
                     (void*)this);
    ESITRACE1("crs:st:key refresh thread start status = %i\n",stts);
    if (!stts)
    {
      bRV = TRUE;
    }
  }

  return bRV;
}

thanks

Joe
3333.15expect solution to workHYDRA::DORHAMERFri Apr 04 1997 12:3313
        #3           4-APR-1997 11:23:09.15                                 
    NEWMAIL
    From:   SMTP%"[email protected]"
    To:     "[email protected]" <[email protected]>
    CC:
    Subj:   Re: DCE problem with sec_key_mgmt_manage_key
    
    Thanks for the solution. I'll try it immediately. It will likely work
    just fine.
    
    Thanks.
    
    Stevep
3333.16problem solvedHYDRA::DORHAMERMon Apr 07 1997 11:184
    Steve reported that the solution provided by VMS engineering did
    resolve his DCE security key problem.  
    
    Karen