summaryrefslogtreecommitdiffstats
path: root/fs/ksmbd/mgmt/user_config.h
blob: b2bb074a0150f02a225b1080808d3d93aaa65e3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 *   Copyright (C) 2018 Samsung Electronics Co., Ltd.
 */

#ifndef __USER_CONFIG_MANAGEMENT_H__
#define __USER_CONFIG_MANAGEMENT_H__

#include "../glob.h"

struct ksmbd_user {
	unsigned short		flags;

	unsigned int		uid;
	unsigned int		gid;

	char			*name;

	size_t			passkey_sz;
	char			*passkey;
};

static inline bool user_guest(struct ksmbd_user *user)
{
	return user->flags & KSMBD_USER_FLAG_GUEST_ACCOUNT;
}

static inline void set_user_flag(struct ksmbd_user *user, int flag)
{
	user->flags |= flag;
}

static inline int test_user_flag(struct ksmbd_user *user, int flag)
{
	return user->flags & flag;
}

static inline void set_user_guest(struct ksmbd_user *user)
{
}

static inline char *user_passkey(struct ksmbd_user *user)
{
	return user->passkey;
}

static inline char *user_name(struct ksmbd_user *user)
{
	return user->name;
}

static inline unsigned int user_uid(struct ksmbd_user *user)
{
	return user->uid;
}

static inline unsigned int user_gid(struct ksmbd_user *user)
{
	return user->gid;
}

struct ksmbd_user *ksmbd_login_user(const char *account);
struct ksmbd_user *ksmbd_alloc_user(struct ksmbd_login_response *resp);
void ksmbd_free_user(struct ksmbd_user *user);
int ksmbd_anonymous_user(struct ksmbd_user *user);
#endif /* __USER_CONFIG_MANAGEMENT_H__ */