View | Details | Raw Unified | Return to bug 1215 | Differences between
and this patch

Collapse All | Expand All

(-)vu-uc-openssh-4.3p2/auth-pam.c (-1 / +21 lines)
Lines 358-363 Link Here
358
#endif
358
#endif
359
}
359
}
360
360
361
char virtual_username[64] = "\0";
362
char local_username[64] = "\0";
363
361
static
364
static
362
int sshpam_handle_user_change(pam_handle_t *sshpam_handle, Authctxt *authctxt)
365
int sshpam_handle_user_change(pam_handle_t *sshpam_handle, Authctxt *authctxt)
363
{
366
{
Lines 374-379 Link Here
374
                char *user = strdup(pam_user);
377
                char *user = strdup(pam_user);
375
                struct passwd *pw;
378
                struct passwd *pw;
376
379
380
		strcpy(local_username, pam_user);
381
		strcpy(virtual_username, authctxt->user);
377
                if (!user)
382
                if (!user)
378
                	return PAM_AUTH_ERR;
383
                	return PAM_AUTH_ERR;
379
		
384
		
Lines 959-969 Link Here
959
	if (sshpam_account_status != -1)
964
	if (sshpam_account_status != -1)
960
		return (sshpam_account_status);
965
		return (sshpam_account_status);
961
966
967
	if (*virtual_username
968
	     && (pam_set_item(sshpam_handle, PAM_USER, virtual_username)
969
		 != PAM_SUCCESS)) {
970
	  error ("PAM: Couldn't attempt authorization with virtual username %s",
971
		 virtual_username);
972
	}	  
962
	sshpam_err = pam_acct_mgmt(sshpam_handle, 0);
973
	sshpam_err = pam_acct_mgmt(sshpam_handle, 0);
963
	debug3("PAM: %s pam_acct_mgmt = %d (%s)", __func__, sshpam_err,
974
	debug3("PAM: %s pam_acct_mgmt = %d (%s)", __func__, sshpam_err,
964
	    pam_strerror(sshpam_handle, sshpam_err));
975
	    pam_strerror(sshpam_handle, sshpam_err));
976
	char *user;
977
	int sshpam_err = pam_get_item(sshpam_handle, PAM_USER, &user);
978
	if (*virtual_username && *local_username
979
	    && (strcmp(user, virtual_username) == 0)
980
	    && (pam_set_item(sshpam_handle, PAM_USER, local_username)
981
		!= PAM_SUCCESS)) {
982
	  error ("PAM: Couldn't switch to local username %s", local_username);
983
	} else {
984
	  sshpam_check_userchanged();
985
	}
965
986
966
	sshpam_check_userchanged();
967
	if (getpwnam(sshpam_authctxt->pw->pw_name) == NULL)
987
	if (getpwnam(sshpam_authctxt->pw->pw_name) == NULL)
968
		fatal("PAM: completed authentication but PAM account invalid");
988
		fatal("PAM: completed authentication but PAM account invalid");
969
989

Return to bug 1215