char *timestr = NULL;
int result = 0;
const char *encryption = "-";
+ enum crypto_degree encryption_degree = CRYPTO_DEGREE_NONE;
const char *signing = "-";
+ enum crypto_degree signing_degree = CRYPTO_DEGREE_NONE;
struct traverse_state *state = (struct traverse_state *)private_data;
TALLOC_CTX *tmp_ctx = talloc_stackframe();
result = -1;
break;
}
+ encryption_degree = CRYPTO_DEGREE_FULL;
}
if (smbXsrv_is_signed(crec->signing_flags)) {
result = -1;
break;
}
+ signing_degree = CRYPTO_DEGREE_FULL;
}
if (!state->json_output) {
signing);
} else {
result = traverse_connections_json(state,
- crec);
+ crec,
+ encryption,
+ encryption_degree,
+ signing,
+ signing_degree);
}
TALLOC_FREE(timestr);
return result;
}
+static int add_crypto_to_json(struct json_object *parent_json,
+ const char *key,
+ const char *cipher,
+ enum crypto_degree degree)
+{
+ struct json_object sub_json;
+ const char *degree_str;
+ int result;
+
+ if (degree == CRYPTO_DEGREE_NONE) {
+ degree_str = "none";
+ } else if (degree == CRYPTO_DEGREE_PARTIAL) {
+ degree_str = "partial";
+ } else {
+ degree_str = "full";
+ }
+
+ sub_json = json_new_object();
+ if (json_is_invalid(&sub_json)) {
+ goto failure;
+ }
+
+ result = json_add_string(&sub_json, "cipher", cipher);
+ if (result < 0) {
+ goto failure;
+ }
+ result = json_add_string(&sub_json, "degree", degree_str);
+ if (result < 0) {
+ goto failure;
+ }
+ result = json_add_object(parent_json, key, &sub_json);
+ if (result < 0) {
+ goto failure;
+ }
+
+ return 0;
+failure:
+ json_free(&sub_json);
+ return -1;
+}
+
int traverse_connections_json(struct traverse_state *state,
- const struct connections_data *crec)
+ const struct connections_data *crec,
+ const char *encryption_cipher,
+ enum crypto_degree encryption_degree,
+ const char *signing_cipher,
+ enum crypto_degree signing_degree)
{
struct json_object sub_json;
struct json_object connections_json;
if (result < 0) {
goto failure;
}
+ result = add_crypto_to_json(&sub_json, "encryption",
+ encryption_cipher, encryption_degree);
+ if (result < 0) {
+ goto failure;
+ }
+ result = add_crypto_to_json(&sub_json, "signing",
+ signing_cipher, signing_degree);
+ if (result < 0) {
+ goto failure;
+ }
result = json_add_object(&connections_json, tcon_id_str, &sub_json);
if (result < 0) {
int add_general_information_to_json(struct traverse_state *state);
int traverse_connections_json(struct traverse_state *state,
- const struct connections_data *crec);
+ const struct connections_data *crec,
+ const char *encryption_cipher,
+ enum crypto_degree encryption_degree,
+ const char *signing_cipher,
+ enum crypto_degree signing_degree);
#endif
}
int traverse_connections_json(struct traverse_state *state,
- const struct connections_data *crec)
+ const struct connections_data *crec,
+ const char *encryption_cipher,
+ enum crypto_degree encryption_degree,
+ const char *signing_cipher,
+ enum crypto_degree signing_degree)
{
return 0;
}