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:
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user