[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Thu Dec 15 22:52:01 UTC 2022
The branch, master has been updated
via ddbb8f1999e lib: Move 448 bytes from R/W data segment to R/O text
via c5bc9f732fe lib: Avoid an includes.h
via 148b86b2ce0 lib: Align an integer type
via bb94ec26557 tdb: Move 160 bytes from R/W data segment to R/O text
via e2ccd822037 smbd: Remove a pointless NULL check from readlink_talloc()
via 88848bc0732 smbd: Use direct struct initialization, avoid explicit ZERO_STRUCT()
via c26f7fcc625 smbd: Fix a debug message
via 7fcbae4e494 libsmb: Don't mess up pathnames in cli_smb2_create_fnum_send()
from 17bbd6ec4c2 smbd: Add "posix" flag to openat_pathref_dirfsp_nosymlink()
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit ddbb8f1999e9e949e3ef0db7cef94115feeb8148
Author: Volker Lendecke <vl at samba.org>
Date: Mon Dec 12 21:20:07 2022 +0100
lib: Move 448 bytes from R/W data segment to R/O text
The linker has to relocate the pointers in the array at startup, save
that. I know we have bigger .data blobs, but every bit counts :-)
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu Dec 15 22:51:06 UTC 2022 on sn-devel-184
commit c5bc9f732fe45bc3a8099f57a1e771cda0036154
Author: Volker Lendecke <vl at samba.org>
Date: Mon Dec 12 21:02:29 2022 +0100
lib: Avoid an includes.h
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 148b86b2ce0a844a8d497c227d998371fc72c339
Author: Volker Lendecke <vl at samba.org>
Date: Mon Dec 12 21:02:17 2022 +0100
lib: Align an integer type
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit bb94ec26557f3d254ce3391d83c200ac3a05abdd
Author: Volker Lendecke <vl at samba.org>
Date: Mon Dec 12 21:20:07 2022 +0100
tdb: Move 160 bytes from R/W data segment to R/O text
The linker has to relocate the pointers in the array at startup, save
that. I know we have bigger .data blobs, but every bit counts :-)
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit e2ccd822037ac14cdedd971fde3a315922c0d135
Author: Volker Lendecke <vl at samba.org>
Date: Mon Dec 5 11:51:28 2022 +0100
smbd: Remove a pointless NULL check from readlink_talloc()
We should never call this without the place to put the target in.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 88848bc07325cec651a57443f5998a411403774a
Author: Volker Lendecke <vl at samba.org>
Date: Fri Dec 2 12:05:14 2022 +0100
smbd: Use direct struct initialization, avoid explicit ZERO_STRUCT()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit c26f7fcc625a365cf943151437953d3dbb0d1159
Author: Volker Lendecke <vl at samba.org>
Date: Mon Dec 5 16:33:37 2022 +0100
smbd: Fix a debug message
This used to be openat_pathref_nostream() at some point back
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 7fcbae4e4940c8d89717c4fa4199d57d69c1d3a4
Author: Volker Lendecke <vl at samba.org>
Date: Thu Dec 15 19:06:20 2022 +0100
libsmb: Don't mess up pathnames in cli_smb2_create_fnum_send()
Master-only bug introduced with dd9cdfb3b14: smb2_dfs_share_path() can
change the length of fname, and if it happens that the original length
hits a \ in the enlarged filename, we cut it off.
Found by accident, this really made me scratch my head when looking at
traces :-)
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/tdb/common/error.c | 53 ++++++++++------
libds/common/flag_mapping.c | 140 ++++++++++++++++++++++++++++-------------
source3/libsmb/cli_smb2_fnum.c | 1 +
source3/smbd/dosmode.c | 7 +--
source3/smbd/files.c | 6 +-
5 files changed, 134 insertions(+), 73 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/tdb/common/error.c b/lib/tdb/common/error.c
index 478eb887ffd..c3ef8bd1438 100644
--- a/lib/tdb/common/error.c
+++ b/lib/tdb/common/error.c
@@ -32,26 +32,43 @@ _PUBLIC_ enum TDB_ERROR tdb_error(struct tdb_context *tdb)
return tdb->ecode;
}
-static struct tdb_errname {
- enum TDB_ERROR ecode; const char *estring;
-} emap[] = { {TDB_SUCCESS, "Success"},
- {TDB_ERR_CORRUPT, "Corrupt database"},
- {TDB_ERR_IO, "IO Error"},
- {TDB_ERR_LOCK, "Locking error"},
- {TDB_ERR_OOM, "Out of memory"},
- {TDB_ERR_EXISTS, "Record exists"},
- {TDB_ERR_NOLOCK, "Lock exists on other keys"},
- {TDB_ERR_EINVAL, "Invalid parameter"},
- {TDB_ERR_NOEXIST, "Record does not exist"},
- {TDB_ERR_RDONLY, "write not permitted"} };
-
-/* Error string for the last tdb error */
_PUBLIC_ const char *tdb_errorstr(struct tdb_context *tdb)
{
- uint32_t i;
- for (i = 0; i < sizeof(emap) / sizeof(struct tdb_errname); i++)
- if (tdb->ecode == emap[i].ecode)
- return emap[i].estring;
+ switch (tdb->ecode) {
+ case TDB_SUCCESS:
+ return "Success";
+ break;
+ case TDB_ERR_CORRUPT:
+ return "Corrupt database";
+ break;
+ case TDB_ERR_IO:
+ return "IO Error";
+ break;
+ case TDB_ERR_LOCK:
+ return "Locking error";
+ break;
+ case TDB_ERR_OOM:
+ return "Out of memory";
+ break;
+ case TDB_ERR_EXISTS:
+ return "Record exists";
+ break;
+ case TDB_ERR_NOLOCK:
+ return "Lock exists on other keys";
+ break;
+ case TDB_ERR_EINVAL:
+ return "Invalid parameter";
+ break;
+ case TDB_ERR_NOEXIST:
+ return "Record does not exist";
+ break;
+ case TDB_ERR_RDONLY:
+ return "write not permitted";
+ break;
+ default:
+ break;
+ }
+
return "Invalid error code";
}
diff --git a/libds/common/flag_mapping.c b/libds/common/flag_mapping.c
index 020922db659..fb64014c74d 100644
--- a/libds/common/flag_mapping.c
+++ b/libds/common/flag_mapping.c
@@ -20,7 +20,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "includes.h"
+#include "replace.h"
+#include "lib/util/data_blob.h"
+#include "lib/util/time.h"
+#include "lib/util/debug.h"
#include "librpc/gen_ndr/samr.h"
#include "../libds/common/flags.h"
#include "flag_mapping.h"
@@ -165,52 +168,99 @@ uint32_t ds_uf2prim_group_rid(uint32_t uf)
return prim_group_rid;
}
-#define FLAG(x) { .name = #x, .uf = x }
-struct {
- const char *name;
- uint32_t uf;
-} user_account_control_name_map[] = {
- FLAG(UF_SCRIPT),
- FLAG(UF_ACCOUNTDISABLE),
- FLAG(UF_00000004),
- FLAG(UF_HOMEDIR_REQUIRED),
- FLAG(UF_LOCKOUT),
- FLAG(UF_PASSWD_NOTREQD),
- FLAG(UF_PASSWD_CANT_CHANGE),
- FLAG(UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED),
-
- FLAG(UF_TEMP_DUPLICATE_ACCOUNT),
- FLAG(UF_NORMAL_ACCOUNT),
- FLAG(UF_00000400),
- FLAG(UF_INTERDOMAIN_TRUST_ACCOUNT),
-
- FLAG(UF_WORKSTATION_TRUST_ACCOUNT),
- FLAG(UF_SERVER_TRUST_ACCOUNT),
- FLAG(UF_00004000),
- FLAG(UF_00008000),
-
- FLAG(UF_DONT_EXPIRE_PASSWD),
- FLAG(UF_MNS_LOGON_ACCOUNT),
- FLAG(UF_SMARTCARD_REQUIRED),
- FLAG(UF_TRUSTED_FOR_DELEGATION),
-
- FLAG(UF_NOT_DELEGATED),
- FLAG(UF_USE_DES_KEY_ONLY),
- FLAG(UF_DONT_REQUIRE_PREAUTH),
- FLAG(UF_PASSWORD_EXPIRED),
- FLAG(UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION),
- FLAG(UF_NO_AUTH_DATA_REQUIRED),
- FLAG(UF_PARTIAL_SECRETS_ACCOUNT),
- FLAG(UF_USE_AES_KEYS)
-};
-
const char *dsdb_user_account_control_flag_bit_to_string(uint32_t uf)
{
- int i;
- for (i=0; i < ARRAY_SIZE(user_account_control_name_map); i++) {
- if (uf == user_account_control_name_map[i].uf) {
- return user_account_control_name_map[i].name;
- }
+ switch (uf) {
+ case UF_SCRIPT:
+ return "UF_SCRIPT";
+ break;
+ case UF_ACCOUNTDISABLE:
+ return "UF_ACCOUNTDISABLE";
+ break;
+ case UF_00000004:
+ return "UF_00000004";
+ break;
+ case UF_HOMEDIR_REQUIRED:
+ return "UF_HOMEDIR_REQUIRED";
+ break;
+ case UF_LOCKOUT:
+ return "UF_LOCKOUT";
+ break;
+ case UF_PASSWD_NOTREQD:
+ return "UF_PASSWD_NOTREQD";
+ break;
+ case UF_PASSWD_CANT_CHANGE:
+ return "UF_PASSWD_CANT_CHANGE";
+ break;
+ case UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED:
+ return "UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED";
+ break;
+
+ case UF_TEMP_DUPLICATE_ACCOUNT:
+ return "UF_TEMP_DUPLICATE_ACCOUNT";
+ break;
+ case UF_NORMAL_ACCOUNT:
+ return "UF_NORMAL_ACCOUNT";
+ break;
+ case UF_00000400:
+ return "UF_00000400";
+ break;
+ case UF_INTERDOMAIN_TRUST_ACCOUNT:
+ return "UF_INTERDOMAIN_TRUST_ACCOUNT";
+ break;
+
+ case UF_WORKSTATION_TRUST_ACCOUNT:
+ return "UF_WORKSTATION_TRUST_ACCOUNT";
+ break;
+ case UF_SERVER_TRUST_ACCOUNT:
+ return "UF_SERVER_TRUST_ACCOUNT";
+ break;
+ case UF_00004000:
+ return "UF_00004000";
+ break;
+ case UF_00008000:
+ return "UF_00008000";
+ break;
+
+ case UF_DONT_EXPIRE_PASSWD:
+ return "UF_DONT_EXPIRE_PASSWD";
+ break;
+ case UF_MNS_LOGON_ACCOUNT:
+ return "UF_MNS_LOGON_ACCOUNT";
+ break;
+ case UF_SMARTCARD_REQUIRED:
+ return "UF_SMARTCARD_REQUIRED";
+ break;
+ case UF_TRUSTED_FOR_DELEGATION:
+ return "UF_TRUSTED_FOR_DELEGATION";
+ break;
+
+ case UF_NOT_DELEGATED:
+ return "UF_NOT_DELEGATED";
+ break;
+ case UF_USE_DES_KEY_ONLY:
+ return "UF_USE_DES_KEY_ONLY";
+ break;
+ case UF_DONT_REQUIRE_PREAUTH:
+ return "UF_DONT_REQUIRE_PREAUTH";
+ break;
+ case UF_PASSWORD_EXPIRED:
+ return "UF_PASSWORD_EXPIRED";
+ break;
+ case UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION:
+ return "UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION";
+ break;
+ case UF_NO_AUTH_DATA_REQUIRED:
+ return "UF_NO_AUTH_DATA_REQUIRED";
+ break;
+ case UF_PARTIAL_SECRETS_ACCOUNT:
+ return "UF_PARTIAL_SECRETS_ACCOUNT";
+ break;
+ case UF_USE_AES_KEYS:
+ return "UF_USE_AES_KEYS";
+ break;
+ default:
+ break;
}
return NULL;
}
diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
index 5cf6f5baf7b..bb99201bb61 100644
--- a/source3/libsmb/cli_smb2_fnum.c
+++ b/source3/libsmb/cli_smb2_fnum.c
@@ -287,6 +287,7 @@ struct tevent_req *cli_smb2_create_fnum_send(
if (tevent_req_nomem(fname, req)) {
return tevent_req_post(req, ev);
}
+ fname_len = strlen(fname);
/* SMB2 is pickier about pathnames. Ensure it doesn't
start in a '\' */
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index 4168eb209c7..5a88cd059b0 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -410,9 +410,9 @@ NTSTATUS set_ea_dos_attribute(connection_struct *conn,
struct smb_filename *smb_fname,
uint32_t dosmode)
{
- struct xattr_DOSATTRIB dosattrib;
+ struct xattr_DOSATTRIB dosattrib = { .version = 0, };
enum ndr_err_code ndr_err;
- DATA_BLOB blob;
+ DATA_BLOB blob = { .data = NULL, };
struct timespec btime;
int ret;
@@ -430,9 +430,6 @@ NTSTATUS set_ea_dos_attribute(connection_struct *conn,
*/
dosmode &= ~FILE_ATTRIBUTE_OFFLINE;
- ZERO_STRUCT(dosattrib);
- ZERO_STRUCT(blob);
-
dosattrib.version = 5;
dosattrib.info.info5.valid_flags = XATTR_DOSINFO_ATTRIB |
XATTR_DOSINFO_CREATE_TIME;
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 3ea879eee3e..87684b1984d 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -614,7 +614,7 @@ NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp,
conn, dirfsp, NULL, &full_fname, base_fname, &how);
TALLOC_FREE(full_fname);
if (!NT_STATUS_IS_OK(status)) {
- DBG_DEBUG("openat_pathref_nostream failed: %s\n",
+ DBG_DEBUG("openat_pathref_fullname() failed: %s\n",
nt_errstr(status));
goto fail;
}
@@ -693,10 +693,6 @@ NTSTATUS readlink_talloc(
char *substitute;
NTSTATUS status;
- if (_substitute == NULL) {
- return NT_STATUS_OK;
- }
-
if (smb_relname == NULL) {
/*
* We have a Linux O_PATH handle in dirfsp and want to
--
Samba Shared Repository
More information about the samba-cvs
mailing list