Unix SMB/Netbios implementation.
Version 1.9.
SMB parameters and setup
- Copyright (C) Andrew Tridgell 1992-1997
- Copyright (C) John H Terpstra 1996-1997
- Copyright (C) Luke Kenneth Casson Leighton 1996-1997
- Copyright (C) Paul Ashton 1997
+ Copyright (C) Andrew Tridgell 1992-1998
+ Copyright (C) John H Terpstra 1996-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1996-1998
+ Copyright (C) Paul Ashton 1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#ifndef _SMB_H
#define _SMB_H
-#ifndef MAX_CONNECTIONS
-#define MAX_CONNECTIONS 127
-#endif
-
-#ifndef MAX_OPEN_FILES
-#define MAX_OPEN_FILES 50
-#endif
-
-#ifndef GUEST_ACCOUNT
-#define GUEST_ACCOUNT "nobody"
-#endif
-
#define BUFFER_SIZE (0xFFFF)
#define SAFETY_MARGIN 1024
-/* Default size of shared memory used for share mode locking */
-#ifndef SHMEM_SIZE
-#define SHMEM_SIZE 102400
-#endif
-
#define NMB_PORT 137
#define DGRAM_PORT 138
#define SMB_PORT 139
#define SAMR_CLOSE 0x01
#define SAMR_OPEN_SECRET 0x07
-#define SAMR_LOOKUPNAMES 0x11
+#define SAMR_LOOKUP_RIDS 0x11
#define SAMR_UNKNOWN_3 0x03
#define SAMR_UNKNOWN_22 0x22
#define SAMR_UNKNOWN_24 0x24
#define SAMR_UNKNOWN_34 0x34
-#define SAMR_UNKNOWN_39 0x39
+#define SAMR_OPEN_POLICY 0x39
#define LSA_OPENPOLICY 0x2c
#define LSA_QUERYINFOPOLICY 0x07
} DOM_SID2;
-/* DOM_RID2 - domain RID structure */
+/* DOM_RID2 - domain RID structure for ntlsa pipe */
typedef struct domrid2_info
{
uint32 type; /* value is 5 */
- uint32 undoc; /* value is 5 */
+ uint32 undoc; /* value is non-zero */
uint32 rid;
uint32 rid_idx; /* don't know what this is */
} DOM_RID2;
+/* DOM_RID3 - domain RID structure for samr pipe */
+typedef struct domrid3_info
+{
+ uint32 rid; /* domain-relative (to a SID) id */
+ uint32 type1; /* value is 0x1 */
+ uint32 ptr_type; /* undocumented pointer */
+ uint32 type2; /* value is 0x1 */
+
+} DOM_RID3;
+
/* DOM_CLNT_SRV - client / server names */
typedef struct clnt_srv_info
{
} LSA_Q_LOOKUP_RIDS;
-/* LSA_R_LOOKUP_RIDS - response to LSA Lookup Names */
+/* LSA_R_LOOKUP_RIDS - response to LSA Lookup RIDs by name */
typedef struct lsa_r_lookup_rids
{
DOM_R_REF dom_ref; /* domain reference info */
} SAMR_R_OPEN_SECRET;
-/* SAMR_Q_UNKNOWN_11 - probably a "read SAM entry" */
-typedef struct q_samr_unknown_11_info
+/****************************************************************************
+SAMR_Q_LOOKUP_RIDS - do a conversion (only one!) from name to RID.
+
+the policy handle allocated by an "samr open secret" call is associated
+with a SID. this policy handle is what is queried here, *not* the SID
+itself. the response to the lookup rids is relative to this SID.
+*****************************************************************************/
+/* SAMR_Q_LOOKUP_RIDS - probably a "read SAM entry" */
+typedef struct q_samr_lookup_names_info
{
LSA_POL_HND pol; /* policy handle */
- uint32 switch_value1; /* 1 - switch value? */
- uint32 unknown_0; /* 0x0000 03E8 - 32 bit unknown */
- uint32 unknown_1; /* 0 - 32 bit unknown */
- uint32 switch_value2; /* 1 - switch value? */
+ uint32 num_rids1; /* 1 - number of rids being looked up */
+ uint32 rid; /* 0000 03e8 - RID of the server being queried? */
+ uint32 ptr; /* 0 - 32 bit unknown */
+ uint32 num_rids2; /* 1 - number of rids being looked up */
UNIHDR hdr_mach_acct; /* unicode machine account name header */
UNISTR2 uni_mach_acct; /* unicode machine account name */
-} SAMR_Q_UNKNOWN_11;
+} SAMR_Q_LOOKUP_RIDS;
-/* SAMR_R_UNKNOWN_11 - probably an open */
-typedef struct r_samr_unknown_11_info
+/* SAMR_R_LOOKUP_RIDS - probably an open */
+typedef struct r_samr_lookup_names_info
{
- uint32 switch_value1; /* 1 - switch value? */
- uint32 ptr_0; /* pointer */
- uint32 switch_value2; /* 1 - switch value? */
- uint32 unknown_0; /* 0x000003e8 - 32 bit unknown */
- uint32 switch_value3; /* 1 - switch value? */
- uint32 ptr_1; /* pointer */
- uint32 switch_value4; /* 1 - switch value? */
- uint32 switch_value5; /* 1 - switch value? */
+ uint32 num_entries;
+ uint32 undoc_buffer; /* undocumented buffer pointer */
+
+ uint32 num_entries2;
+ DOM_RID3 dom_rid[MAX_LOOKUP_SIDS]; /* domain RIDs being looked up */
- uint32 status; /* return status - 0x99: user exists */
+ uint32 num_entries3;
-} SAMR_R_UNKNOWN_11;
+ uint32 status; /* return code */
+
+} SAMR_R_LOOKUP_RIDS;
/* SAMR_Q_UNKNOWN_22 - probably an open */
} SAMR_R_UNKNOWN_32;
-/* SAMR_Q_UNKNOWN_39 - probably an open */
-typedef struct q_samr_unknown_39_info
+/* SAMR_Q_OPEN_POLICY - probably an open */
+typedef struct q_samr_open_policy_info
{
uint32 ptr_srv_name; /* pointer (to server name?) */
UNISTR2 uni_srv_name; /* unicode server name starting with '\\' */
uint32 unknown_0; /* 32 bit unknown */
-} SAMR_Q_UNKNOWN_39;
+} SAMR_Q_OPEN_POLICY;
-/* SAMR_R_UNKNOWN_39 - probably an open */
-typedef struct r_samr_unknown_39_info
+/* SAMR_R_OPEN_POLICY - probably an open */
+typedef struct r_samr_open_policy_info
{
LSA_POL_HND pol; /* policy handle */
uint32 status; /* return status */
-} SAMR_R_UNKNOWN_39;
+} SAMR_R_OPEN_POLICY;
/* WKS_Q_UNKNOWN_0 - probably a capabilities request */
struct current_user
{
- int cnum, id;
+ int cnum, vuid;
int uid, gid;
int ngroups;
gid_t *groups;
int pos;
uint32 size;
int mode;
- int uid;
+ int vuid;
char *mmap_ptr;
uint32 mmap_size;
write_bmpx_struct *wbmpx_ptr;
BOOL print_file;
BOOL modified;
BOOL granted_oplock;
+ BOOL sent_oplock_break;
+ BOOL reserved;
char *name;
} files_struct;
int num_files_open;
name_compare_entry *hide_list; /* Per-share list of files to return as hidden. */
name_compare_entry *veto_list; /* Per-share list of files to veto (never show). */
+ name_compare_entry *veto_oplock_list; /* Per-share list of files to refuse oplocks on. */
} connection_struct;
BOOL (*stop_mgmt)(void);
BOOL (*lock_entry)(int , uint32 , uint32 , int *);
BOOL (*unlock_entry)(int , uint32 , uint32 , int );
- BOOL (*get_entries)(int , int , uint32 , uint32 , share_mode_entry **);
+ int (*get_entries)(int , int , uint32 , uint32 , share_mode_entry **);
void (*del_entry)(int , int );
BOOL (*set_entry)(int , int , uint16 , uint16 );
BOOL (*remove_oplock)(int , int);
/* each implementation of the shared memory code needs
to support the following operations */
struct shmem_ops {
- BOOL (*close)( void );
- int (*alloc)(int );
- BOOL (*free)(int );
+ BOOL (*shm_close)( void );
+ int (*shm_alloc)(int );
+ BOOL (*shm_free)(int );
int (*get_userdef_off)(void);
void *(*offset2addr)(int );
int (*addr2offset)(void *addr);
time_t start;
};
+/* This is used by smbclient to send it to a smbfs mount point */
+struct connection_options {
+ int protocol;
+ /* Connection-Options */
+ uint32 max_xmit;
+ uint16 server_uid;
+ uint16 tid;
+ /* The following are LANMAN 1.0 options */
+ uint16 sec_mode;
+ uint16 max_mux;
+ uint16 max_vcs;
+ uint16 rawmode;
+ uint32 sesskey;
+ /* The following are NT LM 0.12 options */
+ uint32 maxraw;
+ uint32 capabilities;
+ uint16 serverzone;
+};
+
#ifndef LOCKING_VERSION
#define LOCKING_VERSION 4
#endif /* LOCKING_VERSION */
#define MAP_ARCHIVE(cnum) (OPEN_CNUM(cnum) && lp_map_archive(SNUM(cnum)))
#define IS_HIDDEN_PATH(cnum,path) (is_in_path((path),Connections[(cnum)].hide_list))
#define IS_VETO_PATH(cnum,path) (is_in_path((path),Connections[(cnum)].veto_list))
+#define IS_VETO_OPLOCK_PATH(cnum,path) (is_in_path((path),Connections[(cnum)].veto_oplock_list))
#define SMBENCRYPT() (lp_encrypted_passwords())
#endif
/* Defines needed for multi-codepage support. */
+#define MSDOS_LATIN_1_CODEPAGE 850
#define KANJI_CODEPAGE 932
+#define HANGUL_CODEPAGE 949
+#define BIG5_CODEPAGE 950
#ifdef KANJI
/*
/*
* Default client code page - 850 - Western European
*/
-#define DEFAULT_CLIENT_CODE_PAGE 850
+#define DEFAULT_CLIENT_CODE_PAGE MSDOS_LATIN_1_CODEPAGE
#endif /* KANJI */
/*