[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Fw: how to debug a PAM on linux 6.0?

Paul Morgan writes:
>trouble doing is setting the breakpoints.  Using gdb running under the root
>account I wa sable to attach to ftpd and load the symbols for my PAM but was
>unable to set a breakpoint - the error was unable to acess a memory at a
>location in the 0x700 range.  So now I think I am ready to stick guts into
>my PAm except that once I have done this I have been unable to set a
>breakpoint.   So whats the best way to debug a PAM?  Is gdb to best tool for
>this or is another debugger more suited for this?

Put a "sleep(20);" in the pam_sm_open_session function and attach to it
during that sleep; then you should be able to debug fine.

I prefer to debug pam modules with a log function.  That way, I can just
add lots of debugging statements that do nothing in the normal case, but
whenever someone reports a bug in a module I wrote, I can tell them to
add the "debug" keyword to the /etc/pam.d/<foo> file's pam_<blah> line,
and voila! -- the fact that I've done all my debugging with these log
statements means that I've got a pretty good debugging framework set up
and I'm likely to be able to see what the bug is without using email to
guide joe random user through a recompile (to add the sleep statement)
and difficult debugging session.

My $0.02 worth of advice...


"Magazines all too frequently lead to books and should be regarded by the
 prudent as the heavy petting of literature."            -- Fran Lebowitz
 Linux Application Development       http://www.redhat.com/~johnsonm/lad/

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []