Create a ccache get-flags operation.
authorKen Raeburn <raeburn@mit.edu>
Tue, 16 Nov 2004 05:04:56 +0000 (05:04 +0000)
committerKen Raeburn <raeburn@mit.edu>
Tue, 16 Nov 2004 05:04:56 +0000 (05:04 +0000)
The MSLSA and CCAPI versions are untested!

* cc_file.c (krb5_fcc_get_flags): New function.
(krb5_fcc_ops, krb5_cc_file_ops): Add it.
* cc_memory.c (krb5_mcc_get_flags): New function.
(krb5_mcc_ops): Add it.
* cc_mslsa.c (krb5_lcc_get_flags): New function.
(krb5_lcc_ops): Add it.
* ccfns.c (krb5_cc_get_flags): New function.
* ccapi/stdcc.c (krb5_stdcc_get_flags): New function.
(krb5_cc_stdcc_ops): Add it.
* ccapi/stdcc.h (krb5_stdcc_get_flags): Declare.

ticket: 2763
status: open

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

src/lib/krb5/ccache/ChangeLog
src/lib/krb5/ccache/cc_file.c
src/lib/krb5/ccache/cc_memory.c
src/lib/krb5/ccache/cc_mslsa.c
src/lib/krb5/ccache/ccapi/ChangeLog
src/lib/krb5/ccache/ccapi/stdcc.c
src/lib/krb5/ccache/ccapi/stdcc.h
src/lib/krb5/ccache/ccfns.c

index 757ce389c682f8df1d00c35c2c8a2e94dff029d1..9fe362e51e30edb2a48a2b5523f9f8e4ae0c11ae 100644 (file)
@@ -1,3 +1,13 @@
+2004-11-15  Ken Raeburn  <raeburn@mit.edu>
+
+       * cc_file.c (krb5_fcc_get_flags): New function.
+       (krb5_fcc_ops, krb5_cc_file_ops): Add it.
+       * cc_memory.c (krb5_mcc_get_flags): New function.
+       (krb5_mcc_ops): Add it.
+       * cc_mslsa.c (krb5_lcc_get_flags): New function.
+       (krb5_lcc_ops): Add it.
+       * ccfns.c (krb5_cc_get_flags): New function.
+
 2004-10-07  Jeffrey Altman <jaltman@mit.edu>
         * cc_mslsa.c: Fix the forced setting of the Initial Ticket Flag
                 on Win2000 and add it to XP and 2003 SP1
index f247c425d2b24add276524b42102c204dc2e7d6a..14e59a1469a6deea7b421dea47dcc3b42a2ca208 100644 (file)
@@ -2246,6 +2246,30 @@ krb5_fcc_set_flags(krb5_context context, krb5_ccache id, krb5_flags flags)
     return ret;
 }
 
+/*
+ * Requires:
+ * id is a cred cache returned by krb5_fcc_resolve or
+ * krb5_fcc_generate_new, but has not been opened by krb5_fcc_initialize.
+ *
+ * Modifies:
+ * id (mutex only; temporary)
+ * 
+ * Effects:
+ * Returns the operational flags of id.
+ */
+static krb5_error_code KRB5_CALLCONV
+krb5_fcc_get_flags(krb5_context context, krb5_ccache id, krb5_flags *flags)
+{
+    krb5_error_code ret = KRB5_OK;
+
+    ret = k5_mutex_lock(&((krb5_fcc_data *) id->data)->lock);
+    if (ret)
+       return ret;
+    *flags = ((krb5_fcc_data *) id->data)->flags;
+    k5_mutex_unlock(&((krb5_fcc_data *) id->data)->lock);
+    return ret;
+}
+
 
 static krb5_error_code
 krb5_fcc_interpret(krb5_context context, int errnum)
@@ -2314,6 +2338,7 @@ const krb5_cc_ops krb5_fcc_ops = {
      krb5_fcc_end_seq_get,
      krb5_fcc_remove_cred,
      krb5_fcc_set_flags,
+     krb5_fcc_get_flags,
 };
 
 #if defined(_WIN32)
@@ -2374,4 +2399,5 @@ const krb5_cc_ops krb5_cc_file_ops = {
      krb5_fcc_end_seq_get,
      krb5_fcc_remove_cred,
      krb5_fcc_set_flags,
+     krb5_fcc_get_flags,
 };
index 3dc9a7c2b78a2ad4e741b72eb88aa360639edde4..1417aabb7818db8524ee467715f1f3b112913f52 100644 (file)
@@ -564,6 +564,13 @@ krb5_mcc_set_flags(krb5_context context, krb5_ccache id, krb5_flags flags)
     return KRB5_OK;
 }
 
+krb5_error_code KRB5_CALLCONV
+krb5_mcc_get_flags(krb5_context context, krb5_ccache id, krb5_flags *flags)
+{
+    *flags = 0;
+    return KRB5_OK;
+}
+
 /* store: Save away creds in the ccache.  */
 krb5_error_code KRB5_CALLCONV
 krb5_mcc_store(krb5_context ctx, krb5_ccache id, krb5_creds *creds)
@@ -606,4 +613,5 @@ const krb5_cc_ops krb5_mcc_ops = {
      krb5_mcc_end_seq_get,
      krb5_mcc_remove_cred,
      krb5_mcc_set_flags,
+     krb5_mcc_get_flags,
 };
index c12f5817e81035387ecd760a8008e29061b97e02..82f4a86ee0b487eaf4962bbaf34e86b72c644038 100644 (file)
@@ -1798,6 +1798,9 @@ static krb5_error_code KRB5_CALLCONV krb5_lcc_store
 static krb5_error_code KRB5_CALLCONV krb5_lcc_set_flags
         (krb5_context, krb5_ccache id, krb5_flags flags);
 
+static krb5_error_code KRB5_CALLCONV krb5_lcc_get_flags
+        (krb5_context, krb5_ccache id, krb5_flags *flags);
+
 extern const krb5_cc_ops krb5_lcc_ops;
 
 krb5_error_code krb5_change_cache (void);
@@ -2529,6 +2532,18 @@ krb5_lcc_set_flags(krb5_context context, krb5_ccache id, krb5_flags flags)
     return KRB5_OK;
 }
 
+static krb5_error_code KRB5_CALLCONV
+krb5_lcc_get_flags(krb5_context context, krb5_ccache id, krb5_flags *flags)
+{
+    krb5_lcc_data *data = (krb5_lcc_data *)id->data;
+
+    if (!is_windows_2000())
+        return KRB5_FCC_NOFILE;
+
+    *flags = data->flags;
+    return KRB5_OK;
+}
+
 const krb5_cc_ops krb5_lcc_ops = {
      0,
      "MSLSA",
@@ -2545,6 +2560,7 @@ const krb5_cc_ops krb5_lcc_ops = {
      krb5_lcc_next_cred,
      krb5_lcc_end_seq_get,
      krb5_lcc_remove_cred,
-     krb5_lcc_set_flags
+     krb5_lcc_set_flags,
+     krb5_lcc_get_flags,
 };
 #endif /* _WIN32 */
index e7d80c22a09ecc1723cf76270dcfd614b9fa4f2e..4c977770983a493f76965ca37e7eefacf6df2707 100644 (file)
@@ -1,3 +1,9 @@
+2004-11-15  Ken Raeburn  <raeburn@mit.edu>
+
+       * stdcc.c (krb5_stdcc_get_flags): New function.
+       (krb5_cc_stdcc_ops): Add it.
+       * stdcc.h (krb5_stdcc_get_flags): Declare.
+
 2004-06-22  Ken Raeburn  <raeburn@mit.edu>
 
        * stdcc_util.c (dupK5toCC): Don't test macintosh.
index 6bad56a3d50e8f3971c9cdfc47b4dbde493ee8dc..7e6ffe72c467153f417321ee0a0add02ebd2ab12 100644 (file)
@@ -78,6 +78,7 @@ krb5_cc_ops krb5_cc_stdcc_ops = {
       krb5_stdcc_end_seq_get,
       krb5_stdcc_remove, 
       krb5_stdcc_set_flags,
+      krb5_stdcc_get_flags,
 };
 
 #if defined(_WIN32)
@@ -715,6 +716,23 @@ krb5_error_code KRB5_CALLCONV krb5_stdcc_set_flags
        return 0;
 }
 
+/*
+ * get_flags
+ *
+ * - currently a NOP since we don't store any flags in the NC
+ */
+krb5_error_code KRB5_CALLCONV krb5_stdcc_get_flags 
+        (krb5_context context, krb5_ccache id , krb5_flags *flags)
+{
+       stdccCacheDataPtr       ccapi_data = id->data;
+       krb5_error_code         retval;
+       
+       if ((retval = stdcc_setup(context, ccapi_data)))
+               return retval;
+
+       return 0;
+}
+
 /*
  * remove
  *
index 2f653e5cc3093fea858d67931fd65c818b07c3b5..81ce883cb6c08d5226b2be10d16e0e8552aa649c 100644 (file)
@@ -73,5 +73,8 @@ krb5_error_code KRB5_CALLCONV krb5_stdcc_store
 krb5_error_code KRB5_CALLCONV krb5_stdcc_set_flags 
         (krb5_context, krb5_ccache id , krb5_flags flags );
 
+krb5_error_code KRB5_CALLCONV krb5_stdcc_get_flags 
+        (krb5_context, krb5_ccache id , krb5_flags *flags );
+
 krb5_error_code KRB5_CALLCONV krb5_stdcc_remove 
         (krb5_context, krb5_ccache id , krb5_flags flags, krb5_creds *creds);
index a8715b4023603775488682d57af07db816bace43..5e80059aedf05eb43be7b8893f4e2db18cb55b51 100644 (file)
@@ -117,6 +117,12 @@ krb5_cc_set_flags (krb5_context context, krb5_ccache cache, krb5_flags flags)
     return cache->ops->set_flags(context, cache, flags);
 }
 
+krb5_error_code KRB5_CALLCONV
+krb5_cc_get_flags (krb5_context context, krb5_ccache cache, krb5_flags *flags)
+{
+    return cache->ops->get_flags(context, cache, flags);
+}
+
 const char * KRB5_CALLCONV
 krb5_cc_get_type (krb5_context context, krb5_ccache cache)
 {