 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Is there a way a user who is the owner of is userprf enable is disabled id without logging in to the system</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/is-there-a-way-a-user-who-is-the-owner-of-is-userprf-enable-is-disabled-id-without-logging-in-to-the-system/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/is-there-a-way-a-user-who-is-the-owner-of-is-userprf-enable-is-disabled-id-without-logging-in-to-the-system/</link>
	<description></description>
	<lastBuildDate>Wed, 22 May 2013 05:05:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: johnsonmumbai</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/is-there-a-way-a-user-who-is-the-owner-of-is-userprf-enable-is-disabled-id-without-logging-in-to-the-system/#comment-91077</link>
		<dc:creator>johnsonmumbai</dc:creator>
		<pubDate>Tue, 19 Apr 2011 08:58:19 +0000</pubDate>
		<guid isPermaLink="false">#comment-91077</guid>
		<description><![CDATA[Thanks Tom for guiding me through this.  Appreciate your patience.

It worked.  Now only issue is convincing the security team to get it implemented, as they need to ensure this is not picked up as a security issue during internal, external and statutory audit that our IT department needs to undergo every year.

Johnson]]></description>
		<content:encoded><![CDATA[<p>Thanks Tom for guiding me through this.  Appreciate your patience.</p>
<p>It worked.  Now only issue is convincing the security team to get it implemented, as they need to ensure this is not picked up as a security issue during internal, external and statutory audit that our IT department needs to undergo every year.</p>
<p>Johnson</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/is-there-a-way-a-user-who-is-the-owner-of-is-userprf-enable-is-disabled-id-without-logging-in-to-the-system/#comment-91054</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Tue, 19 Apr 2011 02:33:31 +0000</pubDate>
		<guid isPermaLink="false">#comment-91054</guid>
		<description><![CDATA[&lt;i&gt;How do i define binary zeros in CL.&lt;/i&gt;

Use the example that I supplied. Specify binary zeros as hex values -- value( x’0000000000000000′ ).

Tom]]></description>
		<content:encoded><![CDATA[<p><i>How do i define binary zeros in CL.</i></p>
<p>Use the example that I supplied. Specify binary zeros as hex values &#8212; value( x’0000000000000000′ ).</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: johnsonmumbai</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/is-there-a-way-a-user-who-is-the-owner-of-is-userprf-enable-is-disabled-id-without-logging-in-to-the-system/#comment-91015</link>
		<dc:creator>johnsonmumbai</dc:creator>
		<pubDate>Mon, 18 Apr 2011 13:08:08 +0000</pubDate>
		<guid isPermaLink="false">#comment-91015</guid>
		<description><![CDATA[The value for &amp;ErrCode is 8 bytes of binary zeros.

How do i define binary zeros in CL.

When i use following code
DCL   &amp;ERRCODE     *CHAR    8     VALUE(&#039;00000000&#039;) 

i get the following error.

CPF3CF1   40  ESC    Error code parameter not valid. 

Johnson]]></description>
		<content:encoded><![CDATA[<p>The value for &amp;ErrCode is 8 bytes of binary zeros.</p>
<p>How do i define binary zeros in CL.</p>
<p>When i use following code<br />
DCL   &amp;ERRCODE     *CHAR    8     VALUE(&#8217;00000000&#8242;) </p>
<p>i get the following error.</p>
<p>CPF3CF1   40  ESC    Error code parameter not valid. </p>
<p>Johnson</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/is-there-a-way-a-user-who-is-the-owner-of-is-userprf-enable-is-disabled-id-without-logging-in-to-the-system/#comment-90878</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Thu, 14 Apr 2011 20:03:29 +0000</pubDate>
		<guid isPermaLink="false">#comment-90878</guid>
		<description><![CDATA[&lt;i&gt;CALL PGM(QSYGETPH) PARM(&amp;TOUSRPRF &amp;PWD &amp;H_PRF1)&lt;/i&gt;

Since this variation is actually using a password value, Make these changes:&lt;pre&gt;
   dcl   &amp;ErrCode     *char    8     value( x&#039;0000000000000000&#039; )
   dcl   &amp;lPwd        *int           value( 10 )
   dcl   &amp;CCSID       *int           value( -1 )
.
.
.
   call       QSYGETPH      ( +
                              &amp;TOUSRPRF          +
                              &amp;PWD               +
                              &amp;h_Prf1            +
                              &amp;ErrCode           +
                              &amp;lPwd              +
                              &amp;CCSID             +
                            )&lt;/pre&gt;
Parameter 2 can be either a &quot;special value&quot; such as &#039;*NOPWDCHK&#039; or an actual password. Your code attempts to use an actual password to see if it works. When actual passwords are used, the API needs to know the length of the password and the CCSID to use. Also, when those optional parms are added at the end, the error code parameter needs to be specified because it&#039;s in the parameter list before the last two parms.

The value I chose for &amp;lPwd is 10. That works for systems with system value QPWDLVL of &#039;0&#039; or &#039;1&#039;. If longer passphrases are in use, then the actual length of the password needs to be determined.

The value for &amp;CCSID that I used is (-1). That should work for a lot of systems, but you might need to use (0) or you might need an actual CCSID value. An actual CCSID value will take a little extra work.

The value for &amp;ErrCode is 8 bytes of binary zeros. That covers the first two fields of the error code structure and tells the API that errors should be returned as *ESCAPE messages. That&#039;s the same behavior that happens when the parameter is omitted.

If you review the documentation for the API, you should be able to match everything up.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>CALL PGM(QSYGETPH) PARM(&amp;TOUSRPRF &amp;PWD &amp;H_PRF1)</i></p>
<p>Since this variation is actually using a password value, Make these changes:
<pre>
   dcl   &amp;ErrCode     *char    8     value( x'0000000000000000' )
   dcl   &amp;lPwd        *int           value( 10 )
   dcl   &amp;CCSID       *int           value( -1 )
.
.
.
   call       QSYGETPH      ( +
                              &amp;TOUSRPRF          +
                              &amp;PWD               +
                              &amp;h_Prf1            +
                              &amp;ErrCode           +
                              &amp;lPwd              +
                              &amp;CCSID             +
                            )</pre>
<p>Parameter 2 can be either a &#8220;special value&#8221; such as &#8216;*NOPWDCHK&#8217; or an actual password. Your code attempts to use an actual password to see if it works. When actual passwords are used, the API needs to know the length of the password and the CCSID to use. Also, when those optional parms are added at the end, the error code parameter needs to be specified because it&#8217;s in the parameter list before the last two parms.</p>
<p>The value I chose for &amp;lPwd is 10. That works for systems with system value QPWDLVL of &#8217;0&#8242; or &#8217;1&#8242;. If longer passphrases are in use, then the actual length of the password needs to be determined.</p>
<p>The value for &amp;CCSID that I used is (-1). That should work for a lot of systems, but you might need to use (0) or you might need an actual CCSID value. An actual CCSID value will take a little extra work.</p>
<p>The value for &amp;ErrCode is 8 bytes of binary zeros. That covers the first two fields of the error code structure and tells the API that errors should be returned as *ESCAPE messages. That&#8217;s the same behavior that happens when the parameter is omitted.</p>
<p>If you review the documentation for the API, you should be able to match everything up.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: johnsonmumbai</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/is-there-a-way-a-user-who-is-the-owner-of-is-userprf-enable-is-disabled-id-without-logging-in-to-the-system/#comment-90863</link>
		<dc:creator>johnsonmumbai</dc:creator>
		<pubDate>Thu, 14 Apr 2011 12:41:11 +0000</pubDate>
		<guid isPermaLink="false">#comment-90863</guid>
		<description><![CDATA[Error continues to be the same  even if i change the variable to &amp;H_PRF1.
Below is the call command being used.

CALL       PGM(QSYGETPH) PARM(&amp;TOUSRPRF &amp;PWD &amp;H_PRF1) 

 Value for parameter 2 not valid.              
Function check. CPF3C3C Unmonitored by OPIAPI  
The value is displayed as blank.  Why is it?

&amp;H_PRF1  *CHAR 12   &#039;            &#039;

Johnson]]></description>
		<content:encoded><![CDATA[<p>Error continues to be the same  even if i change the variable to &amp;H_PRF1.<br />
Below is the call command being used.</p>
<p>CALL       PGM(QSYGETPH) PARM(&amp;TOUSRPRF &amp;PWD &amp;H_PRF1) </p>
<p> Value for parameter 2 not valid.<br />
Function check. CPF3C3C Unmonitored by OPIAPI<br />
The value is displayed as blank.  Why is it?</p>
<p>&amp;H_PRF1  *CHAR 12   &#8216;            &#8216;</p>
<p>Johnson</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/is-there-a-way-a-user-who-is-the-owner-of-is-userprf-enable-is-disabled-id-without-logging-in-to-the-system/#comment-90824</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Thu, 14 Apr 2011 03:01:07 +0000</pubDate>
		<guid isPermaLink="false">#comment-90824</guid>
		<description><![CDATA[&lt;i&gt;CALL PGM(QSYGETPH) PARM(&amp;TOUSRPRF &amp;PWD &amp;H_PRF2)&lt;/i&gt;

Note that the modified code doesn&#039;t need &amp;H_PRF2. The call should be using &amp;H_PRF1.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>CALL PGM(QSYGETPH) PARM(&amp;TOUSRPRF &amp;PWD &amp;H_PRF2)</i></p>
<p>Note that the modified code doesn&#8217;t need &amp;H_PRF2. The call should be using &amp;H_PRF1.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: johnsonmumbai</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/is-there-a-way-a-user-who-is-the-owner-of-is-userprf-enable-is-disabled-id-without-logging-in-to-the-system/#comment-90743</link>
		<dc:creator>johnsonmumbai</dc:creator>
		<pubDate>Wed, 13 Apr 2011 05:14:10 +0000</pubDate>
		<guid isPermaLink="false">#comment-90743</guid>
		<description><![CDATA[The call statement is 

CALL       PGM(QSYGETPH) PARM(&amp;TOUSRPRF &amp;PWD &amp;H_PRF2)
and the error that appears is &#039;Value for parameter 2 is invalid&#039; 
and &#039; Function check. CPF3C3C   unmonitored by OPIAPI&#039;
Parameter 2 appears as shown below in the dump

&amp;H_PRF1 *CHAR 12 &#039;    m k , Ø &#039; 

We need to overcome this error inorder for the incorrect password error to get trapped. The error code for incorrect password is as mentioned by you ie CPF22E2.

Johnson]]></description>
		<content:encoded><![CDATA[<p>The call statement is </p>
<p>CALL       PGM(QSYGETPH) PARM(&amp;TOUSRPRF &amp;PWD &amp;H_PRF2)<br />
and the error that appears is &#8216;Value for parameter 2 is invalid&#8217;<br />
and &#8216; Function check. CPF3C3C   unmonitored by OPIAPI&#8217;<br />
Parameter 2 appears as shown below in the dump</p>
<p>&amp;H_PRF1 *CHAR 12 &#8216;    m k , Ø &#8216; </p>
<p>We need to overcome this error inorder for the incorrect password error to get trapped. The error code for incorrect password is as mentioned by you ie CPF22E2.</p>
<p>Johnson</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/is-there-a-way-a-user-who-is-the-owner-of-is-userprf-enable-is-disabled-id-without-logging-in-to-the-system/#comment-90713</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Tue, 12 Apr 2011 18:45:02 +0000</pubDate>
		<guid isPermaLink="false">#comment-90713</guid>
		<description><![CDATA[&lt;i&gt;What could be the reason?.&lt;/i&gt;

The first reason would be that CPF22E2 isn&#039;t the error being returned from QSYGETPH on your system. That&#039;s why I suggested that the code would be better with MONMSG MSGID( CPF0000 MCH0000 ) in order to catch every error no matter what it was.

It might be useful if you showed what error was returned from QSYGETPH when an incorrect password was entered. If an error is returned other than CPF22E2, you could simply add that error ID to the MONMSG. But you&#039;d still be better just catching all CPF and MCH errors.

A second reason might be that the CALL to QSYGETPH was coded with an error code parameter. The error identifier would be passed through that parameter and not seen by MONMSG. Please show the CALL and the MONMSG commands used in your program.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>What could be the reason?.</i></p>
<p>The first reason would be that CPF22E2 isn&#8217;t the error being returned from QSYGETPH on your system. That&#8217;s why I suggested that the code would be better with MONMSG MSGID( CPF0000 MCH0000 ) in order to catch every error no matter what it was.</p>
<p>It might be useful if you showed what error was returned from QSYGETPH when an incorrect password was entered. If an error is returned other than CPF22E2, you could simply add that error ID to the MONMSG. But you&#8217;d still be better just catching all CPF and MCH errors.</p>
<p>A second reason might be that the CALL to QSYGETPH was coded with an error code parameter. The error identifier would be passed through that parameter and not seen by MONMSG. Please show the CALL and the MONMSG commands used in your program.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: johnsonmumbai</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/is-there-a-way-a-user-who-is-the-owner-of-is-userprf-enable-is-disabled-id-without-logging-in-to-the-system/#comment-90696</link>
		<dc:creator>johnsonmumbai</dc:creator>
		<pubDate>Tue, 12 Apr 2011 12:44:32 +0000</pubDate>
		<guid isPermaLink="false">#comment-90696</guid>
		<description><![CDATA[Tom,

While i have changed the code as recommended by you, and the TOUSRPRF id gets enabled however when an invalid password is passed, this is not getting trapped using the MONMSG MSGID( CPF22E2 )  exec(chgusrprf  &amp;TOUSRPRF  status( *DISABLED ) ).

Hence even if user enters Invalid password the id does not revert back to disabled.

What could be the reason?.

I meanwhile continue to get the following errors which can be bypassed using MONMSG.

Value for parameter 2 not valid QSYGETPH
                                
Error code parameter not valid QSYRLSPH
                        
Parameter 2 appears as below 

&amp;H_PRF1   *CHAR     12    &#039;    m ¥I»Ð° &#039;]]></description>
		<content:encoded><![CDATA[<p>Tom,</p>
<p>While i have changed the code as recommended by you, and the TOUSRPRF id gets enabled however when an invalid password is passed, this is not getting trapped using the MONMSG MSGID( CPF22E2 )  exec(chgusrprf  &amp;TOUSRPRF  status( *DISABLED ) ).</p>
<p>Hence even if user enters Invalid password the id does not revert back to disabled.</p>
<p>What could be the reason?.</p>
<p>I meanwhile continue to get the following errors which can be bypassed using MONMSG.</p>
<p>Value for parameter 2 not valid QSYGETPH</p>
<p>Error code parameter not valid QSYRLSPH</p>
<p>Parameter 2 appears as below </p>
<p>&amp;H_PRF1   *CHAR     12    &#8216;    m ¥I»Ð° &#8216;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/is-there-a-way-a-user-who-is-the-owner-of-is-userprf-enable-is-disabled-id-without-logging-in-to-the-system/#comment-90585</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Fri, 08 Apr 2011 18:47:36 +0000</pubDate>
		<guid isPermaLink="false">#comment-90585</guid>
		<description><![CDATA[&lt;i&gt;I however get the following error in the dump once i run the program,
Value for parameter 2 not valid QSYGETPH
ProfileHandle is not valid QSYPHDL &lt;/i&gt;

Now that you have a little experience with the API, here&#039;s the trick:

From the Get Profile Handle (QSYGETPH) API documentation:&lt;ul&gt;
	&lt;li&gt;To obtain a profile handle for a profile that is disabled, specify *NOPWDCHK for the password parameter. &lt;/li&gt;
&lt;/ul&gt;
That means that you can&#039;t &lt;b&gt;directly use&lt;/b&gt; the supplied password to get a profile handle for a disabled profile. You need to go by a slightly indirect route.

Change the first part of your code to something like this:&lt;pre&gt;
/* GET THE *USRPRF TO EMULATE */
CHGVAR &amp;TOUSRPRF &amp;PUSRPRF

chgusrprf  &amp;TOUSRPRF  status( *ENABLED )

/* GENERATE PROFILE HANDLES FOR THE  */
/* FOR THE USER ID PASSED TO THIS PROGRAM */
CALL PGM(QSYGETPH) PARM(&amp;TOUSRPRF &amp;PWD &amp;H_PRF1)
MONMSG MSGID( CPF22E2 )  exec(  +
         chgusrprf  &amp;TOUSRPRF  status( *DISABLED ) )

/* NOW, release the HANDLE */
CALL PGM( QSYRLSPH ) PARM( &amp;H_PRF1 x&#039;0000000000000000&#039; )

return
endpgm&lt;/pre&gt;
The idea is that you enable the profile first, then see if you can generate a handle using the password. If the password works, then all is well.

If the password is incorrect, then the MONMSG CPF22E2 tells you that the profile needs to be back at *DISABLED status. Actually, the MONMSG would be better as:&lt;pre&gt;
MONMSG MSGID( CPF0000 MCH0000 )  exec(  +
         chgusrprf  &amp;TOUSRPRF  status( *DISABLED ) )&lt;/pre&gt;
Any error at all should leave the profile back at *DISABLED status.

Then release any handle that was generated and that&#039;s all there is. It&#039;s not necessary to swap. All you want to do is see if the supplied password is accepted for that profile. If it&#039;s accepted, the profile is enabled. If it causes an error, the profile is back to being disabled.

You should also create a logging mechanism. The simplest would be a secured message queue. At the very start of the program, send a message to that queue to log the attempt to enable profile &amp;PUSRPRF. The message will timestamp itself. You might also send an additional message every time an attempt fails. You might not need anything more than that to start and it can be expanded in the future.

Programs such as this should be written in ILE CL and have all observability removed -- no debug info should be left in the program when it is in production.

There are much better ways to get it done, but this is simple, straightforward, easy to understand and about as fool-proof as it gets without some detailed effort.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>I however get the following error in the dump once i run the program,<br />
Value for parameter 2 not valid QSYGETPH<br />
ProfileHandle is not valid QSYPHDL </i></p>
<p>Now that you have a little experience with the API, here&#8217;s the trick:</p>
<p>From the Get Profile Handle (QSYGETPH) API documentation:
<ul>
<li>To obtain a profile handle for a profile that is disabled, specify *NOPWDCHK for the password parameter. </li>
</ul>
<p>That means that you can&#8217;t <b>directly use</b> the supplied password to get a profile handle for a disabled profile. You need to go by a slightly indirect route.</p>
<p>Change the first part of your code to something like this:
<pre>
/* GET THE *USRPRF TO EMULATE */
CHGVAR &amp;TOUSRPRF &amp;PUSRPRF

chgusrprf  &amp;TOUSRPRF  status( *ENABLED )

/* GENERATE PROFILE HANDLES FOR THE  */
/* FOR THE USER ID PASSED TO THIS PROGRAM */
CALL PGM(QSYGETPH) PARM(&amp;TOUSRPRF &amp;PWD &amp;H_PRF1)
MONMSG MSGID( CPF22E2 )  exec(  +
         chgusrprf  &amp;TOUSRPRF  status( *DISABLED ) )

/* NOW, release the HANDLE */
CALL PGM( QSYRLSPH ) PARM( &amp;H_PRF1 x'0000000000000000' )

return
endpgm</pre>
<p>The idea is that you enable the profile first, then see if you can generate a handle using the password. If the password works, then all is well.</p>
<p>If the password is incorrect, then the MONMSG CPF22E2 tells you that the profile needs to be back at *DISABLED status. Actually, the MONMSG would be better as:
<pre>
MONMSG MSGID( CPF0000 MCH0000 )  exec(  +
         chgusrprf  &amp;TOUSRPRF  status( *DISABLED ) )</pre>
<p>Any error at all should leave the profile back at *DISABLED status.</p>
<p>Then release any handle that was generated and that&#8217;s all there is. It&#8217;s not necessary to swap. All you want to do is see if the supplied password is accepted for that profile. If it&#8217;s accepted, the profile is enabled. If it causes an error, the profile is back to being disabled.</p>
<p>You should also create a logging mechanism. The simplest would be a secured message queue. At the very start of the program, send a message to that queue to log the attempt to enable profile &amp;PUSRPRF. The message will timestamp itself. You might also send an additional message every time an attempt fails. You might not need anything more than that to start and it can be expanded in the future.</p>
<p>Programs such as this should be written in ILE CL and have all observability removed &#8212; no debug info should be left in the program when it is in production.</p>
<p>There are much better ways to get it done, but this is simple, straightforward, easy to understand and about as fool-proof as it gets without some detailed effort.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 6/9 queries in 0.011 seconds using memcached
Object Caching 394/397 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-22 09:14:01 -->