linux/fs/smb/server/smb_common.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *   Copyright (C) 2018 Samsung Electronics Co., Ltd.
 *   Copyright (C) 2018 Namjae Jeon <[email protected]>
 */

#include <linux/user_namespace.h>

#include "smb_common.h"
#include "server.h"
#include "misc.h"
#include "smbstatus.h"
#include "connection.h"
#include "ksmbd_work.h"
#include "mgmt/user_session.h"
#include "mgmt/user_config.h"
#include "mgmt/tree_connect.h"
#include "mgmt/share_config.h"

/*for shortname implementation */
static const char basechars[43] =;
#define MANGLE_BASE
#define MAGIC_CHAR
#define PERIOD
#define mangle(V)

struct smb_protocol {};

static struct smb_protocol smb1_protos[] =;

static struct smb_protocol smb2_protos[] =;

unsigned int ksmbd_server_side_copy_max_chunk_count(void)
{}

unsigned int ksmbd_server_side_copy_max_chunk_size(void)
{}

unsigned int ksmbd_server_side_copy_max_total_size(void)
{}

inline int ksmbd_min_protocol(void)
{}

inline int ksmbd_max_protocol(void)
{}

int ksmbd_lookup_protocol_idx(char *str)
{}

/**
 * ksmbd_verify_smb_message() - check for valid smb2 request header
 * @work:	smb work
 *
 * check for valid smb signature and packet direction(request/response)
 *
 * Return:      0 on success, otherwise -EINVAL
 */
int ksmbd_verify_smb_message(struct ksmbd_work *work)
{}

/**
 * ksmbd_smb_request() - check for valid smb request type
 * @conn:	connection instance
 *
 * Return:      true on success, otherwise false
 */
bool ksmbd_smb_request(struct ksmbd_conn *conn)
{}

static bool supported_protocol(int idx)
{}

static char *next_dialect(char *dialect, int *next_off, int bcount)
{}

static int ksmbd_lookup_dialect_by_name(char *cli_dialects, __le16 byte_count)
{}

int ksmbd_lookup_dialect_by_id(__le16 *cli_dialects, __le16 dialects_count)
{}

static int ksmbd_negotiate_smb_dialect(void *buf)
{}

#define SMB_COM_NEGOTIATE_EX

/**
 * get_smb1_cmd_val() - get smb command value from smb header
 * @work:	smb work containing smb header
 *
 * Return:      smb command value
 */
static u16 get_smb1_cmd_val(struct ksmbd_work *work)
{}

/**
 * init_smb1_rsp_hdr() - initialize smb negotiate response header
 * @work:	smb work containing smb request
 *
 * Return:      0 on success, otherwise -EINVAL
 */
static int init_smb1_rsp_hdr(struct ksmbd_work *work)
{}

/**
 * smb1_check_user_session() - check for valid session for a user
 * @work:	smb work containing smb request buffer
 *
 * Return:      0 on success, otherwise error
 */
static int smb1_check_user_session(struct ksmbd_work *work)
{}

/**
 * smb1_allocate_rsp_buf() - allocate response buffer for a command
 * @work:	smb work containing smb request
 *
 * Return:      0 on success, otherwise -ENOMEM
 */
static int smb1_allocate_rsp_buf(struct ksmbd_work *work)
{}

/**
 * set_smb1_rsp_status() - set error type in smb response header
 * @work:	smb work containing smb response header
 * @err:	error code to set in response
 */
static void set_smb1_rsp_status(struct ksmbd_work *work, __le32 err)
{}

static struct smb_version_ops smb1_server_ops =;

static int smb1_negotiate(struct ksmbd_work *work)
{}

static struct smb_version_cmds smb1_server_cmds[1] =;

static int init_smb1_server(struct ksmbd_conn *conn)
{}

int ksmbd_init_smb_server(struct ksmbd_work *work)
{}

int ksmbd_populate_dot_dotdot_entries(struct ksmbd_work *work, int info_level,
				      struct ksmbd_file *dir,
				      struct ksmbd_dir_info *d_info,
				      char *search_pattern,
				      int (*fn)(struct ksmbd_conn *, int,
						struct ksmbd_dir_info *,
						struct ksmbd_kstat *))
{}

/**
 * ksmbd_extract_shortname() - get shortname from long filename
 * @conn:	connection instance
 * @longname:	source long filename
 * @shortname:	destination short filename
 *
 * Return:	shortname length or 0 when source long name is '.' or '..'
 * TODO: Though this function comforms the restriction of 8.3 Filename spec,
 * but the result is different with Windows 7's one. need to check.
 */
int ksmbd_extract_shortname(struct ksmbd_conn *conn, const char *longname,
			    char *shortname)
{}

static int __smb2_negotiate(struct ksmbd_conn *conn)
{}

static int smb_handle_negotiate(struct ksmbd_work *work)
{}

int ksmbd_smb_negotiate_common(struct ksmbd_work *work, unsigned int command)
{}

enum SHARED_MODE_ERRORS {};

static const char * const shared_mode_errors[] =;

static void smb_shared_mode_error(int error, struct ksmbd_file *prev_fp,
				  struct ksmbd_file *curr_fp)
{}

int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp)
{}

bool is_asterisk(char *p)
{}

int ksmbd_override_fsids(struct ksmbd_work *work)
{}

void ksmbd_revert_fsids(struct ksmbd_work *work)
{}

__le32 smb_map_generic_desired_access(__le32 daccess)
{}