cc_ccache_store_credentials should return ccErrBadCredentialsVersion
authorAlexandra Ellwood <lxs@mit.edu>
Wed, 10 Oct 2007 21:17:05 +0000 (21:17 +0000)
committerAlexandra Ellwood <lxs@mit.edu>
Wed, 10 Oct 2007 21:17:05 +0000 (21:17 +0000)
cc_ccache_store_credentials should return ccErrBadCredentialsVersion when
the principal for that version is not set on the ccache.

ticket: new

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20114 dc483132-0cff-0310-8789-dd5450dbe970

src/ccapi/server/ccs_ccache.c
src/ccapi/server/ccs_credentials.c
src/ccapi/server/ccs_credentials.h

index b3ac5d64e53a1a91e33843c0b0f8ef9f57fbb83c..40b652de7b8adf91d74d4b551b5cdbe8d42c84b0 100644 (file)
@@ -687,6 +687,7 @@ static cc_int32 ccs_ccache_store_credentials (ccs_ccache_t           io_ccache,
     
     if (!err) {
         err = ccs_credentials_new (&credentials, in_request_data, 
+                                   io_ccache->creds_version, 
                                    io_ccache->credentials);
     }
     
index f30479946fb9ace6b4b55754e758c841c203ce77..04c8e21b57abbbf9bf674c8bae06e22ccfc60c0a 100644 (file)
@@ -37,6 +37,7 @@ struct ccs_credentials_d ccs_credentials_initializer = { NULL, NULL };
 
 cc_int32 ccs_credentials_new (ccs_credentials_t      *out_credentials,
                               cci_stream_t            in_stream,
+                              cc_uint32               in_ccache_version,
                               ccs_credentials_list_t  io_credentials_list)
 {
     cc_int32 err = ccNoError;
@@ -58,6 +59,11 @@ cc_int32 ccs_credentials_new (ccs_credentials_t      *out_credentials,
         err = cci_cred_union_read (&credentials->cred_union, in_stream);
     }
     
+    if (!err && !(credentials->cred_union->version & in_ccache_version)) {
+        /* ccache does not have a principal set for this credentials version */
+        err = cci_check_error (ccErrBadCredentialsVersion);
+    }
+    
     if (!err) {
         err = ccs_server_new_identifier (&credentials->identifier);
     }
index e0a08fb9c8869c528b8d0e6f96c49cce4ee71874..b9219aa408a0374b03550c7498919a9aa50e9756 100644 (file)
@@ -32,6 +32,7 @@
 
 cc_int32 ccs_credentials_new (ccs_credentials_t      *out_credentials,
                               cci_stream_t            in_stream,
+                              cc_uint32               in_ccache_version,
                               ccs_credentials_list_t  io_credentials_list);
 
 cc_int32 ccs_credentials_release (ccs_credentials_t io_credentials);