81ec7b1554032e884f19741417bd27a95961ded9
[openafs.git] / src / WINNT / afsd / smb.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #ifndef __SMB_H_ENV__
11 #define __SMB_H_ENV__ 1
12
13 #ifdef DJGPP
14 #include "netbios95.h"
15 #endif /* DJGPP */
16
17 #include <ntsecapi.h>
18
19 /* basic core protocol SMB structure */
20 typedef struct smb {
21     unsigned char id[4];
22     unsigned char com;
23     unsigned char rcls;
24     unsigned char reh;
25     unsigned char errLow;
26     unsigned char errHigh;
27     unsigned char reb;
28     unsigned short flg2;
29     unsigned short res[6];
30     unsigned short tid;
31     unsigned short pid;
32     unsigned short uid;
33     unsigned short mid;
34     unsigned char wct;
35     unsigned char vdata[1];
36 } smb_t;
37
38 /* more defines */
39 #define SMB_NOPCODES            256     /* # of opcodes in the dispatch table */
40
41 /* threads per VC */
42 #define SMB_THREADSPERVC        4       /* threads per VC */
43
44 /* flags for functions */
45 #define SMB_FLAG_CREATE         1       /* create the structure if necessary */
46
47 /* max # of bytes we'll receive in an incoming SMB message */
48 /* the maximum is 2^18-1 for NBT and 2^25-1 for Raw transport messages */
49 /* we will use something smaller but large enough to be efficient */
50 #define SMB_PACKETSIZE  32768 /* was 8400 */
51 /* raw mode is considered obsolete and cannot be used with message signing */
52 #define SMB_MAXRAWSIZE  65536
53
54 /* Negotiate protocol constants */
55 /* Security */
56 #define NEGOTIATE_SECURITY_USER_LEVEL               0x01
57 #define NEGOTIATE_SECURITY_CHALLENGE_RESPONSE       0x02
58 #define NEGOTIATE_SECURITY_SIGNATURES_ENABLED       0x04
59 #define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED      0x08
60
61 /* Capabilities */
62 #define NTNEGOTIATE_CAPABILITY_RAWMODE                          0x00000001L
63 #define NTNEGOTIATE_CAPABILITY_MPXMODE                          0x00000002L
64 #define NTNEGOTIATE_CAPABILITY_UNICODE                          0x00000004L
65 #define NTNEGOTIATE_CAPABILITY_LARGEFILES                       0x00000008L
66 #define NTNEGOTIATE_CAPABILITY_NTSMB                            0x00000010L
67 #define NTNEGOTIATE_CAPABILITY_RPCAPI                           0x00000020L
68 #define NTNEGOTIATE_CAPABILITY_NTSTATUS                         0x00000040L
69 #define NTNEGOTIATE_CAPABILITY_LEVEL_II_OPLOCKS         0x00000080L
70 #define NTNEGOTIATE_CAPABILITY_LOCK_AND_READ            0x00000100L
71 #define NTNEGOTIATE_CAPABILITY_NTFIND                           0x00000200L
72 #define NTNEGOTIATE_CAPABILITY_DFS                                      0x00001000L
73 #define NTNEGOTIATE_CAPABILITY_NT_INFO_PASSTHRU         0x00002000L
74 #define NTNEGOTIATE_CAPABILITY_BULK_TRANSFER            0x20000000L
75 #define NTNEGOTIATE_CAPABILITY_COMPRESSED                       0x40000000L
76 #define NTNEGOTIATE_CAPABILITY_EXTENDED_SECURITY        0x80000000L
77
78 /* a packet structure for receiving SMB messages; locked by smb_globalLock.
79  * Most of the work involved is in handling chained requests and responses.
80  *
81  * When handling input, inWctp points to the current request's wct field (and
82  * the other parameters and request data can be found from this field).  The
83  * opcode, unfortunately, isn't available there, so is instead copied to the
84  * packet's inCom field.  It is initially set to com, but each chained
85  * operation sets it, also.
86  * The function smb_AdvanceInput advances an input packet to the next request
87  * in the chain.  The inCom field is set to 0xFF when there are no more
88  * requests.  The inCount field is 0 if this is the first request, and
89  * otherwise counts which request it is.
90  *
91  * When handling output, we also have to chain all of the responses together.
92  * The function smb_GetResponsePacket will setup outWctp to point to the right
93  * place.
94  */
95 #define SMB_PACKETMAGIC 0x7436353       /* magic # for packets */
96 typedef struct smb_packet {
97     char data[SMB_PACKETSIZE];
98     struct smb_packet *nextp;           /* in free list, or whatever */
99     long magic;
100     cm_space_t *spacep;                 /* use this for stripping last component */
101     NCB *ncbp;                          /* use this for sending */
102     struct smb_vc *vcp;
103     unsigned long resumeCode;
104     unsigned short inCount;
105     unsigned short fid;                 /* for calls bundled with openAndX */
106     unsigned char *wctp;
107     unsigned char inCom;
108     unsigned char oddByte;
109     unsigned short ncb_length;
110     unsigned char flags;
111 #ifdef DJGPP
112     dos_ptr dos_pkt;
113     unsigned int dos_pkt_sel;
114 #endif /* DJGPP */
115 } smb_packet_t;
116
117 /* smb_packet flags */
118 #define SMB_PACKETFLAG_PROFILE_UPDATE_OK        1
119 #define SMB_PACKETFLAG_NOSEND                   2
120 #define SMB_PACKETFLAG_SUSPENDED                4
121
122 /* a structure for making Netbios calls; locked by smb_globalLock */
123 #define SMB_NCBMAGIC    0x2334344
124 typedef struct myncb {
125     NCB ncb;                            /* ncb to use */
126     struct myncb *nextp;                /* when on free list */
127     long magic;
128 #ifdef DJGPP
129     dos_ptr dos_ncb;
130     smb_packet_t *orig_pkt;
131     unsigned int dos_ncb_sel;
132 #endif /* DJGPP */
133 } smb_ncb_t;
134
135 /* structures representing environments from kernel / SMB network.
136  * Most have their own locks, but the tree connection fields and
137  * reference counts are locked by the smb_rctLock.  Those fields will
138  * be marked in comments.
139  */
140
141 /* one per virtual circuit */
142 typedef struct smb_vc {
143     struct smb_vc *nextp;               /* not used */
144     unsigned long refCount;             /* the reference count */
145     long flags;                         /* the flags, if any; locked by mx */
146     osi_mutex_t mx;                     /* the mutex */
147     long vcID;                          /* VC id */
148     unsigned short lsn;                 /* the NCB LSN associated with this */
149     unsigned short uidCounter;          /* session ID counter */
150     unsigned short tidCounter;          /* tree ID counter */
151     unsigned short fidCounter;          /* file handle ID counter */
152     struct smb_tid *tidsp;              /* the first child in the tid list */
153     struct smb_user *usersp;            /* the first child in the user session list */
154     struct smb_fid *fidsp;              /* the first child in the open file list */
155     struct smb_user *justLoggedOut;     /* ready for profile upload? */
156     time_t logoffTime;                  /* tick count when logged off */
157     unsigned char errorCount;
158     char rname[17];
159     int lana;
160     char encKey[MSV1_0_CHALLENGE_LENGTH]; /* MSV1_0_CHALLENGE_LENGTH is 8 */
161     void * secCtx;                      /* security context when negotiating SMB extended auth
162                                          * valid when SMB_VCFLAG_AUTH_IN_PROGRESS is set
163                                          */
164 } smb_vc_t;
165
166                                         /* have we negotiated ... */
167 #define SMB_VCFLAG_USEV3        1       /* ... version 3 of the protocol */
168 #define SMB_VCFLAG_USECORE      2       /* ... the core protocol */
169 #define SMB_VCFLAG_USENT        4       /* ... NT LM 0.12 or beyond */
170 #define SMB_VCFLAG_STATUS32     8       /* use 32-bit NT status codes */
171 #define SMB_VCFLAG_REMOTECONN   0x10    /* bad: remote conns not allowed */
172 #define SMB_VCFLAG_ALREADYDEAD  0x20    /* do not get tokens from this vc */
173 #define SMB_VCFLAG_SESSX_RCVD   0x40    /* we received at least one session setups on this vc */
174 #define SMB_VCFLAG_AUTH_IN_PROGRESS 0x80 /* a SMB NT extended authentication is in progress */
175
176 /* one per user session */
177 typedef struct smb_user {
178     struct smb_user *nextp;             /* next sibling */
179     unsigned long refCount;             /* ref count */
180     long flags;                         /* flags; locked by mx */
181     osi_mutex_t mx;
182     long userID;                        /* the session identifier */
183     struct smb_vc *vcp;                 /* back ptr to virtual circuit */
184     struct smb_username *unp;           /* user name struct */
185 } smb_user_t;
186
187 typedef struct smb_username {
188     struct smb_username *nextp;         /* next sibling */
189     unsigned long refCount;             /* ref count */
190     long flags;                         /* flags; locked by mx */
191     osi_mutex_t mx;
192     struct cm_user *userp;              /* CM user structure */
193     char *name;                         /* user name */
194     char *machine;                      /* machine name */
195 } smb_username_t;
196
197 #define SMB_USERFLAG_DELETE     1       /* delete struct when ref count zero */
198
199 #define SMB_MAX_USERNAME_LENGTH 256
200
201 /* one per tree-connect */
202 typedef struct smb_tid {
203     struct smb_tid *nextp;              /* next sibling */
204     unsigned long refCount;
205     long flags;
206     osi_mutex_t mx;                     /* for non-tree-related stuff */
207     unsigned short tid;                 /* the tid */
208     struct smb_vc *vcp;                 /* back ptr */
209     struct cm_user *userp;              /* user logged in at the
210                                          * tree connect level (base) */
211     char *pathname;                     /* pathname derived from sharename */
212 } smb_tid_t;
213
214 #define SMB_TIDFLAG_DELETE      1       /* delete struct when ref count zero */
215 #define SMB_TIDFLAG_IPC 2 /* IPC$ */
216
217 /* one per process ID */
218 typedef struct smb_pid {
219     struct smb_pid *nextp;              /* next sibling */
220     unsigned long refCount;
221     long flags;
222     osi_mutex_t mx;                     /* for non-tree-related stuff */
223     unsigned short pid;                 /* the pid */
224     struct smb_tid *tidp;               /* back ptr */
225 } smb_pid_t;
226
227 /* ioctl parameter, while being assembled and/or processed */
228 typedef struct smb_ioctl {
229     /* input side */
230     char *inDatap;                      /* ioctl func's current position
231                                          * in input parameter block */
232     char *inAllocp;                     /* allocated input parameter block */
233     long inCopied;                      /* # of input bytes copied in so far
234                                          * by write calls */
235     cm_space_t *prefix;                 /* prefix for subst drives */
236     char *tidPathp;                     /* Pathname associated with Tree ID */
237
238     /* output side */
239     char *outDatap;                     /* output results assembled so far */
240     char *outAllocp;                    /* output results assembled so far */
241     long outCopied;                     /* # of output bytes copied back so far
242                                          * by read calls */
243         
244     /* flags */
245     long flags;
246
247     /* fid pointer */
248     struct smb_fid *fidp;
249
250     /* uid pointer */
251     smb_user_t *uidp;
252 } smb_ioctl_t;
253
254 /* flags for smb_ioctl_t */
255 #define SMB_IOCTLFLAG_DATAIN    1       /* reading data from client to server */
256 #define SMB_IOCTLFLAG_LOGON     2       /* got tokens from integrated logon */
257
258 /* one per file ID; these are really file descriptors */
259 typedef struct smb_fid {
260     osi_queue_t q;
261     unsigned long refCount;
262     unsigned long flags;
263     osi_mutex_t mx;                     /* for non-tree-related stuff */
264     unsigned short fid;                 /* the file ID */
265     struct smb_vc *vcp;                 /* back ptr */
266     struct cm_scache *scp;              /* scache of open file */
267     long offset;                        /* our file pointer */
268     smb_ioctl_t *ioctlp;                /* ptr to ioctl structure */
269                                         /* Under NT, we may need to know the
270                                          * parent directory and pathname used
271                                          * to open the file, either to delete
272                                          * the file on close, or to do a
273                                          * change notification */
274     struct cm_scache *NTopen_dscp;      /* parent directory (NT) */
275     char *NTopen_pathp;                 /* path used in open (NT) */
276     char *NTopen_wholepathp;            /* entire path, not just last name */
277     int curr_chunk;                     /* chunk being read */
278     int prev_chunk;                     /* previous chunk read */
279     int raw_writers;                    /* pending async raw writes */
280     EVENT_HANDLE raw_write_event;       /* signal this when raw_writers zero */
281 } smb_fid_t;
282
283 #define SMB_FID_OPENREAD                1       /* open for reading */
284 #define SMB_FID_OPENWRITE               2       /* open for writing */
285 #define SMB_FID_DELETE                  4       /* delete struct on ref count 0 */
286 #define SMB_FID_IOCTL                   8       /* a file descriptor for the
287                                                  * magic ioctl file */
288 #define SMB_FID_OPENDELETE              0x10    /* open for deletion (NT) */
289 #define SMB_FID_DELONCLOSE              0x20    /* marked for deletion */
290 /*
291  * Now some special flags to work around a bug in NT Client
292  */
293 #define SMB_FID_LENGTHSETDONE           0x40    /* have done 0-length write */
294 #define SMB_FID_MTIMESETDONE            0x80    /* have set modtime via Tr2 */
295 #define SMB_FID_LOOKSLIKECOPY   (SMB_FID_LENGTHSETDONE | SMB_FID_MTIMESETDONE)
296 #define SMB_FID_NTOPEN                  0x100   /* have dscp and pathp */
297
298 /*
299  * SMB file attributes
300  */
301 #define SMB_ATTR_ARCHIVE  0x20
302 #define SMB_ATTR_COMPRESSED 0x800 /* file or dir is compressed */
303 #define SMB_ATTR_NORMAL 0x80 /* normal file. Only valid if used alone */
304 #define SMB_ATTR_HIDDEN 0x2 /* hidden file for the purpose of dir listings */
305 #define SMB_ATTR_READONLY 0x1
306 #define SMB_ATTR_TEMPORARY 0x100
307 #define SMB_ATTR_DIRECTORY 0x10
308 #define SMB_ATTR_SYSTEM 0x4
309
310 /* for tracking in-progress directory searches */
311 typedef struct smb_dirSearch {
312     osi_queue_t q;                      /* queue of all outstanding cookies */
313     osi_mutex_t mx;                     /* just in case the caller screws up */
314     unsigned long refCount;             /* reference count */
315     long cookie;                        /* value returned to the caller */
316     struct cm_scache *scp;              /* vnode of the dir we're searching */
317     time_t lastTime;                    /* last time we used this */
318     long flags;                         /* flags (see below);
319                                          * locked by smb_globalLock */
320     unsigned short attribute;           /* search attribute
321                                          * (used for extended protocol) */
322     char mask[256];                     /* search mask for V3 */
323 } smb_dirSearch_t;
324
325 #define SMB_DIRSEARCH_DELETE    1       /* delete struct when ref count zero */
326 #define SMB_DIRSEARCH_HITEOF    2       /* perhaps useful for advisory later */
327 #define SMB_DIRSEARCH_SMALLID   4       /* cookie can only be 8 bits, not 16 */
328 #define SMB_DIRSEARCH_BULKST    8       /* get bulk stat info */
329
330 /* type for patching directory listings */
331 typedef struct smb_dirListPatch {
332     osi_queue_t q;
333     char *dptr;                         /* ptr to attr, time, data, sizel, sizeh */
334     long flags;                         /* flags.  See below */
335     cm_fid_t fid;
336     cm_dirEntry_t *dep;                 /* temp */
337 } smb_dirListPatch_t;
338
339 /* dirListPatch Flags */
340 #define SMB_DIRLISTPATCH_DOTFILE 1  
341 /* the file referenced is a dot file
342  * Note: will not be set if smb_hideDotFiles is false 
343  */
344
345 /* waiting lock list elements */
346 typedef struct smb_waitingLock {
347     osi_queue_t q;
348     smb_vc_t *vcp;
349     smb_packet_t *inp;
350     smb_packet_t *outp;
351     time_t timeRemaining;
352     void *lockp;
353 } smb_waitingLock_t;
354
355 extern smb_waitingLock_t *smb_allWaitingLocks;
356
357 typedef long (smb_proc_t)(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
358
359 typedef struct smb_dispatch {
360     smb_proc_t *procp;                  /* proc to call */
361     int flags;                          /* flags describing function */
362 } smb_dispatch_t;
363
364 #define SMB_DISPATCHFLAG_CHAINED        1       /* this is an _AND_X function */
365 #define SMB_DISPATCHFLAG_NORESPONSE     2       /* don't send the response
366                                                  * packet, typically because
367                                                  * the response was already
368                                                  * sent.
369                                                  */
370 #define SMB_MAX_PATH                    256     /* max path length */
371
372 /* prototypes */
373
374 extern void smb_Init(osi_log_t *logp, char *smbNamep, int useV3, int LANadapt,
375         int nThreads
376 #ifndef DJGPP
377         , void *aMBfunc
378 #endif
379   );
380
381 extern void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, time_t unixTime);
382
383 extern void smb_UnixTimeFromLargeSearchTime(time_t *unixTimep, FILETIME *largeTimep);
384
385 extern void smb_SearchTimeFromUnixTime(time_t *dosTimep, time_t unixTime);
386
387 extern void smb_UnixTimeFromSearchTime(time_t *unixTimep, time_t searchTime);
388
389 extern void smb_DosUTimeFromUnixTime(time_t *dosUTimep, time_t unixTime);
390
391 extern void smb_UnixTimeFromDosUTime(time_t *unixTimep, time_t dosUTime);
392
393 extern smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana);
394
395 extern void smb_ReleaseVC(smb_vc_t *vcp);
396
397 extern smb_tid_t *smb_FindTID(smb_vc_t *vcp, unsigned short tid, int flags);
398
399 extern void smb_ReleaseTID(smb_tid_t *tidp);
400
401 extern smb_user_t *smb_FindUID(smb_vc_t *vcp, unsigned short uid, int flags);
402
403 extern smb_username_t *smb_FindUserByName(char *usern, char *machine, int flags);
404
405 extern smb_user_t *smb_FindUserByNameThisSession(smb_vc_t *vcp, char *usern); 
406
407 extern smb_username_t *smb_FindUserByName(char *usern, char *machine, int flags);
408
409 extern smb_user_t *smb_FindUserByNameThisSession(smb_vc_t *vcp, char *usern);
410
411 extern void smb_ReleaseUID(smb_user_t *uidp);
412
413 extern cm_user_t *smb_GetUser(smb_vc_t *vcp, smb_packet_t *inp);
414
415 extern long smb_LookupTIDPath(smb_vc_t *vcp, unsigned short tid, char ** tidPathp);
416
417 extern smb_fid_t *smb_FindFID(smb_vc_t *vcp, unsigned short fid, int flags);
418
419 extern void smb_ReleaseFID(smb_fid_t *fidp);
420
421 extern int smb_FindShare(smb_vc_t *vcp, smb_user_t *uidp, char *shareName, char **pathNamep);
422
423 extern int smb_FindShareCSCPolicy(char *shareName);
424
425 extern smb_dirSearch_t *smb_FindDirSearchNL(long cookie);
426
427 extern void smb_DeleteDirSearch(smb_dirSearch_t *dsp);
428
429 extern void smb_ReleaseDirSearch(smb_dirSearch_t *dsp);
430
431 extern smb_dirSearch_t *smb_FindDirSearch(long cookie);
432
433 extern smb_dirSearch_t *smb_NewDirSearch(int isV3);
434
435 extern smb_packet_t *smb_CopyPacket(smb_packet_t *packetp);
436
437 extern void smb_FreePacket(smb_packet_t *packetp);
438
439 extern unsigned char *smb_GetSMBData(smb_packet_t *smbp, int *nbytesp);
440
441 extern void smb_SetSMBDataLength(smb_packet_t *smbp, unsigned int dsize);
442
443 extern unsigned int smb_GetSMBParm(smb_packet_t *smbp, int parm);
444
445 extern unsigned int smb_GetSMBOffsetParm(smb_packet_t *smbp, int parm, int offset);
446
447 extern void smb_SetSMBParm(smb_packet_t *smbp, int slot, unsigned int parmValue);
448
449 extern void smb_SetSMBParmLong(smb_packet_t *smbp, int slot, unsigned int parmValue);
450
451 extern void smb_SetSMBParmDouble(smb_packet_t *smbp, int slot, char *parmValuep);
452
453 extern void smb_SetSMBParmByte(smb_packet_t *smbp, int slot, unsigned int parmValue);
454
455 extern void smb_StripLastComponent(char *outPathp, char **lastComponentp,
456         char *inPathp);
457
458 extern unsigned char *smb_ParseASCIIBlock(unsigned char *inp, char **chainpp);
459
460 extern unsigned char *smb_ParseVblBlock(unsigned char *inp, char **chainpp,
461         int *lengthp);
462
463 extern smb_packet_t *smb_GetResponsePacket(smb_vc_t *vcp, smb_packet_t *inp);
464
465 extern void smb_SendPacket(smb_vc_t *vcp, smb_packet_t *inp);
466
467 extern void smb_MapCoreError(long code, smb_vc_t *vcp, unsigned short *scodep,
468         unsigned char *classp);
469
470 extern void smb_MapNTError(long code, unsigned long *NTStatusp);
471
472 extern void smb_HoldVC(smb_vc_t *vcp);
473
474 /* some globals, too */
475 extern char *smb_localNamep;
476 extern int loggedOut;
477 extern time_t loggedOutTime;
478 extern char *loggedOutName;
479 extern smb_user_t *loggedOutUserp;
480
481 extern osi_log_t *smb_logp;
482
483 extern osi_rwlock_t smb_globalLock;
484
485 extern osi_rwlock_t smb_rctLock;
486
487 extern int smb_LogoffTokenTransfer;
488 extern time_t smb_LogoffTransferTimeout;
489
490 extern int smb_maxVCPerServer; /* max # of VCs per server */
491 extern int smb_maxMpxRequests; /* max # of mpx requests */
492
493 extern int smb_StoreAnsiFilenames;
494 extern int smb_hideDotFiles;
495 extern unsigned int smb_IsDotFile(char *lastComp);
496
497 /* the following are used for smb auth */
498 extern int smb_authType; /* Type of SMB authentication to be used. One from below. */
499
500 #define SMB_AUTH_NONE 0
501 #define SMB_AUTH_NTLM 1
502 #define SMB_AUTH_EXTENDED 2
503
504 extern HANDLE smb_lsaHandle; /* LSA handle obtained during smb_init if using SMB auth */
505 extern ULONG smb_lsaSecPackage; /* LSA security package id. Set during smb_init */
506 extern char smb_ServerDomainName[];
507 extern int smb_ServerDomainNameLength;
508 extern char smb_ServerOS[];
509 extern int smb_ServerOSLength;
510 extern char smb_ServerLanManager[];
511 extern int smb_ServerLanManagerLength;
512 extern GUID smb_ServerGUID;
513 extern LSA_STRING smb_lsaLogonOrigin;
514
515 /* used for getting a challenge for SMB auth */
516 typedef struct _MSV1_0_LM20_CHALLENGE_REQUEST {  
517     MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
518 } MSV1_0_LM20_CHALLENGE_REQUEST, *PMSV1_0_LM20_CHALLENGE_REQUEST;
519
520 typedef struct _MSV1_0_LM20_CHALLENGE_RESPONSE {  
521     MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;  
522     UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH];
523 } MSV1_0_LM20_CHALLENGE_RESPONSE, *PMSV1_0_LM20_CHALLENGE_RESPONSE;
524 /**/
525
526 extern long smb_AuthenticateUserLM(smb_vc_t *vcp, char * accountName, char * primaryDomain, char * ciPwd, unsigned ciPwdLength, char * csPwd, unsigned csPwdLength);
527
528 extern long smb_GetNormalizedUsername(char * usern, const char * accountName, const char * domainName);
529
530 extern void smb_FormatResponsePacket(smb_vc_t *vcp, smb_packet_t *inp,
531         smb_packet_t *op);
532
533 extern char *myCrt_Dispatch(int i); 
534
535 extern char *myCrt_2Dispatch(int i);
536
537 extern char *myCrt_RapDispatch(int i);
538
539 extern unsigned int smb_Attributes(cm_scache_t *scp);
540
541 extern int smb_ChainFID(int fid, smb_packet_t *inp);
542
543 extern smb_fid_t *smb_FindFID(smb_vc_t *vcp, unsigned short fid, int flags);
544
545 extern void smb_ReleaseFID(smb_fid_t *fidp);
546
547 extern unsigned char *smb_ParseDataBlock(unsigned char *inp, char **chainpp, int *lengthp);
548
549 extern unsigned char *smb_ParseASCIIBlock(unsigned char *inp, char **chainpp);
550
551 extern unsigned char *smb_ParseVblBlock(unsigned char *inp, char **chainpp, int *lengthp);
552
553 extern int smb_SUser(cm_user_t *userp);
554
555 #ifndef DJGPP
556 extern long smb_ReadData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count,
557         char *op, cm_user_t *userp, long *readp);
558 #else /* DJGPP */
559 extern long smb_ReadData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count,
560         char *op, cm_user_t *userp, long *readp, int dosflag);
561 #endif /* !DJGPP */
562
563 extern long smb_Rename(smb_vc_t *vcp, smb_packet_t *inp, char *oldPathp, char *newPathp, int attrs);
564
565 extern long smb_Link(smb_vc_t *vcp, smb_packet_t *inp, char *oldPathp, char *newPathp);
566
567 extern BOOL smb_IsLegalFilename(char *filename);
568
569 extern char *smb_GetSharename(void);
570
571 extern DWORD smb_ServerExceptionFilter(void);
572
573 /* include other include files */
574 #include "smb3.h"
575 #include "smb_ioctl.h"
576 #include "smb_iocons.h"
577
578 cm_user_t *smb_FindOrCreateUser(smb_vc_t *vcp, char *usern);
579
580 #ifdef NOTSERVICE
581 extern void smb_LogPacket(smb_packet_t *packet);
582 #endif /* NOTSERVICE */
583 #endif /* whole file */