krb5 commit [krb5-1.10]: Improve error translation for CCAPIv3 routines

Tom Yu tlyu at MIT.EDU
Wed Aug 29 19:17:42 EDT 2012


https://github.com/krb5/krb5/commit/fb07cc99ed9a9a6de523f967ea423b9c92f0a9af
commit fb07cc99ed9a9a6de523f967ea423b9c92f0a9af
Author: Ben Kaduk <kaduk at mit.edu>
Date:   Fri Aug 17 19:13:14 2012 -0400

    Improve error translation for CCAPIv3 routines
    
    We can't mix the KRB5 and CC error constants; standardize on the CC ones
    and translate appropriately.
    
    (cherry picked from commit c326061409d6e48e68808e6f37b243e4f7356935)
    
    ticket: 7339
    version_fixed: 1.10.4
    status: resolved

 src/lib/krb5/ccache/ccapi/stdcc.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/lib/krb5/ccache/ccapi/stdcc.c b/src/lib/krb5/ccache/ccapi/stdcc.c
index fa6a1d4..555a961 100644
--- a/src/lib/krb5/ccache/ccapi/stdcc.c
+++ b/src/lib/krb5/ccache/ccapi/stdcc.c
@@ -885,7 +885,7 @@ krb5_stdccv3_ptcursor_new(krb5_context context,
 
     ptcursor = malloc(sizeof(*ptcursor));
     if (ptcursor == NULL) {
-        err = ENOMEM;
+        err = ccErrNoMem;
     }
     else {
         memset(ptcursor, 0, sizeof(*ptcursor));
@@ -910,7 +910,7 @@ krb5_stdccv3_ptcursor_new(krb5_context context,
 
     *cursor = ptcursor;
 
-    return err;
+    return cc_err_xlate(err);
 }
 
 krb5_error_code KRB5_CALLCONV
@@ -936,12 +936,12 @@ krb5_stdccv3_ptcursor_next(
 
     if (!err) {
         newCache = (krb5_ccache) malloc (sizeof (*newCache));
-        if (!newCache) { err = KRB5_CC_NOMEM; }
+        if (!newCache) { err = ccErrNoMem; }
     }
 
     if (!err) {
         ccapi_data = (stdccCacheDataPtr) malloc (sizeof (*ccapi_data));
-        if (!ccapi_data) { err = KRB5_CC_NOMEM; }
+        if (!ccapi_data) { err = ccErrNoMem; }
     }
 
     if (!err) {
@@ -955,7 +955,7 @@ krb5_stdccv3_ptcursor_next(
 
     if (!err) {
         name = strdup (ccstring->data);
-        if (!name) { err = KRB5_CC_NOMEM; }
+        if (!name) { err = ccErrNoMem; }
     }
 
     if (!err) {
@@ -984,7 +984,7 @@ krb5_stdccv3_ptcursor_next(
         err = ccNoError;
     }
 
-    return err;
+    return cc_err_xlate(err);
 }
 
 krb5_error_code KRB5_CALLCONV
@@ -1090,8 +1090,9 @@ krb5_error_code KRB5_CALLCONV krb5_stdccv3_switch_to
     stdccCacheDataPtr ccapi_data = id->data;
     int err;
 
-    if ((retval = stdccv3_setup(context, ccapi_data)))
-        return retval;
+    retval = stdccv3_setup(context, ccapi_data);
+    if (retval)
+        return cc_err_xlate(retval);
 
     err = cc_ccache_set_default(ccapi_data->NamedCache);
     return cc_err_xlate(err);


More information about the cvs-krb5 mailing list