The branch, master has been updated via e0d9e285921 selftest/Samba4: make use of get_cmd_env_vars() to setup all relevant env variables via 83030780285 s4:dsdb/repl: let drepl_out_helpers.c always go via dreplsrv_out_drsuapi_send() via 5abeb724d74 s3:smbcacls: fix ace_compare via c7299556845 lib/fuzzing: fuzz_stable_sort_r_unstable tries to catch overrun via 99d26221311 spelling: comments: synthax -> syntax via 64003d86778 spelling: fix spelling of privilege.ldb in comments via 94b8deffa2d libsmb: Remove file_info->[ug]id via f2b692fb458 smbd: Simplify request_timed_out via 0fe1a6e9dac lib: Use struct initialization via c443d377a0b libsmb: Remove a talloc_strdup() via 335877ec04c libsmb: Remove an unneeded NULL check via 5384244f760 libsmb: Remove unused cli_list_trans() via e79698c4be6 libsmb: Use SMB2_0_INFO_ constants instead of magic numbers via 7ecf3b0e25c libsmb: Execute a "TODO", remove IVAL2_TO_SMB_BIG_UINT via 27ac0beaa01 lib: Fix a typo via 0013105eb55 libsmb: Avoid pointless intermediate variables via 06a322a17f8 libsmb: Use the direct FSCC_ infolevels via dd1dd65026e smbd: Remove an unused function parameter via f69fe79189e smbd: Remove an unnecessary else via ff43158c528 smbd: Remove a no-op call to init_strict_lock_struct via 661532c46c0 smbd: Remove an unnecessary else branch via 6f0628c8485 smbd: Return correct error for fallback sendfile via 9115836687f smbd: Use direct struct initialization via 979f3e23990 smbd: Remove the ZERO_ZERO define via 3542f938c53 smbd: Fix whitespace via a8b9a8358e2 smbd: Move a DBG_DEBUG up via 477dec3770b smbd: Modernize a few DEBUGs from bdfbf25255e test_kinit_export_keytab: reset pw of the test account and test --only-current-keys
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit e0d9e285921ce841e4872aadc6e4750b2ad48973 Author: Stefan Metzmacher <me...@samba.org> Date: Tue May 14 16:55:58 2024 +0200 selftest/Samba4: make use of get_cmd_env_vars() to setup all relevant env variables Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> Autobuild-User(master): Andrew Bartlett <abart...@samba.org> Autobuild-Date(master): Wed May 22 05:26:48 UTC 2024 on atb-devel-224 commit 83030780285290ecf64b57c1744634379b68ea01 Author: Stefan Metzmacher <me...@samba.org> Date: Tue Feb 6 21:09:58 2024 +0100 s4:dsdb/repl: let drepl_out_helpers.c always go via dreplsrv_out_drsuapi_send() I have customer backtraces showing that 'drsuapi' is NULL in dreplsrv_op_pull_source_get_changes_trigger() called from the WERR_DS_DRA_SCHEMA_MISMATCH retry case of dreplsrv_op_pull_source_apply_changes_trigger(), while 'drsuapi' was a valid pointer there. From reading the code I don't understand how this can happen, but it does very often on RODCs. And this fix prevents the problem. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15573 Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 5abeb724d74af2b861f2ee6bc27762bb5bf07bca Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Tue May 21 20:20:36 2024 +1200 s3:smbcacls: fix ace_compare We got this wrong in commit 31101a9fa1503be9d8137e42466f57d85136a156. In fact, we should probably not reorder the inherited ACLs, but that is for another patch series. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15625 Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit c7299556845a764c7ca6195ede3f273bc20ebfbb Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Tue May 14 14:58:51 2024 +1200 lib/fuzzing: fuzz_stable_sort_r_unstable tries to catch overrun Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 99d2622131161d7d597f5b0a9e2b509817483217 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Wed Apr 10 21:25:12 2024 +1200 spelling: comments: synthax -> syntax Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 64003d867786231c130b13f6d84f9d248631d3be Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Wed Apr 10 21:22:57 2024 +1200 spelling: fix spelling of privilege.ldb in comments 'privileges' is a word, but the ldb referred to is privilege.ldb Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 94b8deffa2d8af39309a94d94f4c0c97ea85265b Author: Volker Lendecke <v...@samba.org> Date: Tue May 21 11:21:03 2024 +0200 libsmb: Remove file_info->[ug]id These fields were never assigned Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit f2b692fb458f0253adcb8b7ae2b9eb99346559fb Author: Volker Lendecke <v...@samba.org> Date: Tue May 21 08:38:19 2024 +0200 smbd: Simplify request_timed_out timeval_expired does what we need here Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 0fe1a6e9dac928dec9875981b9d299e5e7cc0496 Author: Volker Lendecke <v...@samba.org> Date: Tue May 21 08:31:45 2024 +0200 lib: Use struct initialization Make sure everything is initialized Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit c443d377a0b61d65996374e336da69a4ec800f43 Author: Volker Lendecke <v...@samba.org> Date: Mon May 20 15:19:06 2024 +0200 libsmb: Remove a talloc_strdup() We're directly overwriting state->mask without actually using it for anything real. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 335877ec04c759b49383c2e3809023a82510abac Author: Volker Lendecke <v...@samba.org> Date: Mon May 20 10:38:47 2024 +0200 libsmb: Remove an unneeded NULL check We have dereferenced p_last_name_raw before in the call to data_blob_free, our only caller does give us a pointer Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 5384244f760905ea2201d9c15be62d19969480ef Author: Volker Lendecke <v...@samba.org> Date: Mon May 20 10:06:46 2024 +0200 libsmb: Remove unused cli_list_trans() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit e79698c4be6a092ec2fb32037040201cd583aeee Author: Volker Lendecke <v...@samba.org> Date: Fri May 17 12:32:20 2024 +0200 libsmb: Use SMB2_0_INFO_ constants instead of magic numbers Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 7ecf3b0e25c5607bcae50a42ee33164ffe118868 Author: Volker Lendecke <v...@samba.org> Date: Fri May 17 16:05:19 2024 +0200 libsmb: Execute a "TODO", remove IVAL2_TO_SMB_BIG_UINT Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 27ac0beaa0140d55fcf01bd123904414e5071bfd Author: Volker Lendecke <v...@samba.org> Date: Fri May 17 16:07:44 2024 +0200 lib: Fix a typo Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 0013105eb55a9f0771c1980f27ef67d6cc2fd78a Author: Volker Lendecke <v...@samba.org> Date: Fri May 17 12:28:53 2024 +0200 libsmb: Avoid pointless intermediate variables Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 06a322a17f8c170caf3e778125bcf66325eb58f4 Author: Volker Lendecke <v...@samba.org> Date: Fri May 17 12:23:19 2024 +0200 libsmb: Use the direct FSCC_ infolevels Could have done this as part of 1776918c5bf already. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit dd1dd65026e7e658ec753d651f50ef2c4920cfc6 Author: Volker Lendecke <v...@samba.org> Date: Thu May 16 12:59:28 2024 +0200 smbd: Remove an unused function parameter Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit f69fe79189e42a1336a974ae7630c7be6543f645 Author: Volker Lendecke <v...@samba.org> Date: Thu May 16 12:49:17 2024 +0200 smbd: Remove an unnecessary else Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit ff43158c5286f664f4eefd0b8e135960aa2d1109 Author: Volker Lendecke <v...@samba.org> Date: Thu May 16 12:05:38 2024 +0200 smbd: Remove a no-op call to init_strict_lock_struct "lock" is a variable on the stack, and initializing it is all that init_strict_lock_struct does. We've done the corresponding checks already in smbd_smb2_read_send Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 661532c46c04bb4f80865874749b1e75671885d8 Author: Volker Lendecke <v...@samba.org> Date: Thu May 16 12:04:23 2024 +0200 smbd: Remove an unnecessary else branch We return in the if branch, review with "git show -w" Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 6f0628c8485c6c258ea8733a9cfc6ca0bb89e48b Author: Volker Lendecke <v...@samba.org> Date: Tue May 21 10:12:22 2024 +0200 smbd: Return correct error for fallback sendfile Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 9115836687f7980d4a1a0cea38262a7956e354fe Author: Volker Lendecke <v...@samba.org> Date: Thu May 16 12:03:46 2024 +0200 smbd: Use direct struct initialization Make sure all fields in the target struct are initialized Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 979f3e239906b2a6b5d648bbed6241f327fd7075 Author: Volker Lendecke <v...@samba.org> Date: Wed May 15 17:26:27 2024 +0200 smbd: Remove the ZERO_ZERO define This code went in with e8e98c9ea06 in 2001 without any mention in the commit message. I don't remember all details, but there was some discussion around the offset=0,length=0 lock being somehow special. These days [MS-FSA] defines the required behaviour (don't conflict) and we implement that behaviour. If someone still remembers why this code is in and thinks it's worthwhile, that's what version control is for. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 3542f938c5368f41682b3503bbf3a4dc07ef6fd9 Author: Volker Lendecke <v...@samba.org> Date: Wed May 15 17:14:55 2024 +0200 smbd: Fix whitespace Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit a8b9a8358e22cd8daae19cf864b67eb9dead0a7e Author: Volker Lendecke <v...@samba.org> Date: Thu May 16 15:27:05 2024 +0200 smbd: Move a DBG_DEBUG up Make it line up with the other branches Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 477dec3770bbb30616b5e58f397f7541dc520abb Author: Volker Lendecke <v...@samba.org> Date: Wed May 15 17:10:24 2024 +0200 smbd: Modernize a few DEBUGs Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> ----------------------------------------------------------------------- Summary of changes: examples/fuse/clifuse.c | 2 +- lib/fuzzing/fuzz_stable_sort_r_unstable.c | 13 ++- lib/util/time.c | 4 +- librpc/idl/security.idl | 2 +- selftest/target/Samba4.pm | 13 ++- source3/include/client.h | 2 - source3/include/includes.h | 1 - source3/lib/util_str.c | 2 +- source3/libsmb/cli_smb2_fnum.c | 139 +++++++++++++-------------- source3/libsmb/clifile.c | 12 +-- source3/libsmb/clilist.c | 66 ++----------- source3/libsmb/clirap.c | 12 +-- source3/libsmb/libsmb_dir.c | 2 - source3/libsmb/proto.h | 7 -- source3/locking/brlock.c | 88 ----------------- source3/locking/locking.c | 18 ++-- source3/locking/posix.c | 51 +++++----- source3/smbd/open.c | 6 +- source3/smbd/smb1_reply.c | 23 ++--- source3/smbd/smb2_read.c | 80 +++++++-------- source3/smbd/smb2_trans2.c | 42 ++++---- source3/utils/smbcacls.c | 2 +- source4/dsdb/repl/drepl_out_helpers.c | 26 +++-- source4/scripting/bin/samba_upgradeprovision | 6 +- 24 files changed, 235 insertions(+), 384 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/fuse/clifuse.c b/examples/fuse/clifuse.c index 59af1602980..dd4aa6d3838 100644 --- a/examples/fuse/clifuse.c +++ b/examples/fuse/clifuse.c @@ -506,7 +506,7 @@ static NTSTATUS parse_finfo_id_both_directory_info(uint8_t *dir_data, finfo->atime_ts = interpret_long_date(BVAL(dir_data, 16)); finfo->mtime_ts = interpret_long_date(BVAL(dir_data, 24)); finfo->ctime_ts = interpret_long_date(BVAL(dir_data, 32)); - finfo->size = IVAL2_TO_SMB_BIG_UINT(dir_data + 40, 0); + finfo->size = BVAL(dir_data + 40, 0); finfo->attr = IVAL(dir_data + 56, 0); namelen = IVAL(dir_data + 60,0); if (namelen > (dir_data_length - 104)) { diff --git a/lib/fuzzing/fuzz_stable_sort_r_unstable.c b/lib/fuzzing/fuzz_stable_sort_r_unstable.c index 45abc6a535c..68174ee460e 100644 --- a/lib/fuzzing/fuzz_stable_sort_r_unstable.c +++ b/lib/fuzzing/fuzz_stable_sort_r_unstable.c @@ -85,9 +85,18 @@ int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) len--; memcpy(buf2, buf, len); - - stable_sort_r(buf2, aux, len, 1, + stable_sort_r(buf2, aux, len - 1, 1, (samba_compare_with_context_fn_t)cmp_int8, &context); + + /* + * We sorted all but the last element, which should remain unchanged. + * buf2[-1] should also be unchanged, but the sanitizers will catch + * that one. + */ + if (buf2[len - 1] != buf[len - 1]) { + abort(); + } + return 0; } diff --git a/lib/util/time.c b/lib/util/time.c index d2bf2454e31..7ed8fb00447 100644 --- a/lib/util/time.c +++ b/lib/util/time.c @@ -102,9 +102,7 @@ time_t convert_timespec_to_time_t(struct timespec ts) struct timespec convert_time_t_to_timespec(time_t t) { - struct timespec ts; - ts.tv_sec = t; - ts.tv_nsec = 0; + struct timespec ts = {.tv_sec = t}; return ts; } diff --git a/librpc/idl/security.idl b/librpc/idl/security.idl index d5e65032652..edeed285943 100644 --- a/librpc/idl/security.idl +++ b/librpc/idl/security.idl @@ -490,7 +490,7 @@ interface security /* Bitmap of privilege values for internal use only. We need * our own bitmap here as privileges.tdb records these values - * as a bitmap (privileges.ldb uses the string forms). + * as a bitmap (privilege.ldb uses the string forms). */ typedef [bitmap64bit] bitmap { SEC_PRIV_MACHINE_ACCOUNT_BIT = 0x00000010, diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index f52d6740c6e..4b289fb27ae 100755 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -2604,9 +2604,8 @@ sub setup_fl2008r2dc $trustpw .= "$env->{SOCKET_WRAPPER_DEFAULT_IFACE}"; $trustpw .= "$nt4_dc_vars->{SOCKET_WRAPPER_DEFAULT_IFACE}"; - my $cmd = ""; - $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$env->{SOCKET_WRAPPER_DEFAULT_IFACE}\" "; - $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$env->{SELFTEST_WINBINDD_SOCKET_DIR}\" "; + my $cmd_env = $self->get_cmd_env_vars($env); + my $cmd = $cmd_env; $cmd .= "$net rpc trust create "; $cmd .= "otherdomainsid=$nt4_dc_vars->{SAMSID} "; $cmd .= "otherdomain=$nt4_dc_vars->{DOMAIN} "; @@ -2620,9 +2619,8 @@ sub setup_fl2008r2dc return undef; } - $cmd = ""; - $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$nt4_dc_vars->{SOCKET_WRAPPER_DEFAULT_IFACE}\" "; - $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$nt4_dc_vars->{SELFTEST_WINBINDD_SOCKET_DIR}\" "; + my $nt4_cmd_env = $self->get_cmd_env_vars($nt4_dc_vars); + $cmd = $nt4_cmd_env; $cmd .= "$net rpc trustdom establish $env->{DOMAIN} -U/%$trustpw $nt4_dc_vars->{CONFIGURATION}"; if (system($cmd) != 0) { @@ -2631,7 +2629,8 @@ sub setup_fl2008r2dc } # Reload trusts - $cmd = "$smbcontrol winbindd reload-config $nt4_dc_vars->{CONFIGURATION}"; + $cmd = $nt4_cmd_env; + $cmd .= "$smbcontrol winbindd reload-config $nt4_dc_vars->{CONFIGURATION}"; if (system($cmd) != 0) { warn("add failed\n$cmd"); diff --git a/source3/include/client.h b/source3/include/client.h index e1a394af4b5..3bd441279d5 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -99,8 +99,6 @@ struct file_info { uint64_t size; uint64_t allocated_size; uint32_t attr; - uid_t uid; - gid_t gid; uint64_t ino; /* these times are normally kept in GMT */ struct timespec btime_ts; /* Birth-time if supported by system */ diff --git a/source3/include/includes.h b/source3/include/includes.h index b33f86a9565..b80683d4601 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -165,7 +165,6 @@ typedef sig_atomic_t volatile SIG_ATOMIC_T; /* TODO: remove this macros */ #define SBIG_UINT(p, ofs, v) SBVAL(p, ofs, v) #define BIG_UINT(p, ofs) BVAL(p, ofs) -#define IVAL2_TO_SMB_BIG_UINT(p, ofs) BVAL(p, ofs) /* * Set the define that tells us if we can do 64 bit diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 3ac1e554246..1591420587e 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -124,7 +124,7 @@ bool trim_char(char *s,char cfront,char cback) while ((ep >= fp) && (*ep == cback)) { ret = true; if ((ep > fp) && (((unsigned char)ep[-1]) & 0x80)) { - /* Could be mb... bail back to tim_string. */ + /* Could be mb... bail back to trim_string. */ char fs[2], bs[2]; if (cfront) { fs[0] = cfront; diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c index cea27444b97..7f44435963f 100644 --- a/source3/libsmb/cli_smb2_fnum.c +++ b/source3/libsmb/cli_smb2_fnum.c @@ -710,8 +710,6 @@ struct tevent_req *cli_smb2_delete_on_close_send(TALLOC_CTX *mem_ctx, struct tevent_req *req = NULL; struct cli_smb2_delete_on_close_state *state = NULL; struct tevent_req *subreq = NULL; - uint8_t in_info_type; - uint8_t in_file_info_class; req = tevent_req_create(mem_ctx, &state, struct cli_smb2_delete_on_close_state); @@ -720,26 +718,19 @@ struct tevent_req *cli_smb2_delete_on_close_send(TALLOC_CTX *mem_ctx, } state->cli = cli; - /* - * setinfo on the handle with info_type SMB2_SETINFO_FILE (1), - * level 13 (SMB_FILE_DISPOSITION_INFORMATION - 1000). - */ - in_info_type = 1; - in_file_info_class = SMB_FILE_DISPOSITION_INFORMATION - 1000; /* Setup data array. */ SCVAL(&state->data[0], 0, flag ? 1 : 0); state->inbuf.data = &state->data[0]; state->inbuf.length = 1; - subreq = cli_smb2_set_info_fnum_send( - state, - ev, - cli, - fnum, - in_info_type, - in_file_info_class, - &state->inbuf, - 0); + subreq = cli_smb2_set_info_fnum_send(state, + ev, + cli, + fnum, + SMB2_0_INFO_FILE, + FSCC_FILE_DISPOSITION_INFORMATION, + &state->inbuf, + 0); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); } @@ -1344,10 +1335,10 @@ static NTSTATUS parse_finfo_id_both_directory_info(const uint8_t *dir_data, finfo->atime_ts = interpret_long_date(BVAL(dir_data, 16)); finfo->mtime_ts = interpret_long_date(BVAL(dir_data, 24)); finfo->ctime_ts = interpret_long_date(BVAL(dir_data, 32)); - finfo->size = IVAL2_TO_SMB_BIG_UINT(dir_data + 40, 0); - finfo->allocated_size = IVAL2_TO_SMB_BIG_UINT(dir_data + 48, 0); + finfo->size = BVAL(dir_data + 40, 0); + finfo->allocated_size = BVAL(dir_data + 48, 0); finfo->attr = IVAL(dir_data + 56, 0); - finfo->ino = IVAL2_TO_SMB_BIG_UINT(dir_data + 96, 0); + finfo->ino = BVAL(dir_data + 96, 0); namelen = IVAL(dir_data + 60,0); if (namelen > (dir_data_length - 104)) { return NT_STATUS_INFO_LENGTH_MISMATCH; @@ -2437,12 +2428,12 @@ NTSTATUS cli_smb2_setatr(struct cli_state *cli, SBVAL(inbuf.data, 8, 0xFFFFFFFFFFFFFFFFLL); SBVAL(inbuf.data, 24, 0xFFFFFFFFFFFFFFFFLL); - return cli_smb2_setpathinfo(cli, - name, - 1, /* in_info_type */ - /* in_file_info_class */ - SMB_FILE_BASIC_INFORMATION - 1000, - &inbuf); + return cli_smb2_setpathinfo( + cli, + name, + SMB2_0_INFO_FILE, /* in_info_type */ + FSCC_FILE_BASIC_INFORMATION, /* in_file_info_class */ + &inbuf); } @@ -2486,13 +2477,13 @@ NTSTATUS cli_smb2_setattrE(struct cli_state *cli, put_long_date((char *)inbuf.data + 16, write_time); } - status = cli_smb2_set_info_fnum(cli, - fnum, - 1, /* in_info_type */ - SMB_FILE_BASIC_INFORMATION - - 1000, /* in_file_info_class */ - &inbuf, /* in_input_buffer */ - 0); /* in_additional_info */ + status = cli_smb2_set_info_fnum( + cli, + fnum, + SMB2_0_INFO_FILE, /* in_info_type */ + FSCC_FILE_BASIC_INFORMATION, /* in_file_info_class */ + &inbuf, /* in_input_buffer */ + 0); /* in_additional_info */ cli->raw_status = status; return status; } @@ -2647,12 +2638,12 @@ NTSTATUS cli_smb2_get_fs_full_size_info(struct cli_state *cli, status = cli_smb2_query_info_fnum( cli, fnum, - SMB2_0_INFO_FILESYSTEM, /* in_info_type */ - SMB_FS_FULL_SIZE_INFORMATION - 1000, /* in_file_info_class */ - 0xFFFF, /* in_max_output_length */ - NULL, /* in_input_buffer */ - 0, /* in_additional_info */ - 0, /* in_flags */ + SMB2_0_INFO_FILESYSTEM, /* in_info_type */ + FSCC_FS_FULL_SIZE_INFORMATION, /* in_file_info_class */ + 0xFFFF, /* in_max_output_length */ + NULL, /* in_input_buffer */ + 0, /* in_additional_info */ + 0, /* in_flags */ frame, &outbuf); if (!NT_STATUS_IS_OK(status)) { @@ -2812,11 +2803,11 @@ NTSTATUS cli_smb2_get_fs_volume_info(struct cli_state *cli, fnum, SMB2_0_INFO_FILESYSTEM, /* in_info_type */ /* in_file_info_class */ - SMB_FS_VOLUME_INFORMATION - 1000, + FSCC_FS_VOLUME_INFORMATION, 0xFFFF, /* in_max_output_length */ - NULL, /* in_input_buffer */ - 0, /* in_additional_info */ - 0, /* in_flags */ + NULL, /* in_input_buffer */ + 0, /* in_additional_info */ + 0, /* in_flags */ frame, &outbuf); if (!NT_STATUS_IS_OK(status)) { @@ -3154,14 +3145,14 @@ static struct tevent_req *cli_smb2_rename_fnum_send( level SMB2_FILE_RENAME_INFORMATION (SMB_FILE_RENAME_INFORMATION - 1000) */ subreq = cli_smb2_set_info_fnum_send( - state, /* mem_ctx */ - ev, /* ev */ - cli, /* cli */ - fnum, /* fnum */ - 1, /* in_info_type */ - SMB_FILE_RENAME_INFORMATION - 1000, /* in_file_info_class */ - &state->inbuf, /* in_input_buffer */ - 0); /* in_additional_info */ + state, /* mem_ctx */ + ev, /* ev */ + cli, /* cli */ + fnum, /* fnum */ + SMB2_0_INFO_FILE, /* in_info_type */ + FSCC_FILE_RENAME_INFORMATION, /* in_file_info_class */ + &state->inbuf, /* in_input_buffer */ + 0); /* in_additional_info */ if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); } @@ -3374,10 +3365,10 @@ NTSTATUS cli_smb2_set_ea_fnum(struct cli_state *cli, status = cli_smb2_set_info_fnum( cli, fnum, - 1, /* in_info_type */ - SMB_FILE_FULL_EA_INFORMATION - 1000, /* in_file_info_class */ - &inbuf, /* in_input_buffer */ - 0); /* in_additional_info */ + SMB2_0_INFO_FILE, /* in_info_type */ + FSCC_FILE_FULL_EA_INFORMATION, /* in_file_info_class */ + &inbuf, /* in_input_buffer */ + 0); /* in_additional_info */ fail: @@ -3483,12 +3474,12 @@ NTSTATUS cli_smb2_get_ea_list_path(struct cli_state *cli, status = cli_smb2_query_info_fnum( cli, fnum, - 1, /* in_info_type */ - SMB_FILE_FULL_EA_INFORMATION - 1000, /* in_file_info_class */ - 0xFFFF, /* in_max_output_length */ - NULL, /* in_input_buffer */ - 0, /* in_additional_info */ - 0, /* in_flags */ + SMB2_0_INFO_FILE, /* in_info_type */ + FSCC_FILE_FULL_EA_INFORMATION, /* in_file_info_class */ + 0xFFFF, /* in_max_output_length */ + NULL, /* in_input_buffer */ + 0, /* in_additional_info */ + 0, /* in_flags */ frame, &outbuf); @@ -3735,12 +3726,12 @@ NTSTATUS cli_smb2_get_fs_quota_info(struct cli_state *cli, status = cli_smb2_query_info_fnum( cli, quota_fnum, - 2, /* in_info_type */ - SMB_FS_QUOTA_INFORMATION - 1000, /* in_file_info_class */ - 0xFFFF, /* in_max_output_length */ - NULL, /* in_input_buffer */ - 0, /* in_additional_info */ - 0, /* in_flags */ + SMB2_0_INFO_FILESYSTEM, /* in_info_type */ + FSCC_FS_QUOTA_INFORMATION, /* in_file_info_class */ + 0xFFFF, /* in_max_output_length */ + NULL, /* in_input_buffer */ + 0, /* in_additional_info */ + 0, /* in_flags */ frame, &outbuf); @@ -3823,10 +3814,10 @@ NTSTATUS cli_smb2_set_fs_quota_info(struct cli_state *cli, status = cli_smb2_set_info_fnum( cli, quota_fnum, - 2, /* in_info_type */ - SMB_FS_QUOTA_INFORMATION - 1000, /* in_file_info_class */ - &inbuf, /* in_input_buffer */ - 0); /* in_additional_info */ + SMB2_0_INFO_FILESYSTEM, /* in_info_type */ + FSCC_FS_QUOTA_INFORMATION, /* in_file_info_class */ + &inbuf, /* in_input_buffer */ + 0); /* in_additional_info */ cleanup: cli->raw_status = status; @@ -4731,9 +4722,9 @@ NTSTATUS cli_smb2_ftruncate(struct cli_state *cli, status = cli_smb2_set_info_fnum( cli, fnum, - 1, /* in_info_type */ - SMB_FILE_END_OF_FILE_INFORMATION-1000, /* in_file_info_class */ - &inbuf, /* in_input_buffer */ + SMB2_0_INFO_FILE, /* in_info_type */ + FSCC_FILE_END_OF_FILE_INFORMATION, /* in_file_info_class */ + &inbuf, /* in_input_buffer */ 0); fail: diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 354d8960dd8..7732cb91279 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -841,10 +841,10 @@ static void cli_posix_stat_done(struct tevent_req *subreq) } /* total size, in bytes */ - sbuf->st_ex_size = IVAL2_TO_SMB_BIG_UINT(data, 0); + sbuf->st_ex_size = BVAL(data, 0); /* number of blocks allocated */ - sbuf->st_ex_blocks = IVAL2_TO_SMB_BIG_UINT(data,8); + sbuf->st_ex_blocks = BVAL(data,8); #if defined (HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE) sbuf->st_ex_blocks /= STAT_ST_BLOCKSIZE; #else @@ -872,7 +872,7 @@ static void cli_posix_stat_done(struct tevent_req *subreq) } #endif /* inode */ - sbuf->st_ex_ino = (SMB_INO_T)IVAL2_TO_SMB_BIG_UINT(data, 76); + sbuf->st_ex_ino = (SMB_INO_T)BVAL(data, 76); /* protection */ sbuf->st_ex_mode |= wire_perms_to_unix(IVAL(data, 84)); @@ -2026,10 +2026,10 @@ static void cli_smb2_hardlink_opened(struct tevent_req *subreq) state->ev, state->cli, state->fnum_src, - 1, /* in_info_type */ - SMB_FILE_LINK_INFORMATION - 1000, /* in_file_info_class */ + SMB2_0_INFO_FILE, /* in_info_type */ + FSCC_FILE_LINK_INFORMATION, /* in_file_info_class */ &inbuf, - 0); /* in_additional_info */ + 0); /* in_additional_info */ if (tevent_req_nomem(subreq, req)) { return; } diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c index 54b46b09e0e..d8951482bac 100644 --- a/source3/libsmb/clilist.c +++ b/source3/libsmb/clilist.c @@ -254,7 +254,7 @@ static size_t interpret_long_filename(TALLOC_CTX *ctx, p += 8; finfo->ctime_ts = interpret_long_date(BVAL(p, 0)); p += 8; - finfo->size = IVAL2_TO_SMB_BIG_UINT(p,0); + finfo->size = BVAL(p,0); p += 8; p += 8; /* alloc size */ finfo->attr = IVAL(p,0); @@ -298,11 +298,10 @@ static size_t interpret_long_filename(TALLOC_CTX *ctx, Namelen doesn't include the terminating unicode null, so copy it here. */ - if (p_last_name_raw) { - *p_last_name_raw = data_blob(NULL, namelen+2); - memcpy(p_last_name_raw->data, p, namelen); - SSVAL(p_last_name_raw->data, namelen, 0); - } + *p_last_name_raw = data_blob(NULL, namelen + 2); + memcpy(p_last_name_raw->data, p, namelen); + SSVAL(p_last_name_raw->data, namelen, 0); + return calc_next_entry_offset(base, pdata_end); } } @@ -668,11 +667,7 @@ static struct tevent_req *cli_list_trans_send(TALLOC_CTX *mem_ctx, } state->ev = ev; state->cli = cli; - state->mask = talloc_strdup(state, mask); - if (tevent_req_nomem(state->mask, req)) { - return tevent_req_post(req, ev); - } - state->mask = smb1_dfs_share_path(state, cli, state->mask); + state->mask = smb1_dfs_share_path(state, cli, mask); if (tevent_req_nomem(state->mask, req)) { return tevent_req_post(req, ev); } @@ -937,55 +932,6 @@ static NTSTATUS cli_list_trans_recv(struct tevent_req *req, return NT_STATUS_OK; } -NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask, - uint32_t attribute, int info_level, - NTSTATUS (*fn)( - struct file_info *finfo, - const char *mask, - void *private_data), - void *private_data) -{ - TALLOC_CTX *frame = talloc_stackframe(); - struct tevent_context *ev; - struct tevent_req *req; - int i, num_finfo; - struct file_info *finfo = NULL; - NTSTATUS status = NT_STATUS_NO_MEMORY; - - if (smbXcli_conn_has_async_calls(cli->conn)) { - /* - * Can't use sync call while an async call is in flight - */ - status = NT_STATUS_INVALID_PARAMETER; - goto fail; - } - ev = samba_tevent_context_init(frame); - if (ev == NULL) { - goto fail; - } - req = cli_list_trans_send(frame, ev, cli, mask, attribute, info_level); - if (req == NULL) { - goto fail; - } - if (!tevent_req_poll_ntstatus(req, ev, &status)) { -- Samba Shared Repository