2 Samba Unix/Linux SMB client library
3 RAP (SMB Remote Procedure Calls) defines and structures
4 Copyright (C) Steve French 2001 (sfrench@us.ibm.com)
5 Copyright (C) Jim McDonough 2001 (jmcd@us.ibm.com)
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 /*****************************************************/
27 /* Additional RAP functionality */
29 /* RAP is the original SMB RPC, documented */
30 /* by Microsoft and X/Open in the 1990s and */
31 /* supported by most SMB/CIFS servers although */
32 /* it is unlikely that any one implementation */
33 /* supports all RAP command codes since some */
34 /* are quite obsolete and a few are specific */
35 /* to a particular network operating system */
37 /* Although it has largely been replaced */
38 /* for complex remote admistration and management */
39 /* (of servers) by the relatively newer */
40 /* DCE/RPC based remote API (which better handles */
41 /* large >64K data structures), there are many */
42 /* important administrative and resource location */
43 /* tasks and user tasks (e.g. password change) */
44 /* that are performed via RAP. */
46 /* Although a few of the RAP calls are implemented */
47 /* in the Samba client library already (clirap.c) */
48 /* the new ones are in clirap2.c for easy patching */
49 /* and integration and a corresponding header */
50 /* file, rap.h, has been created. */
52 /* This is based on data from the CIFS spec */
53 /* and the LAN Server and LAN Manager */
54 /* Programming Reference books and published */
55 /* RAP document and CIFS forum postings and */
56 /* lots of trial and error. Additional */
57 /* background information is available from the */
58 /* X/Open reference book in their PC Interworking */
59 /* series "IPC for SMB" and also from the */
60 /* interoperability documentation in */
61 /* ftp://ftp.microsoft.com/developr/drg/cifs */
63 /* Function names changed from API_ (as they are */
64 /* in the CIFS specification to RAP_ in order */
65 /* to avoid confusion with other API calls */
66 /* sent via DCE RPC */
68 /*****************************************************/
70 /*****************************************************/
72 /* Although without pound defines (of this header) */
73 /* cifsrap.c already includes support for: */
75 /* WshareEnum (API number 0, level 1) */
76 /* NetServerEnum2 (API num 104, level 1) */
77 /* WWkstaUserLogon (132) */
78 /* SamOEMchgPasswordUser2_P (214) */
80 /* and cifsprint.c already includes support for: */
82 /* WPrintJobEnum (API num 76, level 2) */
83 /* WPrintJobDel (API num 81) */
85 /*****************************************************/
87 #define RAP_WshareEnum 0
88 #define RAP_WshareGetInfo 1
89 #define RAP_WshareSetInfo 2
90 #define RAP_WshareAdd 3
91 #define RAP_WshareDel 4
92 #define RAP_NetShareCheck 5
93 #define RAP_WsessionEnum 6
94 #define RAP_WsessionGetInfo 7
95 #define RAP_WsessionDel 8
96 #define RAP_WconnectionEnum 9
97 #define RAP_WfileEnum 10
98 #define RAP_WfileGetInfo 11
99 #define RAP_WfileClose 12
100 #define RAP_WserverGetInfo 13
101 #define RAP_WserverSetInfo 14
102 #define RAP_WserverDiskEnum 15
103 #define RAP_WserverAdminCommand 16
104 #define RAP_NetAuditOpen 17
105 #define RAP_WauditClear 18
106 #define RAP_NetErrorLogOpen 19
107 #define RAP_WerrorLogClear 20
108 #define RAP_NetCharDevEnum 21
109 #define RAP_NetCharDevGetInfo 22
110 #define RAP_WCharDevControl 23
111 #define RAP_NetCharDevQEnum 24
112 #define RAP_NetCharDevQGetInfo 25
113 #define RAP_WCharDevQSetInfo 26
114 #define RAP_WCharDevQPurge 27
115 #define RAP_WCharDevQPurgeSelf 28
116 #define RAP_WMessageNameEnum 29
117 #define RAP_WMessageNameGetInfo 30
118 #define RAP_WMessageNameAdd 31
119 #define RAP_WMessageNameDel 32
120 #define RAP_WMessageNameFwd 33
121 #define RAP_WMessageNameUnFwd 34
122 #define RAP_WMessageBufferSend 35
123 #define RAP_WMessageFileSend 36
124 #define RAP_WMessageLogFileSet 37
125 #define RAP_WMessageLogFileGet 38
126 #define RAP_WServiceEnum 39
127 #define RAP_WServiceInstall 40
128 #define RAP_WServiceControl 41
129 #define RAP_WAccessEnum 42
130 #define RAP_WAccessGetInfo 43
131 #define RAP_WAccessSetInfo 44
132 #define RAP_WAccessAdd 45
133 #define RAP_WAccessDel 46
134 #define RAP_WGroupEnum 47
135 #define RAP_WGroupAdd 48
136 #define RAP_WGroupDel 49
137 #define RAP_WGroupAddUser 50
138 #define RAP_WGroupDelUser 51
139 #define RAP_WGroupGetUsers 52
140 #define RAP_WUserEnum 53
141 #define RAP_WUserAdd 54
142 #define RAP_WUserDel 55
143 #define RAP_WUserGetInfo 56
144 #define RAP_WUserSetInfo 57
145 #define RAP_WUserPasswordSet 58
146 #define RAP_WUserGetGroups 59
147 #define RAP_WWkstaSetUID 62
148 #define RAP_WWkstaGetInfo 63
149 #define RAP_WWkstaSetInfo 64
150 #define RAP_WUseEnum 65
151 #define RAP_WUseAdd 66
152 #define RAP_WUseDel 67
153 #define RAP_WUseGetInfo 68
154 #define RAP_WPrintQEnum 69
155 #define RAP_WPrintQGetInfo 70
156 #define RAP_WPrintQSetInfo 71
157 #define RAP_WPrintQAdd 72
158 #define RAP_WPrintQDel 73
159 #define RAP_WPrintQPause 74
160 #define RAP_WPrintQContinue 75
161 #define RAP_WPrintJobEnum 76
162 #define RAP_WPrintJobGetInfo 77
163 #define RAP_WPrintJobSetInfo_OLD 78
164 #define RAP_WPrintJobDel 81
165 #define RAP_WPrintJobPause 82
166 #define RAP_WPrintJobContinue 83
167 #define RAP_WPrintDestEnum 84
168 #define RAP_WPrintDestGetInfo 85
169 #define RAP_WPrintDestControl 86
170 #define RAP_WProfileSave 87
171 #define RAP_WProfileLoad 88
172 #define RAP_WStatisticsGet 89
173 #define RAP_WStatisticsClear 90
174 #define RAP_NetRemoteTOD 91
175 #define RAP_WNetBiosEnum 92
176 #define RAP_WNetBiosGetInfo 93
177 #define RAP_NetServerEnum 94
178 #define RAP_I_NetServerEnum 95
179 #define RAP_WServiceGetInfo 96
180 #define RAP_WPrintQPurge 103
181 #define RAP_NetServerEnum2 104
182 #define RAP_WAccessGetUserPerms 105
183 #define RAP_WGroupGetInfo 106
184 #define RAP_WGroupSetInfo 107
185 #define RAP_WGroupSetUsers 108
186 #define RAP_WUserSetGroups 109
187 #define RAP_WUserModalsGet 110
188 #define RAP_WUserModalsSet 111
189 #define RAP_WFileEnum2 112
190 #define RAP_WUserAdd2 113
191 #define RAP_WUserSetInfo2 114
192 #define RAP_WUserPasswordSet2 115
193 #define RAP_I_NetServerEnum2 116
194 #define RAP_WConfigGet2 117
195 #define RAP_WConfigGetAll2 118
196 #define RAP_WGetDCName 119
197 #define RAP_NetHandleGetInfo 120
198 #define RAP_NetHandleSetInfo 121
199 #define RAP_WStatisticsGet2 122
200 #define RAP_WBuildGetInfo 123
201 #define RAP_WFileGetInfo2 124
202 #define RAP_WFileClose2 125
203 #define RAP_WNetServerReqChallenge 126
204 #define RAP_WNetServerAuthenticate 127
205 #define RAP_WNetServerPasswordSet 128
206 #define RAP_WNetAccountDeltas 129
207 #define RAP_WNetAccountSync 130
208 #define RAP_WUserEnum2 131
209 #define RAP_WWkstaUserLogon 132
210 #define RAP_WWkstaUserLogoff 133
211 #define RAP_WLogonEnum 134
212 #define RAP_WErrorLogRead 135
213 #define RAP_NetPathType 136
214 #define RAP_NetPathCanonicalize 137
215 #define RAP_NetPathCompare 138
216 #define RAP_NetNameValidate 139
217 #define RAP_NetNameCanonicalize 140
218 #define RAP_NetNameCompare 141
219 #define RAP_WAuditRead 142
220 #define RAP_WPrintDestAdd 143
221 #define RAP_WPrintDestSetInfo 144
222 #define RAP_WPrintDestDel 145
223 #define RAP_WUserValidate2 146
224 #define RAP_WPrintJobSetInfo 147
225 #define RAP_TI_NetServerDiskEnum 148
226 #define RAP_TI_NetServerDiskGetInfo 149
227 #define RAP_TI_FTVerifyMirror 150
228 #define RAP_TI_FTAbortVerify 151
229 #define RAP_TI_FTGetInfo 152
230 #define RAP_TI_FTSetInfo 153
231 #define RAP_TI_FTLockDisk 154
232 #define RAP_TI_FTFixError 155
233 #define RAP_TI_FTAbortFix 156
234 #define RAP_TI_FTDiagnoseError 157
235 #define RAP_TI_FTGetDriveStats 158
236 #define RAP_TI_FTErrorGetInfo 160
237 #define RAP_NetAccessCheck 163
238 #define RAP_NetAlertRaise 164
239 #define RAP_NetAlertStart 165
240 #define RAP_NetAlertStop 166
241 #define RAP_NetAuditWrite 167
242 #define RAP_NetIRemoteAPI 168
243 #define RAP_NetServiceStatus 169
244 #define RAP_NetServerRegister 170
245 #define RAP_NetServerDeregister 171
246 #define RAP_NetSessionEntryMake 172
247 #define RAP_NetSessionEntryClear 173
248 #define RAP_NetSessionEntryGetInfo 174
249 #define RAP_NetSessionEntrySetInfo 175
250 #define RAP_NetConnectionEntryMake 176
251 #define RAP_NetConnectionEntryClear 177
252 #define RAP_NetConnectionEntrySetInfo 178
253 #define RAP_NetConnectionEntryGetInfo 179
254 #define RAP_NetFileEntryMake 180
255 #define RAP_NetFileEntryClear 181
256 #define RAP_NetFileEntrySetInfo 182
257 #define RAP_NetFileEntryGetInfo 183
258 #define RAP_AltSrvMessageBufferSend 184
259 #define RAP_AltSrvMessageFileSend 185
260 #define RAP_wI_NetRplWkstaEnum 186
261 #define RAP_wI_NetRplWkstaGetInfo 187
262 #define RAP_wI_NetRplWkstaSetInfo 188
263 #define RAP_wI_NetRplWkstaAdd 189
264 #define RAP_wI_NetRplWkstaDel 190
265 #define RAP_wI_NetRplProfileEnum 191
266 #define RAP_wI_NetRplProfileGetInfo 192
267 #define RAP_wI_NetRplProfileSetInfo 193
268 #define RAP_wI_NetRplProfileAdd 194
269 #define RAP_wI_NetRplProfileDel 195
270 #define RAP_wI_NetRplProfileClone 196
271 #define RAP_wI_NetRplBaseProfileEnum 197
272 #define RAP_WIServerSetInfo 201
273 #define RAP_WPrintDriverEnum 205
274 #define RAP_WPrintQProcessorEnum 206
275 #define RAP_WPrintPortEnum 207
276 #define RAP_WNetWriteUpdateLog 208
277 #define RAP_WNetAccountUpdate 209
278 #define RAP_WNetAccountConfirmUpdate 210
279 #define RAP_WConfigSet 211
280 #define RAP_WAccountsReplicate 212
281 #define RAP_SamOEMChgPasswordUser2_P 214
282 #define RAP_NetServerEnum3 215
283 #define RAP_WprintDriverGetInfo 250
284 #define RAP_WprintDriverSetInfo 251
285 #define RAP_WaliasAdd 252
286 #define RAP_WaliasDel 253
287 #define RAP_WaliasGetInfo 254
288 #define RAP_WaliasSetInfo 255
289 #define RAP_WaliasEnum 256
290 #define RAP_WuserGetLogonAsn 257
291 #define RAP_WuserSetLogonAsn 258
292 #define RAP_WuserGetAppSel 259
293 #define RAP_WuserSetAppSel 260
294 #define RAP_WappAdd 261
295 #define RAP_WappDel 262
296 #define RAP_WappGetInfo 263
297 #define RAP_WappSetInfo 264
298 #define RAP_WappEnum 265
299 #define RAP_WUserDCDBInit 266
300 #define RAP_WDASDAdd 267
301 #define RAP_WDASDDel 268
302 #define RAP_WDASDGetInfo 269
303 #define RAP_WDASDSetInfo 270
304 #define RAP_WDASDEnum 271
305 #define RAP_WDASDCheck 272
306 #define RAP_WDASDCtl 273
307 #define RAP_WuserRemoteLogonCheck 274
308 #define RAP_WUserPasswordSet3 275
309 #define RAP_WCreateRIPLMachine 276
310 #define RAP_WDeleteRIPLMachine 277
311 #define RAP_WGetRIPLMachineInfo 278
312 #define RAP_WSetRIPLMachineInfo 279
313 #define RAP_WEnumRIPLMachine 280
314 #define RAP_I_ShareAdd 281
315 #define RAP_AliasEnum 282
316 #define RAP_WaccessApply 283
317 #define RAP_WPrt16Query 284
318 #define RAP_WPrt16Set 285
319 #define RAP_WUserDel100 286
320 #define RAP_WUserRemoteLogonCheck2 287
321 #define RAP_WRemoteTODSet 294
322 #define RAP_WprintJobMoveAll 295
323 #define RAP_W16AppParmAdd 296
324 #define RAP_W16AppParmDel 297
325 #define RAP_W16AppParmGet 298
326 #define RAP_W16AppParmSet 299
327 #define RAP_W16RIPLMachineCreate 300
328 #define RAP_W16RIPLMachineGetInfo 301
329 #define RAP_W16RIPLMachineSetInfo 302
330 #define RAP_W16RIPLMachineEnum 303
331 #define RAP_W16RIPLMachineListParmEnum 304
332 #define RAP_W16RIPLMachClassGetInfo 305
333 #define RAP_W16RIPLMachClassEnum 306
334 #define RAP_W16RIPLMachClassCreate 307
335 #define RAP_W16RIPLMachClassSetInfo 308
336 #define RAP_W16RIPLMachClassDelete 309
337 #define RAP_W16RIPLMachClassLPEnum 310
338 #define RAP_W16RIPLMachineDelete 311
339 #define RAP_W16WSLevelGetInfo 312
340 #define RAP_WserverNameAdd 313
341 #define RAP_WserverNameDel 314
342 #define RAP_WserverNameEnum 315
343 #define RAP_I_WDASDEnum 316
344 #define RAP_WDASDEnumTerminate 317
345 #define RAP_WDASDSetInfo2 318
349 /* Parameter description strings for RAP calls */
350 /* Names are defined name for RAP call with _REQ */
351 /* appended to end. */
353 #define RAP_WFileEnum2_REQ "zzWrLehb8g8"
354 #define RAP_WFileGetInfo2_REQ "DWrLh"
355 #define RAP_WFileClose2_REQ "D"
357 #define RAP_NetGroupEnum_REQ "WrLeh"
358 #define RAP_NetGroupAdd_REQ "WsT"
359 #define RAP_NetGroupDel_REQ "z"
360 #define RAP_NetGroupAddUser_REQ "zz"
361 #define RAP_NetGroupDelUser_REQ "zz"
362 #define RAP_NetGroupGetUsers_REQ "zWrLeh"
363 #define RAP_NetGroupSetUsers_REQ "zWsTW"
365 #define RAP_NetUserAdd2_REQ "WsTWW"
366 #define RAP_NetUserEnum_REQ "WrLeh"
367 #define RAP_NetUserEnum2_REQ "WrLDieh"
368 #define RAP_NetUserGetGroups_REQ "zWrLeh"
369 #define RAP_NetUserSetGroups_REQ "zWsTW"
370 #define RAP_NetUserPasswordSet_REQ "zb16b16w"
371 #define RAP_NetUserPasswordSet2_REQ "zb16b16WW"
372 #define RAP_SAMOEMChgPasswordUser2_REQ "B516B16"
373 #define RAP_NetUserValidate2_REQ "Wb62WWrLhWW"
375 #define RAP_NetServerEnum2_REQ "WrLehDz"
376 #define RAP_WserverGetInfo_REQ "WrLh"
377 #define RAP_NetWkstatGetInfo "WrLh"
379 #define RAP_WShareAdd_REQ "WsT"
380 #define RAP_WShareEnum_REQ "WrLeh"
381 #define RAP_WShareDel_REQ "zW"
382 #define RAP_WWkstaGetInfo_REQ "WrLh"
384 #define RAP_NetPrintQEnum_REQ "WrLeh"
385 #define RAP_NetPrintQGetInfo_REQ "zWrLh"
387 #define RAP_NetServerAdminCommand_REQ "zhrLeh"
388 #define RAP_NetServiceEnum_REQ "WrLeh"
389 #define RAP_NetServiceControl_REQ "zWWrL"
390 #define RAP_NetServiceInstall_REQ "zF88sg88T"
391 #define RAP_NetServiceGetInfo_REQ "zWrLh"
392 #define RAP_NetSessionEnum_REQ "WrLeh"
393 #define RAP_NetSessionGetInfo_REQ "zWrLh"
394 #define RAP_NetSessionDel_REQ "zW"
396 #define RAP_NetConnectionEnum_REQ "zWrLeh"
398 #define RAP_NetWkstaUserLogoff_REQ "zzWb38WrLh"
400 /* Description strings for returned data in RAP calls */
401 /* I use all caps here in part to avoid accidental */
402 /* name collisions */
404 #define RAP_FILE_INFO_L2 "D"
405 #define RAP_FILE_INFO_L3 "DWWzz"
407 #define RAP_GROUP_INFO_L0 "B21"
408 #define RAP_GROUP_INFO_L1 "B21Bz"
409 #define RAP_GROUP_USERS_INFO_0 "B21"
410 #define RAP_GROUP_USERS_INFO_1 "B21BN"
412 #define RAP_USER_INFO_L0 "B21"
413 #define RAP_USER_INFO_L1 "B21BB16DWzzWz"
415 #define RAP_SERVER_INFO_L0 "B16"
416 #define RAP_SERVER_INFO_L1 "B16BBDz"
417 #define RAP_SERVER_INFO_L2 "B16BBDzDDDWWzWWWWWWWB21BzWWWWWWWWWWWWWWWWWWWWWWz"
418 #define RAP_SERVER_INFO_L3 "B16BBDzDDDWWzWWWWWWWB21BzWWWWWWWWWWWWWWWWWWWWWWzDWz"
419 #define RAP_SERVICE_INFO_L0 "B16"
420 #define RAP_SERVICE_INFO_L2 "B16WDWB64"
421 #define RAP_SHARE_INFO_L0 "B13"
422 #define RAP_SHARE_INFO_L1 "B13BWz"
423 #define RAP_SHARE_INFO_L2 "B13BWzWWWzB9B"
425 #define RAP_PRINTQ_INFO_L2 "B13BWWWzzzzzWN"
426 #define RAP_SMB_PRINT_JOB_L1 "WB21BB16B10zWWzDDz"
428 #define RAP_SESSION_INFO_L2 "zzWWWDDDz"
429 #define RAP_CONNECTION_INFO_L1 "WWWWDzz"
431 #define RAP_USER_LOGOFF_INFO_L1 "WDW"
433 #define RAP_WKSTA_INFO_L1 "WDzzzzBBDWDWWWWWWWWWWWWWWWWWWWzzWzzW"
434 #define RAP_WKSTA_INFO_L10 "zzzBBzz"
436 /* BB explicit packing would help in structs below */
438 /* sizes of fixed-length fields, including null terminator */
439 #define RAP_GROUPNAME_LEN 21
440 #define RAP_USERNAME_LEN 21
441 #define RAP_SHARENAME_LEN 13
442 #define RAP_UPASSWD_LEN 16 /* user password */
443 #define RAP_SPASSWD_LEN 9 /* share password */
444 #define RAP_MACHNAME_LEN 16
445 #define RAP_SRVCNAME_LEN 16
446 #define RAP_SRVCCMNT_LEN 64
447 #define RAP_DATATYPE_LEN 10
450 typedef struct rap_group_info_1
452 char group_name
[RAP_GROUPNAME_LEN
];
457 typedef struct rap_user_info_1
459 char user_name
[RAP_USERNAME_LEN
];
461 char passwrd
[RAP_UPASSWD_LEN
];
470 typedef struct rap_service_info_2
472 char service_name
[RAP_SRVCNAME_LEN
];
477 } RAP_SERVICE_INFO_2
;
480 typedef struct rap_share_info_0
482 char share_name
[RAP_SHARENAME_LEN
];
485 typedef struct rap_share_info_1
487 char share_name
[RAP_SHARENAME_LEN
];
493 typedef struct rap_share_info_2
495 char share_name
[RAP_SHARENAME_LEN
];
500 uint16 maximum_users
;
503 char password
[RAP_SPASSWD_LEN
];