Ejemplo n.º 1
0
static int onefs_mkdir(vfs_handle_struct *handle, const char *path,
		       mode_t mode)
{
	/* SMB_VFS_MKDIR should never be called in vfs_onefs */
	SMB_ASSERT(false);
	return SMB_VFS_NEXT_MKDIR(handle, path, mode);
}
Ejemplo n.º 2
0
static int mkdir_acl_xattr(vfs_handle_struct *handle, const char *path, mode_t mode)
{
	int ret = SMB_VFS_NEXT_MKDIR(handle, path, mode);

	if (ret == -1) {
		return ret;
	}
	/* New directory - inherit from parent. */
	inherit_new_acl(handle, path, NULL, true);
	return ret;
}
Ejemplo n.º 3
0
static int vfsx_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
{
	int result = -1;
	int count;
	char buf[VFSX_MSG_OUT_SIZE];

	count = snprintf(buf, VFSX_MSG_OUT_SIZE, "mkdir:%s:%s:%s,%d", handle->conn->user, handle->conn->origpath, path, mode);
	if (vfsx_execute(buf, count) == VFSX_SUCCESS_TRANSPARENT) {
		result = SMB_VFS_NEXT_MKDIR(handle, path, mode);
	}
	return result;
}
Ejemplo n.º 4
0
static int audit_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
{
	int result;
	
	result = SMB_VFS_NEXT_MKDIR(handle, path, mode);
	
	syslog(audit_syslog_priority(handle), "mkdir %s %s%s\n", 
	       path,
	       (result < 0) ? "failed: " : "",
	       (result < 0) ? strerror(errno) : "");

	return result;
}
Ejemplo n.º 5
0
static int vfs_my_module_create_dir(vfs_handle_struct *handle, const char *dname, const struct smb_filename *smb_fname)
{
	size_t len;
	mode_t mode;
	char *new_dir = NULL;
	char *tmp_str = NULL;
	char *token;
	char *tok_str;
	bool ret = False;
	char *saveptr;
    int i = 0;
	mode = vfs_my_module_directory_mode(handle);

	tmp_str = SMB_STRDUP(dname);
	ALLOC_CHECK(tmp_str, done);
	tok_str = tmp_str;

	len = strlen(dname)+1;
	new_dir = (char *)SMB_MALLOC(len + 1);
	ALLOC_CHECK(new_dir, done);
	*new_dir = '\0';
	if (dname[0] == '/') {
		/* Absolute path. */
		safe_strcat(new_dir,"/",len);
	}

	/* Create directory tree if neccessary */
	for(token = strtok_r(tok_str, "/", &saveptr); token;
	    token = strtok_r(NULL, "/", &saveptr)) {
		safe_strcat(new_dir, token, len);
		if (vfs_my_module_directory_exist(handle, new_dir))
			DEBUG(10, ("CREATE DIR: dir %s already exists\n", new_dir));
		else {
			DEBUG(1, ("CREATE DIR: creating new dir %s\n", new_dir));
			if (SMB_VFS_NEXT_MKDIR(handle, new_dir,mode) != 0) {
				DEBUG(1,("CREATE DIR: failed for %s with error: %s\n", new_dir, strerror(errno)));
				ret = False;
			}

		}
		safe_strcat(new_dir, "/", len);
		mode = vfs_my_module_subdir_mode(handle);
	i++;
	DEBUG(1,("CREATE DIR COUNTER: %d\n", i));
	ret = True;
	}
done:
	SAFE_FREE(tmp_str);
	SAFE_FREE(new_dir);
	return i;
}
static int greyhole_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
{
	int result;

	result = SMB_VFS_NEXT_MKDIR(handle, path, mode);

	if (result >= 0) {
		gh_spoolf("mkdir\n%s\n%s\n\n",
			lp_servicename(talloc_tos(), handle->conn->params->service),
			path);
	}

	return result;
}
Ejemplo n.º 7
0
static int audit_mkdir(vfs_handle_struct *handle,
		const struct smb_filename *smb_fname,
		mode_t mode)
{
	int result;
	
	result = SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
	
	syslog(audit_syslog_priority(handle), "mkdir %s %s%s\n", 
	       smb_fname->base_name,
	       (result < 0) ? "failed: " : "",
	       (result < 0) ? strerror(errno) : "");

	return result;
}
Ejemplo n.º 8
0
/**
 * Create directory tree
 * @param conn connection
 * @param dname Directory tree to be created
 * @return Returns True for success
 **/
static BOOL recycle_create_dir(vfs_handle_struct *handle, const char *dname)
{
	size_t len;
	mode_t mode;
	char *new_dir = NULL;
	char *tmp_str = NULL;
	char *token;
	char *tok_str;
	BOOL ret = False;

	mode = recycle_directory_mode(handle);

	tmp_str = SMB_STRDUP(dname);
	ALLOC_CHECK(tmp_str, done);
	tok_str = tmp_str;

	len = strlen(dname)+1;
	new_dir = (char *)SMB_MALLOC(len + 1);
	ALLOC_CHECK(new_dir, done);
	*new_dir = '\0';
	if (dname[0] == '/') {
		/* Absolute path. */
		safe_strcat(new_dir,"/",len);
	}

	/* Create directory tree if neccessary */
	for(token = strtok(tok_str, "/"); token; token = strtok(NULL, "/")) {
		safe_strcat(new_dir, token, len);
		if (recycle_directory_exist(handle, new_dir))
			DEBUG(10, ("recycle: dir %s already exists\n", new_dir));
		else {
			DEBUG(5, ("recycle: creating new dir %s\n", new_dir));
			if (SMB_VFS_NEXT_MKDIR(handle, new_dir, mode) != 0) {
				DEBUG(1,("recycle: mkdir failed for %s with error: %s\n", new_dir, strerror(errno)));
				ret = False;
				goto done;
			}
		}
		safe_strcat(new_dir, "/", len);
		mode = recycle_subdir_mode(handle);
	}

	ret = True;
done:
	SAFE_FREE(tmp_str);
	SAFE_FREE(new_dir);
	return ret;
}
Ejemplo n.º 9
0
static int greyhole_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
{
	int result;
	FILE *spoolf;
	char filename[38];
	struct timeval tp;

	result = SMB_VFS_NEXT_MKDIR(handle, path, mode);

	if (result >= 0) {
		gettimeofday(&tp, (struct timezone *) NULL);
		snprintf(filename, 37, "/var/spool/greyhole/%.0f", ((double) (tp.tv_sec)*1000000.0) + (((double) tp.tv_usec)));
		spoolf = fopen(filename, "wt");
		fprintf(spoolf, "mkdir\n%s\n%s\n\n",
			lp_servicename(handle->conn->params->service),
			path);
		fclose(spoolf);
	}

	return result;
}
Ejemplo n.º 10
0
static int mkdir_acl_common(vfs_handle_struct *handle, const char *path, mode_t mode)
{
	int ret;
	NTSTATUS status;
	SMB_STRUCT_STAT sbuf;

	ret = vfs_stat_smb_fname(handle->conn, path, &sbuf);
	if (ret == -1 && errno == ENOENT) {
		struct security_descriptor *parent_desc = NULL;
		struct security_descriptor *psd = NULL;

		/* We're creating a new directory. */
		status = check_parent_acl_common(handle, path,
				SEC_DIR_ADD_SUBDIR, &parent_desc);
		if (!NT_STATUS_IS_OK(status)) {
			errno = map_errno_from_nt_status(status);
			return -1;
		}

		/* Cache the parent security descriptor for
		 * later use. We don't have an fsp here so
		 * use the handle. */

		/* Attach this to the conn, move from talloc_tos(). */
		psd = (struct security_descriptor *)talloc_move(handle->conn,
				&parent_desc);

		if (!psd) {
			return -1;
		}
		SMB_VFS_HANDLE_SET_DATA(handle, psd, free_sd_common,
			struct security_descriptor *, return -1);
	}

	return SMB_VFS_NEXT_MKDIR(handle, path, mode);
}
Ejemplo n.º 11
0
static int skel_mkdir(vfs_handle_struct *handle,
		const struct smb_filename *smb_fname,
		mode_t mode)
{
	return SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
}
Ejemplo n.º 12
0
static int skel_mkdir(vfs_handle_struct *handle,  const char *path, mode_t mode)
{
	return SMB_VFS_NEXT_MKDIR(handle, path, mode);
}
Ejemplo n.º 13
0
static int cap_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode)
{
	pstring cappath;
	capencode(cappath, path);
	return SMB_VFS_NEXT_MKDIR(handle, conn, cappath, mode);
}