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