From: Jule Anger Date: Thu, 24 Mar 2022 14:46:35 +0000 (+0100) Subject: smbstatus: add json items to traverse_struct X-Git-Tag: samba-4.17.0rc1~38 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=15fed37afb6e8eed4f5ce7af168bc9f259048aad;p=thirdparty%2Fsamba.git smbstatus: add json items to traverse_struct Signed-off-by: Jule Anger Reviewed-by: Ralph Boehme --- diff --git a/source3/utils/status.c b/source3/utils/status.c index 8381bc5c07f..20a49a69b67 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -55,6 +55,12 @@ #include "locking/leases_db.h" #include "lib/util/string_wrappers.h" +#ifdef HAVE_JANSSON +#include +#include "audit_logging.h" /* various JSON helpers */ +#include "auth/common_auth.h" +#endif /* HAVE_JANSSON */ + #define SMB_MAXPIDS 2048 static uid_t Ucrit_uid = 0; /* added by OH */ static struct server_id Ucrit_pid[SMB_MAXPIDS]; /* Ugly !!! */ /* added by OH */ @@ -882,6 +888,7 @@ int main(int argc, const char *argv[]) bool ok; state.first = true; + state.json_output = false; state.resolve_uids = false; smb_init_locale(); @@ -956,6 +963,10 @@ int main(int argc, const char *argv[]) sec_init(); +#ifdef HAVE_JANSSON + state.root_json = json_new_object(); +#endif /* HAVE_JANSSON */ + if (getuid() != geteuid()) { fprintf(stderr, "smbstatus should not be run setuid\n"); ret = 1; diff --git a/source3/utils/status.h b/source3/utils/status.h index b5c23f7cb77..c08aba4c262 100644 --- a/source3/utils/status.h +++ b/source3/utils/status.h @@ -17,12 +17,22 @@ * along with this program. If not, see . */ +#ifdef HAVE_JANSSON +#include +#include "audit_logging.h" /* various JSON helpers */ +#include "auth/common_auth.h" +#endif /* HAVE_JANSSON */ + #ifndef STATUS_H #define STATUS_H struct traverse_state { + bool json_output; bool first; bool resolve_uids; +#ifdef HAVE_JANSSON + struct json_object root_json; +#endif /* HAVE_JANSSON */ }; enum crypto_degree {