Author |
Message
|
yasaboy |
Posted: Mon Jul 14, 2014 11:33 pm Post subject: Issue : Connecting to remote Queue manager |
|
|
Voyager
Joined: 23 Jun 2014 Posts: 90
|
Hi,
I am experiencing a rather weird set of results when trying to connect to a queue manager, using MQCD. I tried to connect to local Queue manager by giving the host and port of it.
LocalHost - 172.25.83.xx
port - 20501
Qmanager - AAAAA
Queue - BBBBB
But no matter what ever the host name , port and channel I add it connect to the local queue BBBBB in manager AAAAA.
Code: |
MQCD connectionDescriptor = {MQCD_CLIENT_CONN_DEFAULT}; /* Client connection channel */
strcpy(connectionDescriptor.ConnectionName , "172.00.00.000(AnyValue)");
strcpy(connectionDescriptor.ChannelName, channel);
connectionDescriptor.TransportType = MQXPT_TCP;
connectionDescriptor.Version = MQCD_VERSION_4;
MQCNO cno = {MQCNO_DEFAULT};
cno.Options = MQCNO_HANDLE_SHARE_BLOCK ;
PMQCD pMQCD = &connectionDescriptor;
cno.ClientConnPtr = pMQCD;
cno.Version = MQCNO_VERSION_2;
strcpy(QMgrName,"AAAAA");
MQCONNX(QMgrName, &cno ,&Hcon, &CompCode, &CReason);
MOD_EXIT:
// Open Queues
MQOD od = {MQOD_DEFAULT};
O_options = MQOO_INPUT_AS_Q_DEF|MQOO_FAIL_IF_QUIESCING;
strcpy(od.ObjectName, "BBBBB");
MQOPEN(Hcon, &od, O_options, &Hobj, &OpenCode, &Reason);
|
My ultimate goal of mine is to connect to a remote queue in a different host and a channel. However it seems like the host and port parameters are not properly set by the connection.
Please help me with this, Thanks .  |
|
Back to top |
|
 |
PaulClarke |
Posted: Tue Jul 15, 2014 3:12 am Post subject: |
|
|
 Grand Master
Joined: 17 Nov 2005 Posts: 1002 Location: New Zealand
|
Are you certain that you've linked this application to the client library (eg. libmqic or mqic23.dll) rather than the QM (libmqm or mqm.dll) ?
Cheers,
Paul. _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
 |
yasaboy |
Posted: Tue Jul 15, 2014 11:06 pm Post subject: |
|
|
Voyager
Joined: 23 Jun 2014 Posts: 90
|
PaulClarke wrote: |
Are you certain that you've linked this application to the client library (eg. libmqic or mqic23.dll) rather than the QM (libmqm or mqm.dll) ?
Cheers,
Paul. |
Hi,
@Paul thank you very much for replying. I could found and resolve the issue by adding "lmqic_r" library. Anyway way as I understood
is linked with "mqic" is it so ?
Now I use
Code: |
"-limqs23gl_r" , "-limqb23gl_r" , "-lmqic_r" , "-lmqm_r" |
all libraries. Tobe honest no idea exactly what doing what even if the code is qorking fine. Anyway "_r" is for the recursive version since we are using a multi threaded MQCB mecanism.
can you explain the generic usage of these libries. |
|
Back to top |
|
 |
PaulClarke |
Posted: Tue Jul 15, 2014 11:31 pm Post subject: |
|
|
 Grand Master
Joined: 17 Nov 2005 Posts: 1002 Location: New Zealand
|
The various libraries are explained in the manuals but essentially '*mqm*' is for locally bound applications. '*mqic*' is for client bound applications. The _r variants are for threaded applications which, as you suggest, you need if you are using async. consume.
Cheers,
Paul. _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
 |
gbaddeley |
Posted: Wed Jul 16, 2014 3:33 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
The C language #includes for MQ do not dictate the connection mode, they only provide structures, defined constants and function prototypes. Both Client and Binding mode connections can use the same MQI functions. MQ makes the choice depending on the libraries that are chosen to be loaded, *mqm* or *mqic*. _________________ Glenn |
|
Back to top |
|
 |
yasaboy |
Posted: Thu Jul 17, 2014 2:11 am Post subject: |
|
|
Voyager
Joined: 23 Jun 2014 Posts: 90
|
@ paul & glenn . Thanks  |
|
Back to top |
|
 |
yasaboy |
Posted: Thu Jul 17, 2014 3:25 am Post subject: |
|
|
Voyager
Joined: 23 Jun 2014 Posts: 90
|
Hi,
sorry for reopening this. Another quick question here.
I forgot to mention that I altered the settings of my Queue to make the CONNX connection authorized to access the queue. Those changes are
Code: |
DEFINE CHANNEL (MY.CHANNEL) CHLTYPE (svrconn) TRPTYPE (tcp) [b]MCAUSER('mqm')[/b]
alter qmgr [b]CHLAUTH(DISABLED)[/b]; |
since I got MQRC_NOT_AUTHORIZED error 2035. But I never needed the Host user name Host password fields. Why isn't it needed to login to the 172.xx.xx.xxx. I think there is no attribute in MQCD connectionDescriptor; to set those values as well
Isn't it ? |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Jul 17, 2014 3:43 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Giving a Channel an MCAUSER=mqm is just asking for trouble. This means that anyone connecting over that channel can do anything they want to any MQ Object in the queue manager.
MQ passes the current user id are part of the connection request. MQ Then checks to see if that user is authorized. No password needed.
The Security forum on this site has lots and lots of discussions about this sort of thing.
You could create a user and give that user the access it needs to the QMGR, Channel and relevant queues. Then in your CHLAUTH rule you could assing the MCAUSER to that user if the request comes from one or more know IP Addresses. There are other ways to enable the sort of security you are after as well. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Jul 17, 2014 5:44 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
smdavies99 wrote: |
MQ passes the current user id are part of the connection request. MQ Then checks to see if that user is authorized. No password needed. |
Unless you use MQ V8 and a security policy that requires a password.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Jul 17, 2014 6:09 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
fjb_saper wrote: |
Unless you use MQ V8 and a security policy that requires a password.  |
Indeed but... I was trying to point out that there are other ways to do this sort of thing and that setting the MCAUSR to 'mqm' is a bad idea. Besides, how many are actively using V8 in anything but a POC/Test setup ? _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
|