[27644] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Simplify krb5_ldap_readpassword

daemon@ATHENA.MIT.EDU (Greg Hudson)
Fri Mar 29 11:41:42 2013

Date: Fri, 29 Mar 2013 11:41:35 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201303291541.r2TFfZR8007497@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/e5a79ece676bdb8f9a3aef838ec8f5c5c848c368
commit e5a79ece676bdb8f9a3aef838ec8f5c5c848c368
Author: Greg Hudson <ghudson@mit.edu>
Date:   Fri Mar 29 02:13:04 2013 -0400

    Simplify krb5_ldap_readpassword
    
    There's no need to check whether the file exists and is readable
    before opening it, and setting an extended error message which is just
    strerror_r() of the errno value isn't useful.

 .../kdb/ldap/libkdb_ldap/ldap_service_stash.c      |   21 +------------------
 1 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/src/plugins/kdb/ldap/libkdb_ldap/ldap_service_stash.c b/src/plugins/kdb/ldap/libkdb_ldap/ldap_service_stash.c
index 9985a1b..9e32c25 100644
--- a/src/plugins/kdb/ldap/libkdb_ldap/ldap_service_stash.c
+++ b/src/plugins/kdb/ldap/libkdb_ldap/ldap_service_stash.c
@@ -97,26 +97,9 @@ krb5_ldap_readpassword(krb5_context context, krb5_ldap_context *ldap_context,
 # define strerror_r(ERRNUM, BUF, SIZE) (strncpy(BUF, strerror(ERRNUM), SIZE), BUF[(SIZE)-1] = 0)
 #endif
 
-    /* check whether file exists */
-    if (access(file, F_OK) < 0) {
+    fptr = fopen(file, "r");
+    if (fptr == NULL) {
         st = errno;
-        strerror_r(errno, errbuf, sizeof(errbuf));
-        krb5_set_error_message (context, st, "%s", errbuf);
-        goto rp_exit;
-    }
-
-    /* check read access */
-    if (access(file, R_OK) < 0) {
-        st = errno;
-        strerror_r(errno, errbuf, sizeof(errbuf));
-        krb5_set_error_message (context, st, "%s", errbuf);
-        goto rp_exit;
-    }
-
-    if ((fptr=fopen(file, "r")) == NULL) {
-        st = errno;
-        strerror_r(errno, errbuf, sizeof(errbuf));
-        krb5_set_error_message (context, st, "%s", errbuf);
         goto rp_exit;
     }
     set_cloexec_file(fptr);
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post