Example #1
0
static int atalk_chown(struct vfs_handle_struct *handle,
			const struct smb_filename *smb_fname,
			uid_t uid,
			gid_t gid)
{
	int ret = 0;
	char *adbl_path = 0;
	char *orig_path = 0;
	SMB_STRUCT_STAT adbl_info;
	SMB_STRUCT_STAT orig_info;
	TALLOC_CTX *ctx;

	ret = SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid);

	if (!(ctx = talloc_init("chown_file")))
		return ret;

	if (atalk_build_paths(ctx, handle->conn->cwd, smb_fname->base_name,
			      &adbl_path, &orig_path,
			      &adbl_info, &orig_info) != 0)
		goto exit_chown;

	if (!S_ISDIR(orig_info.st_ex_mode) && !S_ISREG(orig_info.st_ex_mode)) {
		DEBUG(3, ("ATALK: %s has passed..\n", orig_path));		
		goto exit_chown;
	}

	if (chown(adbl_path, uid, gid) == -1) {
		DEBUG(3, ("ATALK: chown error %s\n", strerror(errno)));
	}

exit_chown:	
	talloc_destroy(ctx);
	return ret;
}
Example #2
0
static int atalk_chown(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, uid_t uid, gid_t gid)
{
	int ret = 0;
	char *adbl_path = 0;
	char *orig_path = 0;
	SMB_STRUCT_STAT adbl_info;
	SMB_STRUCT_STAT orig_info;
	TALLOC_CTX *ctx;

	ret = SMB_VFS_NEXT_CHOWN(handle, conn, path, uid, gid);

	if (!conn || !path) return ret;

	if (!(ctx = talloc_init("chown_file")))
		return ret;

	if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path,
	  &adbl_info, &orig_info) != 0)
		return ret;

	if (!S_ISDIR(orig_info.st_mode) && !S_ISREG(orig_info.st_mode)) {
		DEBUG(3, ("ATALK: %s has passed..\n", orig_path));		
		goto exit_chown;
	}

	chown(adbl_path, uid, gid);

exit_chown:	
	talloc_destroy(ctx);
	return ret;
}
Example #3
0
static int skel_chown(vfs_handle_struct *handle,  const char *path, uid_t uid, gid_t gid)
{
	return SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
}
Example #4
0
static int cap_chown(vfs_handle_struct *handle, connection_struct *conn, const char *path, uid_t uid, gid_t gid)
{
        pstring cappath;
	capencode(cappath, path);
	return SMB_VFS_NEXT_CHOWN(handle, conn, cappath, uid, gid);
}