ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » User Exits » MQ Security exits giving errors

Post new topic  Reply to topic
 MQ Security exits giving errors « View previous topic :: View next topic » 
Author Message
borisyakimov
PostPosted: Fri May 30, 2014 6:23 am    Post subject: MQ Security exits giving errors Reply with quote

Newbie

Joined: 30 May 2014
Posts: 2

Hello,

We are attempting to make an MQ configuration with a sender channel that uses a compiled security exit, but we are getting an error when starting the channel.

Quote:

ERROR:
-------------------------------------------------------------------------------
05/30/14 10:02:18 - Process(11227162.1) User(mqm) Program(runmqchl_nd)
AMQ6179: The system could not find the symbol '' in the dynamically loaded
shared library '/var/mqm/exits64/MQDH001'. The system returned error message


EXPLANATION:
This message applies to UNIX systems. The shared library
'/var/mqm/exits64/MQDH001' does not contain symbol '' or it has not been
exported.
ACTION:
Check that symbol name '' is correct and has been exported from the library.
----- amqxufnx.c : 1425 -------------------------------------------------------
05/30/14 10:02:18 - Process(11227162.1) User(mqm) Program(runmqchl_nd)
AMQ9535: User exit not valid.

EXPLANATION:
Channel program 'CHANNELNAME' ended because user exit 'MQDH001' is not
valid.
ACTION:
Ensure that the user exit is specified correctly in the channel definition, and

that the user exit program is correct and available.


We have attempted a few different ways of compiling the exits, i.e. :

Quote:
/usr/vacpp/bin/xlc_r -q64 -e MQStart -bE:mqmdh001.exp -o MQMDH001 mqmdh001.c -I ../inc -D_REENTRANT -DUNIX -DHNLUP -DAIX


Or without an export file :
Code:
/usr/vacpp/bin/xlc_r -q64 -e MQStart -qmkshrobj -o MQDH001 mqmdh001.c -I ../inc -D_REENTRANT -DUNIX -DHNLUP -DAIX


As well as using some the lib64 libraries :
Quote:
/usr/vacpp/bin/xlc_r -q64 -e MQStart -bE:mqmdh001.exp -o MQDH001 mqmdh001.c -I ../inc -D_REENTRANT -DUNIX -DHNLUP -DAIX -L ../lib64 -lmqutl_r



The C code that we used to compile the exit is:
Code:

/*----------------------------------------------------------------------------*/
/*                                                                            */
/*                 Filename: mqmdh001.c  Sample Sender security exit          */
/*                                                                            */
/*                                                                            */
/*   replace "A000Userid  Password" for your company                          */
/*       "A000" + 8 character userid + 8 charaacter password                   */
/*    case is important!!!                                                    */
/*                                                                            */
/* standard headers */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifdef AIX
#include <langinfo.h>
#endif

#include <sys/types.h>
#include <sys/timeb.h>
#include <time.h>

/* MQSeries headers */
#include <cmqc.h>
#include <cmqxc.h>

/*  testing headers  */
#include <time.h>

/* dummy function used as entry point to exit, only needed  AIX boxes */
void MQStart() {;}    /* dummy entry point */

void MQENTRY MQMDH001( PMQCXP     pChannelExitParms,
                       PMQCD      pChannelDefinition,
                       PMQLONG    pDataLength,
                       PMQLONG    pAgentBufferLength,
                       PMQBYTE    AgentBuffer,
                       PMQLONG    pExitBufferLength,
                       PMQPTR     pExitBufferAddr)

{
    char Channel_Logfile[] = "/var/mqm/log/MQMDH001.log";
    FILE * fp;

    /* for test purposes */
    char TimeBuffer[100];
    struct tm *pNow=NULL;
    time_t MyTime;

    /* open the log file */
    fp = fopen(Channel_Logfile,"a+");

    pChannelExitParms->ExitResponse = MQXCC_OK;

    pChannelExitParms->Feedback = 0;

    switch( pChannelExitParms-> ExitReason )
    {
        case MQXR_INIT:
               MyTime=time(NULL);
               pNow=localtime(&MyTime);
               strftime(TimeBuffer, sizeof(TimeBuffer),
                   "\nScy exit called for INIT at %A %B %d, %Y at %I:%M %p\n", pNow);
               fprintf(fp, "%s", TimeBuffer);
               break;
        case MQXR_INIT_SEC:
               *pDataLength = 9;
               pChannelExitParms->ExitResponse = MQXCC_SEND_SEC_MSG;
               strncpy((char *)AgentBuffer, "WHOAREYOU\0", 10);
               fprintf(fp,"Scy exit called for INIT_SEC, resp=%d, buff=%s\n", pChannelExitParms->ExitResponse, (char *)AgentBuffer);
               break;
        case MQXR_SEC_MSG:
               fprintf(fp,"Scy exit called for SEC_MSG, resp=%d, buff=%.10s\n", pChannelExitParms->ExitResponse, (char *)AgentBuffer);
               *pDataLength = 20;
               pChannelExitParms->ExitResponse = MQXCC_SEND_SEC_MSG;

               /******CHANGE userid/password in the following line:********/
               strncpy((char *)AgentBuffer, "pass", 21);
               /******END OF CHANGE userid/password: **********************/

               fprintf(fp,"Scy exit called for SEC_MSG, resp=%d, buff=%.10s\n", pChannelExitParms->ExitResponse, (char *)AgentBuffer);
               break;
        case MQXR_TERM:
               fprintf(fp,"Scy exit called for TERM\n");
               break;
        default:
               fprintf(fp,"Scy exit called with invalid reason code: %d\n", pChannelExitParms-> ExitReason);
               break;
    } /* switch */
    fclose(fp);
    return;
} /* END OF void MQENTRY MQMDH001( */






Here is the sender channel definition, with some values omited as the they are company confidential:

SENDER CHANNEL :

CHANNEL("CHANNELNAME") CHLTYPE(SDR)
ALTDATE(2014-05-23) ALTTIME(10.22.2
BATCHHB(0) BATCHINT(0)
BATCHSZ(50) COMPHDR(NONE)
COMPMSG(NONE) CONNAME("IPADDR"("PORT"))
CONVERT(NO) DESCR( )
DISCINT(300) HBINT(300)
KAINT(AUTO) LOCLADDR( )
LONGRTY(999999999) LONGTMR(1200)
MAXMSGL(4194304) MCANAME( )
MCATYPE(PROCESS) MCAUSER( )
MODENAME( ) MONCHL(QMGR)
MSGDATA( ) MSGEXIT( )
NPMSPEED(FAST) PASSWORD( )
RCVDATA( ) RCVEXIT( )
SCYDATA( ) SCYEXIT(MQMDH001)
SENDDATA( ) SENDEXIT( )
SEQWRAP(999999999) SHORTRTY(10)
SHORTTMR(60) SSLCIPH( )
SSLPEER( ) STATCHL(QMGR)
TPNAME( ) TRPTYPE(TCP)
USERID( ) XMITQ("XMITQNAME")


As I was unable to find much info on the internet, I am asking for your advise.

Thanks in advance.
Back to top
View user's profile Send private message
PaulClarke
PostPosted: Fri May 30, 2014 8:21 am    Post subject: Reply with quote

Grand Master

Joined: 17 Nov 2005
Posts: 1002
Location: New Zealand

On the Distributed platforms a channel exit consists of the names of the library AND the name of the entrypoint you want to call. In your case these seem to be the same value but they don't need to be.

So, try changing your channel definition to say....

SCYDATA( ) SCYEXIT('MQMDH001(MQMDH001)')

Cheers,
P.
_________________
Paul Clarke
MQGem Software
www.mqgem.com
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Sat May 31, 2014 3:39 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Quote:
Or without an export file :
Code:

/usr/vacpp/bin/xlc_r -q64 -e MQStart -qmkshrobj -o MQDH001 mqmdh001.c -I ../inc -D_REENTRANT -DUNIX -DHNLUP -DAIX



As well as using some the lib64 libraries :
Code:

/usr/vacpp/bin/xlc_r -q64 -e MQStart -bE:mqmdh001.exp -o MQDH001 mqmdh001.c -I ../inc -D_REENTRANT -DUNIX -DHNLUP -DAIX -L ../lib64 -lmqutl_r


Note that entry point MQDH001 does not match the code using entry point MQMDH001. Also don't you need an EXPORT statement on your compile / link command when not providing that statement in the export file??

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
RogerLacroix
PostPosted: Mon Jun 02, 2014 11:39 am    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3252
Location: London, ON Canada

Hi Boris,

If you are trying to connect to DTCC then why don't you look at the open source project called SX4DTCC

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
borisyakimov
PostPosted: Fri Jun 13, 2014 3:59 am    Post subject: [RESOLVED] Reply with quote

Newbie

Joined: 30 May 2014
Posts: 2

Hello Guys,

Thanks a bunch for the help. We have managed to resolve the issue. It was exactly as "PaulClarke" suggested :

Quote:
On the Distributed platforms a channel exit consists of the names of the library AND the name of the entrypoint you want to call. In your case these seem to be the same value but they don't need to be.

So, try changing your channel definition to say....

SCYDATA( ) SCYEXIT('MQMDH001(MQMDH001)')


The issue was that on UNIX systems we do not actually use the path to the exit, but the library name and the function in it.


Back to top
View user's profile Send private message
gbaddeley
PostPosted: Sun Jun 15, 2014 3:34 pm    Post subject: Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2492
Location: Melbourne, Australia

Code:
char Channel_Logfile[] = "/var/mqm/log/MQMDH001.log";

Don't use the "log" directory for exits logs, it is reserved for MQ recovery logs. I suggest that you use the exits64 directory itself, that's what most exits use.
_________________
Glenn
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » User Exits » MQ Security exits giving errors
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.