The branch, master has been updated
via ff4c70e03ae lib: Fix error path memleaks in read_ea_list_entry()
via dc84e98ed5c lib: Fix a comment
via df219ed8185 smbd: Simplify smbd_do_qfsinfo()
via 70b3699f8bd Fix whitespace
via ff638743066 vfs: Slightly speed up stream_dir()
via 0dfaa08ce38 vfs: Simplify stream_dir()
via fca88879009 Modernize DEBUGs
via 7e8bfe738a3 pam_winbind: Fix Bug 15771
from e0aab377bdc s3:winbindd: Remove unused set_routing_domain()
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit ff4c70e03aebd9c1b54741d28154468029f7e887
Author: Volker Lendecke <[email protected]>
Date: Thu Dec 12 15:17:05 2024 +0100
lib: Fix error path memleaks in read_ea_list_entry()
Don't leak the result on error
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
Autobuild-User(master): Volker Lendecke <[email protected]>
Autobuild-Date(master): Wed Dec 18 09:30:33 UTC 2024 on atb-devel-224
commit dc84e98ed5c6ec977c678adceec025609bebb0a0
Author: Volker Lendecke <[email protected]>
Date: Thu Dec 12 13:59:45 2024 +0100
lib: Fix a comment
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit df219ed8185a911542087ce8e6d779e4e133e1ee
Author: Volker Lendecke <[email protected]>
Date: Tue Dec 10 11:42:59 2024 +0100
smbd: Simplify smbd_do_qfsinfo()
Do early returns, avoid else statements
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 70b3699f8bdfd95b40076f631af1335206ec2797
Author: Volker Lendecke <[email protected]>
Date: Tue Dec 10 16:57:47 2024 +0100
Fix whitespace
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit ff6387430660848fe250a05dc0372a306938dabd
Author: Volker Lendecke <[email protected]>
Date: Mon Dec 9 10:01:19 2024 +0100
vfs: Slightly speed up stream_dir()
lp_parm_bool() is a relatively expensive string-based operation. Do it
only when needed.
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 0dfaa08ce3807c1dae324dff4312d79e8eb40539
Author: Volker Lendecke <[email protected]>
Date: Mon Dec 9 08:09:53 2024 +0100
vfs: Simplify stream_dir()
We know in advance how large "id_hex" is.
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit fca88879009c13e152d6b14535ee61f0ed506437
Author: Volker Lendecke <[email protected]>
Date: Mon Dec 9 07:55:45 2024 +0100
Modernize DEBUGs
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 7e8bfe738a3d91b0724d57ed54acf40ebe026c14
Author: Volker Lendecke <[email protected]>
Date: Mon Dec 16 17:49:43 2024 +0100
pam_winbind: Fix Bug 15771
Bug: https://bugzilla.samba.org/show_bug.cgi?id=15771
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
-----------------------------------------------------------------------
Summary of changes:
nsswitch/pam_winbind.c | 1 +
source3/include/smb.h | 5 ++++-
source3/include/trans2.h | 8 ++++----
source3/lib/util_ea.c | 20 +++++++++++---------
source3/lib/util_nttoken.c | 6 +++---
source3/modules/vfs_streams_depot.c | 36 +++++++++++++++---------------------
source3/smbd/smb2_trans2.c | 35 ++++++++++++++++++++---------------
7 files changed, 58 insertions(+), 53 deletions(-)
Changeset truncated at 500 lines:
diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index 67f351c056f..e1581427856 100644
--- a/nsswitch/pam_winbind.c
+++ b/nsswitch/pam_winbind.c
@@ -2527,6 +2527,7 @@ static char* winbind_upn_to_username(struct pwb_context
*ctx,
/* Convert the UPN to a SID */
wbc_status = wbcCtxLookupName(ctx->wbc_ctx, domain, name, &sid, &type);
+ TALLOC_FREE(name);
if (!WBC_ERROR_IS_OK(wbc_status)) {
return NULL;
}
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 4cebe366346..2642e364d0a 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -607,7 +607,10 @@ struct ea_list {
struct ea_struct ea;
};
-/* EA names used internally in Samba. KEEP UP TO DATE with prohibited_ea_names
in trans2.c !. */
+/*
+ * EA names used internally in Samba. KEEP UP TO DATE with
+ * samba_private_attr_name() in smb2_trans2.c !.
+ */
#define SAMBA_POSIX_INHERITANCE_EA_NAME "user.SAMBA_PAI"
/* EA to use for DOS attributes */
#define SAMBA_XATTR_DOS_ATTRIB "user.DOSATTRIB"
diff --git a/source3/include/trans2.h b/source3/include/trans2.h
index 21b2a3588e8..4f6b228b753 100644
--- a/source3/include/trans2.h
+++ b/source3/include/trans2.h
@@ -1,4 +1,4 @@
-/*
+/*
Unix SMB/CIFS implementation.
SMB transaction2 handling
@@ -11,12 +11,12 @@
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/>.
*/
@@ -208,7 +208,7 @@ Byte offset Type name description
#define SMB_QUERY_FS_DEVICE_INFO 0x104
#define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105
#if 0
-#define SMB_QUERY_FS_QUOTA_INFO
+#define SMB_QUERY_FS_QUOTA_INFO
#endif
#define l2_vol_fdateCreation 0
diff --git a/source3/lib/util_ea.c b/source3/lib/util_ea.c
index dd48e77e6f1..b0b6726c3ee 100644
--- a/source3/lib/util_ea.c
+++ b/source3/lib/util_ea.c
@@ -33,11 +33,11 @@ struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const
char *pdata, size_t da
size_t converted_size;
if (!eal) {
- return NULL;
+ goto fail;
}
if (data_size < 6) {
- return NULL;
+ goto fail;
}
eal->ea.flags = CVAL(pdata,0);
@@ -45,24 +45,23 @@ struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const
char *pdata, size_t da
val_len = SVAL(pdata,2);
if (4 + namelen + 1 + val_len > data_size) {
- return NULL;
+ goto fail;
}
/* Ensure the name is null terminated. */
if (pdata[namelen + 4] != '\0') {
- return NULL;
+ goto fail;
}
if (!pull_ascii_talloc(ctx, &eal->ea.name, pdata + 4, &converted_size))
{
- DEBUG(0,("read_ea_list_entry: pull_ascii_talloc failed: %s\n",
- strerror(errno)));
+ DBG_ERR("pull_ascii_talloc failed: %s\n", strerror(errno));
}
if (!eal->ea.name) {
- return NULL;
+ goto fail;
}
eal->ea.value = data_blob_talloc(eal, NULL, (size_t)val_len + 1);
if (!eal->ea.value.data) {
- return NULL;
+ goto fail;
}
memcpy(eal->ea.value.data, pdata + 4 + namelen + 1, val_len);
@@ -76,10 +75,13 @@ struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const
char *pdata, size_t da
*pbytes_used = 4 + namelen + 1 + val_len;
}
- DEBUG(10,("read_ea_list_entry: read ea name %s\n", eal->ea.name));
+ DBG_DEBUG("read ea name %s\n", eal->ea.name);
dump_data(10, eal->ea.value.data, eal->ea.value.length);
return eal;
+fail:
+ TALLOC_FREE(eal);
+ return NULL;
}
/****************************************************************************
diff --git a/source3/lib/util_nttoken.c b/source3/lib/util_nttoken.c
index 925b79c041c..8a69bb60876 100644
--- a/source3/lib/util_nttoken.c
+++ b/source3/lib/util_nttoken.c
@@ -1,4 +1,4 @@
-/*
+/*
* Unix SMB/CIFS implementation.
* Authentication utility functions
* Copyright (C) Andrew Tridgell 1992-1998
@@ -13,12 +13,12 @@
* 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/>.
*/
diff --git a/source3/modules/vfs_streams_depot.c
b/source3/modules/vfs_streams_depot.c
index 566d34996c1..408ff02e559 100644
--- a/source3/modules/vfs_streams_depot.c
+++ b/source3/modules/vfs_streams_depot.c
@@ -158,19 +158,15 @@ static char *stream_dir(vfs_handle_struct *handle,
SMB_STRUCT_STAT base_sbuf_tmp;
char *tmp = NULL;
uint8_t first, second;
- char *id_hex;
struct file_id id;
uint8_t id_buf[16];
- bool check_valid;
+ char id_hex[sizeof(id_buf) * 2 + 1];
char *rootdir = NULL;
struct smb_filename *rootdir_fname = NULL;
struct smb_filename *tmp_fname = NULL;
struct vfs_rename_how rhow = { .flags = 0, };
int ret;
- check_valid = lp_parm_bool(SNUM(handle->conn),
- "streams_depot", "check_valid", true);
-
rootdir = stream_rootdir(handle,
talloc_tos());
if (rootdir == NULL) {
@@ -223,18 +219,11 @@ static char *stream_dir(vfs_handle_struct *handle,
first = hash & 0xff;
second = (hash >> 8) & 0xff;
- id_hex = hex_encode_talloc(talloc_tos(), id_buf, sizeof(id_buf));
-
- if (id_hex == NULL) {
- errno = ENOMEM;
- goto fail;
- }
+ hex_encode_buf(id_hex, id_buf, sizeof(id_buf));
result = talloc_asprintf(talloc_tos(), "%s/%2.2X/%2.2X/%s", rootdir,
first, second, id_hex);
- TALLOC_FREE(id_hex);
-
if (result == NULL) {
errno = ENOMEM;
return NULL;
@@ -254,13 +243,18 @@ static char *stream_dir(vfs_handle_struct *handle,
if (SMB_VFS_NEXT_STAT(handle, smb_fname_hash) == 0) {
struct smb_filename *smb_fname_new = NULL;
char *newname;
- bool delete_lost;
+ bool check_valid, delete_lost;
if (!S_ISDIR(smb_fname_hash->st.st_ex_mode)) {
errno = EINVAL;
goto fail;
}
+ check_valid = lp_parm_bool(SNUM(handle->conn),
+ "streams_depot",
+ "check_valid",
+ true);
+
if (!check_valid ||
file_is_valid(handle, smb_fname)) {
return result;
@@ -277,9 +271,9 @@ static char *stream_dir(vfs_handle_struct *handle,
"delete_lost", false);
if (delete_lost) {
- DEBUG(3, ("Someone has recreated a file under an "
- "existing inode. Removing: %s\n",
- smb_fname_hash->base_name));
+ DBG_NOTICE("Someone has recreated a file under an "
+ "existing inode. Removing: %s\n",
+ smb_fname_hash->base_name);
recursive_rmdir(talloc_tos(), handle->conn,
smb_fname_hash);
SMB_VFS_NEXT_UNLINKAT(handle,
@@ -289,10 +283,10 @@ static char *stream_dir(vfs_handle_struct *handle,
} else {
newname = talloc_asprintf(talloc_tos(), "lost-%lu",
random());
- DEBUG(3, ("Someone has recreated a file under an "
- "existing inode. Renaming: %s to: %s\n",
- smb_fname_hash->base_name,
- newname));
+ DBG_NOTICE("Someone has recreated a file under an "
+ "existing inode. Renaming: %s to: %s\n",
+ smb_fname_hash->base_name,
+ newname);
if (newname == NULL) {
errno = ENOMEM;
goto fail;
diff --git a/source3/smbd/smb2_trans2.c b/source3/smbd/smb2_trans2.c
index 4df3cc0eab1..7ec1af751db 100644
--- a/source3/smbd/smb2_trans2.c
+++ b/source3/smbd/smb2_trans2.c
@@ -2474,25 +2474,30 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n",
(unsigned int)bsize, (unsigned
rc = SMB_VFS_STATVFS(conn, &smb_fname, &svfs);
- if (!rc) {
- data_len = 56;
- SIVAL(pdata,0,svfs.OptimalTransferSize);
- SIVAL(pdata,4,svfs.BlockSize);
- SBIG_UINT(pdata,8,svfs.TotalBlocks);
- SBIG_UINT(pdata,16,svfs.BlocksAvail);
- SBIG_UINT(pdata,24,svfs.UserBlocksAvail);
- SBIG_UINT(pdata,32,svfs.TotalFileNodes);
- SBIG_UINT(pdata,40,svfs.FreeFileNodes);
- SBIG_UINT(pdata,48,svfs.FsIdentifier);
- DEBUG(5,("smbd_do_qfsinfo :
SMB_QUERY_POSIX_FS_INFO successful\n"));
#ifdef EOPNOTSUPP
- } else if (rc == EOPNOTSUPP) {
+ if (rc == EOPNOTSUPP) {
return NT_STATUS_INVALID_LEVEL;
-#endif /* EOPNOTSUPP */
- } else {
- DEBUG(0,("vfs_statvfs() failed for service
[%s]\n",lp_servicename(talloc_tos(), lp_sub, SNUM(conn))));
+ }
+#endif
+ if (rc != 0) {
+ DBG_ERR("vfs_statvfs() failed for service "
+ "[%s]\n",
+ lp_servicename(talloc_tos(),
+ lp_sub,
+ SNUM(conn)));
return NT_STATUS_DOS(ERRSRV, ERRerror);
}
+
+ data_len = 56;
+ PUSH_LE_U32(pdata, 0, svfs.OptimalTransferSize);
+ PUSH_LE_U32(pdata, 4, svfs.BlockSize);
+ PUSH_LE_U64(pdata, 8, svfs.TotalBlocks);
+ PUSH_LE_U64(pdata, 16, svfs.BlocksAvail);
+ PUSH_LE_U64(pdata, 24, svfs.UserBlocksAvail);
+ PUSH_LE_U64(pdata, 32, svfs.TotalFileNodes);
+ PUSH_LE_U64(pdata, 40, svfs.FreeFileNodes);
+ PUSH_LE_U64(pdata, 48, svfs.FsIdentifier);
+ DBG_INFO("SMB_QUERY_POSIX_FS_INFO successful\n");
break;
}
--
Samba Shared Repository