The branch, master has been updated via 6bf51860a00 smbd: Remove unused [push_pull]_file_id_24 via 5ef6a8a01f4 smbd: Use struct oplock_break_message for MSG_SMB_KERNEL_BREAK via 7d860a73ca4 smbd: Remove message_to_share_mode_entry and vice versa via 037b9dac21b smbd: Use struct oplock_break_message for MSG_CLOSE_FILE via e2201a8dff3 smbd: Fix a typo via 8f1cc217a89 smbd: Simplify sending oplock_break_message via 4fe0808ebed lib: Convert push_file_id_16 to take uint8_t instead of char via e889d76fad0 vfs: Convert return_data from char * to uint8_t via 6f2aa43a3fe passdb: Use getline(3) to read our old machine sid via 30b7cf9b3c0 pylibsmb: Avoid talloc() via 3f17f194294 pylibsmb: clang-format for the calls to Py_BuildValue() via 8ef24d670b7 pylibsmb: Return reparse_tag from directory listing via ceea95af632 libsmb: Slightly simplify py_cli_list() via 5d51be58914 smbd: Fix a copy&paste error in smbXsrv_client_remove() via c2b80caf5ed smbd: Use direct struct initialization in smbXsrv_client via 60b724a7e59 smbd: Save a few lines in smbXsrv_client_global_init() via 7b4ab077c8d smbd: Do an early TALLOC_FREE in smbXsrv_client_global_init() via 45200770fe6 smbd: Simplify smbXsrv_open_clear_replay_cache() via e5596cf4a6a smbd: Simplify smbXsrv_open_purge_replay_cache() via 647d2c6481c smbd: Simplify an if-condition via 56814d3ee25 smbd: Some README.Coding in smbXsrv_session via 1656cb19010 lib: Fix whitespace via debb5894847 libsmb: Remove unused setup_stat_from_stat_ex() via fba4e66df51 smbd: Save a few bytes of .text from d650f884ec1 lib:ldb: Use correct integer types for sizes
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 6bf51860a0071b5834c68b463cbdc31d2c04a4c0 Author: Volker Lendecke <v...@samba.org> Date: Tue Apr 30 11:43:58 2024 +0200 smbd: Remove unused [push_pull]_file_id_24 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 30 23:48:21 UTC 2024 on atb-devel-224 commit 5ef6a8a01f43c2d962086ce2bb6c4f34c44e42ae Author: Volker Lendecke <v...@samba.org> Date: Tue Apr 30 11:41:50 2024 +0200 smbd: Use struct oplock_break_message for MSG_SMB_KERNEL_BREAK Signed-off-by: Volker Lendecke <v...@samba.org> commit 7d860a73ca48819e80fc8690ae8cfb5b628ace0a Author: Volker Lendecke <v...@samba.org> Date: Tue Apr 30 10:37:06 2024 +0200 smbd: Remove message_to_share_mode_entry and vice versa Used only for closing files from rpc srvsvc these days Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 037b9dac21b4aabcc56169b533cbed749e6fee6c Author: Volker Lendecke <v...@samba.org> Date: Tue Apr 30 10:35:06 2024 +0200 smbd: Use struct oplock_break_message for MSG_CLOSE_FILE We only need to transmit the file_id and share_file_id. Next patch will show why :-) Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e2201a8dff30666b5f8f9ca340039c3c6acd9bd4 Author: Volker Lendecke <v...@samba.org> Date: Tue Apr 30 10:31:37 2024 +0200 smbd: Fix a typo Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 8f1cc217a8909d56adc9279adf9e301a95b52716 Author: Volker Lendecke <v...@samba.org> Date: Mon Apr 29 11:38:18 2024 +0200 smbd: Simplify sending oplock_break_message This is fixed length of 33 bytes, no need to talloc Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 4fe0808ebedd7812cf7097d4d6c3d697e8cebb68 Author: Volker Lendecke <v...@samba.org> Date: Sun Apr 28 19:51:25 2024 +0200 lib: Convert push_file_id_16 to take uint8_t instead of char All callers had a cast from uint8_t to char, avoid those. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e889d76fad07645b8279d149d1519f0d7feb25e6 Author: Volker Lendecke <v...@samba.org> Date: Sun Apr 28 19:43:36 2024 +0200 vfs: Convert return_data from char * to uint8_t Prepares for a small simplification in the next patch Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 6f2aa43a3fe722b93eb68a5bb9ae6d4253a352df Author: Volker Lendecke <v...@samba.org> Date: Wed Apr 10 14:45:56 2024 +0200 passdb: Use getline(3) to read our old machine sid Don't read the whole file. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 30b7cf9b3c0c0968166811313aa48b1eedcad67a Author: Volker Lendecke <v...@samba.org> Date: Sun Apr 28 16:29:23 2024 +0200 pylibsmb: Avoid talloc() dom_sid_string() does an implicit talloc_strdup() which is not necessary here. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 3f17f1942941d8c4dfc54a8d8ac62c77476194a1 Author: Volker Lendecke <v...@samba.org> Date: Sun Apr 28 16:24:31 2024 +0200 pylibsmb: clang-format for the calls to Py_BuildValue() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 8ef24d670b7d130f14dc3639c0359cdb5de48fc7 Author: Volker Lendecke <v...@samba.org> Date: Sun Apr 28 16:21:44 2024 +0200 pylibsmb: Return reparse_tag from directory listing Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit ceea95af632cc1a7bec6c32c7b0daa54bf3d26c0 Author: Volker Lendecke <v...@samba.org> Date: Sun Apr 28 16:07:44 2024 +0200 libsmb: Slightly simplify py_cli_list() We don't need an & to take a function pointer Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 5d51be5891478ec5e5cd338404eeeae8d7d2b39c Author: Volker Lendecke <v...@samba.org> Date: Fri Feb 9 18:23:35 2024 +0100 smbd: Fix a copy&paste error in smbXsrv_client_remove() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit c2b80caf5edc3b08968704391c66252c73713435 Author: Volker Lendecke <v...@samba.org> Date: Fri Feb 9 18:21:14 2024 +0100 smbd: Use direct struct initialization in smbXsrv_client Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 60b724a7e59da03ec0d4d211c8330bf00b83c9cc Author: Volker Lendecke <v...@samba.org> Date: Fri Feb 9 18:16:26 2024 +0100 smbd: Save a few lines in smbXsrv_client_global_init() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 7b4ab077c8d5372ba187efd3a6a540e15cf6c63a Author: Volker Lendecke <v...@samba.org> Date: Fri Feb 9 18:16:09 2024 +0100 smbd: Do an early TALLOC_FREE in smbXsrv_client_global_init() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 45200770fe6862b609adab3f620ef892bb9c27ff Author: Volker Lendecke <v...@samba.org> Date: Fri Feb 9 13:05:28 2024 +0100 smbd: Simplify smbXsrv_open_clear_replay_cache() GUID_buf_string() is designed to never fail Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e5596cf4a6aa1c1025867fcad75485c87d8efd7f Author: Volker Lendecke <v...@samba.org> Date: Fri Feb 9 13:02:25 2024 +0100 smbd: Simplify smbXsrv_open_purge_replay_cache() GUID_buf_string is supposed to never fail except if the guid passed in is NULL. Our only current caller already checks that. dbwrap_purge_bystring() could actually fail, so put the result into a variable for the debugger. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 647d2c6481c07da70a87116089a4a42b72adbdb1 Author: Volker Lendecke <v...@samba.org> Date: Fri Feb 9 12:37:53 2024 +0100 smbd: Simplify an if-condition (state->current_sid == NULL) is true if and only if we could not assign state->current_sid because num_sids was too small. Make that more explicit. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 56814d3ee2500a36a8d1c3db9e2524dfa91fc229 Author: Volker Lendecke <v...@samba.org> Date: Fri Feb 9 12:34:06 2024 +0100 smbd: Some README.Coding in smbXsrv_session Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 1656cb190102a36f77bab7a8b8184f35a77aa442 Author: Volker Lendecke <v...@samba.org> Date: Wed Apr 17 13:45:08 2024 +0200 lib: Fix whitespace Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit debb5894847751d81b01ec3e16414bf86fa5dd17 Author: Volker Lendecke <v...@samba.org> Date: Thu Jan 18 10:30:21 2024 +0100 libsmb: Remove unused setup_stat_from_stat_ex() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit fba4e66df51e15b1dd8fcf60a18a399e05a7c746 Author: Volker Lendecke <v...@samba.org> Date: Wed Apr 17 11:24:25 2024 +0200 smbd: Save a few bytes of .text Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: lib/util/data_blob.c | 14 +-- source3/include/libsmb_internal.h | 3 - source3/include/smb.h | 41 --------- source3/lib/file_id.c | 29 +------ source3/lib/file_id.h | 4 +- source3/lib/xattr_tdb.c | 4 +- source3/libsmb/libsmb_stat.c | 42 --------- source3/libsmb/pylibsmb.c | 62 ++++++++------ source3/modules/vfs_acl_tdb.c | 6 +- source3/modules/vfs_default.c | 8 +- source3/modules/vfs_streams_depot.c | 2 +- source3/passdb/machine_sid.c | 26 +++--- source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 32 +++++-- source3/smbd/close.c | 26 +++--- source3/smbd/open.c | 15 ++-- source3/smbd/proto.h | 5 -- source3/smbd/smb2_negprot.c | 2 +- source3/smbd/smb2_oplock.c | 138 +++++++++--------------------- source3/smbd/smbXsrv_client.c | 17 ++-- source3/smbd/smbXsrv_open.c | 23 ++--- source3/smbd/smbXsrv_session.c | 17 ++-- 21 files changed, 179 insertions(+), 337 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/util/data_blob.c b/lib/util/data_blob.c index 15582000205..b5b78bc7a8a 100644 --- a/lib/util/data_blob.c +++ b/lib/util/data_blob.c @@ -1,19 +1,19 @@ -/* +/* Unix SMB/CIFS implementation. Easy management of byte-length data Copyright (C) Andrew Tridgell 2001 Copyright (C) Andrew Bartlett 2001 - + 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/>. */ @@ -67,7 +67,7 @@ _PUBLIC_ DATA_BLOB data_blob_talloc_named(TALLOC_CTX *mem_ctx, const void *p, si } /** - construct a zero data blob, using supplied TALLOC_CTX. + construct a zero data blob, using supplied TALLOC_CTX. use this sparingly as it initialises data - better to initialise yourself if you want specific data in the blob **/ @@ -220,7 +220,7 @@ _PUBLIC_ DATA_BLOB data_blob_string_const_null(const char *str) } /** - * Create a new data blob from const data + * Create a new data blob from const data */ _PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length) @@ -267,7 +267,7 @@ _PUBLIC_ bool data_blob_append(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, if ((const uint8_t *)p + length < (const uint8_t *)p) { return false; } - + if (!data_blob_realloc(mem_ctx, blob, new_len)) { return false; } diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h index 113111532e0..df238886036 100644 --- a/source3/include/libsmb_internal.h +++ b/source3/include/libsmb_internal.h @@ -530,9 +530,6 @@ void setup_stat(struct stat *st, struct timespec access_time_ts, struct timespec change_time_ts, struct timespec write_time_ts); -void setup_stat_from_stat_ex(const struct stat_ex *stex, - const char *fname, - struct stat *st); int SMBC_stat_ctx(SMBCCTX *context, diff --git a/source3/include/smb.h b/source3/include/smb.h index aa91e3afcb9..e47ccd66133 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -172,47 +172,6 @@ struct interface { #include "librpc/gen_ndr/server_id.h" -/* oplock break message definition - linearization of share_mode_entry. - -Offset Data length. -0 struct server_id pid 4 -4 uint16_t op_mid 8 -12 uint16_t op_type 2 -14 uint32_t access_mask 4 -18 uint32_t share_access 4 -22 uint32_t private_options 4 -26 uint32_t time sec 4 -30 uint32_t time usec 4 -34 uint64_t dev 8 bytes -42 uint64_t inode 8 bytes -50 uint64_t extid 8 bytes -58 unsigned long file_id 4 bytes -62 uint32_t uid 4 bytes -66 uint16_t flags 2 bytes -68 uint32_t name_hash 4 bytes -72 - -*/ - -#define OP_BREAK_MSG_PID_OFFSET 0 -#define OP_BREAK_MSG_MID_OFFSET 4 -#define OP_BREAK_MSG_OP_TYPE_OFFSET 12 -#define OP_BREAK_MSG_ACCESS_MASK_OFFSET 14 -#define OP_BREAK_MSG_SHARE_ACCESS_OFFSET 18 -#define OP_BREAK_MSG_PRIV_OFFSET 22 -#define OP_BREAK_MSG_TIME_SEC_OFFSET 26 -#define OP_BREAK_MSG_TIME_USEC_OFFSET 30 -#define OP_BREAK_MSG_DEV_OFFSET 34 -#define OP_BREAK_MSG_INO_OFFSET 42 -#define OP_BREAK_MSG_EXTID_OFFSET 50 -#define OP_BREAK_MSG_FILE_ID_OFFSET 58 -#define OP_BREAK_MSG_UID_OFFSET 62 -#define OP_BREAK_MSG_FLAGS_OFFSET 66 -#define OP_BREAK_MSG_NAME_HASH_OFFSET 68 - -#define OP_BREAK_MSG_VNN_OFFSET 72 -#define MSG_SMB_SHARE_MODE_ENTRY_SIZE 76 - #define NT_HASH_LEN 16 #define LM_HASH_LEN 16 diff --git a/source3/lib/file_id.c b/source3/lib/file_id.c index 545437afefa..6ad8751b065 100644 --- a/source3/lib/file_id.c +++ b/source3/lib/file_id.c @@ -46,37 +46,10 @@ char *file_id_str_buf(struct file_id fid, struct file_id_buf *dst) push a 16 byte version of a file id into a buffer. This ignores the extid and is needed when dev/inodes are stored in persistent storage (tdbs). */ -void push_file_id_16(char *buf, const struct file_id *id) +void push_file_id_16(uint8_t *buf, const struct file_id *id) { SIVAL(buf, 0, id->devid&0xFFFFFFFF); SIVAL(buf, 4, id->devid>>32); SIVAL(buf, 8, id->inode&0xFFFFFFFF); SIVAL(buf, 12, id->inode>>32); } - -/* - push a 24 byte version of a file id into a buffer - */ -void push_file_id_24(char *buf, const struct file_id *id) -{ - SIVAL(buf, 0, id->devid&0xFFFFFFFF); - SIVAL(buf, 4, id->devid>>32); - SIVAL(buf, 8, id->inode&0xFFFFFFFF); - SIVAL(buf, 12, id->inode>>32); - SIVAL(buf, 16, id->extid&0xFFFFFFFF); - SIVAL(buf, 20, id->extid>>32); -} - -/* - pull a 24 byte version of a file id from a buffer - */ -void pull_file_id_24(const char *buf, struct file_id *id) -{ - ZERO_STRUCTP(id); - id->devid = IVAL(buf, 0); - id->devid |= ((uint64_t)IVAL(buf,4))<<32; - id->inode = IVAL(buf, 8); - id->inode |= ((uint64_t)IVAL(buf,12))<<32; - id->extid = IVAL(buf, 16); - id->extid |= ((uint64_t)IVAL(buf,20))<<32; -} diff --git a/source3/lib/file_id.h b/source3/lib/file_id.h index 255b1ddc5c5..82bae6157fe 100644 --- a/source3/lib/file_id.h +++ b/source3/lib/file_id.h @@ -37,8 +37,6 @@ char *file_id_str_buf(struct file_id fid, struct file_id_buf *dst); /* an allocated string for a file_id structure */ -void push_file_id_16(char *buf, const struct file_id *id); -void push_file_id_24(char *buf, const struct file_id *id); -void pull_file_id_24(const char *buf, struct file_id *id); +void push_file_id_16(uint8_t *buf, const struct file_id *id); #endif diff --git a/source3/lib/xattr_tdb.c b/source3/lib/xattr_tdb.c index 564cdd80965..8c1cc7398c1 100644 --- a/source3/lib/xattr_tdb.c +++ b/source3/lib/xattr_tdb.c @@ -109,7 +109,7 @@ static NTSTATUS xattr_tdb_load_attrs(TALLOC_CTX *mem_ctx, TDB_DATA data; /* For backwards compatibility only store the dev/inode. */ - push_file_id_16((char *)id_buf, id); + push_file_id_16(id_buf, id); status = dbwrap_fetch(db_ctx, mem_ctx, make_tdb_data(id_buf, sizeof(id_buf)), @@ -137,7 +137,7 @@ static struct db_record *xattr_tdb_lock_attrs(TALLOC_CTX *mem_ctx, uint8_t id_buf[16]; /* For backwards compatibility only store the dev/inode. */ - push_file_id_16((char *)id_buf, id); + push_file_id_16(id_buf, id); return dbwrap_fetch_locked(db_ctx, mem_ctx, make_tdb_data(id_buf, sizeof(id_buf))); } diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c index ae18f594647..2c5eddbffde 100644 --- a/source3/libsmb/libsmb_stat.c +++ b/source3/libsmb/libsmb_stat.c @@ -114,48 +114,6 @@ void setup_stat(struct stat *st, set_mtimensec(st, write_time_ts.tv_nsec); } -void setup_stat_from_stat_ex(const struct stat_ex *stex, - const char *fname, - struct stat *st) -{ - st->st_atime = stex->st_ex_atime.tv_sec; - set_atimensec(st, stex->st_ex_atime.tv_nsec); - - st->st_ctime = stex->st_ex_ctime.tv_sec; - set_ctimensec(st, stex->st_ex_ctime.tv_nsec); - - st->st_mtime = stex->st_ex_mtime.tv_sec; - set_mtimensec(st, stex->st_ex_mtime.tv_nsec); - - st->st_mode = stex->st_ex_mode; - st->st_size = stex->st_ex_size; -#ifdef HAVE_STAT_ST_BLKSIZE - st->st_blksize = 512; -#endif -#ifdef HAVE_STAT_ST_BLOCKS - st->st_blocks = (st->st_size + 511) / 512; -#endif -#ifdef HAVE_STRUCT_STAT_ST_RDEV - st->st_rdev = 0; -#endif - st->st_uid = stex->st_ex_uid; - st->st_gid = stex->st_ex_gid; - - st->st_nlink = stex->st_ex_nlink; - - if (stex->st_ex_ino == 0) { - st->st_ino = 0; - if (fname != NULL) { - st->st_ino = generate_inode(fname); - } - } else { - st->st_ino = stex->st_ex_ino; - } - - st->st_dev = stex->st_ex_dev; - -} - /* * Routine to stat a file given a name */ diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c index aa87fa0c1a2..767187913f6 100644 --- a/source3/libsmb/pylibsmb.c +++ b/source3/libsmb/pylibsmb.c @@ -1886,6 +1886,7 @@ static NTSTATUS list_posix_helper(struct file_info *finfo, { PyObject *result = (PyObject *)state; PyObject *file = NULL; + struct dom_sid_buf owner_buf, group_buf; int ret; /* @@ -1895,13 +1896,15 @@ static NTSTATUS list_posix_helper(struct file_info *finfo, "s:K,s:K," "s:l,s:l,s:l,s:l," "s:i,s:K,s:i,s:i,s:I," - "s:s,s:s}", - "name", finfo->name, - "attrib", finfo->attr, - - "size", finfo->size, - "allocaction_size", finfo->allocated_size, - + "s:s,s:s,s:k}", + "name", + finfo->name, + "attrib", + finfo->attr, + "size", + finfo->size, + "allocaction_size", + finfo->allocated_size, "btime", convert_timespec_to_time_t(finfo->btime_ts), "atime", @@ -1910,17 +1913,22 @@ static NTSTATUS list_posix_helper(struct file_info *finfo, convert_timespec_to_time_t(finfo->mtime_ts), "ctime", convert_timespec_to_time_t(finfo->ctime_ts), - - "perms", finfo->st_ex_mode, - "ino", finfo->ino, - "dev", finfo->st_ex_dev, - "nlink", finfo->st_ex_nlink, - "reparse_tag", finfo->reparse_tag, - + "perms", + finfo->st_ex_mode, + "ino", + finfo->ino, + "dev", + finfo->st_ex_dev, + "nlink", + finfo->st_ex_nlink, + "reparse_tag", + finfo->reparse_tag, "owner_sid", - dom_sid_string(finfo, &finfo->owner_sid), + dom_sid_str_buf(&finfo->owner_sid, &owner_buf), "group_sid", - dom_sid_string(finfo, &finfo->group_sid)); + dom_sid_str_buf(&finfo->group_sid, &group_buf), + "reparse_tag", + (unsigned long)finfo->reparse_tag); if (file == NULL) { return NT_STATUS_NO_MEMORY; } @@ -1954,13 +1962,19 @@ static NTSTATUS list_helper(struct file_info *finfo, * Build a dictionary representing the file info. * Note: Windows does not always return short_name (so it may be None) */ - file = Py_BuildValue("{s:s,s:i,s:s,s:O,s:l}", - "name", finfo->name, - "attrib", (int)finfo->attr, - "short_name", finfo->short_name, - "size", size, + file = Py_BuildValue("{s:s,s:i,s:s,s:O,s:l,s:k}", + "name", + finfo->name, + "attrib", + (int)finfo->attr, + "short_name", + finfo->short_name, + "size", + size, "mtime", - convert_timespec_to_time_t(finfo->mtime_ts)); + convert_timespec_to_time_t(finfo->mtime_ts), + "reparse_tag", + (unsigned long)finfo->reparse_tag); Py_CLEAR(size); @@ -2077,7 +2091,7 @@ static PyObject *py_cli_list(struct py_cli_state *self, const char *kwlist[] = { "directory", "mask", "attribs", "info_level", NULL }; NTSTATUS (*callback_fn)(struct file_info *, const char *, void *) = - &list_helper; + list_helper; if (!ParseTupleAndKeywords(args, kwds, "z|sII:list", kwlist, &base_dir, &user_mask, &attribute, @@ -2099,7 +2113,7 @@ static PyObject *py_cli_list(struct py_cli_state *self, } if (info_level == SMB2_FIND_POSIX_INFORMATION) { - callback_fn = &list_posix_helper; + callback_fn = list_posix_helper; } status = do_listing(self, base_dir, user_mask, attribute, info_level, callback_fn, result); diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c index bccb1ab0bec..5ecba7ba757 100644 --- a/source3/modules/vfs_acl_tdb.c +++ b/source3/modules/vfs_acl_tdb.c @@ -102,7 +102,7 @@ static NTSTATUS acl_tdb_delete(vfs_handle_struct *handle, uint8_t id_buf[16]; /* For backwards compatibility only store the dev/inode. */ - push_file_id_16((char *)id_buf, &id); + push_file_id_16(id_buf, &id); status = dbwrap_delete(db, make_tdb_data(id_buf, sizeof(id_buf))); return status; @@ -131,7 +131,7 @@ static NTSTATUS fget_acl_blob(TALLOC_CTX *ctx, id = vfs_file_id_from_sbuf(handle->conn, &fsp->fsp_name->st); /* For backwards compatibility only store the dev/inode. */ - push_file_id_16((char *)id_buf, &id); + push_file_id_16(id_buf, &id); status = dbwrap_fetch(db, ctx, @@ -179,7 +179,7 @@ static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle, id = vfs_file_id_from_sbuf(handle->conn, &fsp->fsp_name->st); /* For backwards compatibility only store the dev/inode. */ - push_file_id_16((char *)id_buf, &id); + push_file_id_16(id_buf, &id); status = dbwrap_store( db, make_tdb_data(id_buf, sizeof(id_buf)), data, 0); diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 62ad5063af0..379802fc547 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1478,7 +1478,7 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle, case FSCTL_CREATE_OR_GET_OBJECT_ID: { unsigned char objid[16]; - char *return_data = NULL; + uint8_t *return_data = NULL; /* This should return the object-id on this file. * I think I'll make this be the inode+dev. JRA. @@ -1490,7 +1490,7 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle, *out_len = MIN(max_out_len, 64); /* Hmmm, will this cause problems if less data asked for? */ - return_data = talloc_array(ctx, char, 64); + return_data = talloc_array(ctx, uint8_t, 64); if (return_data == NULL) { return NT_STATUS_NO_MEMORY; } @@ -1498,9 +1498,9 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle, /* For backwards compatibility only store the dev/inode. */ push_file_id_16(return_data, &fsp->file_id); memcpy(return_data+16,create_volume_objectid(fsp->conn,objid),16); - push_file_id_16(return_data+32, &fsp->file_id); + push_file_id_16(return_data + 32, &fsp->file_id); memset(return_data+48, 0, 16); - *out_data = return_data; + *_out_data = return_data; return NT_STATUS_OK; } diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c index f9701cc66ed..1221b2c2be2 100644 --- a/source3/modules/vfs_streams_depot.c +++ b/source3/modules/vfs_streams_depot.c @@ -215,7 +215,7 @@ static char *stream_dir(vfs_handle_struct *handle, id = SMB_VFS_FILE_ID_CREATE(handle->conn, &base_sbuf_tmp); - push_file_id_16((char *)id_buf, &id); + push_file_id_16(id_buf, &id); hash = hash_fn(data_blob_const(id_buf, sizeof(id_buf))); diff --git a/source3/passdb/machine_sid.c b/source3/passdb/machine_sid.c index 16ef6ce266c..c6b8ed403ea 100644 --- a/source3/passdb/machine_sid.c +++ b/source3/passdb/machine_sid.c @@ -21,7 +21,6 @@ */ #include "includes.h" -#include "lib/util/util_file.h" #include "passdb/machine_sid.h" #include "secrets.h" #include "dbwrap/dbwrap.h" @@ -42,19 +41,24 @@ static struct dom_sid *global_sam_sid=NULL; static bool read_sid_from_file(const char *fname, struct dom_sid *sid) { - char **lines; - int numlines; - bool ret; - - lines = file_lines_load(fname, &numlines,0, NULL); + char *line = NULL; + size_t n; + ssize_t len; + bool ret = false; + FILE *f = NULL; + + f = fopen(fname, "r"); + if (f == NULL) { + return false; + } - if (!lines || numlines < 1) { - TALLOC_FREE(lines); - return False; + len = getline(&line, &n, f); + if (len >= 0) { + ret = string_to_sid(sid, line); + SAFE_FREE(line); } - ret = string_to_sid(sid, lines[0]); - TALLOC_FREE(lines); + fclose(f); return ret; } diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 29d224c427d..1129576f751 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -30,6 +30,7 @@ #include "librpc/rpc/dcesrv_core.h" #include "librpc/gen_ndr/ndr_srvsvc.h" #include "librpc/gen_ndr/ndr_srvsvc_scompat.h" +#include "librpc/gen_ndr/ndr_open_files.h" #include "../libcli/security/security.h" #include "../librpc/gen_ndr/ndr_security.h" -- Samba Shared Repository