The branch, master has been updated via 072cb98e432 smbd: Avoid a ZERO_STRUCT() with direct struct initialization via 02d9631cf33 tools: Fix whitespace via f948b6267e4 smbd: Fix a typo via 17caec0ead0 smbd: Fix and modernize a few DBG statements via 965fec35472 smbd: Give smbXsrv_session.c its own header file via c37eb90d731 vfs: Fix a typo via d393fd46936 auth: Simplify smb_krb5_send_to_kdc_state_destructor() via 7f5d5ddde1d smbd: Fix a comment via ac8d38cf13f smbXsrv_version: Use a struct assignment via 5885a69a985 smbXsrv_version: Remove unused smbXsrv_version_global0->db_rec via f1af8843def smbXsrv_version: Use a struct assignment instead of ZERO_STRUCT via 90bd197dd57 smbXsrv_version: Modernize DEBUG statements via 97896fa7e54 lib: Simplify _hexcharval via 01cbfab9538 smbd: Add parentheses for easier readability via 56233406de4 torture: Fix an error message via 32ecf1fe607 lib: Simplify copy_unix_token() via 9f565512755 libsmb: Simplify an if-condition via 7c68d88cefb lib: Make GUID_to_ndr_buf() return void via ea09be77523 smbd: Remove get_Protocol() via 67f6fcfe17b smbd: Remove the last use of get_Protocol() via 72492de5783 smbd: Add conn_protocol() via 51bb236a698 smbd: Modernize a DEBUG statement via 5246267d173 smbd: Simplify fsp_fullbasepath() via be15ab4c785 smbd: Remove unused declarations in smbXsrv.idl from 0e40506d21b selftest: add tests for "samba-tool user list --locked-only"
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 072cb98e4326c4124c649e911970acbf004f16bb Author: Volker Lendecke <v...@samba.org> Date: Mon Feb 19 09:57:16 2024 +0100 smbd: Avoid a ZERO_STRUCT() with direct struct initialization Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> Autobuild-User(master): Volker Lendecke <v...@samba.org> Autobuild-Date(master): Tue Mar 12 14:33:14 UTC 2024 on atb-devel-224 commit 02d9631cf3319ead42487ea301aa268f659d9f0b Author: Volker Lendecke <v...@samba.org> Date: Thu Feb 8 11:02:15 2024 +0100 tools: Fix whitespace Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit f948b6267e413b33672d4de7d78fe4eb5b838c5a Author: Volker Lendecke <v...@samba.org> Date: Thu Feb 8 10:28:02 2024 +0100 smbd: Fix a typo Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 17caec0ead0913836ca136663fc5c591dc983f84 Author: Volker Lendecke <v...@samba.org> Date: Thu Feb 8 10:24:56 2024 +0100 smbd: Fix and modernize a few DBG statements There were still a few function names in DBGs Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 965fec354729fd63a25616fc52989d524826f4b4 Author: Volker Lendecke <v...@samba.org> Date: Thu Feb 8 10:04:32 2024 +0100 smbd: Give smbXsrv_session.c its own header file Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit c37eb90d73131d005b563d7f0944daf39cd92de6 Author: Volker Lendecke <v...@samba.org> Date: Sun Feb 4 10:09:07 2024 +0100 vfs: Fix a typo Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit d393fd469365d64c4acde3c399a167123916c348 Author: Volker Lendecke <v...@samba.org> Date: Mon Feb 12 13:35:19 2024 +0100 auth: Simplify smb_krb5_send_to_kdc_state_destructor() Replace a call to dbwrap_fetch_locked() with the higherlevel dbwrap_delete(). Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 7f5d5ddde1d8fa7674c352f049f49298d5169975 Author: Volker Lendecke <v...@samba.org> Date: Sun Feb 11 12:44:10 2024 +0100 smbd: Fix a comment Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit ac8d38cf13f6feee9ae70c851a3a045ed63dbb6d Author: Volker Lendecke <v...@samba.org> Date: Sat Feb 10 10:40:46 2024 +0100 smbXsrv_version: Use a struct assignment Make sure everything is initialized Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 5885a69a9855e450a27980462f58654c80a9782b Author: Volker Lendecke <v...@samba.org> Date: Sat Feb 10 10:37:42 2024 +0100 smbXsrv_version: Remove unused smbXsrv_version_global0->db_rec Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit f1af8843defeaaf03b1e7d77655419b6c9e67f39 Author: Volker Lendecke <v...@samba.org> Date: Sat Feb 10 10:36:51 2024 +0100 smbXsrv_version: Use a struct assignment instead of ZERO_STRUCT Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 90bd197dd57d7872b730b488e9d16144bde60438 Author: Volker Lendecke <v...@samba.org> Date: Sat Feb 10 10:29:35 2024 +0100 smbXsrv_version: Modernize DEBUG statements Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 97896fa7e54039b0a56510f9ccd22e71fb42b42c Author: Volker Lendecke <v...@samba.org> Date: Mon Feb 19 13:15:55 2024 +0100 lib: Simplify _hexcharval Saves a few bytes and conditional jumps Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 01cbfab953807b5231a255f69294d39a67a76ce9 Author: Volker Lendecke <v...@samba.org> Date: Wed Jan 31 17:16:04 2024 +0100 smbd: Add parentheses for easier readability Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 56233406de46eb37f87bd4b2b6123b14ff2d9282 Author: Volker Lendecke <v...@samba.org> Date: Wed Jan 31 14:06:58 2024 +0100 torture: Fix an error message Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 32ecf1fe607f0442511189cb6639d405cb5125df Author: Volker Lendecke <v...@samba.org> Date: Fri Feb 2 15:14:33 2024 +0100 lib: Simplify copy_unix_token() Avoid an else with implicit NULL initialization Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 9f5655127550e02aed6c8636fda406ad66871a6d Author: Volker Lendecke <v...@samba.org> Date: Fri Feb 2 15:06:06 2024 +0100 libsmb: Simplify an if-condition Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 7c68d88cefb541375fd0027cf9109130d1ff0b6b Author: Volker Lendecke <v...@samba.org> Date: Fri Feb 9 19:09:35 2024 +0100 lib: Make GUID_to_ndr_buf() return void The whole point of struct GUID_ndr_buf is that this never fails. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit ea09be77523541ee4fd6dd7b1b8165ab6678bce7 Author: Volker Lendecke <v...@samba.org> Date: Tue Feb 13 13:13:26 2024 +0100 smbd: Remove get_Protocol() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 67f6fcfe17ba82dfd7fc08fbe687b56df69e3286 Author: Volker Lendecke <v...@samba.org> Date: Tue Feb 13 13:12:14 2024 +0100 smbd: Remove the last use of get_Protocol() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 72492de5783cdc3b90b9983ba66178edd5f12522 Author: Volker Lendecke <v...@samba.org> Date: Tue Feb 13 12:26:22 2024 +0100 smbd: Add conn_protocol() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 51bb236a6981fa2199a6aa097831cfe82136740b Author: Volker Lendecke <v...@samba.org> Date: Mon Feb 12 09:44:51 2024 +0100 smbd: Modernize a DEBUG statement Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 5246267d173964aed8c6ff585baec18a261e18d0 Author: Volker Lendecke <v...@samba.org> Date: Sun Feb 4 10:57:28 2024 +0100 smbd: Simplify fsp_fullbasepath() snprintf deals well with NULL/0 buffers. Basically this undoes 6555fa9d8fbc and 193df617. 6555fa9d8fbc gave cppcheck as a reason for this patch, but if I look into susv4's snprintf definition I find: If n is zero, nothing shall be written and s may be a null pointer. This removes the checks and makes sure we fulfill the requirement of susv4 that states that buf can only be NULL if buflen is 0. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit be15ab4c785d0868647269c931edbf07defe990e Author: Volker Lendecke <v...@samba.org> Date: Thu Feb 8 10:30:52 2024 +0100 smbd: Remove unused declarations in smbXsrv.idl Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> ----------------------------------------------------------------------- Summary of changes: lib/replace/replace.h | 2 +- libcli/ldap/ldap_ndr.c | 6 +- libcli/smb/smbXcli_base.c | 14 +- librpc/ABI/{ndr-4.0.0.sigs => ndr-5.0.0.sigs} | 2 +- librpc/ndr/libndr.h | 2 +- librpc/ndr/uuid.c | 13 +- librpc/tools/ndrdump.c | 22 +-- librpc/wscript_build | 2 +- source3/include/proto.h | 1 - source3/lib/ctdbd_conn.c | 3 +- source3/lib/sessionid_tdb.c | 1 + source3/lib/util.c | 16 +-- source3/librpc/idl/smbXsrv.idl | 51 +------ source3/libsmb/clifile.c | 2 +- source3/modules/vfs_shadow_copy2.c | 2 +- source3/smbd/conn.c | 14 ++ source3/smbd/dosmode.c | 12 +- source3/smbd/files.c | 8 +- source3/smbd/globals.h | 71 ---------- source3/smbd/open.c | 2 +- source3/smbd/password.c | 1 + source3/smbd/proto.h | 1 + source3/smbd/server.c | 1 + source3/smbd/server_exit.c | 1 + source3/smbd/smb1_lanman.c | 1 + source3/smbd/smb1_process.c | 1 + source3/smbd/smb1_reply.c | 1 + source3/smbd/smb1_sesssetup.c | 1 + source3/smbd/smb1_trans2.c | 4 +- source3/smbd/smb2_ioctl_network_fs.c | 5 +- source3/smbd/smb2_process.c | 1 + source3/smbd/smb2_server.c | 16 ++- source3/smbd/smb2_sesssetup.c | 1 + source3/smbd/smbXsrv_client.c | 6 +- source3/smbd/smbXsrv_session.c | 188 ++++++++++++-------------- source3/smbd/smbXsrv_session.h | 110 +++++++++++++++ source3/smbd/smbXsrv_version.c | 64 ++++----- source3/smbd/uid.c | 1 + source3/torture/test_posix.c | 2 +- source3/utils/conn_tdb.c | 1 + source3/utils/net_serverid.c | 1 + source4/auth/kerberos/krb5_init_context.c | 10 +- source4/libcli/raw/rawrequest.c | 6 +- source4/libcli/smb2/create.c | 18 +-- 44 files changed, 323 insertions(+), 365 deletions(-) copy librpc/ABI/{ndr-4.0.0.sigs => ndr-5.0.0.sigs} (99%) create mode 100644 source3/smbd/smbXsrv_session.h Changeset truncated at 500 lines: diff --git a/lib/replace/replace.h b/lib/replace/replace.h index a6a2b40777f..537e61e1e48 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -1079,7 +1079,7 @@ static inline bool uid_wrapper_enabled(void) static inline bool _hexcharval(char c, uint8_t *val) { if ((c >= '0') && (c <= '9')) { *val = c - '0'; return true; } - if ((c >= 'a') && (c <= 'f')) { *val = c - 'a' + 10; return true; } + c &= 0xDF; /* map lower to upper case -- thanks libnfs :-) */ if ((c >= 'A') && (c <= 'F')) { *val = c - 'A' + 10; return true; } return false; } diff --git a/libcli/ldap/ldap_ndr.c b/libcli/ldap/ldap_ndr.c index 4f63bc179e7..1310123a614 100644 --- a/libcli/ldap/ldap_ndr.c +++ b/libcli/ldap/ldap_ndr.c @@ -65,12 +65,8 @@ char *ldap_encode_ndr_GUID(TALLOC_CTX *mem_ctx, const struct GUID *guid) { struct GUID_ndr_buf buf = { .buf = {0}, }; DATA_BLOB blob = { .data = buf.buf, .length = sizeof(buf.buf), }; - NTSTATUS status; char *ret; - status = GUID_to_ndr_buf(guid, &buf); - if (!NT_STATUS_IS_OK(status)) { - return NULL; - } + GUID_to_ndr_buf(guid, &buf); ret = ldb_binary_encode(mem_ctx, blob); return ret; } diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index a52a615857f..90e343c9d12 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -4858,14 +4858,9 @@ static struct tevent_req *smbXcli_negprot_smb2_subreq(struct smbXcli_negprot_sta SIVAL(buf, 8, 0); /* Capabilities */ } if (state->conn->max_protocol >= PROTOCOL_SMB2_10) { - NTSTATUS status; struct GUID_ndr_buf guid_buf = { .buf = {0}, }; - status = GUID_to_ndr_buf(&state->conn->smb2.client.guid, - &guid_buf); - if (!NT_STATUS_IS_OK(status)) { - return NULL; - } + GUID_to_ndr_buf(&state->conn->smb2.client.guid, &guid_buf); memcpy(buf+12, guid_buf.buf, 16); /* ClientGuid */ } else { memset(buf+12, 0, 16); /* ClientGuid */ @@ -5678,14 +5673,9 @@ struct tevent_req *smb2cli_validate_negotiate_info_send(TALLOC_CTX *mem_ctx, SIVAL(buf, 0, 0); /* Capabilities */ } if (state->conn->max_protocol >= PROTOCOL_SMB2_10) { - NTSTATUS status; struct GUID_ndr_buf guid_buf = { .buf = {0}, }; - status = GUID_to_ndr_buf(&conn->smb2.client.guid, - &guid_buf); - if (!NT_STATUS_IS_OK(status)) { - return NULL; - } + GUID_to_ndr_buf(&conn->smb2.client.guid, &guid_buf); memcpy(buf+4, guid_buf.buf, 16); /* ClientGuid */ } else { memset(buf+4, 0, 16); /* ClientGuid */ diff --git a/librpc/ABI/ndr-4.0.0.sigs b/librpc/ABI/ndr-5.0.0.sigs similarity index 99% copy from librpc/ABI/ndr-4.0.0.sigs copy to librpc/ABI/ndr-5.0.0.sigs index 5474a5184b0..ecfcd7ad3af 100644 --- a/librpc/ABI/ndr-4.0.0.sigs +++ b/librpc/ABI/ndr-5.0.0.sigs @@ -10,7 +10,7 @@ GUID_random: struct GUID (void) GUID_string: char *(TALLOC_CTX *, const struct GUID *) GUID_string2: char *(TALLOC_CTX *, const struct GUID *) GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *) -GUID_to_ndr_buf: NTSTATUS (const struct GUID *, struct GUID_ndr_buf *) +GUID_to_ndr_buf: void (const struct GUID *, struct GUID_ndr_buf *) GUID_zero: struct GUID (void) _ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, const char *, const char *, ...) _ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, const char *, const char *, ...) diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h index 03d1aead01a..aafdc1536eb 100644 --- a/librpc/ndr/libndr.h +++ b/librpc/ndr/libndr.h @@ -863,7 +863,7 @@ enum ndr_err_code ndr_push_charset_to_null(struct ndr_push *ndr, ndr_flags_type /* GUIDs */ bool GUID_equal(const struct GUID *u1, const struct GUID *u2); struct GUID_ndr_buf { uint8_t buf[16]; }; -NTSTATUS GUID_to_ndr_buf(const struct GUID *guid, struct GUID_ndr_buf *buf); +void GUID_to_ndr_buf(const struct GUID *guid, struct GUID_ndr_buf *buf); NTSTATUS GUID_to_ndr_blob(const struct GUID *guid, TALLOC_CTX *mem_ctx, DATA_BLOB *b); NTSTATUS GUID_from_ndr_blob(const DATA_BLOB *b, struct GUID *guid); NTSTATUS GUID_from_data_blob(const DATA_BLOB *s, struct GUID *guid); diff --git a/librpc/ndr/uuid.c b/librpc/ndr/uuid.c index a7599008c3c..9fcf12bda90 100644 --- a/librpc/ndr/uuid.c +++ b/librpc/ndr/uuid.c @@ -22,21 +22,22 @@ */ #include "replace.h" +#include "lib/util/debug.h" #include "lib/util/samba_util.h" #include "lib/util/genrand.h" #include "librpc/ndr/libndr.h" #include "librpc/gen_ndr/ndr_misc.h" #include "lib/util/util_str_hex.h" -_PUBLIC_ NTSTATUS GUID_to_ndr_buf( - const struct GUID *guid, struct GUID_ndr_buf *buf) +_PUBLIC_ void GUID_to_ndr_buf(const struct GUID *guid, + struct GUID_ndr_buf *buf) { DATA_BLOB b = { .data = buf->buf, .length = sizeof(buf->buf), }; enum ndr_err_code ndr_err; ndr_err = ndr_push_struct_into_fixed_blob( &b, guid, (ndr_push_flags_fn_t)ndr_push_GUID); - return ndr_map_error2ntstatus(ndr_err); + SMB_ASSERT(NDR_ERR_CODE_IS_SUCCESS(ndr_err)); } /** @@ -45,12 +46,8 @@ _PUBLIC_ NTSTATUS GUID_to_ndr_buf( _PUBLIC_ NTSTATUS GUID_to_ndr_blob(const struct GUID *guid, TALLOC_CTX *mem_ctx, DATA_BLOB *b) { struct GUID_ndr_buf buf = { .buf = {0}, }; - NTSTATUS status; - status = GUID_to_ndr_buf(guid, &buf); - if (!NT_STATUS_IS_OK(status)) { - return status; - } + GUID_to_ndr_buf(guid, &buf); *b = data_blob_talloc(mem_ctx, buf.buf, sizeof(buf.buf)); if (b->data == NULL) { diff --git a/librpc/tools/ndrdump.c b/librpc/tools/ndrdump.c index 528e1fa5473..f706510f4de 100644 --- a/librpc/tools/ndrdump.c +++ b/librpc/tools/ndrdump.c @@ -1,19 +1,19 @@ -/* +/* Unix SMB/CIFS implementation. SMB torture tester Copyright (C) Andrew Tridgell 2003 Copyright (C) Jelmer Vernooij 2006 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -180,7 +180,7 @@ static const struct ndr_interface_table *load_iface_from_plugin(const char *plug } talloc_free(symbol); - + return p; } @@ -311,8 +311,8 @@ static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...) struct poptOption long_options[] = { POPT_AUTOHELP {"context-file", 'c', POPT_ARG_STRING, NULL, OPT_CONTEXT_FILE, "In-filename to parse first", "CTX-FILE" }, - {"validate", 0, POPT_ARG_NONE, NULL, OPT_VALIDATE, "try to validate the data", NULL }, - {"dump-data", 0, POPT_ARG_NONE, NULL, OPT_DUMP_DATA, "dump the hex data", NULL }, + {"validate", 0, POPT_ARG_NONE, NULL, OPT_VALIDATE, "try to validate the data", NULL }, + {"dump-data", 0, POPT_ARG_NONE, NULL, OPT_DUMP_DATA, "dump the hex data", NULL }, {"load-dso", 0, POPT_ARG_STRING, NULL, OPT_LOAD_DSO, "load from shared object file", NULL }, {"ndr64", 0, POPT_ARG_NONE, NULL, OPT_NDR64, "Assume NDR64 data", NULL }, {"quiet", 0, POPT_ARG_NONE, NULL, OPT_QUIET, "Don't actually dump anything", NULL }, @@ -409,7 +409,7 @@ static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...) if (plugin != NULL) { p = load_iface_from_plugin(plugin, pipe_name); - } + } if (!p) { p = ndr_table_by_name(pipe_name); } @@ -481,7 +481,7 @@ static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...) TALLOC_FREE(mem_ctx); exit(1); } - + data = (uint8_t *)file_load(ctx_filename, &size, 0, mem_ctx); if (!data) { perror(ctx_filename); @@ -543,7 +543,7 @@ static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...) perror("stdin"); exit(1); } - + if (hex_input && base64_input) { printf("cannot combine --hex-input with --base64-input\n"); TALLOC_FREE(mem_ctx); @@ -790,6 +790,6 @@ static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...) TALLOC_FREE(mem_ctx); poptFreeContext(pc); - + return 0; } diff --git a/librpc/wscript_build b/librpc/wscript_build index ee2ad70857d..b1765863d9c 100644 --- a/librpc/wscript_build +++ b/librpc/wscript_build @@ -674,7 +674,7 @@ bld.SAMBA_LIBRARY('ndr', public_deps='samba-errors talloc samba-util util_str_hex', public_headers='gen_ndr/misc.h gen_ndr/ndr_misc.h ndr/libndr.h:ndr.h', header_path= [('*gen_ndr*', 'gen_ndr')], - vnum='4.0.0', + vnum='5.0.0', abi_directory='ABI', abi_match='!ndr_table_* ndr_* GUID_* _ndr_pull_error* _ndr_push_error*', ) diff --git a/source3/include/proto.h b/source3/include/proto.h index e9e13f67173..ed45485e654 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -277,7 +277,6 @@ bool is_allowed_domain(const char *domain_name); /* The following definitions come from lib/util.c */ -enum protocol_types get_Protocol(void); void set_Protocol(enum protocol_types p); void gfree_all( void ); bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf, diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index 9f8dce684bc..f32397d9353 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -1291,7 +1291,7 @@ void ctdbd_unregister_ips(struct ctdbd_connection *conn, void *private_data), void *private_data) { - struct ctdb_connection p; + struct ctdb_connection p = {}; TDB_DATA data = { .dptr = (uint8_t *)&p, .dsize = sizeof(p) }; int ret; struct sockaddr_storage client; @@ -1304,7 +1304,6 @@ void ctdbd_unregister_ips(struct ctdbd_connection *conn, smbd_ctdb_canonicalize_ip(_client, &client); smbd_ctdb_canonicalize_ip(_server, &server); - ZERO_STRUCT(p); switch (client.ss_family) { case AF_INET: memcpy(&p.dst.ip, &server, sizeof(p.dst.ip)); diff --git a/source3/lib/sessionid_tdb.c b/source3/lib/sessionid_tdb.c index 2376fd42a25..53bb9aeebbc 100644 --- a/source3/lib/sessionid_tdb.c +++ b/source3/lib/sessionid_tdb.c @@ -24,6 +24,7 @@ #include "session.h" #include "util_tdb.h" #include "smbd/globals.h" +#include "source3/smbd/smbXsrv_session.h" struct sessionid_traverse_read_state { int (*fn)(const char *key, struct sessionid *session, diff --git a/source3/lib/util.c b/source3/lib/util.c index 51dc50d0b66..d0af82cd986 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -54,11 +54,6 @@ static enum protocol_types Protocol = PROTOCOL_COREPLUS; -enum protocol_types get_Protocol(void) -{ - return Protocol; -} - void set_Protocol(enum protocol_types p) { Protocol = p; @@ -1907,9 +1902,12 @@ struct security_unix_token *copy_unix_token(TALLOC_CTX *ctx, const struct securi return NULL; } - cpy->uid = tok->uid; - cpy->gid = tok->gid; - cpy->ngroups = tok->ngroups; + *cpy = (struct security_unix_token){ + .uid = tok->uid, + .gid = tok->gid, + .ngroups = tok->ngroups, + }; + if (tok->ngroups) { /* Make this a talloc child of cpy. */ cpy->groups = (gid_t *)talloc_memdup( @@ -1918,8 +1916,6 @@ struct security_unix_token *copy_unix_token(TALLOC_CTX *ctx, const struct securi TALLOC_FREE(cpy); return NULL; } - } else { - cpy->groups = NULL; } return cpy; } diff --git a/source3/librpc/idl/smbXsrv.idl b/source3/librpc/idl/smbXsrv.idl index 4eb43e6dd3c..9569ba9b0ca 100644 --- a/source3/librpc/idl/smbXsrv.idl +++ b/source3/librpc/idl/smbXsrv.idl @@ -57,7 +57,6 @@ interface smbXsrv } smbXsrv_version_node0; typedef struct { - [ignore] db_record *db_rec; [range(1, 1024)] uint32 num_nodes; smbXsrv_version_node0 nodes[num_nodes]; } smbXsrv_version_global0; @@ -73,10 +72,6 @@ interface smbXsrv [switch_is(version)] smbXsrv_version_globalU info; } smbXsrv_version_globalB; - void smbXsrv_version_global_decode( - [in] smbXsrv_version_globalB blob - ); - /* client */ typedef struct { @@ -101,10 +96,6 @@ interface smbXsrv [switch_is(version)] smbXsrv_client_globalU info; } smbXsrv_client_globalB; - void smbXsrv_client_global_decode( - [in] smbXsrv_client_globalB blob - ); - typedef [public] struct { [ignore] smbXsrv_client_table *table; [ignore] struct tevent_context *raw_ev_ctx; @@ -162,10 +153,6 @@ interface smbXsrv [switch_is(version)] smbXsrv_clientU info; } smbXsrv_clientB; - void smbXsrv_client_decode( - [in] smbXsrv_clientB blob - ); - /* * smbXsrv_connection_pass is used in the MSG_SMBXSRV_CONNECTION_PASS * message and echo'ed as MSG_SMBXSRV_CONNECTION_PASSED message with @@ -191,10 +178,6 @@ interface smbXsrv [switch_is(version)] smbXsrv_connection_passU info; } smbXsrv_connection_passB; - void smbXsrv_connection_pass_decode( - [in] smbXsrv_connection_passB blob - ); - /* * smbXsrv_connection_drop is used in the MSG_SMBXSRV_CONNECTION_DROP * message as reaction the record is deleted. @@ -218,10 +201,6 @@ interface smbXsrv [switch_is(version)] smbXsrv_connection_dropU info; } smbXsrv_connection_dropB; - void smbXsrv_connection_drop_decode( - [in] smbXsrv_connection_dropB blob - ); - /* sessions */ typedef [public,bitmap8bit] bitmap { @@ -294,10 +273,6 @@ interface smbXsrv [switch_is(version)] smbXsrv_session_globalU info; } smbXsrv_session_globalB; - void smbXsrv_session_global_decode( - [in] smbXsrv_session_globalB blob - ); - /* * The main server code should just work with * 'struct smbXsrv_session' and never use @@ -353,12 +328,8 @@ interface smbXsrv [switch_is(version)] smbXsrv_sessionU info; } smbXsrv_sessionB; - void smbXsrv_session_decode( - [in] smbXsrv_sessionB blob - ); - /* - * smbXsrv_session_close is use in the MSG_SMBXSRV_SESSION_CLOSE + * smbXsrv_session_close is used in the MSG_SMBXSRV_SESSION_CLOSE * message */ typedef struct { @@ -379,10 +350,6 @@ interface smbXsrv [switch_is(version)] smbXsrv_session_closeU info; } smbXsrv_session_closeB; - void smbXsrv_session_close_decode( - [in] smbXsrv_session_closeB blob - ); - /* tree connects */ typedef struct { @@ -411,10 +378,6 @@ interface smbXsrv [switch_is(version)] smbXsrv_tcon_globalU info; } smbXsrv_tcon_globalB; - void smbXsrv_tcon_global_decode( - [in] smbXsrv_tcon_globalB blob - ); - /* * The main server code should just work with * 'struct smbXsrv_tcon' and never use @@ -448,10 +411,6 @@ interface smbXsrv [switch_is(version)] smbXsrv_tconU info; } smbXsrv_tconB; - void smbXsrv_tcon_decode( - [in] smbXsrv_tconB blob - ); - /* open files */ typedef [public,bitmap8bit] bitmap { @@ -496,10 +455,6 @@ interface smbXsrv [switch_is(version)] smbXsrv_open_globalU info; } smbXsrv_open_globalB; - void smbXsrv_open_global_decode( - [in] smbXsrv_open_globalB blob - ); - /* * The main server code should just work with * 'struct smbXsrv_open' and never use @@ -536,10 +491,6 @@ interface smbXsrv [switch_is(version)] smbXsrv_openU info; } smbXsrv_openB; - void smbXsrv_open_decode( - [in] smbXsrv_openB blob - ); - const uint32 SMBXSRV_OPEN_REPLAY_CACHE_FIXED_SIZE = 28; typedef [public] struct { GUID holder_req_guid; diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index cc1b4d40044..1ff3973bb39 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -3509,7 +3509,7 @@ NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, } #if defined(O_SYNC) - if ((flags & O_SYNC) == O_SYNC) { + if (flags & O_SYNC) { dos_deny |= (1<<14); } #endif /* O_SYNC */ diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index c6e6ecd26c4..9d3f5843f43 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -1974,7 +1974,7 @@ static const char *shadow_copy2_find_snapdir(TALLOC_CTX *mem_ctx, config = priv->config; /* - * If the non-snapdisrseverywhere mode, we should not search! + * If the non-snapdirseverywhere mode, we should not search! */ if (!config->snapdirseverywhere) { return config->snapshot_basepath; diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c index 27a4d27c695..e6c1fa72dcb 100644 --- a/source3/smbd/conn.c +++ b/source3/smbd/conn.c @@ -70,6 +70,20 @@ bool conn_snum_used(struct smbd_server_connection *sconn, -- Samba Shared Repository