smbstatus: add session_id to connections dictionary
authorJule Anger <janger@samba.org>
Thu, 7 Jul 2022 08:09:05 +0000 (10:09 +0200)
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_json.c

index fdbe8bb4573a0a43caa1eb735657569c5347e32d..f4f412d60522a316ddbd5c73a643d505d8ad0d17 100644 (file)
@@ -131,6 +131,7 @@ int traverse_connections_json(struct traverse_state *state,
        struct json_object sub_json;
        struct json_object connections_json;
        int result = 0;
+       char *sess_id_str = NULL;
        char *tcon_id_str = NULL;
 
        TALLOC_CTX *tmp_ctx = talloc_stackframe();
@@ -163,6 +164,14 @@ int traverse_connections_json(struct traverse_state *state,
        if (result < 0) {
                goto failure;
        }
+       sess_id_str = talloc_asprintf(tmp_ctx, "%u", crec->sess_id);
+       if (sess_id_str == NULL) {
+               goto failure;
+       }
+       result = json_add_string(&sub_json, "session_id", sess_id_str);
+       if (result < 0) {
+               goto failure;
+       }
        result = json_add_string(&sub_json, "machine", crec->machine);
        if (result < 0) {
                goto failure;