]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbstatus: add json items to traverse_struct
authorJule Anger <janger@samba.org>
Thu, 24 Mar 2022 14:46:35 +0000 (15:46 +0100)
committerJule Anger <janger@samba.org>
Mon, 8 Aug 2022 12:56:28 +0000 (12:56 +0000)
Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/utils/status.c
source3/utils/status.h

index 8381bc5c07f318d0eb1f8744e0da92aebc05434a..20a49a69b6765a8cd1fc47aea1c355c0c44eeca0 100644 (file)
 #include "locking/leases_db.h"
 #include "lib/util/string_wrappers.h"
 
+#ifdef HAVE_JANSSON
+#include <jansson.h>
+#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;
index b5c23f7cb7773b72a25d6ad596cddb6913146601..c08aba4c26245f5f3248a1c73fbd98f65ee44976 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifdef HAVE_JANSSON
+#include <jansson.h>
+#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 {