bug-cvs
[Top][All Lists]
Advanced

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

Re: Compile error in current CVS, src/server.c:5500


From: Brian Murphy
Subject: Re: Compile error in current CVS, src/server.c:5500
Date: Mon, 21 Jul 2003 20:56:18 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030529

Derek Robert Price wrote:

Assuming that you can't find a way to use pam_strerrorm I'll second that with an, "harrumph", as opposed to a half-smile. :)

Also, I'd still like to understand why you aren't calling pam_strerror when the three calls previous to pam_end fail to return PAM_SUCCESS.

Because all the other examples including the examples with the pam library for linux don't.

Please find fix attached - I hope it makes everyone happy.

I have looked at the pam code for linux and the pam_handle is not used in the
pam_strerr function. In any case calling it with a NULL pam_handle should
be safe. I have looked at the documentation for Solaris and they say to do this if the call to pam_start fails. This should be good enough too if the call to pam_end
fails.

/Brian
Index: src/server.c
===================================================================
RCS file: /cvs/ccvs/src/server.c,v
retrieving revision 1.301
diff -u -r1.301 server.c
--- src/server.c        20 Jul 2003 16:38:55 -0000      1.301
+++ src/server.c        21 Jul 2003 18:54:54 -0000
@@ -5483,7 +5483,7 @@
     char *username, *password;
 {
     pam_handle_t *pamh = NULL;
-    int retval;
+    int retval, err;
     struct cvs_pam_userinfo ui = { username, password };
     struct pam_conv conv = { cvs_pam_conv, (void *)&ui };
 
@@ -5491,14 +5491,19 @@
 
     if (retval == PAM_SUCCESS)
        retval = pam_authenticate(pamh, 0);
+    else
+       printf("E PAM Error: %s\n", pam_strerror(NULL, retval));
 
     if (retval == PAM_SUCCESS)
        retval = pam_acct_mgmt(pamh, 0);
+    else
+       printf("E PAM Error: %s\n", pam_strerror(pamh, retval));
 
-    if (pam_end(pamh,retval) != PAM_SUCCESS)
+    if ((err = pam_end(pamh, retval)) != PAM_SUCCESS)
     {
-       printf("E Fatal error, aborting.\n
-               pam failed to release authenticator\n");
+       printf("E Fatal error, aborting.\n\
+error 0 pam failed to release authenticator\n\
+PAM error number %d: %s\n", err, pam_strerror(NULL, err));
        error_exit ();
     }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]