summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sesman/verify_user_pam.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/sesman/verify_user_pam.c b/sesman/verify_user_pam.c
index eec12c66..a2b3f93a 100644
--- a/sesman/verify_user_pam.c
+++ b/sesman/verify_user_pam.c
@@ -118,22 +118,31 @@ auth_userpass(char *user, char *pass, int *errorcode)
if (error != PAM_SUCCESS)
{
- if(errorcode!=NULL){
- *errorcode = error ;
- }
+ if (errorcode != NULL)
+ {
+ *errorcode = error;
+ }
g_printf("pam_start failed: %s\r\n", pam_strerror(auth_info->ph, error));
pam_end(auth_info->ph, error);
g_free(auth_info);
return 0;
}
+ error = pam_set_item(auth_info->ph, PAM_TTY, service_name);
+ if (error != PAM_SUCCESS)
+ {
+ g_printf("pam_set_item failed: %s\r\n",
+ pam_strerror(auth_info->ph, error));
+ }
+
error = pam_authenticate(auth_info->ph, 0);
if (error != PAM_SUCCESS)
{
- if(errorcode!=NULL){
- *errorcode = error ;
- }
+ if (errorcode != NULL)
+ {
+ *errorcode = error;
+ }
g_printf("pam_authenticate failed: %s\r\n",
pam_strerror(auth_info->ph, error));
pam_end(auth_info->ph, error);
@@ -150,9 +159,10 @@ auth_userpass(char *user, char *pass, int *errorcode)
if (error != PAM_SUCCESS)
{
- if(errorcode!=NULL){
- *errorcode = error ;
- }
+ if (errorcode != NULL)
+ {
+ *errorcode = error;
+ }
g_printf("pam_acct_mgmt failed: %s\r\n",
pam_strerror(auth_info->ph, error));
pam_end(auth_info->ph, error);