Why my module can not be added?

qin junying.qin at gmail.com
Thu Mar 8 03:48:05 UTC 2007


Hi,

I have built a test pam module to run with sshd. The codes are as following:

#define PAM_SM_AUTH

#define _PAM_EXTERN_FUNCTIONS
#include <security/_pam_macros.h>
#include <security/pam_modules.h>
#include <security/pam_ext.h>

PAM_EXTERN int pam_sm_authenticate(pam_handle_t * pamh, int flags
				   ,int argc, const char **argv)
{
	unsigned int ctrl;
	int retval;
	const char *name;
	const void *p;



	ctrl = _set_ctrl(pamh, flags, NULL, argc, argv);



	/* get the user'name' */

	retval = pam_get_user(pamh, &name, NULL);
	if (retval == PAM_SUCCESS)
	{
		pam_syslog(pamh, LOG_DEBUG,
		   "XOS:checking logins for '%s'", name);
	}
	return retval;	
}

#ifdef PAM_STATIC
struct pam_module _pam_xos_auth_modstruct = {
    "pam_xos_auth",
    pam_sm_authenticate,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
};

I compiled as pam_xos_auth.so, and inserted in pam.d/sshd
# cat sshd
auth    required   /path/to/pam_xos_auth.so
...

When I used the ssh to login, I was told I had no permission. And
also, I checked the
/var/log/secure and found:
# cat /var/log/secure
...
Mar  8 10:12:19 FedoraC4 sshd[4814]: PAM unable to
dlopen(/path/to/pam_xos_auth.so)
Mar  8 10:12:19 FedoraC4 sshd[4814]: PAM [dlerror:
/path/to/pam_xos_auth.so: undefined symbol: pam_syslog]
Mar  8 10:12:19 FedoraC4 sshd[4814]: PAM adding faulty module:
/path/to/pam_xos_auth.so
Mar  8 10:12:24 FedoraC4 sshd[4814]: Failed password for anqin from
::ffff:10.61.0.7 port 4228 ssh2

what is the matter with this? Could somebody give me some advices?

Thank you very much!




More information about the Pam-list mailing list