]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbstatus: add method add_section_to_json
authorJule Anger <janger@samba.org>
Thu, 31 Mar 2022 08:17:47 +0000 (10:17 +0200)
committerJule Anger <janger@samba.org>
Mon, 8 Aug 2022 12:56:28 +0000 (12:56 +0000)
The method adds an empty json object (value) under a given section name
(key) to a given json object.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/utils/status_json.c
source3/utils/status_json.h
source3/utils/status_json_dummy.c

index b2ade6bc69b66d0dd9aaa6d85d1807f07845be96..e9e04026a153bfcb40678980c113edff43851423 100644 (file)
 #include <jansson.h>
 #include "audit_logging.h" /* various JSON helpers */
 #include "auth/common_auth.h"
+
+int add_section_to_json(struct traverse_state *state,
+                       const char *key)
+{
+       struct json_object empty_json;
+       int result;
+
+       empty_json = json_new_object();
+       if (json_is_invalid(&empty_json)) {
+               return -1;
+       }
+
+       result = json_add_object(&state->root_json, key, &empty_json);
+       if (result < 0) {
+               return -1;
+       }
+
+       return result;
+}
index bb42acd16bd8a03fa89bce210fa5413be0846fed..abae91c65a9156face0d67a7b6b0754f08b007da 100644 (file)
@@ -22,4 +22,7 @@
 #ifndef STATUS_JSON_H
 #define STATUS_JSON_H
 
+int add_section_to_json(struct traverse_state *state,
+                       const char *key);
+
 #endif
index 0854eb70ef489917329c95b478f992a1ed7cdcd5..0f6dd832705c65e0849335e0dac0d0ce79cade4c 100644 (file)
@@ -22,3 +22,9 @@
 #include "../libcli/security/security.h"
 #include "librpc/gen_ndr/open_files.h"
 #include "status_json.h"
+
+int add_section_to_json(struct traverse_state *state,
+                       const char *key)
+{
+       return 0;
+}