]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbstatus: add server_id to notifies
authorJule Anger <janger@samba.org>
Mon, 2 May 2022 08:58:24 +0000 (10:58 +0200)
committerJule Anger <janger@samba.org>
Mon, 8 Aug 2022 12:56:29 +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_json.c
source3/utils/status_json.h
source3/utils/status_json_dummy.c

index 3cf9a1df32ba0db091ee6477a268154bee554491..2477cd2171ba904ac719b41cb064bac1856ccfa2 100644 (file)
@@ -834,7 +834,7 @@ static bool print_notify_rec(const char *path, struct server_id server,
        } else {
                result = print_notify_rec_json(state,
                                               instance,
-                                              server_id_str_buf(server, &idbuf),
+                                              server,
                                               path);
        }
 
index a4237d5fa9e2265fcfa10153e99745942a894165..b57b690e552de8dfeb877d0238724dd086ab8bec 100644 (file)
@@ -1112,13 +1112,15 @@ failure:
 
 bool print_notify_rec_json(struct traverse_state *state,
                           const struct notify_instance *instance,
-                          char *pid,
+                          const struct server_id server_id,
                           const char *path)
 {
        struct json_object sub_json;
        struct json_object notify_json;
        char *filter = NULL;
        char *subdir_filter = NULL;
+       char *pid = NULL;
+       struct server_id_buf tmp;
        int result = 0;
 
        TALLOC_CTX *tmp_ctx = talloc_stackframe();
@@ -1135,7 +1137,7 @@ bool print_notify_rec_json(struct traverse_state *state,
                goto failure;
        }
 
-       result = json_add_string(&sub_json, "pid", pid);
+       result = add_server_id_to_json(&sub_json, server_id);
        if (result < 0) {
                goto failure;
        }
@@ -1160,6 +1162,7 @@ bool print_notify_rec_json(struct traverse_state *state,
                goto failure;
        }
 
+       pid = server_id_str_buf(server_id, &tmp);
        result = json_add_object(&notify_json, pid, &sub_json);
        if (result < 0) {
                goto failure;
index 224470f38b318ea4487bac03fe59e20ac0b94a45..72ff4b359cc6f0b767eaa97957da608c54c99573 100644 (file)
@@ -66,6 +66,6 @@ int print_brl_json(struct traverse_state *state,
 
 bool print_notify_rec_json(struct traverse_state *state,
                           const struct notify_instance *instance,
-                          char *pid,
+                          const struct server_id server_id,
                           const char *path);
 #endif
index 551ae9293b22c809b48725e8f388203378fb121e..03eb00e64a469c5ff1a91d2f4cfee8dd1b4a0533 100644 (file)
@@ -85,7 +85,7 @@ int print_brl_json(struct traverse_state *state,
 
 bool print_notify_rec_json(struct traverse_state *state,
                           const struct notify_instance *instance,
-                          char *pid,
+                          const struct server_id server_id,
                           const char *path)
 {
        return 0;