Author |
Message
|
mart |
Posted: Wed Aug 03, 2005 5:23 am Post subject: Where to specify userid/pwd using C v5.3 client on Solaris |
|
|
Novice
Joined: 03 Aug 2005 Posts: 12 Location: UK
|
I am attempting to connect to a remote server using the v5.3 of the C/C++ MQ client but I am having trouble setting the userid and password. I have looked through the documentation without any luck.
I have been given some example code written in Java (see below) but this is obviously not much use. I need to set the same username/password from the C++ application I'm working on.
Previously we haven't required this username/password and I am new to this software.
Thanks,
Mart (MQ Newbie)
Code: |
private javax.jms.QueueConnection getConnection() throws JMSException {
//Create a queue connection from the factory
if (this.connection == null) {
if ((this.getConnectionUserId() != null)
&& (this.getConnectionUserId().trim().length() > 0)
&& (this.getConnectionPassword() != null)
&& (this.getConnectionPassword().trim().length() > 0))
this.connection =
this.getFactory().createQueueConnection(
this.getConnectionPassword());
else
this.connection = this.getFactory().createQueueConnection();
this.connection.start();
System.out.println("Connection started");
}
return this.connection;
}
|
|
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 03, 2005 5:27 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You can't do this in C/C++.
The client automatically always passes the OS user id.
You can fool around with MQCONNX and MCA users, but it's not quite the same thing.
If I recall correctly. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
mart |
Posted: Wed Aug 03, 2005 5:44 am Post subject: |
|
|
Novice
Joined: 03 Aug 2005 Posts: 12 Location: UK
|
Quote: |
You can't do this in C/C++.
The client automatically always passes the OS user id.
You can fool around with MQCONNX and MCA users, but it's not quite the same thing. |
Thanks for the quick reply.
I'll have a look at MQCONNX with MCA users and see if that works.
Do you know if there is a later version of the C/C++ client with which it is possible? Or am I doomed to have to write a Java application that the C++ application communicates to the server through?
Thanks. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 03, 2005 5:56 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Why not create an OS user and run your program under that user?
I do not believe it was ever IBM's intention to allow programs to specify an arbitrary user for MQ connections - they were forced to do so for Java because of the nature of Java and it's relationship to accessing OS level elements.
Consequently, I don't think it will ever be "fixed" in the C/C++ client. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
wschutz |
Posted: Wed Aug 03, 2005 6:05 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Quote: |
I am attempting to connect to a remote server using the v5.3 of the C/C++ MQ client but I am having trouble setting the userid and password. I have looked through the documentation without any luck.
|
Do you *really* need to set the password? MQ doesn't know about passwords (unless you get involved in security exits and such).
MQ V6 has new options on the MQCONNX that allows you to set a userid and password, but if you do you'll need to provide your own authorization service (there's a new erntry point).
You'll probably find that mcauser is what you need. _________________ -wayne |
|
Back to top |
|
 |
mart |
Posted: Wed Aug 03, 2005 6:11 am Post subject: |
|
|
Novice
Joined: 03 Aug 2005 Posts: 12 Location: UK
|
Quote: |
Do you *really* need to set the password? |
Unfortunately yes. We are connecting to servers belonging to another company who are insisting that its required.
Quote: |
MQ V6 has new options on the MQCONNX that allows you to set a userid and password, but if you do you'll need to provide your own authorization service (there's a new erntry point). |
I'll take a look at this.
Quote: |
Why not create an OS user and run your program under that user? |
This is a possibility, but the main application has to be run under a certain other user so we would have to come up with a different way of calling the MQ client, which I would prefer to avoid if at all possible.
Quote: |
I do not believe it was ever IBM's intention to allow programs to specify an arbitrary user for MQ connections - they were forced to do so for Java because of the nature of Java and it's relationship to accessing OS level elements.
Consequently, I don't think it will ever be "fixed" in the C/C++ client. |
Annoyingly, for other connections to the same company via MQ we do not require this user id, this appears to be a new requirement. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 03, 2005 6:14 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
mart wrote: |
Quote: |
Do you *really* need to set the password? |
Unfortunately yes. We are connecting to servers belonging to another company who are insisting that its required. |
Then this is likely to be an authority exit on the other side. Good luck. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
mart |
Posted: Wed Aug 03, 2005 6:17 am Post subject: |
|
|
Novice
Joined: 03 Aug 2005 Posts: 12 Location: UK
|
Quote: |
Then this is likely to be an authority exit on the other side. Good luck. |
What is an "authority exit"? (Sorry I'm very new to the MQ client and its landed on my desk.) |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 03, 2005 6:22 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
mart wrote: |
Quote: |
Then this is likely to be an authority exit on the other side. Good luck. |
What is an "authority exit"? (Sorry I'm very new to the MQ client and its landed on my desk.) |
It's a piece of code that can be plugged into MQ to provide authorization for connections. Technically, I guess, it's a channel exit not an authorization exit. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
mart |
Posted: Wed Aug 03, 2005 6:30 am Post subject: |
|
|
Novice
Joined: 03 Aug 2005 Posts: 12 Location: UK
|
Thanks for your help Jeff, you've given me a lot more information than the 'experts' I have discussed this with in the past. |
|
Back to top |
|
 |
wschutz |
Posted: Thu Aug 04, 2005 6:50 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Do you know how "the other side" is going to check the userid and password? If they are expecting you use that sample java code:
Code: |
this.connection =
this.getFactory().createQueueConnection(
this.getConnectionPassword()); |
then this means that they have a channel security exit which will check the password (It would be in the RemotePassword field of the MQCD structure). Or are they planning some "other" mechanism to check passwords?
btw..that code doesn't compile, you have to pass in BOTH the userid and password on that method. _________________ -wayne |
|
Back to top |
|
 |
|