ac237f7
diff -up PyPAM-0.5.0/PAMmodule.c.retval PyPAM-0.5.0/PAMmodule.c
ac237f7
--- PyPAM-0.5.0/PAMmodule.c.retval	2012-05-04 21:47:51.000000000 +0200
ac237f7
+++ PyPAM-0.5.0/PAMmodule.c	2012-05-07 09:42:27.690963206 +0200
ac237f7
@@ -248,7 +248,7 @@ static PyObject * PyPAM_setcred(PyObject
ac237f7
     result = pam_setcred(_self->pamh, flags);
ac237f7
     
ac237f7
     if (result != PAM_SUCCESS) {
ac237f7
-        PyErr_SetString(PyPAM_Error, "Not authenticated");
ac237f7
+        PyPAM_Err(_self, result);
ac237f7
         return NULL;
ac237f7
     }
ac237f7
 
ac237f7
@@ -270,7 +270,7 @@ static PyObject * PyPAM_acct_mgmt(PyObje
ac237f7
     result = pam_acct_mgmt(_self->pamh, flags);
ac237f7
     
ac237f7
     if (result != PAM_SUCCESS) {
ac237f7
-        PyErr_SetString(PyPAM_Error, "Not authenticated");
ac237f7
+        PyPAM_Err(_self, result);
ac237f7
         return NULL;
ac237f7
     }
ac237f7
 
ac237f7
@@ -292,7 +292,7 @@ static PyObject * PyPAM_chauthtok(PyObje
ac237f7
     result = pam_chauthtok(_self->pamh, flags);
ac237f7
     
ac237f7
     if (result != PAM_SUCCESS) {
ac237f7
-        PyErr_SetString(PyPAM_Error, "Not authenticated");
ac237f7
+        PyPAM_Err(_self, result);
ac237f7
         return NULL;
ac237f7
     }
ac237f7
 
ac237f7
@@ -314,7 +314,7 @@ static PyObject * PyPAM_open_session(PyO
ac237f7
     result = pam_open_session(_self->pamh, flags);
ac237f7
     
ac237f7
     if (result != PAM_SUCCESS) {
ac237f7
-        PyErr_SetString(PyPAM_Error, "Not authenticated");
ac237f7
+        PyPAM_Err(_self, result);
ac237f7
         return NULL;
ac237f7
     }
ac237f7
 
ac237f7
@@ -336,7 +336,7 @@ static PyObject * PyPAM_close_session(Py
ac237f7
     result = pam_close_session(_self->pamh, flags);
ac237f7
     
ac237f7
     if (result != PAM_SUCCESS) {
ac237f7
-        PyErr_SetString(PyPAM_Error, "Not authenticated");
ac237f7
+        PyPAM_Err(_self, result);
ac237f7
         return NULL;
ac237f7
     }
ac237f7
 
ac237f7
@@ -433,7 +433,7 @@ static PyObject * PyPAM_putenv(PyObject
ac237f7
     result = pam_putenv(_self->pamh, val);
ac237f7
     
ac237f7
     if (result != PAM_SUCCESS) {
ac237f7
-        PyErr_SetString(PyPAM_Error, "Not authenticated");
ac237f7
+        PyPAM_Err(_self, result);
ac237f7
         return NULL;
ac237f7
     }
ac237f7