<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: pam routine problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/pam-routine-problem/m-p/4502470#M732983</link>
    <description>Hi!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;The correct format for pointers is %p, not %x.&lt;BR /&gt;&lt;BR /&gt;Correct, but hMsg[i]-&amp;gt;name_of_field in the first printf, where name_of_field is equal to msg_style, is integral int value, not pointer (struct pam_message: man pam_start).&lt;BR /&gt;&lt;BR /&gt;Kind regards,&lt;BR /&gt;&lt;BR /&gt;Kobylka&lt;BR /&gt;</description>
    <pubDate>Thu, 24 Sep 2009 10:43:54 GMT</pubDate>
    <dc:creator>kobylka</dc:creator>
    <dc:date>2009-09-24T10:43:54Z</dc:date>
    <item>
      <title>pam routine problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pam-routine-problem/m-p/4502467#M732980</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;We have an application which calls the pam library. It works fine except  for when the num_msg value &amp;gt; 1.&lt;BR /&gt;&lt;BR /&gt;The declaration of our routine looks like:&lt;BR /&gt;&lt;BR /&gt;extern int SVSWPamCallBack(int iNumMsg, struct pam_message **hMsg,&lt;BR /&gt;    struct pam_response **hPamResponse, void *pData)&lt;BR /&gt;&lt;BR /&gt;In our routine, we have debug code which displays the value of iNumMsg, hMsg, and hMsg-&amp;gt;msg&lt;BR /&gt;&lt;BR /&gt;printf("iNumMsg=%d\n",iNumMsg);&lt;BR /&gt;for (i = 0; i &amp;lt; iNumMsg; ++i)&lt;BR /&gt;{&lt;BR /&gt;  printf(pContext-&amp;gt;pLog,"hMsg[%d]=x%x\n",i,hMsg[i]);&lt;BR /&gt;  printf(pContext-&amp;gt;pLog,"hMsg[%d]-&amp;gt;msg=x%x\n",i,hMsg[i]-&amp;gt;msg);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;When the iNumMsg &amp;gt; 1, we get odd values returned.&lt;BR /&gt;&lt;BR /&gt;iNumMsg=2&lt;BR /&gt;hMsg[0]=x7fff59b0&lt;BR /&gt;hMsg[0]-&amp;gt;msg=x7fff5a40&lt;BR /&gt;hMsg[1]=x7eff6258&lt;BR /&gt;hMsg[1]-&amp;gt;msg=xffffffff&lt;BR /&gt;&lt;BR /&gt;The contents of the string hMsg[0]-&amp;gt;msg is "Password must contain at least two alphabetic characters and"&lt;BR /&gt;&lt;BR /&gt;If we try to access hMsg[1]-&amp;gt; we get a SIGSEGV thrown.&lt;BR /&gt;&lt;BR /&gt;Another example is&lt;BR /&gt;&lt;BR /&gt;iNumMsg=5&lt;BR /&gt;hMsg[0]=x7fff5990&lt;BR /&gt;hMsg[0]-&amp;gt;msg=x7fff5a40&lt;BR /&gt;hMsg[1]=x1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hMsg[0]-&amp;gt;msg contains the string&lt;BR /&gt;"The password entered is not valid.  Valid passwords must contain at least:&lt;LF&gt;&lt;HT&gt;  1 upper case character(s),&lt;LF&gt;&lt;HT&gt;  0 lower case character(s),&lt;LF&gt;&lt;HT&gt;  1 digit(s), and&lt;LF&gt;&lt;HT&gt;  1 special character(s).&lt;LF&gt;"&lt;BR /&gt;&lt;BR /&gt;The man pages says:&lt;BR /&gt;The parameter num_msg is the number of messages associated with the call.  The parameter msg is a pointer to an array of length num_msg of the pam_message structure.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is there something obvious that we are doing wrong?&lt;BR /&gt;&lt;BR /&gt;thanks,&lt;BR /&gt;&lt;BR /&gt;&lt;/LF&gt;&lt;/HT&gt;&lt;/LF&gt;&lt;/HT&gt;&lt;/LF&gt;&lt;/HT&gt;&lt;/LF&gt;&lt;/HT&gt;&lt;/LF&gt;</description>
      <pubDate>Wed, 23 Sep 2009 19:46:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pam-routine-problem/m-p/4502467#M732980</guid>
      <dc:creator>christian_derek</dc:creator>
      <dc:date>2009-09-23T19:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: pam routine problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pam-routine-problem/m-p/4502468#M732981</link>
      <description>Hello Christian!&lt;BR /&gt;&lt;BR /&gt;The declaration of your routine:&lt;BR /&gt;extern int SVSWPamCallBack(int iNumMsg, struct pam_message **hMsg, struct pam_response **hPamResponse, void *pData);&lt;BR /&gt;&lt;BR /&gt;Note this:&lt;BR /&gt;struct pam_message **hMsg &amp;lt;-- pointer to pointer&lt;BR /&gt;&lt;BR /&gt;Now back to your loop:&lt;BR /&gt;for (i = 0; i &amp;lt; iNumMsg; ++i)&lt;BR /&gt;{&lt;BR /&gt;printf(pContext-&amp;gt;pLog,"hMsg[%d]=x%x\n",i,hMsg[i]);&lt;BR /&gt;printf(pContext-&amp;gt;pLog,"hMsg[%d]-&amp;gt;msg=x%x\n",i,hMsg[i]-&amp;gt;msg);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The first printf takes as argument hMsg[i] which points to another pointer that points to the struct pam_message (**hMsg). So this should be:&lt;BR /&gt;&lt;BR /&gt;printf(pContext-&amp;gt;pLog,"hMsg[%d]=x%x\n",i,hMsg[i]-&amp;gt;name_of_field);&lt;BR /&gt;&lt;BR /&gt;If using pam_message structs then name_of_field should be msg_style:&lt;BR /&gt;&lt;BR /&gt;printf(pContext-&amp;gt;pLog,"hMsg[%d]=x%x\n",i,hMsg[i]-&amp;gt;msg_style);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The second printf is correct regarding the dereferencing (hMsg[i]-&amp;gt;msg) but fails to provide the correct format specifier:&lt;BR /&gt;&lt;BR /&gt;"hMsg[%d]-&amp;gt;msg=x%x\n"&lt;BR /&gt;&lt;BR /&gt;should be&lt;BR /&gt;&lt;BR /&gt;"hMsg[%d]-&amp;gt;msg=x%s\n"&lt;BR /&gt;&lt;BR /&gt;thus&lt;BR /&gt;&lt;BR /&gt;printf(pContext-&amp;gt;pLog,"hMsg[%d]-&amp;gt;msg=x%s\n",i,hMsg[i]-&amp;gt;msg);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Kind regards,&lt;BR /&gt;&lt;BR /&gt;Kobylka</description>
      <pubDate>Wed, 23 Sep 2009 20:33:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pam-routine-problem/m-p/4502468#M732981</guid>
      <dc:creator>kobylka</dc:creator>
      <dc:date>2009-09-23T20:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: pam routine problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pam-routine-problem/m-p/4502469#M732982</link>
      <description>&amp;gt;kobylka: printf(pContext-&amp;gt;pLog,"hMsg[%d]=x%x\n",i,hMsg[i]-&amp;gt;name_of_field);&lt;BR /&gt;&lt;BR /&gt;The correct format for pointers is %p, not %x.</description>
      <pubDate>Thu, 24 Sep 2009 08:32:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pam-routine-problem/m-p/4502469#M732982</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-09-24T08:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: pam routine problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pam-routine-problem/m-p/4502470#M732983</link>
      <description>Hi!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;The correct format for pointers is %p, not %x.&lt;BR /&gt;&lt;BR /&gt;Correct, but hMsg[i]-&amp;gt;name_of_field in the first printf, where name_of_field is equal to msg_style, is integral int value, not pointer (struct pam_message: man pam_start).&lt;BR /&gt;&lt;BR /&gt;Kind regards,&lt;BR /&gt;&lt;BR /&gt;Kobylka&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Sep 2009 10:43:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pam-routine-problem/m-p/4502470#M732983</guid>
      <dc:creator>kobylka</dc:creator>
      <dc:date>2009-09-24T10:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: pam routine problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pam-routine-problem/m-p/4502471#M732984</link>
      <description>Christian's post was actually based on an email from me, and I had some typos, which probably confused things.&lt;BR /&gt;&lt;BR /&gt;The issue is that we are receiving invalid address values passed back in the pam callback routine. We were displaying the values of the addresses of hMsg[i] and hMsg[i]-&amp;gt;msg to try to track down the problem.&lt;BR /&gt;&lt;BR /&gt;(Yes, we should have used %p instead of %x, but the end result is similar)&lt;BR /&gt;&lt;BR /&gt;In the example when iNumMsg=5, note that the address of hMsg[1] is x1.&lt;BR /&gt;&lt;BR /&gt;In the example when iNumMsg=2, note that the address of hMsg[1]-&amp;gt;msg is xffffffff&lt;BR /&gt;&lt;BR /&gt;This is what I am trying to solve.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Glenn&lt;BR /&gt;</description>
      <pubDate>Fri, 25 Sep 2009 11:35:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pam-routine-problem/m-p/4502471#M732984</guid>
      <dc:creator>Glenn L</dc:creator>
      <dc:date>2009-09-25T11:35:43Z</dc:date>
    </item>
  </channel>
</rss>

