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 » Issue with Security Exits for DTCC

Post new topic  Reply to topic
 Issue with Security Exits for DTCC « View previous topic :: View next topic » 
Author Message
angel_a
PostPosted: Mon Aug 05, 2013 4:31 am    Post subject: Issue with Security Exits for DTCC Reply with quote

Newbie

Joined: 05 Aug 2013
Posts: 5
Location: Sofia Bulgaria

Hello all,

At the moment I have the task to connect our MQ System with DTCC ( QMGRs). To do this task we need external security exits to be compiled. An sample program has been provided by DTCC.
Our system is AIX 6.1 with WMQ 6.0.

Sample program is the following:

/*----------------------------------------------------------------------------*/
/* */
/* Filename: mqmdh001.c Sample Sender security exit */
/* */
/* */
/* replace "A000Userid Password" for your company */
/* "A000" + 8 character userid + 8 character password */
/* case is important!!! */
/* */
/* standard headers */
extern "C" {
#include </usr/vacpp/include/stdio.h>
#include </usr/vacpp/include/stdlib.h>
#include </usr/vacpp/include/string.h>

#ifdef AIX
#include </usr/vacpp/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 </usr/vacpp/include/time.h>

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

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

{
char Channel_Logfile[] = "/var/mqm/exits/";
FILE * fp;

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

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

pChannelExitParams->ExitResponse = MQXCC_OK;




pChannelExitParams->Feedback = 0;

switch( pChannelExitParams-> 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;
pChannelExitParams->ExitResponse = MQXCC_SEND_SEC_MSG;
strncpy((char *)AgentBuffer, "WHOAREYOU\0", 10);
fprintf(fp,"Scy exit called for INIT_SEC, resp=%d, buff=%s\n", pChannelExitParams->ExitResponse, (char *)AgentBuffer);
break;
case MQXR_SEC_MSG:
fprintf(fp,"Scy exit called for SEC_MSG, resp=%d, buff=%.10s\n", pChannelExitParams->ExitResponse, (char *)AgentBuffer);
*pDataLength = 20;
pChannelExitParams->ExitResponse = MQXCC_SEND_SEC_MSG;

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

fprintf(fp,"Scy exit called for SEC_MSG, resp=%d, buff=%.10s\n", pChannelExitParams->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", pChannelExitParams-> ExitReason);
break;
} /* switch */
fclose(fp);
return;
} /* END OF void MQENTRY MQMDH001( */

} /* END OF extern "C" { */



I am tryig to compile it using:
/usr/vacpp/bin/xlC_r -q64 -e MQStart -bE:mqmdh001.exp -bM:SRE -o /var/mqm/exits/mqmdh001 mqmdh001.c -I/usr/mqm/inc

I am having the following error:

"/usr/include/stdio.h", line 73.1: 1506-248 (S) More than one storage class specifier typedef.
"/usr/include/stdio.h", line 181.8: 1506-166 (S) Definition of function size_t requires parentheses.
"/usr/include/stdio.h", line 181.25: 1506-276 (S) Syntax error: possible missing '{'?
"/usr/include/sys/inttypes.h", line 59.9: 1506-045 (S) Undeclared identifier intmax_t.
"/usr/include/sys/inttypes.h", line 61.3: 1506-273 (E) Missing type in declaration of imaxdiv_t.
"/usr/include/sys/inttypes.h", line 79.8: 1506-166 (S) Definition of function intmax_t requires parentheses.
"/usr/include/sys/inttypes.h", line 79.17: 1506-276 (S) Syntax error: possible missing '{'?
"/usr/include/sys/types.h", line 330.3: 1506-273 (E) Missing type in declaration of sigset_t.
"/usr/include/sys/types.h", line 342.9: 1506-046 (S) Syntax error.
"/usr/include/sys/types.h", line 377.9: 1506-046 (S) Syntax error.
"/usr/include/sys/vm_types.h", line 39.9: 1506-166 (S) Definition of function uint_t requires parentheses.
"/usr/include/sys/vm_types.h", line 39.25: 1506-276 (S) Syntax error: possible missing '{'?
"/usr/include/sys/vm_types.h", line 142.9: 1506-045 (S) Undeclared identifier vmhandle_t.
"/usr/include/sys/vm_types.h", line 143.9: 1506-045 (S) Undeclared identifier caddr_t.
"/usr/include/sys/vm_types.h", line 148.3: 1506-273 (E) Missing type in declaration of vmaddr_t.
"/usr/include/sys/vm_types.h", line 158.9: 1506-046 (S) Syntax error.
"/usr/include/sys/vm_types.h", line 184.9: 1506-046 (S) Syntax error.
"/usr/include/sys/vm_types.h", line 251.9: 1506-166 (S) Definition of function vmhandle_t requires parentheses.
"/usr/include/sys/vm_types.h", line 251.25: 1506-276 (S) Syntax error: possible missing '{'?
"/usr/include/sys/m_types.h", line 52.27: 1506-275 (S) Unexpected text iar encountered.
"/usr/include/sys/m_types.h", line 52.9: 1506-045 (S) Undeclared identifier ulong_t.
"/usr/include/sys/m_types.h", line 53.27: 1506-275 (S) Unexpected text stack encountered.
"/usr/include/sys/m_types.h", line 54.27: 1506-275 (S) Unexpected text toc encountered.
"/usr/include/sys/m_types.h", line 55.27: 1506-275 (S) Unexpected text cr encountered.
"/usr/include/sys/m_types.h", line 56.27: 1506-275 (S) Unexpected text intpri encountered.


Can someone help on this. I stuck with this sample program which was provided.

Thank you in advance

Best Regards
Angel
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Aug 05, 2013 5:04 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I'm quite sure MQ v6 is not supported on AIX 6.1.

In fact, I'm quite sure MQ v6 is not supported on any platform at all.

Even when it was supported, I'm nearly sure it was never supported on AIX 6.1.

You also can't use compiler commands for mq v7 or 7.5 to compile things against mq v6.

I'd recommend you upgrade to at least MQ v7.0.1.x, if not 7.5, and then follow the correct exit compiling instructions (from the info center) for that version of MQ.

I also really hope that DTCC is not saying that it's customers have to use MQ v6.
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Mon Aug 05, 2013 4:27 pm    Post subject: Reply with quote

Jedi

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

Looks like a C compiler environment issue. There could be a conflict between /usr/vacpp/include and /usr/include. You might need to tweak the includes and command line. Its unusual to see statements like #include </usr/vacpp/include/stdio.h>, normally it would just be #include <stdio.h>. If a non default include path needs to be used, it should be specified on the command line using -I.
_________________
Glenn
Back to top
View user's profile Send private message
angel_a
PostPosted: Mon Aug 05, 2013 10:40 pm    Post subject: Reply with quote

Newbie

Joined: 05 Aug 2013
Posts: 5
Location: Sofia Bulgaria

I have tested with the sample channel exit which comes with the MQ Server and i was able to compile it sucessfully. Therefore i think that there is something additional that has to be added, but still don't have an idea what exactly....
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Aug 06, 2013 6:54 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Go back to DTCC and ask them what you should be doing to compile this exit.

If they have not given you instructions, then ask them to give you a binary.

If they have given you instructions, and these instructions don't work, then ask them for help.

If they have said they don't support their exit on MQ v6... Then stop using MQ v6.

It turns out I was wrong about AIX 6.1 being supported by MQ v6 - http://www-01.ibm.com/support/docview.wss?uid=swg27006268 - but you do need to be at least at a specific fixpack for that to be true.

If you are not at that fixpack, or later, then in addition to trying to climb a mountain of your own making by using out of support MQ v6, you are actually building the mountain higher as you go.

Also, the MQ v6 info center is now available and I storngly suggest you go back and review the cc command for compiling 64 bit exits, and then review the xlc command for linking then.
Back to top
View user's profile Send private message
angel_a
PostPosted: Wed Aug 07, 2013 12:56 am    Post subject: Reply with quote

Newbie

Joined: 05 Aug 2013
Posts: 5
Location: Sofia Bulgaria

Yes I have asked them several times, but they are still saying that the security code that they have provided should work. The sample security exit was compiled without any issues, therefore i think that the provided code has not be tested on AIX...

Regarding the version of WMQ v 6.0 is with latest fix packs. This version of MQ is no longer supported by IBM, but at the moment we are not able to invest money in upgrade.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Aug 07, 2013 6:12 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

So your boss says two things:
  • We need to establish communications with DTCC
  • We can't afford an upgrade of MQ
.

You should tell your boss "You only get to pick one of those two things. I don't care which it is.".

Glenn says you have a compiler environment issue, that the shell or includes you are building against are weird. I'd review the include statements and confirm that the paths in question are the right ones on your system.

I also say you need to go back and comb through the v6 documentation on compiling exits, and follow those *specifically*. But I also haven't double-checked the XLC command you posted against the one in the doc.
Back to top
View user's profile Send private message
JosephGramig
PostPosted: Wed Aug 07, 2013 6:22 am    Post subject: Reply with quote

Grand Master

Joined: 09 Feb 2006
Posts: 1230
Location: Gold Coast of Florida, USA

angle_a,

The level of xlC also matters. Be sure you meet the level requirements of the version of WMQ that you are using (and this has OS and other requirements, so check all that too).
Back to top
View user's profile Send private message AIM Address
angel_a
PostPosted: Tue Aug 13, 2013 5:01 am    Post subject: Reply with quote

Newbie

Joined: 05 Aug 2013
Posts: 5
Location: Sofia Bulgaria

Thank you for your help, at the end i have figured out where the problem is:

I have removed the following two lines, and the security exits compiles without any issues.

extern "C" {
} /* END OF extern "C" { */

Regards
Angel
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Aug 13, 2013 5:06 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

angel_a wrote:
I have removed the following two lines, and the security exits compiles without any issues.


This is good, and well done.

Do they execute normally when called?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
angel_a
PostPosted: Tue Aug 13, 2013 5:08 am    Post subject: Reply with quote

Newbie

Joined: 05 Aug 2013
Posts: 5
Location: Sofia Bulgaria

Yes, it works just fine.
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Thu Nov 21, 2013 3:19 pm    Post subject: Reply with quote

Jedi Knight

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

Ok, to make everyone's life easier, I have created an MQ client-side security exit that is designed to work with DTCC's server-side security exit. You do not need to compile & link anything, just install the DLL/shared library and you are good to go.

For more details see:
http://www.mqseries.net/phpBB2/viewtopic.php?t=65993

Or see:
http://www.capitalware.biz/rl_blog/?p=2742

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
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » User Exits » Issue with Security Exits for DTCC
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.