1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-26 01:49:31 +03:00

smbstatus: add method add_section_to_json

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>
This commit is contained in:
Jule Anger
2022-03-31 10:17:47 +02:00
parent 15fed37afb
commit a64c907874
3 changed files with 28 additions and 0 deletions

View File

@ -26,3 +26,22 @@
#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;
}

View 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

View 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;
}