| Author | 
		  Message
		 | 
		
		  | Henry | 
		  
		    
			  
				 Posted: Sat Nov 01, 2003 9:14 pm    Post subject: Provide userid in C and VB | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 08 Oct 2003 Posts: 73
  
  | 
		  
		    
			  
				Hi!
 
 
I would like to ask how can I provide userid in C and VB in order to connect to the queue and qmanager?  The C programme is running in Solaris and Windows NT.  
 
 
How should I code for the userid and password in my programme in C, VB in order to connect the queue manager and open the queue?
 
 
Many thanks!!
 
 
      | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | JasonE | 
		  
		    
			  
				 Posted: Tue Nov 04, 2003 2:38 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 03 Nov 2003 Posts: 1220 Location: Hursley 
  | 
		  
		    
			  
				| Without security exits in place, the client always sends over the signed on userid on Unix and Windows, so you have no control over what userid is used. You can use alternate userids once connected (if +altusr authorized) but you cannot change what the connect is done with. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Tue Nov 04, 2003 5:32 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				
   
	| JasonE wrote: | 
   
  
	| Without security exits in place, the client always sends over the signed on userid on Unix and Windows, so you have no control over what userid is used. You can use alternate userids once connected (if +altusr authorized) but you cannot change what the connect is done with. | 
   
 
 Unless of course, your program changes what user it is running as before it makes the connection.
 
 
Code to do this is left as an exercise...   _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Henry | 
		  
		    
			  
				 Posted: Tue Nov 04, 2003 8:14 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 08 Oct 2003 Posts: 73
  
  | 
		  
		    
			  
				In java code, there is an API call to give the userid 
 
 
MQEnvironment.userID = "<userid>"
 
 
is there any API call in C or VB like the java one? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | JasonE | 
		  
		    
			  
				 Posted: Wed Nov 05, 2003 1:51 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 03 Nov 2003 Posts: 1220 Location: Hursley 
  | 
		  
		    
			  
				| No. I think the only reason you can do it in java is because getting the signed on userid is unreliable (a system property which I think is unreadable from an applet). | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | vanvught | 
		  
		    
			  
				 Posted: Sun Nov 09, 2003 5:33 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Apprentice
 
 Joined: 02 Jul 2001 Posts: 35 Location: The Netherlands 
  | 
		  
		    
			  
				In C you have:
 
 
   
	| Code: | 
   
  
	struct tagMQOD {
 
   MQCHAR4   StrucId;              /* Structure identifier */
 
   MQLONG    Version;              /* Structure version number */
 
   MQLONG    ObjectType;           /* Object type */
 
   MQCHAR48  ObjectName;           /* Object name */
 
   MQCHAR48  ObjectQMgrName;       /* Object queue manager name */
 
   MQCHAR48  DynamicQName;         /* Dynamic queue name */
 
   MQCHAR12  AlternateUserId;      /* Alternate user identifier */ | 
   
 
 
 
   
	| Quote: | 
   
  
	AlternateUserId (MQCHAR12)
 
Alternate user identifier. 
 
 
If MQOO_ALTERNATE_USER_AUTHORITY is specified for the  MQOPEN  call, or MQPMO_ALTERNATE_USER_AUTHORITY for the  MQPUT1  call, this field contains an alternate user identifier that is to be used to check the authorization for the open, in place of the user identifier that the application is currently running under. Some checks, however, are still carried out with the current user identifier (for example, context checks). 
 
 
If MQOO_ALTERNATE_USER_AUTHORITY or MQPMO_ALTERNATE_USER_AUTHORITY is specified and this field is entirely blank up to the first null character or the end of the field, the open can succeed only if no user authorization is needed to open this object with the options specified. 
 
 
If neither MQOO_ALTERNATE_USER_AUTHORITY nor MQPMO_ALTERNATE_USER_AUTHORITY is specified, this field is ignored. 
 
 | 
   
 
 
 
Regards, Arjan
 
WBI: B2B and WebSphere MQ --> http://edi.services.ibm.com/mqseries/spec_sheets.shtml | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | JasonE | 
		  
		    
			  
				 Posted: Mon Nov 10, 2003 12:59 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 03 Nov 2003 Posts: 1220 Location: Hursley 
  | 
		  
		    
			  
				Yes, but dont forget alternate id's dont affect connects and require the userid connecting to be authorized to use alternate userid. 
 
 
The Java equivalent sets the userid on the connect, which is slightly different. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |