- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- pam routine problem
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2009 12:46 PM
09-23-2009 12:46 PM
pam routine problem
We have an application which calls the pam library. It works fine except for when the num_msg value > 1.
The declaration of our routine looks like:
extern int SVSWPamCallBack(int iNumMsg, struct pam_message **hMsg,
struct pam_response **hPamResponse, void *pData)
In our routine, we have debug code which displays the value of iNumMsg, hMsg, and hMsg->msg
printf("iNumMsg=%d\n",iNumMsg);
for (i = 0; i < iNumMsg; ++i)
{
printf(pContext->pLog,"hMsg[%d]=x%x\n",i,hMsg[i]);
printf(pContext->pLog,"hMsg[%d]->msg=x%x\n",i,hMsg[i]->msg);
}
When the iNumMsg > 1, we get odd values returned.
iNumMsg=2
hMsg[0]=x7fff59b0
hMsg[0]->msg=x7fff5a40
hMsg[1]=x7eff6258
hMsg[1]->msg=xffffffff
The contents of the string hMsg[0]->msg is "Password must contain at least two alphabetic characters and"
If we try to access hMsg[1]-> we get a SIGSEGV thrown.
Another example is
iNumMsg=5
hMsg[0]=x7fff5990
hMsg[0]->msg=x7fff5a40
hMsg[1]=x1
hMsg[0]->msg contains the string
"The password entered is not valid. Valid passwords must contain at least:
The man pages says:
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.
Is there something obvious that we are doing wrong?
thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2009 01:33 PM
09-23-2009 01:33 PM
Re: pam routine problem
The declaration of your routine:
extern int SVSWPamCallBack(int iNumMsg, struct pam_message **hMsg, struct pam_response **hPamResponse, void *pData);
Note this:
struct pam_message **hMsg <-- pointer to pointer
Now back to your loop:
for (i = 0; i < iNumMsg; ++i)
{
printf(pContext->pLog,"hMsg[%d]=x%x\n",i,hMsg[i]);
printf(pContext->pLog,"hMsg[%d]->msg=x%x\n",i,hMsg[i]->msg);
}
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:
printf(pContext->pLog,"hMsg[%d]=x%x\n",i,hMsg[i]->name_of_field);
If using pam_message structs then name_of_field should be msg_style:
printf(pContext->pLog,"hMsg[%d]=x%x\n",i,hMsg[i]->msg_style);
The second printf is correct regarding the dereferencing (hMsg[i]->msg) but fails to provide the correct format specifier:
"hMsg[%d]->msg=x%x\n"
should be
"hMsg[%d]->msg=x%s\n"
thus
printf(pContext->pLog,"hMsg[%d]->msg=x%s\n",i,hMsg[i]->msg);
Kind regards,
Kobylka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2009 01:32 AM
09-24-2009 01:32 AM
Re: pam routine problem
The correct format for pointers is %p, not %x.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2009 03:43 AM
09-24-2009 03:43 AM
Re: pam routine problem
>The correct format for pointers is %p, not %x.
Correct, but hMsg[i]->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).
Kind regards,
Kobylka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2009 04:35 AM
09-25-2009 04:35 AM
Re: pam routine problem
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]->msg to try to track down the problem.
(Yes, we should have used %p instead of %x, but the end result is similar)
In the example when iNumMsg=5, note that the address of hMsg[1] is x1.
In the example when iNumMsg=2, note that the address of hMsg[1]->msg is xffffffff
This is what I am trying to solve.
Thanks,
Glenn