smb-auth-20040711
[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     int 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         unsigned long logoffTime;       /* tick count when logged off */
157         /*struct cm_user *logonDLLUser; /* integrated logon user */
158         unsigned char errorCount;
159     char rname[17];
160         int lana;
161         char encKey[MSV1_0_CHALLENGE_LENGTH]; /* MSV1_0_CHALLENGE_LENGTH is 8 */
162     void * secCtx;              /* security context when negotiating SMB extended auth
163                                  * valid when SMB_VCFLAG_AUTH_IN_PROGRESS is set
164                                  */
165 } smb_vc_t;
166
167                                         /* have we negotiated ... */
168 #define SMB_VCFLAG_USEV3        1       /* ... version 3 of the protocol */
169 #define SMB_VCFLAG_USECORE      2       /* ... the core protocol */
170 #define SMB_VCFLAG_USENT        4       /* ... NT LM 0.12 or beyond */
171 #define SMB_VCFLAG_STATUS32     8       /* use 32-bit NT status codes */
172 #define SMB_VCFLAG_REMOTECONN   0x10    /* bad: remote conns not allowed */
173 #define SMB_VCFLAG_ALREADYDEAD  0x20    /* do not get tokens from this vc */
174 #define SMB_VCFLAG_SESSX_RCVD   0x40    /* we received at least one session setups on this vc */
175 #define SMB_VCFLAG_AUTH_IN_PROGRESS 0x80 /* a SMB NT extended authentication is in progress */
176
177 /* one per user session */
178 typedef struct smb_user {
179         struct smb_user *nextp;         /* next sibling */
180         long refCount;                  /* ref count */
181         long flags;                     /* flags; locked by mx */
182         osi_mutex_t mx;
183         long userID;                    /* the session identifier */
184         struct smb_vc *vcp;             /* back ptr to virtual circuit */
185   struct smb_username *unp;        /* user name struct */
186 } smb_user_t;
187
188 typedef struct smb_username {
189         struct smb_username *nextp;             /* next sibling */
190         long refCount;                  /* ref count */
191         long flags;                     /* flags; locked by mx */
192         osi_mutex_t mx;
193         struct cm_user *userp;          /* CM user structure */
194         char *name;                     /* user name */
195   char *machine;                  /* machine name */
196 } smb_username_t;
197
198 #define SMB_USERFLAG_DELETE     1       /* delete struct when ref count zero */
199
200 #define SMB_MAX_USERNAME_LENGTH 256
201
202 /* one per tree-connect */
203 typedef struct smb_tid {
204         struct smb_tid *nextp;          /* next sibling */
205         long refCount;
206         long flags;
207         osi_mutex_t mx;                 /* for non-tree-related stuff */
208         unsigned short tid;             /* the tid */
209         struct smb_vc *vcp;             /* back ptr */
210         struct cm_user *userp;          /* user logged in at the
211                                          * tree connect level (base) */
212         char *pathname;                 /* pathname derived from sharename */
213 } smb_tid_t;
214
215 #define SMB_TIDFLAG_DELETE      1       /* delete struct when ref count zero */
216
217 /* one per process ID */
218 typedef struct smb_pid {
219         struct smb_pid *nextp;          /* next sibling */
220         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
253 } smb_ioctl_t;
254
255 /* flags for smb_ioctl_t */
256 #define SMB_IOCTLFLAG_DATAIN    1       /* reading data from client to server */
257 #define SMB_IOCTLFLAG_LOGON     2       /* got tokens from integrated logon */
258
259 /* one per file ID; these are really file descriptors */
260 typedef struct smb_fid {
261         osi_queue_t q;
262         long refCount;
263         long flags;
264         osi_mutex_t mx;                 /* for non-tree-related stuff */
265         unsigned short fid;             /* the file ID */
266         struct smb_vc *vcp;             /* back ptr */
267         struct cm_scache *scp;          /* scache of open file */
268         long offset;                    /* our file pointer */
269         smb_ioctl_t *ioctlp;            /* ptr to ioctl structure */
270                                         /* Under NT, we may need to know the
271                                          * parent directory and pathname used
272                                          * to open the file, either to delete
273                                          * the file on close, or to do a
274                                          * change notification */
275         struct cm_scache *NTopen_dscp;  /* parent directory (NT) */
276         char *NTopen_pathp;             /* path used in open (NT) */
277         char *NTopen_wholepathp;        /* entire path, not just last name */
278         int curr_chunk;                 /* chunk being read */
279         int prev_chunk;                 /* previous chunk read */
280         int raw_writers;                /* pending async raw writes */
281         EVENT_HANDLE raw_write_event;   /* signal this when raw_writers zero */
282 } smb_fid_t;
283
284 #define SMB_FID_OPENREAD                1       /* open for reading */
285 #define SMB_FID_OPENWRITE               2       /* open for writing */
286 #define SMB_FID_DELETE                  4       /* delete struct on ref count 0 */
287 #define SMB_FID_IOCTL                   8       /* a file descriptor for the
288                                                  * magic ioctl file */
289 #define SMB_FID_OPENDELETE              0x10    /* open for deletion (NT) */
290 #define SMB_FID_DELONCLOSE              0x20    /* marked for deletion */
291 /*
292  * Now some special flags to work around a bug in NT Client
293  */
294 #define SMB_FID_LENGTHSETDONE           0x40    /* have done 0-length write */
295 #define SMB_FID_MTIMESETDONE            0x80    /* have set modtime via Tr2 */
296 #define SMB_FID_LOOKSLIKECOPY   (SMB_FID_LENGTHSETDONE | SMB_FID_MTIMESETDONE)
297 #define SMB_FID_NTOPEN                  0x100   /* have dscp and pathp */
298
299 /*
300  * SMB file attributes
301  */
302 #define SMB_ATTR_ARCHIVE  0x20
303 #define SMB_ATTR_COMPRESSED 0x800 /* file or dir is compressed */
304 #define SMB_ATTR_NORMAL 0x80 /* normal file. Only valid if used alone */
305 #define SMB_ATTR_HIDDEN 0x2 /* hidden file for the purpose of dir listings */
306 #define SMB_ATTR_READONLY 0x1
307 #define SMB_ATTR_TEMPORARY 0x100
308 #define SMB_ATTR_DIRECTORY 0x10
309 #define SMB_ATTR_SYSTEM 0x4
310
311 /* for tracking in-progress directory searches */
312 typedef struct smb_dirSearch {
313         osi_queue_t q;                  /* queue of all outstanding cookies */
314         osi_mutex_t mx;                 /* just in case the caller screws up */
315         int refCount;                   /* reference count */
316         long cookie;                    /* value returned to the caller */
317         struct cm_scache *scp;          /* vnode of the dir we're searching */
318         long lastTime;                  /* last time we used this */
319         long flags;                     /* flags (see below);
320                                          * locked by smb_globalLock */
321         unsigned short attribute;       /* search attribute
322                                          * (used for extended protocol) */
323         char mask[256];                 /* search mask for V3 */
324 } smb_dirSearch_t;
325
326 #define SMB_DIRSEARCH_DELETE    1       /* delete struct when ref count zero */
327 #define SMB_DIRSEARCH_HITEOF    2       /* perhaps useful for advisory later */
328 #define SMB_DIRSEARCH_SMALLID   4       /* cookie can only be 8 bits, not 16 */
329 #define SMB_DIRSEARCH_BULKST    8       /* get bulk stat info */
330
331 /* type for patching directory listings */
332 typedef struct smb_dirListPatch {
333         osi_queue_t q;
334     char *dptr;         /* ptr to attr, time, data, sizel, sizeh */
335     long flags;     /* flags.  See below */
336         cm_fid_t fid;
337   cm_dirEntry_t *dep;   /* temp */
338 } smb_dirListPatch_t;
339
340 /* dirListPatch Flags */
341 #define SMB_DIRLISTPATCH_DOTFILE 1  /* the file referenced is a dot file 
342                                                                            Note: will not be set if smb_hideDotFiles is false */
343
344 /* waiting lock list elements */
345 typedef struct smb_waitingLock {
346         osi_queue_t q;
347         smb_vc_t *vcp;
348         smb_packet_t *inp;
349         smb_packet_t *outp;
350         u_long timeRemaining;
351         void *lockp;
352 } smb_waitingLock_t;
353
354 extern smb_waitingLock_t *smb_allWaitingLocks;
355
356 typedef long (smb_proc_t)(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
357
358 typedef struct smb_dispatch {
359         smb_proc_t *procp;      /* proc to call */
360         int flags;              /* flags describing function */
361 } smb_dispatch_t;
362
363 #define SMB_DISPATCHFLAG_CHAINED        1       /* this is an _AND_X function */
364 #define SMB_DISPATCHFLAG_NORESPONSE     2       /* don't send the response
365                                                  * packet, typically because
366                                                  * the response was already
367                                                  * sent.
368                                                  */
369 #define SMB_MAX_PATH                    256     /* max path length */
370
371 /* prototypes */
372
373 extern void smb_Init(osi_log_t *logp, char *smbNamep, int useV3, int LANadapt,
374         int nThreads
375 #ifndef DJGPP
376         , void *aMBfunc
377 #endif
378   );
379
380 extern void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, long unixTime);
381
382 extern void smb_UnixTimeFromLargeSearchTime(long *unixTimep, FILETIME *largeTimep);
383
384 extern void smb_SearchTimeFromUnixTime(long *dosTimep, long unixTime);
385
386 extern void smb_UnixTimeFromSearchTime(long *unixTimep, long searchTime);
387
388 extern void smb_DosUTimeFromUnixTime(long *dosUTimep, long unixTime);
389
390 extern void smb_UnixTimeFromDosUTime(long *unixTimep, long dosUTime);
391
392 extern smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana);
393
394 extern void smb_ReleaseVC(smb_vc_t *vcp);
395
396 extern smb_tid_t *smb_FindTID(smb_vc_t *vcp, unsigned short tid, int flags);
397
398 extern void smb_ReleaseTID(smb_tid_t *tidp);
399
400 extern smb_user_t *smb_FindUID(smb_vc_t *vcp, unsigned short uid, int flags);
401
402 extern smb_username_t *smb_FindUserByName(char *usern, char *machine, int flags);
403
404 extern smb_user_t *smb_FindUserByNameThisSession(smb_vc_t *vcp, char *usern); 
405
406 extern smb_username_t *smb_FindUserByName(char *usern, char *machine, int flags);
407
408 extern smb_user_t *smb_FindUserByNameThisSession(smb_vc_t *vcp, char *usern);
409
410 extern void smb_ReleaseUID(smb_user_t *uidp);
411
412 extern cm_user_t *smb_GetUser(smb_vc_t *vcp, smb_packet_t *inp);
413
414 extern char *smb_GetTIDPath(smb_vc_t *vcp, unsigned short tid);
415
416 extern smb_fid_t *smb_FindFID(smb_vc_t *vcp, unsigned short fid, int flags);
417
418 extern void smb_ReleaseFID(smb_fid_t *fidp);
419
420 extern int smb_FindShare(smb_vc_t *vcp, smb_user_t *uidp, char *shareName, char **pathNamep);
421
422 extern int smb_FindShareCSCPolicy(char *shareName);
423
424 extern smb_dirSearch_t *smb_FindDirSearchNL(long cookie);
425
426 extern void smb_DeleteDirSearch(smb_dirSearch_t *dsp);
427
428 extern void smb_ReleaseDirSearch(smb_dirSearch_t *dsp);
429
430 extern smb_dirSearch_t *smb_FindDirSearch(long cookie);
431
432 extern smb_dirSearch_t *smb_NewDirSearch(int isV3);
433
434 extern smb_packet_t *smb_CopyPacket(smb_packet_t *packetp);
435
436 extern void smb_FreePacket(smb_packet_t *packetp);
437
438 extern unsigned char *smb_GetSMBData(smb_packet_t *smbp, int *nbytesp);
439
440 extern void smb_SetSMBDataLength(smb_packet_t *smbp, unsigned int dsize);
441
442 extern unsigned int smb_GetSMBParm(smb_packet_t *smbp, int parm);
443
444 extern unsigned int smb_GetSMBOffsetParm(smb_packet_t *smbp, int parm, int offset);
445
446 extern void smb_SetSMBParm(smb_packet_t *smbp, int slot, unsigned int parmValue);
447
448 extern void smb_SetSMBParmLong(smb_packet_t *smbp, int slot, unsigned int parmValue);
449
450 extern void smb_SetSMBParmDouble(smb_packet_t *smbp, int slot, char *parmValuep);
451
452 extern void smb_SetSMBParmByte(smb_packet_t *smbp, int slot, unsigned int parmValue);
453
454 extern void smb_StripLastComponent(char *outPathp, char **lastComponentp,
455         char *inPathp);
456
457 extern unsigned char *smb_ParseASCIIBlock(unsigned char *inp, char **chainpp);
458
459 extern unsigned char *smb_ParseVblBlock(unsigned char *inp, char **chainpp,
460         int *lengthp);
461
462 extern smb_packet_t *smb_GetResponsePacket(smb_vc_t *vcp, smb_packet_t *inp);
463
464 extern void smb_SendPacket(smb_vc_t *vcp, smb_packet_t *inp);
465
466 extern void smb_MapCoreError(long code, smb_vc_t *vcp, unsigned short *scodep,
467         unsigned char *classp);
468
469 extern void smb_MapNTError(long code, unsigned long *NTStatusp);
470
471 extern void smb_HoldVC(smb_vc_t *vcp);
472
473 /* some globals, too */
474 extern int loggedOut;
475 extern unsigned long loggedOutTime;
476 extern char *loggedOutName;
477 extern smb_user_t *loggedOutUserp;
478
479 extern osi_log_t *smb_logp;
480
481 extern osi_rwlock_t smb_globalLock;
482
483 extern osi_rwlock_t smb_rctLock;
484
485 extern int smb_LogoffTokenTransfer;
486 extern unsigned long smb_LogoffTransferTimeout;
487
488 extern int smb_maxVCPerServer; /* max # of VCs per server */
489 extern int smb_maxMpxRequests; /* max # of mpx requests */
490
491 extern int smb_hideDotFiles;
492 extern unsigned int smb_IsDotFile(char *lastComp);
493
494 /* the following are used for smb auth */
495 extern int smb_authType; /* Type of SMB authentication to be used. One from below. */
496
497 #define SMB_AUTH_NONE 0
498 #define SMB_AUTH_NTLM 1
499 #define SMB_AUTH_EXTENDED 2
500
501 extern HANDLE smb_lsaHandle; /* LSA handle obtained during smb_init if using SMB auth */
502 extern ULONG smb_lsaSecPackage; /* LSA security package id. Set during smb_init */
503 extern char smb_ServerDomainName[];
504 extern int smb_ServerDomainNameLength;
505 extern char smb_ServerOS[];
506 extern int smb_ServerOSLength;
507 extern char smb_ServerLanManager[];
508 extern int smb_ServerLanManagerLength;
509 extern GUID smb_ServerGUID;
510 extern LSA_STRING smb_lsaLogonOrigin;
511
512 /* used for getting a challenge for SMB auth */
513 typedef struct _MSV1_0_LM20_CHALLENGE_REQUEST {  
514         MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
515 } MSV1_0_LM20_CHALLENGE_REQUEST, *PMSV1_0_LM20_CHALLENGE_REQUEST;
516
517 typedef struct _MSV1_0_LM20_CHALLENGE_RESPONSE {  
518         MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;  
519         UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH];
520 } MSV1_0_LM20_CHALLENGE_RESPONSE, *PMSV1_0_LM20_CHALLENGE_RESPONSE;
521 /**/
522
523 extern long smb_AuthenticateUserLM(smb_vc_t *vcp, char * accountName, char * primaryDomain, char * ciPwd, unsigned ciPwdLength, char * csPwd, unsigned csPwdLength);
524
525 extern long smb_GetNormalizedUsername(char * usern, const char * accountName, const char * domainName);
526
527 extern void smb_FormatResponsePacket(smb_vc_t *vcp, smb_packet_t *inp,
528         smb_packet_t *op);
529
530 extern char *myCrt_2Dispatch(int i); 
531
532 extern char *myCrt_2Dispatch(int i);
533
534 extern unsigned int smb_Attributes(cm_scache_t *scp);
535
536 extern int smb_ChainFID(int fid, smb_packet_t *inp);
537
538 extern smb_fid_t *smb_FindFID(smb_vc_t *vcp, unsigned short fid, int flags);
539
540 extern void smb_ReleaseFID(smb_fid_t *fidp);
541
542 extern unsigned char *smb_ParseDataBlock(unsigned char *inp, char **chainpp, int *lengthp);
543
544 extern unsigned char *smb_ParseASCIIBlock(unsigned char *inp, char **chainpp);
545
546 extern unsigned char *smb_ParseVblBlock(unsigned char *inp, char **chainpp, int *lengthp);
547
548 extern int smb_SUser(cm_user_t *userp);
549
550 #ifndef DJGPP
551 extern long smb_ReadData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count,
552         char *op, cm_user_t *userp, long *readp);
553 #else /* DJGPP */
554 extern long smb_ReadData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count,
555         char *op, cm_user_t *userp, long *readp, int dosflag);
556 #endif /* !DJGPP */
557
558 extern BOOL smb_IsLegalFilename(char *filename);
559
560 extern char *smb_GetSharename(void);
561
562 /* include other include files */
563 #include "smb3.h"
564 #include "smb_ioctl.h"
565 #include "smb_iocons.h"
566
567 cm_user_t *smb_FindOrCreateUser(smb_vc_t *vcp, char *usern);
568
569 #ifdef NOTSERVICE
570 extern void smb_LogPacket(smb_packet_t *packet);
571 #endif /* NOTSERVICE */
572 #endif /* whole file */