]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbstatus: add server_id to open files dictionary
authorJule Anger <janger@samba.org>
Mon, 2 May 2022 08:56:27 +0000 (10:56 +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 cf58ff831004c1e91924fb96d612a2581e6f145e..fbe9ce1a15e58944f44c321be8676e3547ae9053 100644 (file)
@@ -317,7 +317,6 @@ static int print_share_mode(struct file_id fid,
                                              d,
                                              e,
                                              fid,
-                                             pid,
                                              user_str,
                                              oplock,
                                              lstate,
index 56cf0e2ab95eda41f0d1806952bc46e15318273a..ce6ee178b4a6e07d97fdf7e8b2e73eceb3243779 100644 (file)
@@ -617,7 +617,6 @@ failure:
 static int add_open_to_json(struct json_object *parent_json,
                            const struct share_mode_entry *e,
                            bool resolve_uids,
-                           const char *pid,
                            const char *op_str,
                            uint32_t lease_type,
                            const char *uid_str)
@@ -628,6 +627,8 @@ static int add_open_to_json(struct json_object *parent_json,
        bool add_lease = false;
        char *key = NULL;
        char *share_file_id = NULL;
+       char *pid = NULL;
+       struct server_id_buf tmp;
 
        TALLOC_CTX *tmp_ctx = talloc_stackframe();
        if (tmp_ctx == NULL) {
@@ -644,7 +645,7 @@ static int add_open_to_json(struct json_object *parent_json,
        }
 
 
-       result = json_add_string(&sub_json, "pid", pid);
+       result = add_server_id_to_json(&sub_json, e->pid);
        if (result < 0) {
                goto failure;
        }
@@ -677,6 +678,7 @@ static int add_open_to_json(struct json_object *parent_json,
                goto failure;
        }
 
+       pid = server_id_str_buf(e->pid, &tmp);
        key = talloc_asprintf(tmp_ctx, "%s/%lu", pid, e->share_file_id);
        result = json_add_object(&opens_json, key, &sub_json);
        if (result < 0) {
@@ -735,7 +737,6 @@ int print_share_mode_json(struct traverse_state *state,
                          const struct share_mode_data *d,
                          const struct share_mode_entry *e,
                          struct file_id fid,
-                         const char *pid,
                          const char *uid_str,
                          const char *op_str,
                          uint32_t lease_type,
@@ -786,7 +787,6 @@ int print_share_mode_json(struct traverse_state *state,
        result = add_open_to_json(&file_json,
                                  e,
                                  state->resolve_uids,
-                                 pid,
                                  op_str,
                                  lease_type,
                                  uid_str);
index 2ee5b59fba838caae1962fc8b96b4b996c1846aa..1f23dc1d62bbcfffd485c9976f094fb6c2e812ca 100644 (file)
@@ -48,7 +48,6 @@ int print_share_mode_json(struct traverse_state *state,
                          const struct share_mode_data *d,
                          const struct share_mode_entry *e,
                          struct file_id fid,
-                         const char *pid,
                          const char *uid_str,
                          const char *op_str,
                          uint32_t lease_type,
index 51bdfb4cf789989648527245287b858c8fdff76b..c92fbb493726e5aed68b9fa6478f59b2ae67d39e 100644 (file)
@@ -62,7 +62,6 @@ int print_share_mode_json(struct traverse_state *state,
                          const struct share_mode_data *d,
                          const struct share_mode_entry *e,
                          struct file_id fid,
-                         const char *pid,
                          const char *uid_str,
                          const char *op_str,
                          uint32_t lease_type,