Print this page
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/lib/libsmbfs/smb/private.h
+++ new/usr/src/lib/libsmbfs/smb/private.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
|
↓ open down ↓ |
23 lines elided |
↑ open up ↑ |
24 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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
33 33 /*
34 - * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
35 34 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
36 35 * Use is subject to license terms.
36 + *
37 + * Copyright 2018 Nexenta Systems, Inc. All rights reserved.
37 38 */
38 39
39 40 #ifndef _PRIVATE_H
40 41 #define _PRIVATE_H
41 42
42 43 /*
43 44 * Private declarations for this library.
44 45 * Moved from smb_lib.h
45 46 */
46 47
47 48 #include <inttypes.h>
48 49 #include <sys/byteorder.h>
49 50 #include <sys/ccompile.h>
50 51
51 52 #include <netsmb/mchain.h>
52 53 #include <netsmb/netbios.h>
53 54
|
↓ open down ↓ |
7 lines elided |
↑ open up ↑ |
54 55 extern void dprint(const char *, const char *, ...)
55 56 __PRINTFLIKE(2);
56 57
57 58 #if defined(DEBUG) || defined(__lint)
58 59 #define DPRINT(...) dprint(__func__, __VA_ARGS__)
59 60 #else
60 61 #define DPRINT(...) ((void)0)
61 62 #endif
62 63
63 64 /*
64 - * Flags bits in ct_vcflags (copied from smb_conn.h)
65 - * Pass these to the driver?
66 - */
67 -#define SMBV_RECONNECTING 0x0002 /* conn in process of reconnection */
68 -#define SMBV_LONGNAMES 0x0004 /* conn configured to use long names */
69 -#define SMBV_ENCRYPT 0x0008 /* server demands encrypted password */
70 -#define SMBV_WIN95 0x0010 /* used to apply bugfixes for this OS */
71 -#define SMBV_NT4 0x0020 /* used when NT4 issues invalid resp */
72 -#define SMBV_UNICODE 0x0040 /* conn configured to use Unicode */
73 -#define SMBV_EXT_SEC 0x0080 /* conn to use extended security */
74 -#define SMBV_WILL_SIGN 0x0100 /* negotiated signing */
75 -
76 -/*
77 - * request handling structures
78 - */
79 -struct smb_rq {
80 - struct smb_ctx *rq_ctx;
81 - struct mbdata rq_rq;
82 - struct mbdata rq_rp;
83 - int rq_rpbufsz;
84 - uint8_t rq_cmd;
85 - uint8_t rq_hflags;
86 - uint16_t rq_hflags2;
87 - uint32_t rq_status;
88 - uint16_t rq_uid;
89 - uint16_t rq_tid;
90 - uint16_t rq_mid;
91 - uint32_t rq_seqno;
92 - /* See rq_[bw]{start,end} functions */
93 - char *rq_wcntp;
94 - int rq_wcbase;
95 - char *rq_bcntp;
96 - int rq_bcbase;
97 -};
98 -typedef struct smb_rq smb_rq_t;
99 -
100 -#define smb_rq_getrequest(rqp) (&(rqp)->rq_rq)
101 -#define smb_rq_getreply(rqp) (&(rqp)->rq_rp)
102 -
103 -int smb_rq_init(struct smb_ctx *, uchar_t, struct smb_rq **);
104 -void smb_rq_done(struct smb_rq *);
105 -void smb_rq_bstart(struct smb_rq *);
106 -void smb_rq_bend(struct smb_rq *);
107 -void smb_rq_wstart(struct smb_rq *);
108 -void smb_rq_wend(struct smb_rq *);
109 -int smb_rq_simple(struct smb_rq *);
110 -int smb_rq_dmem(struct mbdata *, const char *, size_t);
111 -int smb_rq_internal(struct smb_ctx *, struct smb_rq *);
112 -void smb_rq_sign(struct smb_rq *);
113 -int smb_rq_verify(struct smb_rq *);
114 -int smb_t2_request(int, int, uint16_t *, const char *,
115 - int, void *, int, void *, int *, void *, int *, void *, int *);
116 -
117 -/*
118 65 * This library extends the mchain.h function set a little.
119 66 */
120 67 int m_getm(struct mbuf *, int, struct mbuf **);
121 68 int m_lineup(struct mbuf *, struct mbuf **);
122 69 size_t m_totlen(struct mbuf *);
123 70
124 71 int mb_init_sz(struct mbdata *, int);
125 72 int mb_fit(struct mbdata *mbp, int size, char **pp);
126 73
127 74 int mb_put_string(struct mbdata *mbp, const char *s, int);
128 75 int mb_put_astring(struct mbdata *mbp, const char *s);
129 76 int mb_put_ustring(struct mbdata *mbp, const char *s);
130 77
131 78 int md_get_string(struct mbdata *, char **, int);
132 79 int md_get_astring(struct mbdata *, char **);
133 80 int md_get_ustring(struct mbdata *, char **);
134 81
135 82 /*
136 83 * Network stuff (NetBIOS and otherwise)
137 84 */
138 85 struct nb_name;
139 86 struct sockaddr_nb;
140 87
141 88 extern int smb_recv_timeout; /* seconds */
142 89
143 90 void dump_ctx(char *, struct smb_ctx *);
144 91 void dump_addrinfo(struct addrinfo *);
145 92 void dump_sockaddr(struct sockaddr *);
146 93 int nb_ssn_request(struct smb_ctx *, char *);
147 94
148 95 int nb_name_len(struct nb_name *);
149 96 int nb_name_encode(struct mbdata *, struct nb_name *);
150 97 int nb_encname_len(const uchar_t *);
151 98
152 99 int nb_snballoc(struct sockaddr_nb **);
153 100 void nb_snbfree(struct sockaddr *);
154 101 int nb_sockaddr(struct sockaddr *, struct nb_name *, struct sockaddr_nb **);
155 102
156 103 int nbns_getaddrinfo(const char *name, struct nb_ctx *nbc,
157 104 struct addrinfo **res);
158 105 int nbns_resolvename(const char *, struct nb_ctx *, struct sockaddr **);
159 106 int get_xti_err(int);
160 107
161 108
162 109 /*
163 110 * Private SMB stuff
164 111 */
165 112
166 113 struct smb_bitname {
|
↓ open down ↓ |
39 lines elided |
↑ open up ↑ |
167 114 uint_t bn_bit;
168 115 char *bn_name;
169 116 };
170 117 typedef struct smb_bitname smb_bitname_t;
171 118 char *smb_printb(char *, int, const struct smb_bitname *);
172 119
173 120 int smb_ctx_getaddr(struct smb_ctx *ctx);
174 121 int smb_ctx_gethandle(struct smb_ctx *ctx);
175 122
176 123 int smb_iod_start(struct smb_ctx *);
124 +const char *smb_iod_state_name(enum smbiod_state st);
177 125
178 -int smb_ssn_send(struct smb_ctx *, struct mbdata *);
179 -int smb_ssn_recv(struct smb_ctx *, struct mbdata *);
180 -
181 -int smb_negprot(struct smb_ctx *, struct mbdata *);
182 -
183 -int smb_ssnsetup_null(struct smb_ctx *);
184 -int smb_ssnsetup_ntlm1(struct smb_ctx *);
185 -int smb_ssnsetup_ntlm2(struct smb_ctx *);
186 -int smb_ssnsetup_spnego(struct smb_ctx *, struct mbdata *);
187 -
188 126 void smb_time_local2server(struct timeval *, int, long *);
189 127 void smb_time_server2local(ulong_t, int, struct timeval *);
190 128 void smb_time_NT2local(uint64_t, int, struct timeval *);
191 129 void smb_time_local2NT(struct timeval *, int, uint64_t *);
192 130
193 131 int smb_getlocalname(char **);
194 132 int smb_get_authentication(struct smb_ctx *);
195 133 int smb_get_keychain(struct smb_ctx *ctx);
196 134 void smb_hexdump(const void *buf, int len);
197 135
198 136 /* See ssp.c */
199 137 int ssp_ctx_create_client(struct smb_ctx *, struct mbdata *);
200 138 int ssp_ctx_next_token(struct smb_ctx *, struct mbdata *, struct mbdata *);
201 139 void ssp_ctx_destroy(struct smb_ctx *);
202 140
203 141 #ifdef KICONV_SUPPORT
204 142 /* See nls.c (get rid of this?) */
205 143 extern uchar_t nls_lower[256], nls_upper[256];
206 144 #endif /* KICONV_SUPPORT */
207 145
208 146 #endif /* _PRIVATE_H */
|
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX