Print this page
NEX-14666 Need to provide SMB 2.1 Client
NEX-17187 panic in smbfs_acl_store
NEX-17231 smbfs create xattr files finds wrong file
NEX-17224 smbfs lookup EINVAL should be ENOENT
NEX-17260 SMB1 client fails to list directory after NEX-14666
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
and: (cleanup)
NEX-16824 SMB client connection setup rework
NEX-17232 SMB client reconnect failures
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
and: (improve debug)
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/fs/smbclnt/netsmb/smb_subr.h
+++ new/usr/src/uts/common/fs/smbclnt/netsmb/smb_subr.h
1 1 /*
2 2 * Copyright (c) 2000-2001, Boris Popov
3 3 * All rights reserved.
4 4 *
5 5 * Redistribution and use in source and binary forms, with or without
6 6 * modification, are permitted provided that the following conditions
7 7 * are met:
8 8 * 1. Redistributions of source code must retain the above copyright
9 9 * notice, this list of conditions and the following disclaimer.
10 10 * 2. Redistributions in binary form must reproduce the above copyright
11 11 * notice, this list of conditions and the following disclaimer in the
12 12 * documentation and/or other materials provided with the distribution.
13 13 * 3. All advertising materials mentioning features or use of this software
14 14 * must display the following acknowledgement:
15 15 * This product includes software developed by Boris Popov.
16 16 * 4. Neither the name of the author nor the names of any co-contributors
17 17 * may be used to endorse or promote products derived from this software
18 18 * without specific prior written permission.
19 19 *
20 20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
↓ open down ↓ |
25 lines elided |
↑ open up ↑ |
26 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 30 * SUCH DAMAGE.
31 31 *
32 32 * $Id: smb_subr.h,v 1.13 2004/09/14 22:59:08 lindak Exp $
33 33 */
34 34
35 35 /*
36 - * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
37 36 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
37 + * Copyright 2018 Nexenta Systems, Inc. All rights reserved.
38 38 */
39 39
40 40 #ifndef _NETSMB_SMB_SUBR_H_
41 41 #define _NETSMB_SMB_SUBR_H_
42 42
43 43 #include <sys/cmn_err.h>
44 44 #include <sys/lock.h>
45 45 #include <sys/note.h>
46 +#include <netsmb/mchain.h>
46 47 #include <netsmb/smb_conn.h>
47 48
49 +/*
50 + * Possible lock commands
51 + */
52 +#define SMB_LOCK_EXCL 0
53 +#define SMB_LOCK_SHARED 1
54 +#define SMB_LOCK_RELEASE 2
55 +
48 56 struct msgb; /* avoiding sys/stream.h here */
49 57
50 58 /* Helper function for SMBERROR */
51 59 /*PRINTFLIKE3*/
52 60 extern void smb_errmsg(int, const char *, const char *, ...)
53 61 __KPRINTFLIKE(3);
54 62 void m_dumpm(struct msgb *);
55 63
56 64 /*
57 65 * Let's use C99 standard variadic macros!
58 66 * Also the C99 __func__ (function name) feature.
59 67 */
60 68 #define SMBERROR(...) \
61 69 smb_errmsg(CE_NOTE, __func__, __VA_ARGS__)
62 70 #define SMBPANIC(...) \
63 71 smb_errmsg(CE_PANIC, __func__, __VA_ARGS__)
64 72 #define SMBSDEBUG(...) \
65 73 smb_errmsg(CE_CONT, __func__, __VA_ARGS__)
66 74 #define SMBIODEBUG(...) \
67 75 smb_errmsg(CE_CONT, __func__, __VA_ARGS__)
68 76 #define NBDEBUG(...) \
69 77 smb_errmsg(CE_CONT, __func__, __VA_ARGS__)
70 78
71 79 #if defined(DEBUG) || defined(lint)
72 80
73 81 #define DEBUG_ENTER(str) debug_enter(str)
74 82
75 83 #else /* DEBUG or lint */
76 84
77 85 #define DEBUG_ENTER(str) ((void)0)
78 86
79 87 #endif /* DEBUG or lint */
80 88
81 89 typedef uint16_t smb_unichar;
82 90 typedef smb_unichar *smb_uniptr;
83 91
84 92 extern smb_unichar smb_unieol;
85 93
86 94 struct mbchain;
87 95 struct smb_rq;
88 96 struct smb_vc;
89 97
90 98 /*
91 99 * These are the attributes we can get from the server via
92 100 * SMB commands such as TRANS2_QUERY_FILE_INFORMATION
93 101 * with info level SMB_QFILEINFO_ALL_INFO, and directory
94 102 * FindFirst/FindNext info. levels FIND_DIRECTORY_INFO
95 103 * and FIND_BOTH_DIRECTORY_INFO, etc.
96 104 *
97 105 * Values in this struct are always native endian,
98 106 * and times are converted converted to Unix form.
99 107 * Note: zero in any of the times means "unknown".
100 108 */
101 109 typedef struct smbfattr {
102 110 timespec_t fa_createtime; /* Note, != ctime */
103 111 timespec_t fa_atime; /* these 3 are like unix */
104 112 timespec_t fa_mtime;
105 113 timespec_t fa_ctime;
106 114 u_offset_t fa_size; /* EOF position */
107 115 u_offset_t fa_allocsz; /* Allocated size. */
108 116 uint32_t fa_attr; /* Ext. file (DOS) attr */
109 117 } smbfattr_t;
|
↓ open down ↓ |
52 lines elided |
↑ open up ↑ |
110 118
111 119 /*
112 120 * Tunable timeout values. See: smb_smb.c
113 121 */
114 122 extern int smb_timo_notice;
115 123 extern int smb_timo_default;
116 124 extern int smb_timo_open;
117 125 extern int smb_timo_read;
118 126 extern int smb_timo_write;
119 127 extern int smb_timo_append;
128 +extern dev_t nsmb_dev_tcp;
129 +extern dev_t nsmb_dev_tcp6;
120 130
121 -#define EMOREDATA (0x7fff)
131 +/*
132 + * Tunable timeout values. See: smb2_smb.c
133 + */
134 +extern int smb2_timo_notice;
135 +extern int smb2_timo_default;
136 +extern int smb2_timo_open;
137 +extern int smb2_timo_read;
138 +extern int smb2_timo_write;
139 +extern int smb2_timo_append;
122 140
123 141 void smb_credinit(struct smb_cred *scred, cred_t *cr);
124 142 void smb_credrele(struct smb_cred *scred);
125 143
126 -void smb_oldlm_hash(const char *apwd, uchar_t *hash);
127 -void smb_ntlmv1hash(const char *apwd, uchar_t *hash);
128 -void smb_ntlmv2hash(const uchar_t *v1hash, const char *user,
129 - const char *destination, uchar_t *v2hash);
130 -
131 -int smb_lmresponse(const uchar_t *hash, const uchar_t *C8, uchar_t *RN);
132 -int smb_ntlmv2response(const uchar_t *hash, const uchar_t *C8,
133 - const uchar_t *blob, size_t bloblen, uchar_t **RN, size_t *RNlen);
134 144 int smb_maperror(int eclass, int eno);
135 145 int smb_maperr32(uint32_t eno);
146 +uint_t smb_doserr2status(int, int);
147 +int smb_get_dstring(struct mdchain *mdc, struct smb_vc *vcp,
148 + char *outbuf, size_t *outlen, int inlen);
136 149 int smb_put_dmem(struct mbchain *mbp, struct smb_vc *vcp,
137 150 const char *src, int len, int caseopt, int *lenp);
138 151 int smb_put_dstring(struct mbchain *mbp, struct smb_vc *vcp,
139 152 const char *src, int caseopt);
140 153 int smb_put_string(struct smb_rq *rqp, const char *src);
141 154 int smb_put_asunistring(struct smb_rq *rqp, const char *src);
142 -int smb_checksmp(void);
143 155
156 +int smb_smb_ntcreate(struct smb_share *ssp, struct mbchain *name_mb,
157 + uint32_t crflag, uint32_t req_acc, uint32_t efa, uint32_t sh_acc,
158 + uint32_t disp, uint32_t createopt, uint32_t impersonate,
159 + struct smb_cred *scrp, smb_fh_t *fhp,
160 + uint32_t *cr_act_p, struct smbfattr *fap);
161 +
162 +int smb_smb_close(struct smb_share *ssp, smb_fh_t *fhp,
163 + struct smb_cred *scrp);
164 +
165 +int smb_rwuio(smb_fh_t *fhp, uio_rw_t rw,
166 + uio_t *uiop, smb_cred_t *scred, int timo);
167 +
144 168 int smb_cmp_sockaddr(struct sockaddr *, struct sockaddr *);
145 169 struct sockaddr *smb_dup_sockaddr(struct sockaddr *sa);
146 170 void smb_free_sockaddr(struct sockaddr *sa);
147 -int smb_toupper(const char *, char *, size_t);
148 171
172 +int smb_sign_init(struct smb_vc *);
149 173 void smb_rq_sign(struct smb_rq *);
150 174 int smb_rq_verify(struct smb_rq *);
151 175 int smb_calcv2mackey(struct smb_vc *, const uchar_t *,
152 176 const uchar_t *, size_t);
153 177 int smb_calcmackey(struct smb_vc *, const uchar_t *,
154 178 const uchar_t *, size_t);
155 -void smb_crypto_mech_init(void);
156 179
180 +int smb2_sign_init(struct smb_vc *);
181 +void smb2_rq_sign(struct smb_rq *);
182 +int smb2_rq_verify(struct smb_rq *);
157 183
158 184 /*
159 185 * SMB protocol level functions
160 186 */
187 +int smb_smb_negotiate(struct smb_vc *vcp, struct smb_cred *scred);
188 +int smb_smb_ssnsetup(struct smb_vc *vcp, struct smb_cred *scred);
189 +int smb_smb_logoff(struct smb_vc *vcp, struct smb_cred *scred);
161 190 int smb_smb_echo(smb_vc_t *vcp, smb_cred_t *scred, int timo);
162 191 int smb_smb_treeconnect(smb_share_t *ssp, smb_cred_t *scred);
163 192 int smb_smb_treedisconnect(smb_share_t *ssp, smb_cred_t *scred);
164 193
165 -int
166 -smb_smb_ntcreate(struct smb_share *ssp, struct mbchain *name_mb,
194 +int smb1_smb_ntcreate(struct smb_share *ssp, struct mbchain *name_mb,
167 195 uint32_t crflag, uint32_t req_acc, uint32_t efa, uint32_t sh_acc,
168 196 uint32_t disp, uint32_t createopt, uint32_t impersonate,
169 197 struct smb_cred *scrp, uint16_t *fidp,
170 198 uint32_t *cr_act_p, struct smbfattr *fap);
171 199
172 -int smb_smb_close(struct smb_share *ssp, uint16_t fid,
200 +int smb1_smb_close(struct smb_share *ssp, uint16_t fid,
173 201 struct timespec *mtime, struct smb_cred *scrp);
174 202
175 -int
176 -smb_smb_open_prjob(struct smb_share *ssp, char *title,
203 +int smb_smb_open_prjob(struct smb_share *ssp, char *title,
177 204 uint16_t setuplen, uint16_t mode,
178 205 struct smb_cred *scrp, uint16_t *fidp);
179 206
180 207 int smb_smb_close_prjob(struct smb_share *ssp, uint16_t fid,
181 208 struct smb_cred *scrp);
182 209
183 -int smb_rwuio(smb_share_t *ssp, uint16_t fid, uio_rw_t rw,
210 +int smb_smb_readx(smb_fh_t *fhp, uint32_t *lenp,
184 211 uio_t *uiop, smb_cred_t *scred, int timo);
212 +int smb_smb_writex(smb_fh_t *fhp, uint32_t *lenp,
213 + uio_t *uiop, smb_cred_t *scred, int timo);
185 214
186 215 /*
187 - * time conversions
216 + * SMB2 protocol level functions
188 217 */
218 +int smb2_smb_negotiate(struct smb_vc *vcp, struct smb_cred *scred);
219 +int smb2_smb_ssnsetup(struct smb_vc *vcp, struct smb_cred *scred);
220 +int smb2_smb_logoff(struct smb_vc *vcp, struct smb_cred *scred);
221 +int smb2_smb_echo(smb_vc_t *vcp, smb_cred_t *scred, int timo);
222 +int smb2_smb_treeconnect(smb_share_t *ssp, smb_cred_t *scred);
223 +int smb2_smb_treedisconnect(smb_share_t *ssp, smb_cred_t *scred);
189 224
190 -void smb_time_init(void);
191 -void smb_time_fini(void);
225 +int
226 +smb2_smb_ntcreate(struct smb_share *ssp, struct mbchain *name_mb,
227 + struct mbchain *cctx_in, struct mdchain *cctx_out,
228 + uint32_t crflag, uint32_t req_acc, uint32_t efa, uint32_t sh_acc,
229 + uint32_t disp, uint32_t createopt, uint32_t impersonate,
230 + struct smb_cred *scrp, smb2fid_t *fidp,
231 + uint32_t *cr_act_p, struct smbfattr *fap);
192 232
233 +int smb2_smb_close(struct smb_share *ssp, smb2fid_t *fid,
234 + struct smb_cred *scrp);
235 +
236 +int smb2_smb_ioctl(struct smb_share *ssp, smb2fid_t *fid,
237 + struct mbchain *data_in, struct mdchain *data_out,
238 + uint32_t *data_out_sz, /* max / returned */
239 + uint32_t ctl_code, struct smb_cred *scrp);
240 +
241 +int smb2_smb_read(smb_fh_t *fhp, uint32_t *lenp,
242 + uio_t *uiop, smb_cred_t *scred, int timo);
243 +int smb2_smb_write(smb_fh_t *fhp, uint32_t *lenp,
244 + uio_t *uiop, smb_cred_t *scred, int timo);
245 +
246 +/*
247 + * time conversions
248 + */
249 +
193 250 void smb_time_local2server(struct timespec *tsp, int tzoff, long *seconds);
194 251 void smb_time_server2local(ulong_t seconds, int tzoff, struct timespec *tsp);
195 252 void smb_time_NT2local(uint64_t nsec, struct timespec *tsp);
196 253 void smb_time_local2NT(struct timespec *tsp, uint64_t *nsec);
197 -void smb_time_unix2dos(struct timespec *tsp, int tzoff, uint16_t *ddp,
198 - uint16_t *dtp, uint8_t *dhp);
199 -void smb_dos2unixtime(uint_t dd, uint_t dt, uint_t dh, int tzoff,
200 - struct timespec *tsp);
201 254
202 255 #endif /* !_NETSMB_SMB_SUBR_H_ */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX