The branch, v4-15-stable has been updated via cbfc80e7b7d VERSION: Disable GIT_SNAPSHOT for the 4.15.0rc5 release. via da5c0a93a63 WHATSNEW: Add release notes for Samba 4.15.0rc5. via defbbe7127f s4/samba: POPT_COMMON_DAEMON via c65fb0b0a0e winbindd: use POPT_COMMON_DAEMON via 3eef217a9da nmbd: use POPT_COMMON_DAEMON via e1be4413c99 smbd: use POPT_COMMON_DAEMON via 476ed842726 lib/cmdline: restore pre-4.15 logging behaviour for daemons via 29c895c6d8a lib/cmdline: add POPT_COMMON_DAEMON daemon popt options via 4889512c705 s3: smbd: Fix openat_pathref_fsp() to cope with FIFO's in the filesystem. via 5ec6be2ae36 s3: smbd: Add fifo test for the DISABLE_OPATH case. via b5b0471caf3 s3:winbind: Do not start if the priviliged socket path is too long via 915784c099c WHATSNEW: servers are now also logging to stderr at startup via 6bae027bf57 WHATSNEW: fix a typo via 51d64ce925b script/autobuild.py: Restore MIT ADDC tests against fl2008* via 57b266e23c4 s3: smbd: In create_conn_struct_cwd(), don't TALLOC_FREE() an unallocated pointer on error. via 2ed234deee3 s3: mdssvc: Correctly disconnect the VFS connection inside the mds_ctx destructor. via cf4845f9b35 winbind: ensure wb_parent_idmap_setup_send() gets called in winbindd_allocate_uid_send() via 591bd2f3405 winbindd: call wb_parent_idmap_setup_send() in wb_queryuser_send() via 16306431a24 registry: check for running as root in clustering mode via 189bb79ac74 s3/lib/dbwrap: check if global_messaging_context() succeeded via 19485894d4b vfs_gpfs: deal with pathrefs fsps in smbd_gpfs_set_times() via a0fe4423b8e lib/gpfswrap: add gpfs_set_times_path() wrapper via 85e5508c4d9 vfs_gpfs: remove ENOSYS fallback from vfs_gpfs_fntimes() via f626ffdf6d5 vfs_gpfs: pass fsp to smbd_gpfs_set_times() via 3fe4d78f021 vfs_gpfs: deal with pathref fsps in vfs_gpfs_fntimes() via 45a63783526 vfs_gpfs: add sys_proc_fd_path() fallback to vfs_gpfs_fset_dos_attributes() via e07c7110e55 vfs_gpfs: remove ENOSYS fallback from vfs_gpfs_fset_dos_attributes() via ee741bcc44c vfs_gpfs: add path based fallback for gpfswrap_fstat_x() on pathref handles via 896a92e0382 vfs_gpfs: check for O_PATH support in gpfswrap_fstat_x() via 3db79fdfd61 vfs_gpfs: make vfs_gpfs_connect() a no-op on IPC shares via 81fa1a65849 vfs_gpfs: don't check for struct gpfs_config_data in vfs_gpfs_[l]stat() via f171810b970 vfs_gpfs: call SMB_VFS_NEXT_CONNECT() before running some module initialization code via 5b80738ec02 smbd: avoid calling creating a pathref in smb_set_file_dosmode() via 8cc118dacc9 VERSION: Bump version up to 4.15.0rc5... from 8a2c51f268b VERSION: Disable GIT_SNAPSHOT for the 4.15.0rc4 release.
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-15-stable - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: VERSION | 2 +- WHATSNEW.txt | 34 +++- lib/cmdline/cmdline.c | 80 +++++++++ lib/cmdline/cmdline.h | 29 ++++ lib/cmdline/cmdline_private.h | 4 + lib/cmdline/cmdline_s3.c | 11 +- lib/util/gpfswrap.c | 14 ++ lib/util/gpfswrap.h | 1 + script/autobuild.py | 4 +- source3/lib/dbwrap/dbwrap_open.c | 4 + source3/modules/vfs_gpfs.c | 268 ++++++++++++++++++++++++++----- source3/nmbd/nmbd.c | 103 +++--------- source3/registry/reg_backend_db.c | 9 ++ source3/rpc_server/mdssvc/mdssvc.c | 5 + source3/script/tests/test_fifo.sh | 83 ++++++++++ source3/selftest/tests.py | 3 + source3/smbd/files.c | 4 + source3/smbd/msdfs.c | 7 +- source3/smbd/server.c | 112 ++++--------- source3/smbd/trans2.c | 67 ++++---- source3/winbindd/wb_queryuser.c | 30 +++- source3/winbindd/winbindd.c | 116 ++++++------- source3/winbindd/winbindd_allocate_uid.c | 44 ++++- source4/samba/server.c | 88 +++------- 24 files changed, 728 insertions(+), 394 deletions(-) create mode 100755 source3/script/tests/test_fifo.sh Changeset truncated at 500 lines: diff --git a/VERSION b/VERSION index b185563e6ae..9dc372ed3ca 100644 --- a/VERSION +++ b/VERSION @@ -87,7 +87,7 @@ SAMBA_VERSION_PRE_RELEASE= # e.g. SAMBA_VERSION_RC_RELEASE=1 # # -> "3.0.0rc1" # ######################################################## -SAMBA_VERSION_RC_RELEASE=4 +SAMBA_VERSION_RC_RELEASE=5 ######################################################## # To mark SVN snapshots this should be set to 'yes' # diff --git a/WHATSNEW.txt b/WHATSNEW.txt index 9b072788ad1..d2c25df89ff 100644 --- a/WHATSNEW.txt +++ b/WHATSNEW.txt @@ -1,7 +1,7 @@ Release Announcements ===================== -This is the fourth release candidate of Samba 4.15. This is *not* +This is the fifth release candidate of Samba 4.15. This is *not* intended for production environments and is designed for testing purposes only. Please report any defects via the Samba bug reporting system at https://bugzilla.samba.org/. @@ -94,13 +94,14 @@ other, some options meant different in different tools. These should be stories of the past now. A new command line parser has been implemented with sanity checking. Also the command line interface has been -simplified and provides better control for encryption, singing and kerberos. +simplified and provides better control for encryption, signing and kerberos. Also several command line options have a smb.conf variable to control the default now. -All tools are logging to stderr by default. You can use "--debug-stdout" to -change the behavior. +All tools are now logging to stderr by default. You can use "--debug-stdout" to +change the behavior. All servers will log to stderr at early startup until logging +is setup to go to a file by default. ### Common parser: @@ -315,6 +316,31 @@ smb.conf changes winbind scan trusted domains Changed No +CHANGES SINCE 4.15.0rc4 +======================= + +o Jeremy Allison <j...@samba.org> + * BUG 14809: Shares with variable substitutions cause core dump upon + connection from MacOS Big Sur 11.5.2. + * BUG 14816: Fix pathref open of a filesystem fifo in the DISABLE_OPATH + build. + +o Andrew Bartlett <abart...@samba.org> + * BUG 14815: A subset of tests from Samba's selftest system were not being + run, while others were run twice. + +o Ralph Boehme <s...@samba.org> + * BUG 14771: Some VFS operations on pathref (O_PATH) handles fail on GPFS. + * BUG 14787: net conf list crashes when run as normal user, + * BUG 14803: smbd/winbindd started in daemon mode generate output on + stderr/stdout. + * BUG 14804: winbindd can crash because idmap child state is not fully + initialized. + +o Stefan Metzmacher <me...@samba.org> + * BUG 14771: Some VFS operations on pathref (O_PATH) handles fail on GPFS. + + CHANGES SINCE 4.15.0rc3 ======================= diff --git a/lib/cmdline/cmdline.c b/lib/cmdline/cmdline.c index a0a55f4dcfb..a299a229f69 100644 --- a/lib/cmdline/cmdline.c +++ b/lib/cmdline/cmdline.c @@ -28,6 +28,7 @@ static TALLOC_CTX *cmdline_mem_ctx; static struct loadparm_context *cmdline_lp_ctx; static struct cli_credentials *cmdline_creds; static samba_cmdline_load_config cmdline_load_config_fn; +static struct samba_cmdline_daemon_cfg cmdline_daemon_cfg; /* PRIVATE */ bool samba_cmdline_set_talloc_ctx(TALLOC_CTX *mem_ctx) @@ -59,6 +60,10 @@ bool samba_cmdline_init_common(TALLOC_CTX *mem_ctx) return false; } + cmdline_daemon_cfg = (struct samba_cmdline_daemon_cfg) { + .fork = true, + }; + fault_setup(); /* @@ -112,6 +117,11 @@ struct cli_credentials *samba_cmdline_get_creds(void) return cmdline_creds; } +struct samba_cmdline_daemon_cfg *samba_cmdline_get_daemon_cfg(void) +{ + return &cmdline_daemon_cfg; +} + void samba_cmdline_burn(int argc, char *argv[]) { bool found = false; @@ -1134,6 +1144,73 @@ static struct poptOption popt_common_version[] = { POPT_TABLEEND }; +/********************************************************** + * DAEMON POPT + **********************************************************/ + +static void popt_daemon_callback(poptContext ctx, + enum poptCallbackReason reason, + const struct poptOption *opt, + const char *arg, + const void *data) +{ + switch(opt->val) { + case OPT_DAEMON: + cmdline_daemon_cfg.daemon = true; + break; + case OPT_INTERACTIVE: + cmdline_daemon_cfg.interactive = true; + cmdline_daemon_cfg.fork = false; + break; + case OPT_FORK: + cmdline_daemon_cfg.fork = false; + break; + case OPT_NO_PROCESS_GROUP: + cmdline_daemon_cfg.no_process_group = true; + break; + } +} + +static struct poptOption popt_common_daemon[] = { + { + .argInfo = POPT_ARG_CALLBACK, + .arg = (void *)popt_daemon_callback + }, + { + .longName = "daemon", + .shortName = 'D', + .argInfo = POPT_ARG_NONE, + .arg = NULL, + .val = OPT_DAEMON, + .descrip = "Become a daemon (default)" , + }, + { + .longName = "interactive", + .shortName = 'i', + .argInfo = POPT_ARG_NONE, + .arg = NULL, + .val = OPT_INTERACTIVE, + .descrip = "Run interactive (not a daemon) and log to stdout", + }, + { + .longName = "foreground", + .shortName = 'F', + .argInfo = POPT_ARG_NONE, + .arg = NULL, + .val = OPT_FORK, + .descrip = "Run daemon in foreground (for daemontools, etc.)", + }, + { + .longName = "no-process-group", + .shortName = '\0', + .argInfo = POPT_ARG_NONE, + .arg = NULL, + .val = OPT_NO_PROCESS_GROUP, + .descrip = "Don't create a new process group" , + }, + POPT_TABLEEND +}; + /********************************************************** * LEGACY S3 POPT **********************************************************/ @@ -1270,6 +1347,9 @@ struct poptOption *samba_cmdline_get_popt(enum smb_cmdline_popt_options opt) case SAMBA_CMDLINE_POPT_OPT_VERSION: return popt_common_version; break; + case SAMBA_CMDLINE_POPT_OPT_DAEMON: + return popt_common_daemon; + break; case SAMBA_CMDLINE_POPT_OPT_SAMBA_LDB: return popt_common_samba_ldb; break; diff --git a/lib/cmdline/cmdline.h b/lib/cmdline/cmdline.h index 3c0c9e8c18d..1f85da0099e 100644 --- a/lib/cmdline/cmdline.h +++ b/lib/cmdline/cmdline.h @@ -46,11 +46,19 @@ enum smb_cmdline_popt_options { SAMBA_CMDLINE_POPT_OPT_CONNECTION, SAMBA_CMDLINE_POPT_OPT_CREDENTIALS, SAMBA_CMDLINE_POPT_OPT_VERSION, + SAMBA_CMDLINE_POPT_OPT_DAEMON, SAMBA_CMDLINE_POPT_OPT_SAMBA_LDB, SAMBA_CMDLINE_POPT_OPT_LEGACY_S3, SAMBA_CMDLINE_POPT_OPT_LEGACY_S4, }; +struct samba_cmdline_daemon_cfg { + bool daemon; + bool interactive; + bool fork; + bool no_process_group; +}; + /** * @brief Initialize the commandline interface for parsing options. * @@ -114,6 +122,15 @@ struct cli_credentials *samba_cmdline_get_creds(void); */ struct poptOption *samba_cmdline_get_popt(enum smb_cmdline_popt_options opt); +/** + * @brief Get a pointer to the poptOptions for daemons + * + * @return A pointer to the daemon options + * + * @see POPT_COMMON_DAEMON + */ +struct samba_cmdline_daemon_cfg *samba_cmdline_get_daemon_cfg(void); + /** * @brief Burn secrets on the command line. * @@ -249,6 +266,18 @@ poptContext samba_popt_get_context(const char * name, .descrip = "Version options:", \ .argDescrip = NULL }, +/** + * @brief A popt structure for daemon options. + */ +#define POPT_COMMON_DAEMON { \ + .longName = NULL, \ + .shortName = '\0', \ + .argInfo = POPT_ARG_INCLUDE_TABLE, \ + .arg = samba_cmdline_get_popt(SAMBA_CMDLINE_POPT_OPT_DAEMON), \ + .val = 0, \ + .descrip = "Daemon options:", \ + .argDescrip = NULL }, + /** * @brief A popt structure for common samba options. */ diff --git a/lib/cmdline/cmdline_private.h b/lib/cmdline/cmdline_private.h index 2261e753447..b1584e020dc 100644 --- a/lib/cmdline/cmdline_private.h +++ b/lib/cmdline/cmdline_private.h @@ -34,6 +34,10 @@ enum { OPT_USE_KERBEROS_CCACHE, OPT_USE_WINBIND_CCACHE, OPT_CLIENT_PROTECTION, + OPT_DAEMON, + OPT_INTERACTIVE, + OPT_FORK, + OPT_NO_PROCESS_GROUP, }; typedef bool (*samba_cmdline_load_config)(void); diff --git a/lib/cmdline/cmdline_s3.c b/lib/cmdline/cmdline_s3.c index 70fd768a648..1f8d9ed5eb5 100644 --- a/lib/cmdline/cmdline_s3.c +++ b/lib/cmdline/cmdline_s3.c @@ -55,10 +55,19 @@ static bool _samba_cmdline_load_config_s3(void) case SAMBA_CMDLINE_CONFIG_CLIENT: ok = lp_load_client(config_file); break; - case SAMBA_CMDLINE_CONFIG_SERVER: + case SAMBA_CMDLINE_CONFIG_SERVER: + { + const struct samba_cmdline_daemon_cfg *cmdline_daemon_cfg = + samba_cmdline_get_daemon_cfg(); + + if (!cmdline_daemon_cfg->interactive) { + setup_logging(getprogname(), DEBUG_FILE); + } + ok = lp_load_global(config_file); break; } + } if (!ok) { fprintf(stderr, diff --git a/lib/util/gpfswrap.c b/lib/util/gpfswrap.c index c348ed7c5b8..5cf6d2148e7 100644 --- a/lib/util/gpfswrap.c +++ b/lib/util/gpfswrap.c @@ -39,6 +39,9 @@ static int (*gpfs_get_winattrs_fn)(int fd, struct gpfs_winattr *attrs); static int (*gpfs_ftruncate_fn)(int fd, gpfs_off64_t length); static int (*gpfs_lib_init_fn)(int flags); static int (*gpfs_set_times_fn)(int fd, int flags, gpfs_timestruc_t times[4]); +static int (*gpfs_set_times_path_fn)(char *path, + int flags, + gpfs_timestruc_t times[4]); static int (*gpfs_quotactl_fn)(const char *pathname, int cmd, int id, @@ -77,6 +80,7 @@ int gpfswrap_init(void) gpfs_ftruncate_fn = dlsym(l, "gpfs_ftruncate"); gpfs_lib_init_fn = dlsym(l, "gpfs_lib_init"); gpfs_set_times_fn = dlsym(l, "gpfs_set_times"); + gpfs_set_times_path_fn = dlsym(l, "gpfs_set_times_path"); gpfs_quotactl_fn = dlsym(l, "gpfs_quotactl"); gpfs_init_trace_fn = dlsym(l, "gpfs_init_trace"); gpfs_query_trace_fn = dlsym(l, "gpfs_query_trace"); @@ -213,6 +217,16 @@ int gpfswrap_set_times(int fd, int flags, gpfs_timestruc_t times[4]) return gpfs_set_times_fn(fd, flags, times); } +int gpfswrap_set_times_path(char *path, int flags, gpfs_timestruc_t times[4]) +{ + if (gpfs_set_times_path_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_set_times_path_fn(path, flags, times); +} + int gpfswrap_quotactl(const char *pathname, int cmd, int id, void *bufp) { if (gpfs_quotactl_fn == NULL) { diff --git a/lib/util/gpfswrap.h b/lib/util/gpfswrap.h index 138e6ec696e..764cf686d2e 100644 --- a/lib/util/gpfswrap.h +++ b/lib/util/gpfswrap.h @@ -44,6 +44,7 @@ int gpfswrap_get_winattrs(int fd, struct gpfs_winattr *attrs); int gpfswrap_ftruncate(int fd, gpfs_off64_t length); int gpfswrap_lib_init(int flags); int gpfswrap_set_times(int fd, int flags, gpfs_timestruc_t times[4]); +int gpfswrap_set_times_path(char *path, int flags, gpfs_timestruc_t times[4]); int gpfswrap_quotactl(const char *pathname, int cmd, int id, void *bufp); int gpfswrap_init_trace(void); int gpfswrap_query_trace(void); diff --git a/script/autobuild.py b/script/autobuild.py index c554c331da4..b1dcece0093 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -689,8 +689,8 @@ tasks = { "sequence": [ ("random-sleep", random_sleep(1, 1)), ("test", make_test(include_envs=[ - "fl2000dc", - "fl2003dc", + "fl2008dc", + "fl2008r2dc", ])), ("lcov", LCOV_CMD), ("check-clean-tree", CLEAN_SOURCE_TREE_CMD), diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c index 1d8c40af75e..52c8a94aeff 100644 --- a/source3/lib/dbwrap/dbwrap_open.c +++ b/source3/lib/dbwrap/dbwrap_open.c @@ -149,6 +149,10 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx, * to be initialized. */ msg_ctx = global_messaging_context(); + if (msg_ctx == NULL) { + DBG_ERR("Failed to initialize messaging\n"); + return NULL; + } conn = messaging_ctdb_connection(); if (conn == NULL) { diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index d74bc43db0e..4d1cfa6075a 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -55,6 +55,9 @@ struct gpfs_config_data { bool acl; bool settimes; bool recalls; + struct { + bool gpfs_fstat_x; + } pathref_ok; }; struct gpfs_fsp_extension { @@ -1471,6 +1474,9 @@ static NTSTATUS vfs_gpfs_fget_dos_attributes(struct vfs_handle_struct *handle, uint32_t *dosmode) { struct gpfs_config_data *config; + int fd = fsp_get_pathref_fd(fsp); + char buf[PATH_MAX]; + const char *p = NULL; struct gpfs_iattr64 iattr = { }; unsigned int litemask; struct timespec ts; @@ -1486,7 +1492,22 @@ static NTSTATUS vfs_gpfs_fget_dos_attributes(struct vfs_handle_struct *handle, return SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle, fsp, dosmode); } - ret = gpfswrap_fstat_x(fsp_get_pathref_fd(fsp), &litemask, &iattr, sizeof(iattr)); + if (fsp->fsp_flags.is_pathref && !config->pathref_ok.gpfs_fstat_x) { + if (fsp->fsp_flags.have_proc_fds) { + p = sys_proc_fd_path(fd, buf, sizeof(buf)); + if (p == NULL) { + return NT_STATUS_NO_MEMORY; + } + } else { + p = fsp->fsp_name->base_name; + } + } + + if (p != NULL) { + ret = gpfswrap_stat_x(p, &litemask, &iattr, sizeof(iattr)); + } else { + ret = gpfswrap_fstat_x(fd, &litemask, &iattr, sizeof(iattr)); + } if (ret == -1 && errno == ENOSYS) { return SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle, fsp, dosmode); } @@ -1503,8 +1524,17 @@ static NTSTATUS vfs_gpfs_fget_dos_attributes(struct vfs_handle_struct *handle, set_effective_capability(DAC_OVERRIDE_CAPABILITY); - ret = gpfswrap_fstat_x(fsp_get_pathref_fd(fsp), &litemask, - &iattr, sizeof(iattr)); + if (p != NULL) { + ret = gpfswrap_stat_x(p, + &litemask, + &iattr, + sizeof(iattr)); + } else { + ret = gpfswrap_fstat_x(fd, + &litemask, + &iattr, + sizeof(iattr)); + } if (ret == -1) { saved_errno = errno; } @@ -1554,16 +1584,48 @@ static NTSTATUS vfs_gpfs_fset_dos_attributes(struct vfs_handle_struct *handle, } attrs.winAttrs = vfs_gpfs_dosmode_to_winattrs(dosmode); - ret = gpfswrap_set_winattrs(fsp_get_io_fd(fsp), - GPFS_WINATTR_SET_ATTRS, &attrs); - if (ret == -1 && errno == ENOSYS) { - return SMB_VFS_NEXT_FSET_DOS_ATTRIBUTES(handle, fsp, dosmode); + if (!fsp->fsp_flags.is_pathref) { + ret = gpfswrap_set_winattrs(fsp_get_io_fd(fsp), + GPFS_WINATTR_SET_ATTRS, &attrs); + if (ret == -1) { + DBG_WARNING("Setting winattrs failed for %s: %s\n", + fsp_str_dbg(fsp), strerror(errno)); + return map_nt_error_from_unix(errno); + } + return NT_STATUS_OK; } + if (fsp->fsp_flags.have_proc_fds) { + int fd = fsp_get_pathref_fd(fsp); + const char *p = NULL; + char buf[PATH_MAX]; + + p = sys_proc_fd_path(fd, buf, sizeof(buf)); + if (p == NULL) { + return NT_STATUS_NO_MEMORY; + } + + ret = gpfswrap_set_winattrs_path(p, + GPFS_WINATTR_SET_ATTRS, + &attrs); + if (ret == -1) { + DBG_WARNING("Setting winattrs failed for [%s][%s]: %s\n", + p, fsp_str_dbg(fsp), strerror(errno)); + return map_nt_error_from_unix(errno); + } + return NT_STATUS_OK; + } + + /* + * This is no longer a handle based call. + */ + ret = gpfswrap_set_winattrs_path(fsp->fsp_name->base_name, + GPFS_WINATTR_SET_ATTRS, + &attrs); if (ret == -1) { - DBG_WARNING("Setting winattrs failed for %s: %s\n", - fsp->fsp_name->base_name, strerror(errno)); + DBG_WARNING("Setting winattrs failed for [%s]: %s\n", + fsp_str_dbg(fsp), strerror(errno)); return map_nt_error_from_unix(errno); } @@ -1616,11 +1678,6 @@ static int vfs_gpfs_stat(struct vfs_handle_struct *handle, struct smb_filename *smb_fname) -- Samba Shared Repository