Add an internal json function to make it easier to detect if an object
is empty, and use it to avoid creating a ccache config entry for
preauth module config data if there isn't any to save.
(cherry picked from commit
ec6dc0e991b3653e16a637bfaa0daf783f82af31)
ticket: 7427
version_fixed: 1.11
status: resolved
void k5_json_object_iterate(k5_json_object obj,
k5_json_object_iterator_fn func, void *arg);
+/* Return the number of mappings in an object. */
+size_t k5_json_object_count(k5_json_object obj);
/* Store val into object at key, incrementing val's reference count. */
int k5_json_object_set(k5_json_object obj, const char *key, k5_json_value val);
char *encoded;
krb5_error_code code;
- if (ctx->cc_config_out == NULL)
+ if (ctx->cc_config_out == NULL ||
+ k5_json_object_count(ctx->cc_config_out) == 0)
return 0;
encoded = k5_json_encode(ctx->cc_config_out);
if (encoded == NULL)
return alloc_value(&object_type, sizeof(struct k5_json_object_st));
}
+size_t
+k5_json_object_count(k5_json_object obj)
+{
+ return obj->len;
+}
+
/* Return the entry for key within obj, or NULL if none exists. */
static struct entry *
object_search(k5_json_object obj, const char *key)
k5_json_null_create
k5_json_number_create
k5_json_number_value
+k5_json_object_count
k5_json_object_create
k5_json_object_get
k5_json_object_iterate