The branch, master has been updated via 06f4ba3 lib: Remove server_id_str() via b2c34d4 lib: Simplify dom_sid_parse_length via 78f43ed lib: Fix a typo via 838218d Fix the O3 developer build via db5b766 lib: Remove procid_str_static from fdbca5e vfs_gpfs: Fix ENODATA for getacl on .snapshot dirs
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 06f4ba321761d6fdfb4a722849da6a11f6779a0a Author: Volker Lendecke <v...@samba.org> Date: Tue Apr 28 11:30:58 2015 +0000 lib: Remove server_id_str() Call server_id_str_buf instead Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Tue Apr 28 20:48:01 CEST 2015 on sn-devel-104 commit b2c34d45c0b16a8e7acff864b8c5fdca9f38d20d Author: Volker Lendecke <v...@samba.org> Date: Fri Jan 2 11:02:45 2015 +0100 lib: Simplify dom_sid_parse_length Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 78f43ed5a751ccf5cf03093a9515615543694de7 Author: Volker Lendecke <v...@samba.org> Date: Tue Apr 28 08:38:43 2015 +0200 lib: Fix a typo Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 838218db63e2ca50d2f374a11e73d4bd81b15ccd Author: Volker Lendecke <v...@samba.org> Date: Sat Mar 14 22:41:36 2015 +0100 Fix the O3 developer build Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit db5b76690388ff1ae31b8197572d1cfb65eed6c0 Author: Volker Lendecke <v...@samba.org> Date: Thu Apr 23 18:06:17 2015 +0200 lib: Remove procid_str_static Replace all callers with direct calls to server_id_str_buf without talloc_tos() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: lib/util/debug_s3.c | 5 ++-- lib/util/samba_util.h | 1 - lib/util/server_id.c | 19 +------------ libcli/security/dom_sid.c | 11 ++------ source3/include/proto.h | 1 - source3/lib/dbwrap/dbwrap_watch.c | 6 ++-- source3/lib/gencache.c | 2 +- source3/lib/util.c | 5 ---- source3/locking/brlock.c | 31 ++++++++++++++------ source3/locking/locking.c | 13 ++++++--- source3/locking/share_mode_lock.c | 3 +- source3/smbd/notify_internal.c | 8 ++++-- source3/smbd/open.c | 3 +- source3/smbd/oplock.c | 6 ++-- source3/smbd/scavenger.c | 47 +++++++++++++++++++------------ source3/smbd/server.c | 7 +++-- source3/smbd/sesssetup.c | 3 +- source3/smbd/smbXsrv_open.c | 7 +++-- source3/smbd/smbXsrv_session.c | 4 ++- source3/smbd/smbXsrv_tcon.c | 3 +- source3/utils/dbwrap_tool.c | 5 ++-- source3/utils/net_g_lock.c | 7 ++--- source3/utils/net_serverid.c | 30 +++++++++++--------- source3/utils/net_status.c | 12 +++++--- source3/utils/status.c | 20 +++++++------ source4/dsdb/samdb/ldb_modules/ridalloc.c | 4 ++- source4/rpc_server/lsa/dcesrv_lsa.c | 6 ++-- source4/smb_server/smb/receive.c | 10 +++---- source4/smbd/service_stream.c | 3 +- 29 files changed, 155 insertions(+), 127 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/util/debug_s3.c b/lib/util/debug_s3.c index 160e2ef..d9ac15f 100644 --- a/lib/util/debug_s3.c +++ b/lib/util/debug_s3.c @@ -84,14 +84,15 @@ static void debuglevel_message(struct messaging_context *msg_ctx, DATA_BLOB *data) { char *message = debug_list_class_names_and_levels(); + struct server_id_buf tmp; if (!message) { DEBUG(0,("debuglevel_message - debug_list_class_names_and_levels returned NULL\n")); return; } - DEBUG(1,("INFO: Received REQ_DEBUGLEVEL message from PID %s\n", - procid_str_static(&src))); + DEBUG(1, ("INFO: Received REQ_DEBUGLEVEL message from PID %s\n", + server_id_str_buf(src, &tmp))); messaging_send_buf(msg_ctx, src, MSG_DEBUGLEVEL, (uint8 *)message, strlen(message) + 1); diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h index 6941308..176930b 100644 --- a/lib/util/samba_util.h +++ b/lib/util/samba_util.h @@ -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); diff --git a/lib/util/server_id.c b/lib/util/server_id.c index 308ee2a..60b5235 100644 --- a/lib/util/server_id.c +++ b/lib/util/server_id.c @@ -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. */ diff --git a/libcli/security/dom_sid.c b/libcli/security/dom_sid.c index 836979e..2910434 100644 --- a/libcli/security/dom_sid.c +++ b/libcli/security/dom_sid.c @@ -243,14 +243,9 @@ struct dom_sid *dom_sid_parse_talloc(TALLOC_CTX *mem_ctx, const char *sidstr) */ struct dom_sid *dom_sid_parse_length(TALLOC_CTX *mem_ctx, const DATA_BLOB *sid) { - struct dom_sid *ret; - char *p = talloc_strndup(mem_ctx, (char *)sid->data, sid->length); - if (!p) { - return NULL; - } - ret = dom_sid_parse_talloc(mem_ctx, p); - talloc_free(p); - return ret; + char p[sid->length+1]; + memcpy(p, sid->data, sizeof(p)); + return dom_sid_parse_talloc(mem_ctx, p); } /* diff --git a/source3/include/proto.h b/source3/include/proto.h index 30fd4fa..f73778f 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -437,7 +437,6 @@ struct server_id procid_self(void); #define serverid_equal(p1, p2) server_id_equal(p1,p2) bool procid_is_me(const struct server_id *pid); struct server_id interpret_pid(const char *pid_string); -char *procid_str_static(const struct server_id *pid); bool procid_valid(const struct server_id *pid); bool procid_is_local(const struct server_id *pid); bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off); diff --git a/source3/lib/dbwrap/dbwrap_watch.c b/source3/lib/dbwrap/dbwrap_watch.c index c0571d9..da1a9cc 100644 --- a/source3/lib/dbwrap/dbwrap_watch.c +++ b/source3/lib/dbwrap/dbwrap_watch.c @@ -356,10 +356,10 @@ static void dbwrap_watch_record_stored(struct db_context *db, status = messaging_send_buf(msg, ids[i], MSG_DBWRAP_MODIFIED, w_key.dptr, w_key.dsize); if (!NT_STATUS_IS_OK(status)) { - char *str = procid_str_static(&ids[i]); + struct server_id_buf tmp; DEBUG(1, ("messaging_send to %s failed: %s\n", - str, nt_errstr(status))); - TALLOC_FREE(str); + server_id_str_buf(ids[i], &tmp), + nt_errstr(status))); } } done: diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c index 19fafe1..90eafaa 100644 --- a/source3/lib/gencache.c +++ b/source3/lib/gencache.c @@ -273,7 +273,7 @@ static int last_stabilize_parser(TDB_DATA key, TDB_DATA data, * @param blob DATA_BLOB value being cached * @param timeout time when the value is expired * - * @retval true when entry is successfuly stored + * @retval true when entry is successfully stored * @retval false on failure **/ diff --git a/source3/lib/util.c b/source3/lib/util.c index e296fd5..c7ab0ee 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1984,11 +1984,6 @@ struct server_id interpret_pid(const char *pid_string) return server_id_from_string(get_my_vnn(), pid_string); } -char *procid_str_static(const struct server_id *pid) -{ - return server_id_str(talloc_tos(), pid); -} - bool procid_valid(const struct server_id *pid) { return (pid->pid != (uint64_t)-1); diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index 46401a0..0738464 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -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, @@ -969,8 +971,12 @@ static NTSTATUS brl_lock_posix(struct messaging_context *msg_ctx, if (pend_lock->lock_type == PENDING_READ_LOCK && brl_pending_overlap(plock, pend_lock)) { - DEBUG(10,("brl_lock_posix: sending unlock message to pid %s\n", - procid_str_static(&pend_lock->context.pid ))); + struct server_id_buf tmp; + + DEBUG(10, ("brl_lock_posix: sending unlock " + "message to pid %s\n", + server_id_str_buf(pend_lock->context.pid, + &tmp))); messaging_send(msg_ctx, pend_lock->context.pid, MSG_SMB_UNLOCK, &data_blob_null); @@ -1155,8 +1161,12 @@ bool brl_unlock_windows_default(struct messaging_context *msg_ctx, /* We could send specific lock info here... */ if (brl_pending_overlap(plock, pend_lock)) { - DEBUG(10,("brl_unlock: sending unlock message to pid %s\n", - procid_str_static(&pend_lock->context.pid ))); + struct server_id_buf tmp; + + DEBUG(10, ("brl_unlock: sending unlock message to " + "pid %s\n", + server_id_str_buf(pend_lock->context.pid, + &tmp))); messaging_send(msg_ctx, pend_lock->context.pid, MSG_SMB_UNLOCK, &data_blob_null); @@ -1312,8 +1322,12 @@ static bool brl_unlock_posix(struct messaging_context *msg_ctx, /* We could send specific lock info here... */ if (brl_pending_overlap(plock, pend_lock)) { - DEBUG(10,("brl_unlock: sending unlock message to pid %s\n", - procid_str_static(&pend_lock->context.pid ))); + struct server_id_buf tmp; + + DEBUG(10, ("brl_unlock: sending unlock message to " + "pid %s\n", + server_id_str_buf(pend_lock->context.pid, + &tmp))); messaging_send(msg_ctx, pend_lock->context.pid, MSG_SMB_UNLOCK, &data_blob_null); @@ -2231,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; } diff --git a/source3/locking/locking.c b/source3/locking/locking.c index ce595e1..67eff8f 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -426,12 +426,14 @@ void locking_close_file(struct messaging_context *msg_ctx, char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e) { + struct server_id_buf tmp; + return talloc_asprintf(ctx, "share_mode_entry[%d]: " "pid = %s, share_access = 0x%x, private_options = 0x%x, " "access_mask = 0x%x, mid = 0x%llx, type= 0x%x, gen_id = %llu, " "uid = %u, flags = %u, file_id %s, name_hash = 0x%x", num, - procid_str_static(&e->pid), + server_id_str_buf(e->pid, &tmp), e->share_access, e->private_options, e->access_mask, (unsigned long long)e->op_mid, e->op_type, (unsigned long long)e->share_file_id, @@ -533,6 +535,8 @@ bool rename_share_filename(struct messaging_context *msg_ctx, /* Send the messages. */ for (i=0; i<d->num_share_modes; i++) { struct share_mode_entry *se = &d->share_modes[i]; + struct server_id_buf tmp; + if (!is_valid_share_mode_entry(se)) { continue; } @@ -557,7 +561,7 @@ bool rename_share_filename(struct messaging_context *msg_ctx, DEBUG(10,("rename_share_filename: sending rename message to " "pid %s file_id %s sharepath %s base_name %s " "stream_name %s\n", - procid_str_static(&se->pid), + server_id_str_buf(se->pid, &tmp), file_id_string_tos(&id), d->servicepath, d->base_name, has_stream ? d->stream_name : "")); @@ -729,6 +733,7 @@ static void remove_share_mode_lease(struct share_mode_data *d, */ bool share_mode_stale_pid(struct share_mode_data *d, uint32_t idx) { + struct server_id_buf tmp; struct share_mode_entry *e; if (idx > d->num_share_modes) { @@ -745,12 +750,12 @@ bool share_mode_stale_pid(struct share_mode_data *d, uint32_t idx) } if (serverid_exists(&e->pid)) { DEBUG(10, ("PID %s (index %u out of %u) still exists\n", - procid_str_static(&e->pid), idx, + server_id_str_buf(e->pid, &tmp), idx, (unsigned)d->num_share_modes)); return false; } DEBUG(10, ("PID %s (index %u out of %u) does not exist anymore\n", - procid_str_static(&e->pid), idx, + server_id_str_buf(e->pid, &tmp), idx, (unsigned)d->num_share_modes)); e->stale = true; diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index 79efb70..5eedcc5 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -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) { diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c index e612f16..845a7cc 100644 --- a/source3/smbd/notify_internal.c +++ b/source3/smbd/notify_internal.c @@ -444,12 +444,13 @@ static NTSTATUS notify_del_entry(struct db_record *rec, void *private_data) { TDB_DATA value = dbwrap_record_get_value(rec); + struct server_id_buf tmp; struct notify_db_entry *entries; size_t i, num_entries; time_t now; - DEBUG(10, ("del_entry called for %s %p\n", procid_str_static(pid), - private_data)); + DEBUG(10, ("del_entry called for %s %p\n", + server_id_str_buf(*pid, &tmp), private_data)); if ((value.dsize % sizeof(struct notify_db_entry)) != 0) { DEBUG(1, ("Invalid value.dsize = %u\n", @@ -777,9 +778,10 @@ static void notify_trigger_local(struct notify_context *notify, } if (!procid_is_local(&e->server)) { + struct server_id_buf tmp; DEBUG(1, ("internal error: Non-local pid %s in " "notify.tdb\n", - procid_str_static(&e->server))); + server_id_str_buf(e->server, &tmp))); continue; } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 773b146..ca674b4 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1251,9 +1251,10 @@ NTSTATUS send_break_message(struct messaging_context *msg_ctx, { NTSTATUS status; char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE]; + struct server_id_buf tmp; DEBUG(10, ("Sending break request to PID %s\n", - procid_str_static(&exclusive->pid))); + server_id_str_buf(exclusive->pid, &tmp))); /* Create the message. */ share_mode_entry_to_message(msg, exclusive); diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 8f318f5..e29b5b1 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -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); diff --git a/source3/smbd/scavenger.c b/source3/smbd/scavenger.c index 19f9b43..3691ba0 100644 --- a/source3/smbd/scavenger.c +++ b/source3/smbd/scavenger.c @@ -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", -- Samba Shared Repository