lib: Remove server_id_str()
authorVolker Lendecke <vl@samba.org>
Tue, 28 Apr 2015 11:30:58 +0000 (11:30 +0000)
committerJeremy Allison <jra@samba.org>
Tue, 28 Apr 2015 18:48:01 +0000 (20:48 +0200)
Call server_id_str_buf instead

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 28 20:48:01 CEST 2015 on sn-devel-104

17 files changed:
lib/util/samba_util.h
lib/util/server_id.c
source3/locking/brlock.c
source3/locking/share_mode_lock.c
source3/smbd/oplock.c
source3/smbd/scavenger.c
source3/smbd/sesssetup.c
source3/smbd/smbXsrv_open.c
source3/smbd/smbXsrv_session.c
source3/smbd/smbXsrv_tcon.c
source3/utils/dbwrap_tool.c
source3/utils/net_g_lock.c
source3/utils/net_serverid.c
source3/utils/status.c
source4/dsdb/samdb/ldb_modules/ridalloc.c
source4/smb_server/smb/receive.c
source4/smbd/service_stream.c

index 69413080c5c4e7a6972ba770f76dd501bc08df23..176930b8f6bb769a02284280d388daefa9a1b918 100644 (file)
@@ -876,7 +876,6 @@ char *server_id_str_buf(struct server_id id, struct server_id_buf *dst);
 bool server_id_same_process(const struct server_id *p1,
                            const struct server_id *p2);
 bool server_id_equal(const struct server_id *p1, const struct server_id *p2);
-char *server_id_str(TALLOC_CTX *mem_ctx, const struct server_id *id);
 struct server_id server_id_from_string(uint32_t local_vnn,
                                       const char *pid_string);
 
index 308ee2a492e450e04438a66429368838db498388..60b5235d16927bbf1d25c241dd81b41694a59893 100644 (file)
@@ -65,23 +65,6 @@ char *server_id_str_buf(struct server_id id, struct server_id_buf *dst)
        return dst->buf;
 }
 
-char *server_id_str(TALLOC_CTX *mem_ctx, const struct server_id *id)
-{
-       struct server_id_buf tmp;
-       char *result;
-
-       result = talloc_strdup(mem_ctx, server_id_str_buf(*id, &tmp));
-       if (result == NULL) {
-               return NULL;
-       }
-
-       /*
-        * beautify the talloc_report output
-        */
-       talloc_set_name_const(result, result);
-       return result;
-}
-
 struct server_id server_id_from_string(uint32_t local_vnn,
                                       const char *pid_string)
 {
@@ -93,7 +76,7 @@ struct server_id server_id_from_string(uint32_t local_vnn,
 
        /*
         * We accept various forms with 1, 2 or 3 component forms
-        * because the server_id_str() can print different forms, and
+        * because the server_id_str_buf() can print different forms, and
         * we want backwards compatibility for scripts that may call
         * smbclient.
         */
index 5dee91c96c446e393b3b7e461f9fc919e4ca7ea1..0738464163ae0f0e0ff1a1936ae7dda44f4067ce 100644 (file)
@@ -58,11 +58,13 @@ struct byte_range_lock {
 
 static void print_lock_struct(unsigned int i, const struct lock_struct *pls)
 {
+       struct server_id_buf tmp;
+
        DEBUG(10,("[%u]: smblctx = %llu, tid = %u, pid = %s, ",
                        i,
                        (unsigned long long)pls->context.smblctx,
                        (unsigned int)pls->context.tid,
-                       server_id_str(talloc_tos(), &pls->context.pid) ));
+                       server_id_str_buf(pls->context.pid, &tmp) ));
 
        DEBUG(10, ("start = %ju, size = %ju, fnum = %ju, %s %s\n",
                   (uintmax_t)pls->start,
@@ -2243,10 +2245,11 @@ bool brl_cleanup_disconnected(struct file_id fid, uint64_t open_persistent_id)
                struct lock_context *ctx = &lock[n].context;
 
                if (!server_id_is_disconnected(&ctx->pid)) {
+                       struct server_id_buf tmp;
                        DEBUG(5, ("brl_cleanup_disconnected: byte range lock "
                                  "%s used by server %s, do not cleanup\n",
                                  file_id_string(frame, &fid),
-                                 server_id_str(frame, &ctx->pid)));
+                                 server_id_str_buf(ctx->pid, &tmp)));
                        goto done;
                }
 
index 79efb70ccc67db1f57d4a880cef7238aa7ffc54f..5eedcc5fbe45dc89d332ba71426a6c9041833443 100644 (file)
@@ -792,6 +792,7 @@ bool share_mode_cleanup_disconnected(struct file_id fid,
                struct share_mode_entry *entry = &data->share_modes[n];
 
                if (!server_id_is_disconnected(&entry->pid)) {
+                       struct server_id_buf tmp;
                        DEBUG(5, ("share_mode_cleanup_disconnected: "
                                  "file (file-id='%s', servicepath='%s', "
                                  "base_name='%s%s%s') "
@@ -803,7 +804,7 @@ bool share_mode_cleanup_disconnected(struct file_id fid,
                                  ? "" : "', stream_name='",
                                  (data->stream_name == NULL)
                                  ? "" : data->stream_name,
-                                 server_id_str(frame, &entry->pid)));
+                                 server_id_str_buf(entry->pid, &tmp)));
                        goto done;
                }
                if (open_persistent_id != entry->share_file_id) {
index 8f318f58485f3371adea5a759d60b76b2819daf7..e29b5b175fe98a2c400168aa30e1b366f9578afc 100644 (file)
@@ -776,6 +776,7 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
        uint16_t break_from;
        uint16_t break_to;
        bool break_needed = true;
+       struct server_id_buf tmp;
 
        if (data->data == NULL) {
                DEBUG(0, ("Got NULL buffer\n"));
@@ -792,7 +793,7 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
        break_to = msg.op_type;
 
        DEBUG(10, ("Got oplock break to %u message from pid %s: %s/%llu\n",
-                  (unsigned)break_to, server_id_str(talloc_tos(), &src),
+                  (unsigned)break_to, server_id_str_buf(src, &tmp),
                   file_id_string_tos(&msg.id),
                   (unsigned long long)msg.share_file_id));
 
@@ -970,6 +971,7 @@ static void process_kernel_oplock_break(struct messaging_context *msg_ctx,
        struct smbd_server_connection *sconn =
                talloc_get_type_abort(private_data,
                struct smbd_server_connection);
+       struct server_id_buf tmp;
 
        if (data->data == NULL) {
                DEBUG(0, ("Got NULL buffer\n"));
@@ -986,7 +988,7 @@ static void process_kernel_oplock_break(struct messaging_context *msg_ctx,
        file_id = (unsigned long)IVAL(data->data, 24);
 
        DEBUG(10, ("Got kernel oplock break message from pid %s: %s/%u\n",
-                  server_id_str(talloc_tos(), &src), file_id_string_tos(&id),
+                  server_id_str_buf(src, &tmp), file_id_string_tos(&id),
                   (unsigned int)file_id));
 
        fsp = initial_break_processing(sconn, id, file_id);
index 19f9b43cc6dab7d8f3250cac4e50cb6497c81f20..3691ba0b76ad3a4305775a97c927ba1faec48f33 100644 (file)
@@ -49,9 +49,11 @@ struct scavenger_message {
 
 static int smbd_scavenger_main(struct smbd_scavenger_state *state)
 {
+       struct server_id_buf tmp1, tmp2;
+
        DEBUG(10, ("scavenger: %s started, parent: %s\n",
-                  server_id_str(talloc_tos(), state->scavenger_id),
-                  server_id_str(talloc_tos(), &state->parent_id)));
+                  server_id_str_buf(*state->scavenger_id, &tmp1),
+                  server_id_str_buf(state->parent_id, &tmp2)));
 
        while (true) {
                TALLOC_CTX *frame = talloc_stackframe();
@@ -66,7 +68,7 @@ static int smbd_scavenger_main(struct smbd_scavenger_state *state)
                }
 
                DEBUG(10, ("scavenger: %s event loop iteration\n",
-                          server_id_str(talloc_tos(), state->scavenger_id)));
+                          server_id_str_buf(*state->scavenger_id, &tmp1)));
                TALLOC_FREE(frame);
        }
 
@@ -78,9 +80,10 @@ static void smbd_scavenger_done(struct tevent_context *event_ctx, struct tevent_
 {
        struct smbd_scavenger_state *state = talloc_get_type_abort(
                private_data, struct smbd_scavenger_state);
+       struct server_id_buf tmp;
 
        DEBUG(2, ("scavenger: %s died\n",
-                 server_id_str(talloc_tos(), state->scavenger_id)));
+                 server_id_str_buf(*state->scavenger_id, &tmp)));
 
        TALLOC_FREE(state->scavenger_id);
 }
@@ -91,10 +94,11 @@ static void smbd_scavenger_parent_dead(struct tevent_context *event_ctx,
 {
        struct smbd_scavenger_state *state = talloc_get_type_abort(
                private_data, struct smbd_scavenger_state);
+       struct server_id_buf tmp1, tmp2;
 
        DEBUG(2, ("scavenger: %s parent %s died\n",
-                 server_id_str(talloc_tos(), state->scavenger_id),
-                 server_id_str(talloc_tos(), &state->parent_id)));
+                 server_id_str_buf(*state->scavenger_id, &tmp1),
+                 server_id_str_buf(state->parent_id, &tmp2)));
 
        exit_server("smbd_scavenger_parent_dead");
 }
@@ -143,6 +147,7 @@ static bool scavenger_say_hello(int fd, struct server_id self)
        const uint8_t *msg = (const uint8_t *)&self;
        size_t remaining = sizeof(self);
        size_t ofs = 0;
+       struct server_id_buf tmp;
 
        while (remaining > 0) {
                ssize_t ret;
@@ -157,7 +162,7 @@ static bool scavenger_say_hello(int fd, struct server_id self)
        }
 
        DEBUG(4, ("scavenger_say_hello: self[%s]\n",
-                 server_id_str(talloc_tos(), &self)));
+                 server_id_str_buf(self, &tmp)));
        return true;
 }
 
@@ -166,6 +171,7 @@ static bool scavenger_wait_hello(int fd, struct server_id *child)
        uint8_t *msg = (uint8_t *)child;
        size_t remaining = sizeof(*child);
        size_t ofs = 0;
+       struct server_id_buf tmp;
 
        while (remaining > 0) {
                ssize_t ret;
@@ -180,7 +186,7 @@ static bool scavenger_wait_hello(int fd, struct server_id *child)
        }
 
        DEBUG(4, ("scavenger_say_hello: child[%s]\n",
-                 server_id_str(talloc_tos(), child)));
+                 server_id_str_buf(*child, &tmp)));
        return true;
 }
 
@@ -196,16 +202,18 @@ static bool smbd_scavenger_start(struct smbd_scavenger_state *state)
        SMB_ASSERT(server_id_equal(&state->parent_id, &self));
 
        if (smbd_scavenger_running(state)) {
+               struct server_id_buf tmp;
                DEBUG(10, ("scavenger %s already running\n",
-                          server_id_str(talloc_tos(),
-                                        state->scavenger_id)));
+                          server_id_str_buf(*state->scavenger_id,
+                                            &tmp)));
                return true;
        }
 
        if (state->scavenger_id != NULL) {
+               struct server_id_buf tmp;
                DEBUG(10, ("scavenger zombie %s, cleaning up\n",
-                          server_id_str(talloc_tos(),
-                                        state->scavenger_id)));
+                          server_id_str_buf(*state->scavenger_id,
+                                            &tmp)));
                TALLOC_FREE(state->scavenger_id);
        }
 
@@ -328,10 +336,11 @@ static void smbd_scavenger_msg(struct messaging_context *msg_ctx,
        TALLOC_CTX *frame = talloc_stackframe();
        struct server_id self = messaging_server_id(msg_ctx);
        struct scavenger_message *msg = NULL;
+       struct server_id_buf tmp1, tmp2;
 
        DEBUG(10, ("smbd_scavenger_msg: %s got message from %s\n",
-                  server_id_str(talloc_tos(), &self),
-                  server_id_str(talloc_tos(), &src)));
+                  server_id_str_buf(self, &tmp1),
+                  server_id_str_buf(src, &tmp2)));
 
        if (server_id_equal(&state->parent_id, &self)) {
                NTSTATUS status;
@@ -416,6 +425,7 @@ void scavenger_schedule_disconnected(struct files_struct *fsp)
        uint64_t timeout_usec;
        struct scavenger_message msg;
        DATA_BLOB msg_blob;
+       struct server_id_buf tmp;
 
        if (fsp->op == NULL) {
                return;
@@ -433,7 +443,7 @@ void scavenger_schedule_disconnected(struct files_struct *fsp)
 
        DEBUG(10, ("smbd: %s mark file %s as disconnected at %s with timeout "
                   "at %s in %fs\n",
-                  server_id_str(talloc_tos(), &self),
+                  server_id_str_buf(self, &tmp),
                   file_id_string_tos(&fsp->file_id),
                   timeval_string(talloc_tos(), &disconnect_time, true),
                   timeval_string(talloc_tos(), &until, true),
@@ -451,11 +461,12 @@ void scavenger_schedule_disconnected(struct files_struct *fsp)
                                MSG_SMB_SCAVENGER,
                                &msg_blob);
        if (!NT_STATUS_IS_OK(status)) {
+               struct server_id_buf tmp1, tmp2;
                DEBUG(2, ("Failed to send message to parent smbd %s "
                          "from %s: %s\n",
-                         server_id_str(talloc_tos(),
-                                       &smbd_scavenger_state->parent_id),
-                         server_id_str(talloc_tos(), &self),
+                         server_id_str_buf(smbd_scavenger_state->parent_id,
+                                           &tmp1),
+                         server_id_str_buf(self, &tmp2),
                          nt_errstr(status)));
        }
 }
index b2617041e52726e469677341867326d232810a26..f41f8e32362f0b6f30f02f943a75ccc2be38970e 100644 (file)
@@ -511,9 +511,10 @@ static int shutdown_other_smbds(struct smbXsrv_session_global0 *session,
        struct server_id self_pid = messaging_server_id(state->msg_ctx);
        struct server_id pid = session->channels[0].server_id;
        const char *addr = session->channels[0].remote_address;
+       struct server_id_buf tmp;
 
        DEBUG(10, ("shutdown_other_smbds: %s, %s\n",
-                  server_id_str(talloc_tos(), &pid), addr));
+                  server_id_str_buf(pid, &tmp), addr));
 
        if (!process_exists(pid)) {
                DEBUG(10, ("process does not exist\n"));
index 2440ecb26410b9420333ce181491cbc05ed1e08d..1fe8b1bb5a4e7da9f8c94eeaac3ed91eb8708a89 100644 (file)
@@ -630,10 +630,11 @@ static void smbXsrv_open_global_verify_record(struct db_record *db_rec,
                exists = serverid_exists(&global->server_id);
        }
        if (!exists) {
+               struct server_id_buf idbuf;
                DEBUG(2,("smbXsrv_open_global_verify_record: "
                         "key '%s' server_id %s does not exist.\n",
                         hex_encode_talloc(frame, key.dptr, key.dsize),
-                        server_id_str(frame, &global->server_id)));
+                        server_id_str_buf(global->server_id, &idbuf)));
                if (CHECK_DEBUGLVL(2)) {
                        NDR_PRINT_DEBUG(smbXsrv_open_globalB, &global_blob);
                }
@@ -1453,9 +1454,11 @@ NTSTATUS smbXsrv_open_cleanup(uint64_t persistent_id)
                           op->durable_timeout_msec / 1000,
                           delete_open ? "" : " not"));
        } else if (!serverid_exists(&op->server_id)) {
+               struct server_id_buf idbuf;
                DEBUG(10, ("smbXsrv_open_cleanup[global: 0x%08x] "
                           "server[%s] does not exist\n",
-                          global_id, server_id_str(frame, &op->server_id)));
+                          global_id,
+                          server_id_str_buf(op->server_id, &idbuf)));
                delete_open = true;
        }
 
index c5b7b7936c9f5cdc03611e8510094d11dbcd16e1..a49e2461c2bec5333894f4873e59d9b838c2ea63 100644 (file)
@@ -782,10 +782,12 @@ static void smbXsrv_session_global_verify_record(struct db_record *db_rec,
 
        exists = serverid_exists(&global->channels[0].server_id);
        if (!exists) {
+               struct server_id_buf idbuf;
                DEBUG(2,("smbXsrv_session_global_verify_record: "
                         "key '%s' server_id %s does not exist.\n",
                         hex_encode_talloc(frame, key.dptr, key.dsize),
-                        server_id_str(frame, &global->channels[0].server_id)));
+                        server_id_str_buf(global->channels[0].server_id,
+                                          &idbuf)));
                if (DEBUGLVL(2)) {
                        NDR_PRINT_DEBUG(smbXsrv_session_globalB, &global_blob);
                }
index 89a25e8bee782c49c817ad4aa85db836c1fa9a6a..1d2a141e6b5fdd65fd228b6aef0a3c1301e99fc7 100644 (file)
@@ -604,10 +604,11 @@ static void smbXsrv_tcon_global_verify_record(struct db_record *db_rec,
 
        exists = serverid_exists(&global->server_id);
        if (!exists) {
+               struct server_id_buf idbuf;
                DEBUG(2,("smbXsrv_tcon_global_verify_record: "
                         "key '%s' server_id %s does not exist.\n",
                         hex_encode_talloc(frame, key.dptr, key.dsize),
-                        server_id_str(frame, &global->server_id)));
+                        server_id_str_buf(global->server_id, &idbuf)));
                if (DEBUGLVL(2)) {
                        NDR_PRINT_DEBUG(smbXsrv_tcon_globalB, &global_blob);
                }
index 7492af1bb3a85a6d8317e47855ed8867bb97941e..aefc04c709b5fd4ede32d77b59664bdda674cb5d 100644 (file)
@@ -353,9 +353,8 @@ static int dbwrap_tool_listwatchers_cb(const uint8_t *db_id, size_t db_id_len,
        dump_data_file(key.dptr, key.dsize, false, stdout);
 
        for (i=0; i<num_watchers; i++) {
-               char *str = server_id_str(talloc_tos(), &watchers[i]);
-               printf("%s\n", str);
-               TALLOC_FREE(str);
+               struct server_id_buf idbuf;
+               printf("%s\n", server_id_str_buf(watchers[i], &idbuf));
        }
        printf("\n");
        return 0;
index 8de5c7cc33883eb73f471d4fabe4fd1ae2a94ddb..5ac832a49a782693d04903b0d728c2499668d5fe 100644 (file)
@@ -111,12 +111,9 @@ done:
 static int net_g_lock_dump_fn(struct server_id pid, enum g_lock_type lock_type,
                              void *private_data)
 {
-       char *pidstr;
-
-       pidstr = server_id_str(talloc_tos(), &pid);
-       d_printf("%s: %s\n", pidstr,
+       struct server_id_buf idbuf;
+       d_printf("%s: %s\n", server_id_str_buf(pid, &idbuf),
                 (lock_type & 1) ? "WRITE" : "READ");
-       TALLOC_FREE(pidstr);
        return 0;
 }
 
index cf2c33f8954bd9d60fa271fe60d990467f009a32..9eb1cf4a4dd6e41c5542cc70bd51b4607ec74abd 100644 (file)
 static int net_serverid_list_fn(const struct server_id *id,
                                uint32_t msg_flags, void *priv)
 {
-       char *str = server_id_str(talloc_tos(), id);
-       d_printf("%s %llu 0x%x\n", str, (unsigned long long)id->unique_id,
+       struct server_id_buf idbuf;
+       d_printf("%s %llu 0x%x\n", server_id_str_buf(*id, &idbuf),
+                (unsigned long long)id->unique_id,
                 (unsigned int)msg_flags);
-       TALLOC_FREE(str);
        return 0;
 }
 
@@ -55,10 +55,9 @@ static int net_serverid_wipe_fn(struct db_record *rec,
        }
        status = dbwrap_record_delete(rec);
        if (!NT_STATUS_IS_OK(status)) {
-               char *str = server_id_str(talloc_tos(), id);
+               struct server_id_buf idbuf;
                DEBUG(1, ("Could not delete serverid.tdb record %s: %s\n",
-                         str, nt_errstr(status)));
-               TALLOC_FREE(str);
+                         server_id_str_buf(*id, &idbuf), nt_errstr(status)));
        }
        return 0;
 }
@@ -125,34 +124,39 @@ static struct wipedbs_server_data *get_server_data(struct wipedbs_state *state,
                ret = *(struct wipedbs_server_data**) val.dptr;
                TALLOC_FREE(val.dptr);
        } else if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
+               struct server_id_buf idbuf;
+
+               server_id_str_buf(*id, &idbuf);
+
                ret = talloc_zero(state->id2server_data,
                                  struct wipedbs_server_data);
                if (ret == NULL) {
                        DEBUG(0, ("Failed to allocate server entry for %s\n",
-                                 server_id_str(talloc_tos(), id)));
+                                 idbuf.buf));
                        goto done;
                }
                ret->server_id = *id;
-               ret->server_id_str = server_id_str(ret, id);
+               ret->server_id_str = talloc_strdup(ret, idbuf.buf);
                ret->exists = true;
                val = make_tdb_data((const void*)&ret, sizeof(ret));
                status = dbwrap_store(state->id2server_data,
                                      key, val, TDB_INSERT);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0, ("Failed to store server entry for %s: %s\n",
-                                 server_id_str(talloc_tos(), id),
-                                 nt_errstr(status)));
+                                 idbuf.buf, nt_errstr(status)));
                }
                goto done;
        } else {
+               struct server_id_buf idbuf;
                DEBUG(0, ("Failed to fetch server entry for %s: %s\n",
-                         server_id_str(talloc_tos(), id), nt_errstr(status)));
+                         server_id_str_buf(*id, &idbuf), nt_errstr(status)));
                goto done;
        }
        if (!server_id_equal(id, &ret->server_id)) {
+               struct server_id_buf idbuf1, idbuf2;
                DEBUG(0, ("uniq id collision for %s and %s\n",
-                         server_id_str(talloc_tos(), id),
-                         server_id_str(talloc_tos(), &ret->server_id)));
+                         server_id_str_buf(*id, &idbuf1),
+                         server_id_str_buf(ret->server_id, &idbuf2)));
                smb_panic("server_id->unique_id not unique!");
        }
 done:
index 33ca728cf50ebce1236064970ca57d0aae191275..afbba69126a0d3de91dfe11eed66b8eababe26e2 100644 (file)
@@ -340,12 +340,11 @@ static void print_notify_recs(const char *path,
 
        for (i=0; i<num_entries; i++) {
                struct notify_db_entry *e = &entries[i];
-               char *str;
+               struct server_id_buf idbuf;
 
-               str = server_id_str(talloc_tos(), &e->server);
-               printf("%s %x %x\n", str, (unsigned)e->filter,
+               printf("%s %x %x\n", server_id_str_buf(e->server, &idbuf),
+                      (unsigned)e->filter,
                       (unsigned)e->subdir_filter);
-               TALLOC_FREE(str);
        }
        printf("\n");
 }
index 05764eeb4fe924ca75865f7d1bec3456e73290e2..4c619b7edc60530fef674886cfca691820ebcbfa 100644 (file)
@@ -101,9 +101,11 @@ static int ridalloc_poke_rid_manager(struct ldb_module *module)
 
        /* Only error out if an error happened, not on STATUS_MORE_ENTRIES, ie a delayed message */
        if (NT_STATUS_IS_ERR(status)) {
+               struct server_id_buf idbuf;
                ldb_asprintf_errstring(ldb_module_get_ctx(module),
                                "Failed to send MSG_DREPL_ALLOCATE_RID to dreplsrv at %s: %s",
-                               server_id_str(tmp_ctx, servers), nt_errstr(status));
+                               server_id_str_buf(*servers, &idbuf),
+                               nt_errstr(status));
                talloc_free(tmp_ctx);
                return LDB_ERR_UNWILLING_TO_PERFORM;
        }
index 344383490183032794beef2014d97ebabf0ea731..94bd5ce7ad40c2dda4b5b9f8bf2aebaa62935a8c 100644 (file)
@@ -471,7 +471,7 @@ static void switch_message(int type, struct smbsrv_request *req)
        int flags;
        struct smbsrv_connection *smb_conn = req->smb_conn;
        NTSTATUS status;
-       char *task_id;
+       struct server_id_buf idbuf;
 
        type &= 0xff;
 
@@ -495,10 +495,10 @@ static void switch_message(int type, struct smbsrv_request *req)
                req->session = smbsrv_session_find(req->smb_conn, SVAL(req->in.hdr,HDR_UID), req->request_time);
        }
 
-       task_id = server_id_str(NULL, &req->smb_conn->connection->server_id);
-       DEBUG(5,("switch message %s (task_id %s)\n",
-                smb_fn_name(type), task_id));
-       talloc_free(task_id);
+       DEBUG(5, ("switch message %s (task_id %s)\n",
+                 smb_fn_name(type),
+                 server_id_str_buf(req->smb_conn->connection->server_id,
+                                   &idbuf)));
 
        /* this must be called before we do any reply */
        if (flags & SIGNING_NO_REPLY) {
index 11e6deb35de2da264d6e134141e66918b7aef4e7..9aca501007d3e34842078dbe77e87b389671ea36 100644 (file)
@@ -215,6 +215,7 @@ static void stream_new_connection(struct tevent_context *ev,
        {
                TALLOC_CTX *tmp_ctx;
                const char *title;
+               struct server_id_buf idbuf;
 
                tmp_ctx = talloc_new(srv_conn);
 
@@ -222,7 +223,7 @@ static void stream_new_connection(struct tevent_context *ev,
                                        stream_socket->ops->name, 
                                        tsocket_address_string(srv_conn->remote_address, tmp_ctx),
                                        tsocket_address_string(srv_conn->local_address, tmp_ctx),
-                                       server_id_str(tmp_ctx, &server_id));
+                                       server_id_str_buf(server_id, &idbuf));
                if (title) {
                        stream_connection_set_title(srv_conn, title);
                }