pam_chauthtok crash in solaris

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

 



A couple questions on using pam_chauthtok in Solaris (I am
testing/developing in 8).  Please let me know if for some reason this is not
an appropriate list, but it seems to be the only active one I can find ;)

When I setup and call pam_chauthtok in a PAM aware app like:

if( (ret = pam_start("passwd", NULL, &changeconv, &pamh)) == PAM_SUCCESS )
			if( (ret = pam_chauthtok(pamh, PAM_SILENT)) == PAM_SUCCESS )
					changed = 1;

It seems to crash before even getting to my conversation function (which is
included below just in case) - it just segfaults.  The same exact code works
fine in linux, so I am guessing it is a quirk with Solaris.  All I want to
do is force a change of the users password (regardless of expiration etc) as
this is for an application that manages users.

Any ideas? suggestions?  Let me know if I need to provide more, the app is
to be GPL'd so I can share source as necessary etc.

Thanks in advance!
Nathan Yocom
nate@yocom.org

my conversation function (where new_pass and gl_username are globals):

/** PAM Conversation for changing a users password */
int change_conv(int num_msg,const struct pam_message **msg, struct
pam_response **response, void *appdata_ptr)
{
	struct pam_response *reply_with = NULL;
	int num_replies;
	char buffer[80];

	if( num_msg <= 0 )
		return PAM_CONV_ERR;

	reply_with = (struct pam_response *)calloc(num_msg, sizeof(struct
pam_response));

	if( reply_with == NULL )
		return PAM_SYSTEM_ERR;

	memset(buffer,'\0',sizeof(buffer));

	for( num_replies = 0; num_replies < num_msg; num_replies++ )
	{
		if( msg[num_replies]->msg_style == PAM_PROMPT_ECHO_OFF )
		{
			reply_with[num_replies].resp_retcode = PAM_SUCCESS;
			reply_with[num_replies].resp = strdup(new_pass);
		}
		else if( msg[num_replies]->msg_style == PAM_PROMPT_ECHO_ON )
		{
			reply_with[num_replies].resp_retcode = PAM_SUCCESS;
			reply_with[num_replies].resp = strdup(gl_username);
		}
		else
		{
			free(reply_with);
			return PAM_CONV_ERR;
		}
	}

	*response = reply_with;
	return PAM_SUCCESS;
}



_______________________________________________

Pam-list@redhat.com
https://listman.redhat.com/mailman/listinfo/pam-list

[Index of Archives]     [Fedora Users]     [Kernel]     [Red Hat Install]     [Linux for the blind]     [Gimp]

  Powered by Linux