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

Re: dlopen() failing in pam_start (HELP!)



On Thu, 3 Jun 1999 mpg4@paradise.duluoz.net wrote:

> 
>     Sorry if this comes through twice, I had a mailer problem... 
>  
>     I'm writing a program, randpass, that creates a random password for
>  an account, and then sets the password using PAM. I have no
>  compilation problems, but at runtime I either get a segfault
>  (dynamically linked libs) or an error 28 "Module is unknown" (static
>  libs) from somewhere inside pam_chauthtok.
>  
>     I've discovered that the dlopen() call in _pam_add_handler is
>  failing with this error "/usr/lib/security/pam_pwdb.so: undefined
>  symbol: pam_get_item".  
>  
>  /usr/lib/security/pam_pwdb.so exists.  The /etc/pam.d/randpass file is
>  a symbolic link to /etc/pam.d/passwd, and passwd works fine.  I've
>  recompiled and reinstalled libpam (0.66), with no change. Relevant
>  portions of the code are below.  Any ideas?  Let me know if you need
>  more info.
>  
>  -mike
>  
>  
>    /* init PAM */
>    ret = pam_start(PROGNAME, user, &pconv, &pamh);
>    if (ret != PAM_SUCCESS) {
>      fprintf(stderr, "%s: pam_start() failed: %s\n", PROGNAME, 
>  	    pam_strerror(pamh, ret));
>      exit (3);
>    }
>  
>    /* set the password */
>    ret = pam_chauthtok(pamh, PAM_SILENT);  /* returns 28 here */
>    if ( ret != PAM_SUCCESS ) {
>      fprintf(stderr, "%s: pam_chauthtok() failed: %s\n", PROGNAME,
>  	    pam_strerror(pamh, ret));
>      exit (3);
>    }

	Hi Mike

	All I can say is that the piece of code you've sent is incomplete.
I have no idea how you initialize pconv. If you want just a quick test,
define a global variable

static struct pam_conv pconv =
{
        &misc_conv,
        NULL
};

	I think this is your problem: you use an unitialized conversation
structure. 

Use #include <security/pam_misc.h> (besides pam_appl.h), and compile with
-lpam -lpam_misc -ldl

Hope this helps.

Cheers,
Misa



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