static int syncops_connect(struct vfs_handle_struct *handle, const char *service, const char *user) { struct syncops_config_data *config; int ret = SMB_VFS_NEXT_CONNECT(handle, service, user); if (ret < 0) { return ret; } config = talloc_zero(handle->conn, struct syncops_config_data); if (!config) { SMB_VFS_NEXT_DISCONNECT(handle); DEBUG(0, ("talloc_zero() failed\n")); return -1; } config->onclose = lp_parm_bool(SNUM(handle->conn), "syncops", "onclose", true); config->onmeta = lp_parm_bool(SNUM(handle->conn), "syncops", "onmeta", true); config->disable = lp_parm_bool(SNUM(handle->conn), "syncops", "disable", false); SMB_VFS_HANDLE_SET_DATA(handle, config, NULL, struct syncops_config_data, return -1); return 0; }
/* setup the inotify handle - called the first time a watch is added on this context */ static NTSTATUS inotify_setup(struct sys_notify_context *ctx) { struct inotify_private *in; if (!lp_parm_bool(-1, "notify", "inotify", True)) { return NT_STATUS_INVALID_SYSTEM_SERVICE; } in = talloc(ctx, struct inotify_private); NT_STATUS_HAVE_NO_MEMORY(in); in->fd = inotify_init(); if (in->fd == -1) { DEBUG(0,("Failed to init inotify - %s\n", strerror(errno))); talloc_free(in); return map_nt_error_from_unix(errno); } in->ctx = ctx; in->watches = NULL; ctx->private_data = in; talloc_set_destructor(in, inotify_destructor); /* add a event waiting for the inotify fd to be readable */ tevent_add_fd(ctx->ev, in, in->fd, TEVENT_FD_READ, inotify_handler, in); return NT_STATUS_OK; }
bool db_is_local(const char *name) { #ifdef CLUSTER_SUPPORT const char *sockname = lp_ctdbd_socket(); if(!sockname || !*sockname) { sockname = CTDB_PATH; } if (lp_clustering() && socket_exist(sockname)) { const char *partname; /* ctdb only wants the file part of the name */ partname = strrchr(name, '/'); if (partname) { partname++; } else { partname = name; } /* allow ctdb for individual databases to be disabled */ if (lp_parm_bool(-1, "ctdb", partname, True)) { return false; } } #endif return true; }
/** * Returns the location of the next direntry to be read via onefs_readdir(). * * This value can be passed into onefs_seekdir(). * * @param[in] handle vfs handle given in most VFS calls * @param[in] dirp system DIR handle to set offset on * * @return offset from the start of the directory where the next read * will take place */ long onefs_telldir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp) { struct rdp_dir_state *dsp = NULL; bool same_as_last; int ret = -1; /* Fallback to default system routines if readdirplus is disabled */ if (!lp_parm_bool(SNUM(handle->conn), PARM_ONEFS_TYPE, PARM_USE_READDIRPLUS, PARM_USE_READDIRPLUS_DEFAULT)) { return sys_telldir(dirp); } /* Retrieve state based off DIR handle */ ret = rdp_retrieve_dir_state(dirp, &dsp, &same_as_last); if (ret) { DEBUG(1, ("Could not retrieve dir_state struct for " "SMB_STRUCT_DIR pointer.\n")); return -1; } DEBUG(9, ("Tell DIR %p, location: %ld, cache cursor: %zu\n", dsp->dirp, dsp->location, dsp->stat_cursor)); return dsp->location; }
/** * open a database */ struct db_context *db_open(TALLOC_CTX *mem_ctx, const char *name, int hash_size, int tdb_flags, int open_flags, mode_t mode) { struct db_context *result = NULL; #ifdef CLUSTER_SUPPORT const char *sockname = lp_ctdbd_socket(); if(!sockname || !*sockname) { sockname = CTDB_PATH; } if (lp_clustering()) { const char *partname; if (!socket_exist(sockname)) { DEBUG(1, ("ctdb socket does not exist - is ctdb not " "running?\n")); return NULL; } /* ctdb only wants the file part of the name */ partname = strrchr(name, '/'); if (partname) { partname++; } else { partname = name; } /* allow ctdb for individual databases to be disabled */ if (lp_parm_bool(-1, "ctdb", partname, True)) { result = db_open_ctdb(mem_ctx, partname, hash_size, tdb_flags, open_flags, mode); if (result == NULL) { DEBUG(0,("failed to attach to ctdb %s\n", partname)); if (errno == 0) { errno = EIO; } return NULL; } } } #endif if (result == NULL) { result = db_open_tdb(mem_ctx, name, hash_size, tdb_flags, open_flags, mode); } if ((result != NULL) && (result->fetch == NULL)) { result->fetch = dbwrap_fallback_fetch; } if ((result != NULL) && (result->parse_record == NULL)) { result->parse_record = dbwrap_fallback_parse_record; } return result; }
/** * Set the next direntry to be read via onefs_readdir() to the beginning of the * directory. * * @param[in] handle vfs handle given in most VFS calls * @param[in] dirp system DIR handle to set offset on * * @return no return value */ void onefs_rewinddir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp) { struct rdp_dir_state *dsp = NULL; bool same_as_last; int ret = -1; /* Fallback to default system routines if readdirplus is disabled */ if (!lp_parm_bool(SNUM(handle->conn), PARM_ONEFS_TYPE, PARM_USE_READDIRPLUS, PARM_USE_READDIRPLUS_DEFAULT)) { return sys_rewinddir(dirp); } /* Retrieve state based off DIR handle */ ret = rdp_retrieve_dir_state(dirp, &dsp, &same_as_last); if (ret) { DEBUG(1, ("Could not retrieve dir_state struct for " "SMB_STRUCT_DIR pointer.\n")); return; } /* Reset location and resume key to beginning */ ret = rdp_init(dsp); if (ret) { DEBUG(0, ("Error re-initializing rdp cursors: %s\n", strerror(ret))); return; } DEBUG(9, ("Rewind DIR: %p, to location: %ld\n", dsp->dirp, dsp->location)); return; }
/** * Create a dir_state to track an open directory that we're enumerating. * * This utility function is globally accessible for use by other parts of the * onefs.so module to initialize a dir_state when a directory is opened through * a path other than the VFS layer. * * @return 0 on success and errno on failure * * @note: Callers of this function MUST cleanup the dir_state through a proper * call to VFS_CLOSEDIR(). */ int onefs_rdp_add_dir_state(connection_struct *conn, SMB_STRUCT_DIR *dirp) { int ret = 0; struct rdp_dir_state *dsp = NULL; /* No-op if readdirplus is disabled */ if (!lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE, PARM_USE_READDIRPLUS, PARM_USE_READDIRPLUS_DEFAULT)) { return 0; } /* Create a struct dir_state */ dsp = SMB_MALLOC_P(struct rdp_dir_state); if (!dsp) { DEBUG(0, ("Error allocating struct rdp_dir_state.\n")); return ENOMEM; } /* Initialize the dir_state structure and add it to the list */ ret = rdp_init(dsp); if (ret) { DEBUG(0, ("Error initializing readdirplus() buffers: %s\n", strerror(ret))); return ret; } /* Set the SMB_STRUCT_DIR in the dsp */ dsp->dirp = dirp; DLIST_ADD(dirstatelist, dsp); return 0; }
/** * Open a directory for enumeration. * * Create a state struct to track the state of this directory for the life * of this open. * * @param[in] handle vfs handle given in most VFS calls * @param[in] fname filename of the directory to open * @param[in] mask unused * @param[in] attr unused * * @return DIR pointer, NULL if directory does not exist, NULL on error */ SMB_STRUCT_DIR * onefs_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr) { int ret = 0; SMB_STRUCT_DIR *ret_dirp; /* Fallback to default system routines if readdirplus is disabled */ if (!lp_parm_bool(SNUM(handle->conn), PARM_ONEFS_TYPE, PARM_USE_READDIRPLUS, PARM_USE_READDIRPLUS_DEFAULT)) { return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr); } /* Open the directory */ ret_dirp = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr); if (!ret_dirp) { DEBUG(3, ("Unable to open directory: %s\n", fname)); return NULL; } /* Create the dir_state struct and add it to the list */ ret = onefs_rdp_add_dir_state(handle->conn, ret_dirp); if (ret) { DEBUG(0, ("Error adding dir_state to the list\n")); return NULL; } DEBUG(9, ("Opened handle on directory: \"%s\", DIR %p\n", fname, ret_dirp)); return ret_dirp; }
NTSTATUS srv_fssa_start(struct messaging_context *msg_ctx) { NTSTATUS status; fss_global.mem_ctx = talloc_named_const(NULL, 0, "parent fss rpc server ctx"); if (fss_global.mem_ctx == NULL) { return NT_STATUS_NO_MEMORY; } fss_global.db_path = lock_path(FSS_DB_NAME); if (fss_global.db_path == NULL) { talloc_free(fss_global.mem_ctx); return NT_STATUS_NO_MEMORY; } fss_global.min_vers = FSRVP_RPC_VERSION_1; fss_global.max_vers = FSRVP_RPC_VERSION_1; /* * The server MUST populate the GlobalShadowCopySetTable with the * ShadowCopySet entries read from the configuration store. */ if (lp_parm_bool(GLOBAL_SECTION_SNUM, "fss", "prune stale", false)) { fss_prune_stale(msg_ctx, fss_global.db_path); } become_root(); status = fss_state_retrieve(fss_global.mem_ctx, &fss_global.sc_sets, &fss_global.sc_sets_count, fss_global.db_path); unbecome_root(); if (!NT_STATUS_IS_OK(status)) { DEBUG(1, ("failed to retrieve fss server state: %s\n", nt_errstr(status))); } return NT_STATUS_OK; }
static char *shadow_copy2_snapshot_to_gmt(TALLOC_CTX *mem_ctx, vfs_handle_struct *handle, const char *name) { struct tm timestamp; time_t timestamp_t; char gmt[GMT_NAME_LEN + 1]; const char *fmt; fmt = lp_parm_const_string(SNUM(handle->conn), "shadow", "format", SHADOW_COPY2_DEFAULT_FORMAT); ZERO_STRUCT(timestamp); if (strptime(name, fmt, ×tamp) == NULL) { DEBUG(10, ("shadow_copy2_snapshot_to_gmt: no match %s: %s\n", fmt, name)); return NULL; } DEBUG(10, ("shadow_copy2_snapshot_to_gmt: match %s: %s\n", fmt, name)); if (lp_parm_bool(SNUM(handle->conn), "shadow", "localtime", SHADOW_COPY2_DEFAULT_LOCALTIME)) { timestamp.tm_isdst = -1; timestamp_t = mktime(×tamp); gmtime_r(×tamp_t, ×tamp); } strftime(gmt, sizeof(gmt), SHADOW_COPY2_GMT_FORMAT, ×tamp); return talloc_strdup(mem_ctx, gmt); }
static bool vfs_my_module_keep_dir_tree(vfs_handle_struct *handle) { bool ret; ret = lp_parm_bool(SNUM(handle->conn), "vfs_my_module", "keeptree", True); return ret; }
static bool smbconf_reg_requires_messaging(struct smbconf_ctx *ctx) { #ifdef CLUSTER_SUPPORT if (lp_clustering() && lp_parm_bool(-1, "ctdb", "registry.tdb", true)) { return true; } #endif return false; }
static bool recycle_keep_dir_tree(vfs_handle_struct *handle) { bool ret; ret = lp_parm_bool(SNUM(handle->conn), "recycle", "keeptree", False); DEBUG(10, ("recycle_bin: keeptree = %s\n", ret?"True":"False")); return ret; }
static bool recycle_versions(vfs_handle_struct *handle) { bool ret; ret = lp_parm_bool(SNUM(handle->conn), "recycle", "versions", False); DEBUG(10, ("recycle: versions = %s\n", ret?"True":"False")); return ret; }
static bool recycle_touch(vfs_handle_struct *handle) { bool ret; ret = lp_parm_bool(SNUM(handle->conn), "recycle", "touch", False); DEBUG(10, ("recycle: touch = %s\n", ret?"True":"False")); return ret; }
static uint32_t onefs_fs_capabilities(struct vfs_handle_struct *handle) { uint32_t result = 0; if (!lp_parm_bool(SNUM(handle->conn), PARM_ONEFS_TYPE, PARM_IGNORE_STREAMS, PARM_IGNORE_STREAMS_DEFAULT)) { result |= FILE_NAMED_STREAMS; } return result | SMB_VFS_NEXT_FS_CAPABILITIES(handle); }
static struct tevent_req *notifyd_req(struct messaging_context *msg_ctx, struct tevent_context *ev) { struct tevent_req *req; sys_notify_watch_fn sys_notify_watch = NULL; struct sys_notify_context *sys_notify_ctx = NULL; if (lp_kernel_change_notify()) { #ifdef HAVE_INOTIFY if (lp_parm_bool(-1, "notify", "inotify", true)) { sys_notify_watch = inotify_watch; } #endif #ifdef HAVE_FAM if (lp_parm_bool(-1, "notify", "fam", (sys_notify_watch == NULL))) { sys_notify_watch = fam_watch; } #endif } if (sys_notify_watch != NULL) { sys_notify_ctx = sys_notify_context_create(msg_ctx, ev); if (sys_notify_ctx == NULL) { return NULL; } } req = notifyd_send(msg_ctx, ev, msg_ctx, messaging_ctdbd_connection(), sys_notify_watch, sys_notify_ctx); if (req == NULL) { TALLOC_FREE(sys_notify_ctx); return NULL; } tevent_req_set_callback(req, notifyd_stopped, msg_ctx); return req; }
void init_gpfs(void) { init_gpfs_function(&gpfs_set_share_fn, "gpfs_set_share"); init_gpfs_function(&gpfs_set_lease_fn, "gpfs_set_lease"); init_gpfs_function(&gpfs_getacl_fn, "gpfs_getacl"); init_gpfs_function(&gpfs_putacl_fn, "gpfs_putacl"); init_gpfs_function(&gpfs_get_realfilename_path_fn, "gpfs_get_realfilename_path"); init_gpfs_function(&gpfs_get_winattrs_path_fn,"gpfs_get_winattrs_path"); init_gpfs_function(&gpfs_set_winattrs_path_fn,"gpfs_set_winattrs_path"); init_gpfs_function(&gpfs_get_winattrs_fn,"gpfs_get_winattrs"); init_gpfs_function(&gpfs_ftruncate_fn, "gpfs_ftruncate"); init_gpfs_function(&gpfs_lib_init_fn,"gpfs_lib_init"); gpfs_getrealfilename = lp_parm_bool(-1, "gpfs", "getrealfilename", True); gpfs_winattr = lp_parm_bool(-1, "gpfs", "winattr", False); gpfs_do_ftruncate = lp_parm_bool(-1, "gpfs", "ftruncate", True); return; }
/* * Gather special parameters for NFS4 ACL handling */ static int smbacl4_get_vfs_params( struct connection_struct *conn, smbacl4_vfs_params *params ) { static const struct enum_list enum_smbacl4_modes[] = { { e_simple, "simple" }, { e_special, "special" }, { -1 , NULL } }; static const struct enum_list enum_smbacl4_acedups[] = { { e_dontcare, "dontcare" }, { e_reject, "reject" }, { e_ignore, "ignore" }, { e_merge, "merge" }, { -1 , NULL } }; int enumval; ZERO_STRUCTP(params); enumval = lp_parm_enum(SNUM(conn), SMBACL4_PARAM_TYPE_NAME, "mode", enum_smbacl4_modes, e_simple); if (enumval == -1) { DEBUG(10, ("value for %s:mode unknown\n", SMBACL4_PARAM_TYPE_NAME)); return -1; } params->mode = (enum smbacl4_mode_enum)enumval; params->do_chown = lp_parm_bool(SNUM(conn), SMBACL4_PARAM_TYPE_NAME, "chown", true); enumval = lp_parm_enum(SNUM(conn), SMBACL4_PARAM_TYPE_NAME, "acedup", enum_smbacl4_acedups, e_dontcare); if (enumval == -1) { DEBUG(10, ("value for %s:acedup unknown\n", SMBACL4_PARAM_TYPE_NAME)); return -1; } params->acedup = (enum smbacl4_acedup_enum)enumval; params->map_full_control = lp_acl_map_full_control(SNUM(conn)); DEBUG(10, ("mode:%s, do_chown:%s, acedup: %s map full control:%s\n", enum_smbacl4_modes[params->mode].name, params->do_chown ? "true" : "false", enum_smbacl4_acedups[params->acedup].name, params->map_full_control ? "true" : "false")); return 0; }
static int aio_pthread_open_fn(vfs_handle_struct *handle, struct smb_filename *smb_fname, files_struct *fsp, int flags, mode_t mode) { int my_errno = 0; int fd = -1; bool aio_allow_open = lp_parm_bool( SNUM(handle->conn), "aio_pthread", "aio open", false); if (smb_fname->stream_name) { /* Don't handle stream opens. */ errno = ENOENT; return -1; } if (!aio_allow_open) { /* aio opens turned off. */ return open(smb_fname->base_name, flags, mode); } if (!(flags & O_CREAT)) { /* Only creates matter. */ return open(smb_fname->base_name, flags, mode); } if (!(flags & O_EXCL)) { /* Only creates with O_EXCL matter. */ return open(smb_fname->base_name, flags, mode); } /* * See if this is a reentrant call - i.e. is this a * restart of an existing open that just completed. */ if (find_completed_open(fsp, &fd, &my_errno)) { errno = my_errno; return fd; } /* Ok, it's a create exclusive call - pass it to a thread helper. */ return open_async(fsp, flags, mode); }
static int streams_xattr_connect(vfs_handle_struct *handle, const char *service, const char *user) { struct streams_xattr_config *config; const char *default_prefix = SAMBA_XATTR_DOSSTREAM_PREFIX; const char *prefix; int rc; rc = SMB_VFS_NEXT_CONNECT(handle, service, user); if (rc != 0) { return rc; } config = talloc_zero(handle->conn, struct streams_xattr_config); if (config == NULL) { DEBUG(1, ("talloc_zero() failed\n")); errno = ENOMEM; return -1; } prefix = lp_parm_const_string(SNUM(handle->conn), "streams_xattr", "prefix", default_prefix); config->prefix = talloc_strdup(config, prefix); if (config->prefix == NULL) { DEBUG(1, ("talloc_strdup() failed\n")); errno = ENOMEM; return -1; } config->prefix_len = strlen(config->prefix); DEBUG(10, ("streams_xattr using stream prefix: %s\n", config->prefix)); config->store_stream_type = lp_parm_bool(SNUM(handle->conn), "streams_xattr", "store_stream_type", true); SMB_VFS_HANDLE_SET_DATA(handle, config, NULL, struct stream_xattr_config, return -1); return 0; }
/* drsuapi_DsReplicaGetInfo */ static WERROR dcesrv_drsuapi_DsReplicaGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct drsuapi_DsReplicaGetInfo *r) { enum security_user_level level; if (!lp_parm_bool(dce_call->conn->dce_ctx->lp_ctx, NULL, "drs", "disable_sec_check", false)) { level = security_session_user_level(dce_call->conn->auth_state.session_info); if (level < SECURITY_ADMINISTRATOR) { DEBUG(1,(__location__ ": Administrator access required for DsReplicaGetInfo\n")); security_token_debug(2, dce_call->conn->auth_state.session_info->security_token); return WERR_DS_DRA_ACCESS_DENIED; } } dcesrv_irpc_forward_rpc_call(dce_call, mem_ctx, r, NDR_DRSUAPI_DSREPLICAGETINFO, &ndr_table_drsuapi, "kccsrv", "DsReplicaGetInfo"); return WERR_OK; }
/* modify a sbuf return to ensure that inodes in the shadow directory are different from those in the main directory */ static void convert_sbuf(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf) { if (lp_parm_bool(SNUM(handle->conn), "shadow", "fixinodes", False)) { /* some snapshot systems, like GPFS, return the name device:inode for the snapshot files as the current files. That breaks the 'restore' button in the shadow copy GUI, as the client gets a sharing violation. This is a crude way of allowing both files to be open at once. It has a slight chance of inode number collision, but I can't see a better approach without significant VFS changes */ uint32_t shash = string_hash(fname) & 0xFF000000; if (shash == 0) { shash = 1; } sbuf->st_ex_ino ^= shash; } }
static size_t afs_get_nt_acl(struct files_struct *fsp, uint32 security_info, struct security_descriptor **ppdesc) { struct afs_acl acl; size_t sd_size; DEBUG(5, ("afs_get_nt_acl: %s\n", fsp->fsp_name)); sidpts = lp_parm_bool(SNUM(fsp->conn), "afsacl", "sidpts", False); if (!afs_get_afs_acl(fsp->fsp_name, &acl)) { return 0; } sd_size = afs_to_nt_acl(&acl, fsp, security_info, ppdesc); free_afs_acl(&acl); return sd_size; }
/* module initialisation */ static NTSTATUS auth_init_sam(struct auth_context *auth_context, const char *param, auth_methods **auth_method) { struct auth_methods *result; if (lp_server_role() == ROLE_ACTIVE_DIRECTORY_DC && !lp_parm_bool(-1, "server role check", "inhibit", false)) { DEBUG(0, ("server role = 'active directory domain controller' not compatible with running the auth_sam module. \n")); DEBUGADD(0, ("You should not set 'auth methods' when running the AD DC.\n")); exit(1); } result = talloc_zero(auth_context, struct auth_methods); if (result == NULL) { return NT_STATUS_NO_MEMORY; } result->auth = auth_samstrict_auth; result->name = "sam"; *auth_method = result; return NT_STATUS_OK; }
static NTSTATUS afsacl_fget_nt_acl(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 security_info, struct security_descriptor **ppdesc) { struct afs_acl acl; size_t sd_size; DEBUG(5, ("afsacl_fget_nt_acl: %s\n", fsp->fsp_name)); sidpts = lp_parm_bool(SNUM(fsp->conn), "afsacl", "sidpts", False); if (!afs_get_afs_acl(fsp->fsp_name, &acl)) { return NT_STATUS_ACCESS_DENIED; } sd_size = afs_fto_nt_acl(&acl, fsp, security_info, ppdesc); free_afs_acl(&acl); return (sd_size != 0) ? NT_STATUS_OK : NT_STATUS_ACCESS_DENIED; }
/* call-back function processing the NT acl -> NFS4 acl using NFSv4 conv. */ static bool nfs4acl_xattr_fset_smb4acl(vfs_handle_struct *handle, files_struct *fsp, struct SMB4ACL_T *smbacl) { TALLOC_CTX *frame = talloc_stackframe(); struct nfs4acl *nfs4acl; int ret; bool denymissingspecial; DATA_BLOB blob; denymissingspecial = lp_parm_bool(fsp->conn->params->service, "nfs4acl_xattr", "denymissingspecial", false); if (!nfs4acl_smb4acl2nfs4acl(frame, smbacl, &nfs4acl, denymissingspecial)) { DEBUG(0, ("Failed to convert smb ACL to nfs4 ACL.\n")); TALLOC_FREE(frame); return false; } blob = nfs4acl_acl2blob(frame, nfs4acl); if (!blob.data) { DEBUG(0, ("Failed to convert ACL to linear blob for xattr\n")); TALLOC_FREE(frame); errno = EINVAL; return false; } if (fsp->fh->fd == -1) { DEBUG(0, ("Error: fsp->fh->fd == -1\n")); } ret = SMB_VFS_NEXT_FSETXATTR(handle, fsp, NFS4ACL_XATTR_NAME, blob.data, blob.length, 0); if (ret != 0) { DEBUG(0, ("can't store acl in xattr: %s\n", strerror(errno))); } TALLOC_FREE(frame); return ret == 0; }
/* Common routine for embedded RPC servers */ bool rpc_setup_embedded(struct tevent_context *ev_ctx, struct messaging_context *msg_ctx, const struct ndr_interface_table *t, const char *pipe_name) { struct dcerpc_binding_vector *v; enum rpc_service_mode_e epm_mode = rpc_epmapper_mode(); NTSTATUS status; /* Registration of ncacn_np services is problematic. The * ev_ctx passed in here is passed down to all children of the * smbd process, and if the end point mapper ever goes away, * they will all attempt to re-register. But we want to test * the code for now, so it is enabled in on environment in * make test */ if (epm_mode != RPC_SERVICE_MODE_DISABLED && (lp_parm_bool(-1, "rpc_server", "register_embedded_np", false))) { status = dcerpc_binding_vector_new(talloc_tos(), &v); if (!NT_STATUS_IS_OK(status)) { return false; } status = dcerpc_binding_vector_add_np_default(t, v); if (!NT_STATUS_IS_OK(status)) { return false; } status = rpc_ep_register(ev_ctx, msg_ctx, t, v); if (!NT_STATUS_IS_OK(status)) { return false; } } return true; }
/* * Gather special parameters for NFS4 ACL handling */ static int smbacl4_get_vfs_params( const char *type_name, struct connection_struct *conn, smbacl4_vfs_params *params ) { static const struct enum_list enum_smbacl4_modes[] = { { e_simple, "simple" }, { e_special, "special" }, { -1 , NULL } }; static const struct enum_list enum_smbacl4_acedups[] = { { e_dontcare, "dontcare" }, { e_reject, "reject" }, { e_ignore, "ignore" }, { e_merge, "merge" }, { -1 , NULL } }; memset(params, 0, sizeof(smbacl4_vfs_params)); params->mode = (enum smbacl4_mode_enum)lp_parm_enum( SNUM(conn), type_name, "mode", enum_smbacl4_modes, e_simple); params->do_chown = lp_parm_bool(SNUM(conn), type_name, "chown", true); params->acedup = (enum smbacl4_acedup_enum)lp_parm_enum( SNUM(conn), type_name, "acedup", enum_smbacl4_acedups, e_dontcare); params->map_full_control = lp_acl_map_full_control(SNUM(conn)); DEBUG(10, ("mode:%s, do_chown:%s, acedup: %s map full control:%s\n", enum_smbacl4_modes[params->mode].name, params->do_chown ? "true" : "false", enum_smbacl4_acedups[params->acedup].name, params->map_full_control ? "true" : "false")); return 0; }
/** * Close DIR pointer and remove all state for that directory open. * * @param[in] handle vfs handle given in most VFS calls * @param[in] dirp system DIR handle to set offset on * * @return -1 on failure, setting errno */ int onefs_closedir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp) { struct rdp_dir_state *dsp = NULL; bool same_as_last; int ret_val = -1; int ret = -1; /* Fallback to default system routines if readdirplus is disabled */ if (!lp_parm_bool(SNUM(handle->conn), PARM_ONEFS_TYPE, PARM_USE_READDIRPLUS, PARM_USE_READDIRPLUS_DEFAULT)) { return SMB_VFS_NEXT_CLOSEDIR(handle, dirp); } /* Retrieve state based off DIR handle */ ret = rdp_retrieve_dir_state(dirp, &dsp, &same_as_last); if (ret) { DEBUG(1, ("Could not retrieve dir_state struct for " "SMB_STRUCT_DIR pointer.\n")); errno = ENOENT; return -1; } /* Close DIR pointer */ ret_val = SMB_VFS_NEXT_CLOSEDIR(handle, dsp->dirp); DEBUG(9, ("Closed handle on DIR %p\n", dsp->dirp)); /* Tear down state struct */ DLIST_REMOVE(dirstatelist, dsp); SAFE_FREE(dsp); /* Set lastp to NULL, as cache is no longer valid */ rdp_last_dirp = NULL; return ret_val; }