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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# uts/intel/nsmb/Makefile
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright (c) 2018, Joyent, Inc.
# Copyright 2024 RackTop Systems, Inc.
#
# intel architecture dependent
#
#
# Path to the base of the uts directory tree (usually /usr/src/uts).
#
UTSBASE = ../..
#
# Define the module and object file sets.
#
MODULE = nsmb
OBJECTS = $(NSMB_OBJS:%=$(OBJS_DIR)/%)
ROOTMODULE = $(USR_DRV_DIR)/$(MODULE)
CONF_SRCDIR = $(UTSBASE)/common/fs/smbclnt/netsmb
OFFSETS_SRC = $(CONF_SRCDIR)/offsets.in
IOC_CHECK_H = $(OBJS_DIR)/ioc_check.h
# What symbols we export (e.g. _init(), ...)
MAPFILE = $(CONF_SRCDIR)/$(MODULE).mapfile
# The symbols we link against
MAPFILE_EXT = $(CONF_SRCDIR)/nsmb_ext.mapfile
MAPFILES += tlimod ddi
#
# Include common rules.
#
include $(UTSBASE)/intel/Makefile.intel
#
# Define targets
#
ALL_TARGET = $(ALL_TARGET_$(OBJS_DIR))
INSTALL_TARGET = $(INSTALL_TARGET_$(OBJS_DIR))
#
# Overrides.
#
# We need some unusual overrides here so we'll
# build ioc_check.h for both 32-bit/64-bit,
# but only build 64-bit binaries.
#
# Hammerhead: 64-bit only, skip 32-bit offset checking
DEF_BUILDS = $(DEF_BUILDS64)
ALL_BUILDS = $(ALL_BUILDS64)
# ... but don't build any 32-bit objects
ALL_TARGET_debug32 = $(IOC_CHECK_H)
ALL_TARGET_debug64 = $(BINARY) $(SRC_CONFILE)
ALL_TARGET_obj32 = $(IOC_CHECK_H)
ALL_TARGET_obj64 = $(BINARY) $(SRC_CONFILE)
# ... and remove -xcg92 (not supported by cw)
CFLAGS_32=
# ... same deal for install targets
INSTALL_TARGET_debug32 = $(IOC_CHECK_H)
INSTALL_TARGET_debug64 = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
INSTALL_TARGET_obj32 = $(IOC_CHECK_H)
INSTALL_TARGET_obj64 = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
#
# Now the normal overrides...
#
CLEANFILES += $(IOC_CHECK_H)
INC_PATH += -I$(UTSBASE)/common/fs/smbclnt
LDFLAGS += -Ncrypto/md4 -Ncrypto/md5 -Nmisc/kcf -Nmisc/tlimod
LDFLAGS += -M $(MAPFILE) -M $(MAPFILE_EXT)
#
# For now, disable these warnings; maintainers should endeavor
# to investigate and remove these for maximum coverage.
# Please do not carry these forward to new Makefiles.
#
# The mb_put/md_get functions are intentionally used with and without
# return value checks, so filter those.
SMOFF += all_func_returns
# needs work
SMOFF += signed,deref_check
#
# Default build targets.
#
.KEEP_STATE:
def: $(DEF_DEPS)
all: $(ALL_DEPS)
clean: $(CLEAN_DEPS)
clobber: $(CLOBBER_DEPS)
install: $(INSTALL_DEPS)
#
# Create ioc_check.h and compare with the saved
# ioc_check.ref to ensure 32/64-bit invariance.
#
$(OBJECTS) : $(IOC_CHECK_H)
$(IOC_CHECK_H): $(OFFSETS_SRC)
$(OFFSETS_CREATE) <$(OFFSETS_SRC) >$@.tmp
cmp -s ioc_check.ref $@.tmp && \
mv -f $@.tmp $@
#
# Include common targets.
#
include $(UTSBASE)/Makefile.mapfile
include $(UTSBASE)/intel/Makefile.targ
#define ID_SRVADDR 0x0
#define ID_DOMAIN 0x20
#define ID_DOMAIN_INCR 0x1
#define ID_USER 0x120
#define ID_USER_INCR 0x1
#define SSN_OWNER 0x0
#define SSN_VOPT 0x4
#define SSN_MINVER 0x8
#define SSN_MAXVER 0xa
#define SSN_ID 0xc
#define SSN_SRVNAME 0x22c
#define SSN_SRVNAME_INCR 0x1
#define SH_USE 0x0
#define SH_TYPE 0x4
#define SH_NAME 0x8
#define SH_NAME_INCR 0x1
#define SH_PASS 0x108
#define SH_PASS_INCR 0x1
#define TC_FLAGS 0x0
#define TC_OPT 0x4
#define TC_SH 0x8
#define WK_OUT_STATE 0x0
#define WK_U_SSNKEY_LEN 0x4
#define WK_U_SSNKEY_BUF 0x8
#define WK_U_AUTH_RLEN 0x10
#define WK_U_AUTH_WLEN 0x14
#define WK_U_AUTH_RBUF 0x18
#define WK_U_AUTH_WBUF 0x20
#define WK_CL_GUID 0x28
#define WK_CL_GUID_INCR 0x1
#define SIZEOF_SMBIOC_RW 0x18
#define IOC_CNT 0x0
#define IOC_FLAGS 0x4
#define _IOC_OFFSET 0x8
#define _IOC_BASE 0x10
#define SIZEOF_SMBIOC_XNP 0x20
#define IOC_TDLEN 0x0
#define IOC_RDLEN 0x4
#define IOC_MORE 0x8
#define IOC_PAD1 0xc
#define _IOC_TDATA 0x10
#define _IOC_RDATA 0x18
#define SIZEOF_NTCREATE 0x114
#define IOC_REQ_ACC 0x0
#define IOC_EFATTR 0x4
#define IOC_SHARE_ACC 0x8
#define IOC_OPEN_DISP 0xc
#define IOC_CREAT_OPTS 0x10
#define IOC_NTCR_NAME 0x14
#define IOC_NTCR_NAME_INCR 0x1
#define SIZEOF_PRINTJOB 0x104
#define IOC_SETUPLEN 0x0
#define IOC_PRMODE 0x2
#define IOC_TITLE 0x4
#define IOC_TITLE_INCR 0x1
#define SIZEOF_SMBIOC_PK 0x224
#define PK_UID 0x0
#define PK_DOM 0x4
#define PK_DOM_INCR 0x1
#define PK_USR 0x104
#define PK_USR_INCR 0x1
#define PK_LMHASH 0x204
#define PK_LMHASH_INCR 0x1
#define PK_NTHASH 0x214
#define PK_NTHASH_INCR 0x1
|