From 0e8fd3398771da2f016d72830179507f3edda51b Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Sat, 4 May 1996 07:50:46 +0000 Subject: Initial version imported to CVS (This used to be commit 291551d80711daab7b7581720bcd9a08d6096517) --- source3/include/smb.h | 1006 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1006 insertions(+) create mode 100644 source3/include/smb.h (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h new file mode 100644 index 0000000000..b7faffa9e9 --- /dev/null +++ b/source3/include/smb.h @@ -0,0 +1,1006 @@ +/* + Unix SMB/Netbios implementation. + Version 1.9. + SMB parameters and setup + Copyright (C) Andrew Tridgell 1992-1995 + + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#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 + +#ifndef EXTERN +# define EXTERN extern +#endif + +#define False (0) +#define True (1) +#define BOOLSTR(b) ((b) ? "Yes" : "No") +#define BITSETB(ptr,bit) ((((char *)ptr)[0] & (1<<(bit)))!=0) +#define BITSETW(ptr,bit) ((SVAL(ptr,0) & (1<<(bit)))!=0) +#define PTR_DIFF(p1,p2) ((ptrdiff_t)(((char *)(p1)) - (char *)(p2))) + +typedef int BOOL; + +/* + Samba needs type definitions for int16, int32, uint16 and uint32. + + Normally these are signed and unsigned 16 and 32 bit integers, but + they actually only need to be at least 16 and 32 bits + respectively. Thus if your word size is 8 bytes just defining them + as signed and unsigned int will work. +*/ + +/* afs/stds.h defines int16 and int32 */ +#ifndef AFS_AUTH +typedef short int16; +typedef int int32; +#endif + +#ifndef uint16 +typedef unsigned short uint16; +#endif + +#ifndef uint32 +typedef unsigned int uint32; +#endif + +#define SIZEOFWORD 2 + +#ifndef DEF_CREATE_MASK +#define DEF_CREATE_MASK (0755) +#endif + +#ifndef DEFAULT_PIPE_TIMEOUT +#define DEFAULT_PIPE_TIMEOUT 10000000 /* Ten seconds */ +#endif + +/* debugging code */ +#ifndef SYSLOG +#define DEBUG(level,body) ((DEBUGLEVEL>=(level))?(Debug1 body):0) +#else +EXTERN int syslog_level; + +#define DEBUG(level,body) ((DEBUGLEVEL>=(level))? \ + (syslog_level = (level), Debug1 body):0) +#endif + +#define DIR_STRUCT_SIZE 43 + +/* these define all the command types recognised by the server - there +are lots of gaps so probably there are some rare commands that are not +implemented */ + +#define pSETDIR '\377' + +/* these define the attribute byte as seen by DOS */ +#define aRONLY (1L<<0) +#define aHIDDEN (1L<<1) +#define aSYSTEM (1L<<2) +#define aVOLID (1L<<3) +#define aDIR (1L<<4) +#define aARCH (1L<<5) + +/* deny modes */ +#define DENY_DOS 0 +#define DENY_ALL 1 +#define DENY_WRITE 2 +#define DENY_READ 3 +#define DENY_NONE 4 +#define DENY_FCB 7 + +/* share types */ +#define STYPE_DISKTREE 0 /* Disk drive */ +#define STYPE_PRINTQ 1 /* Spooler queue */ +#define STYPE_DEVICE 2 /* Serial device */ +#define STYPE_IPC 3 /* Interprocess communication (IPC) */ + +/* SMB X/Open error codes for the ERRdos error class */ +#define ERRbadfunc 1 /* Invalid function (or system call) */ +#define ERRbadfile 2 /* File not found (pathname error) */ +#define ERRbadpath 3 /* Directory not found */ +#define ERRnofids 4 /* Too many open files */ +#define ERRnoaccess 5 /* Access denied */ +#define ERRbadfid 6 /* Invalid fid */ +#define ERRnomem 8 /* Out of memory */ +#define ERRbadmem 9 /* Invalid memory block address */ +#define ERRbadenv 10 /* Invalid environment */ +#define ERRbadaccess 12 /* Invalid open mode */ +#define ERRbaddata 13 /* Invalid data (only from ioctl call) */ +#define ERRres 14 /* reserved */ +#define ERRbaddrive 15 /* Invalid drive */ +#define ERRremcd 16 /* Attempt to delete current directory */ +#define ERRdiffdevice 17 /* rename/move across different filesystems */ +#define ERRnofiles 18 /* no more files found in file search */ +#define ERRbadshare 32 /* Share mode on file conflict with open mode */ +#define ERRlock 33 /* Lock request conflicts with existing lock */ +#define ERRfilexists 80 /* File in operation already exists */ +#define ERRbadpipe 230 /* Named pipe invalid */ +#define ERRpipebusy 231 /* All instances of pipe are busy */ +#define ERRpipeclosing 232 /* named pipe close in progress */ +#define ERRnotconnected 233 /* No process on other end of named pipe */ +#define ERRmoredata 234 /* More data to be returned */ +#define ERROR_EAS_DIDNT_FIT 275 /* Extended attributes didn't fit */ +#define ERROR_EAS_NOT_SUPPORTED 282 /* Extended attributes not suppored */ +#define ERRunknownlevel 124 +#define ERRunknownipc 2142 + + +/* here's a special one from observing NT */ +#define ERRnoipc 66 /* don't support ipc */ + +/* Error codes for the ERRSRV class */ + +#define ERRerror 1 /* Non specific error code */ +#define ERRbadpw 2 /* Bad password */ +#define ERRbadtype 3 /* reserved */ +#define ERRaccess 4 /* No permissions to do the requested operation */ +#define ERRinvnid 5 /* tid invalid */ +#define ERRinvnetname 6 /* Invalid servername */ +#define ERRinvdevice 7 /* Invalid device */ +#define ERRqfull 49 /* Print queue full */ +#define ERRqtoobig 50 /* Queued item too big */ +#define ERRinvpfid 52 /* Invalid print file in smb_fid */ +#define ERRsmbcmd 64 /* Unrecognised command */ +#define ERRsrverror 65 /* smb server internal error */ +#define ERRfilespecs 67 /* fid and pathname invalid combination */ +#define ERRbadlink 68 /* reserved */ +#define ERRbadpermits 69 /* Access specified for a file is not valid */ +#define ERRbadpid 70 /* reserved */ +#define ERRsetattrmode 71 /* attribute mode invalid */ +#define ERRpaused 81 /* Message server paused */ +#define ERRmsgoff 82 /* Not receiving messages */ +#define ERRnoroom 83 /* No room for message */ +#define ERRrmuns 87 /* too many remote usernames */ +#define ERRtimeout 88 /* operation timed out */ +#define ERRnoresource 89 /* No resources currently available for request. */ +#define ERRtoomanyuids 90 /* too many userids */ +#define ERRbaduid 91 /* bad userid */ +#define ERRuseMPX 250 /* temporarily unable to use raw mode, use MPX mode */ +#define ERRuseSTD 251 /* temporarily unable to use raw mode, use standard mode */ +#define ERRcontMPX 252 /* resume MPX mode */ +#define ERRbadPW /* reserved */ +#define ERRnosupport 0xFFFF +#define ERRunknownsmb 22 /* from NT 3.5 response */ + + +/* Error codes for the ERRHRD class */ + +#define ERRnowrite 19 /* read only media */ +#define ERRbadunit 20 /* Unknown device */ +#define ERRnotready 21 /* Drive not ready */ +#define ERRbadcmd 22 /* Unknown command */ +#define ERRdata 23 /* Data (CRC) error */ +#define ERRbadreq 24 /* Bad request structure length */ +#define ERRseek 25 +#define ERRbadmedia 26 +#define ERRbadsector 27 +#define ERRnopaper 28 +#define ERRwrite 29 /* write fault */ +#define ERRread 30 /* read fault */ +#define ERRgeneral 31 /* General hardware failure */ +#define ERRwrongdisk 34 +#define ERRFCBunavail 35 +#define ERRsharebufexc 36 /* share buffer exceeded */ +#define ERRdiskfull 39 + + +typedef char pstring[1024]; +typedef char fstring[128]; +typedef fstring string; + +typedef struct +{ + int size; + int mode; + int uid; + int gid; + /* these times are normally kept in GMT */ + time_t mtime; + time_t atime; + time_t ctime; + pstring name; +} file_info; + + +/* Structure used when SMBwritebmpx is active */ +typedef struct + { + int wr_total_written; /* So we know when to discard this */ + int32 wr_timeout; + int32 wr_errclass; + int32 wr_error; /* Cached errors */ + BOOL wr_mode; /* write through mode) */ + BOOL wr_discard; /* discard all further data */ + } write_bmpx_struct; + +typedef struct +{ + int cnum; + int fd; + int pos; + int size; + int mode; + char *mmap_ptr; + int mmap_size; + write_bmpx_struct *wbmpx_ptr; + time_t open_time; + BOOL open; + BOOL can_lock; + BOOL can_read; + BOOL can_write; + BOOL share_mode; + BOOL share_pending; + BOOL print_file; + BOOL modified; + char *name; +} files_struct; + + +struct uid_cache { + int entries; + int list[UID_CACHE_SIZE]; +}; + +typedef struct +{ + int service; + BOOL force_user; + int uid; /* uid of user who *opened* this connection */ + int gid; /* gid of user who *opened* this connection */ + struct uid_cache uid_cache; + void *dirptr; + BOOL open; + BOOL printer; + BOOL ipc; + BOOL read_only; + BOOL admin_user; + char *dirpath; + char *connectpath; + char *origpath; + char *user; /* name of user who *opened* this connection */ + /* following groups stuff added by ih */ + /* This groups info is valid for the user that *opened* the connection */ + int ngroups; + gid_t *groups; + int *igroups; /* an integer version - some OSes are broken :-( */ + time_t lastused; + BOOL used; + int num_files_open; +} connection_struct; + + +typedef struct +{ + int uid; /* uid of a validated user */ + int gid; /* gid of a validated user */ + fstring name; /* name of a validated user */ + BOOL guest; + /* following groups stuff added by ih */ + /* This groups info is needed for when we become_user() for this uid */ + int user_ngroups; + gid_t *user_groups; + int *user_igroups; /* an integer version - some OSes are broken :-( */ +} user_struct; + + +enum {LPQ_QUEUED,LPQ_PAUSED,LPQ_SPOOLING,LPQ_PRINTING}; + +typedef struct +{ + int job; + int size; + int status; + int priority; + time_t time; + char user[30]; + char file[100]; +} print_queue_struct; + +enum {LPSTAT_OK, LPSTAT_STOPPED, LPSTAT_ERROR}; + +typedef struct +{ + fstring message; + int status; +} print_status_struct; + + +/* this is used for smbstatus */ +struct connect_record +{ + int magic; + int pid; + int cnum; + int uid; + int gid; + char name[24]; + char addr[24]; + char machine[128]; + time_t start; +}; + + +#define LOCKING_VERSION 2 + +/* these are useful macros for checking validity of handles */ +#define VALID_FNUM(fnum) (((fnum) >= 0) && ((fnum) < MAX_OPEN_FILES)) +#define OPEN_FNUM(fnum) (VALID_FNUM(fnum) && Files[fnum].open) +#define VALID_CNUM(cnum) (((cnum) >= 0) && ((cnum) < MAX_CONNECTIONS)) +#define OPEN_CNUM(cnum) (VALID_CNUM(cnum) && Connections[cnum].open) +#define IS_IPC(cnum) (VALID_CNUM(cnum) && Connections[cnum].ipc) +#define FNUM_OK(fnum,c) (OPEN_FNUM(fnum) && (c)==Files[fnum].cnum) + +#define CHECK_FNUM(fnum,c) if (!FNUM_OK(fnum,c)) \ + return(ERROR(ERRDOS,ERRbadfid)) +#define CHECK_READ(fnum) if (!Files[fnum].can_read) \ + return(ERROR(ERRDOS,ERRbadaccess)) +#define CHECK_WRITE(fnum) if (!Files[fnum].can_write) \ + return(ERROR(ERRDOS,ERRbadaccess)) +#define CHECK_ERROR(fnum) if (HAS_CACHED_ERROR(fnum)) \ + return(CACHED_ERROR(fnum)) + +/* translates a connection number into a service number */ +#define SNUM(cnum) (Connections[cnum].service) + +/* access various service details */ +#define SERVICE(snum) (lp_servicename(snum)) +#define PRINTCAP (lp_printcapname()) +#define PRINTCOMMAND(snum) (lp_printcommand(snum)) +#define PRINTERNAME(snum) (lp_printername(snum)) +#define CAN_WRITE(cnum) (OPEN_CNUM(cnum) && !Connections[cnum].read_only) +#define VALID_SNUM(snum) (lp_snum_ok(snum)) +#define GUEST_OK(snum) (VALID_SNUM(snum) && lp_guest_ok(snum)) +#define GUEST_ONLY(snum) (VALID_SNUM(snum) && lp_guest_only(snum)) +#define CAN_SETDIR(snum) (!lp_no_set_dir(snum)) +#define CAN_PRINT(cnum) (OPEN_CNUM(cnum) && lp_print_ok(SNUM(cnum))) +#define POSTSCRIPT(cnum) (OPEN_CNUM(cnum) && lp_postscript(SNUM(cnum))) +#define MAP_HIDDEN(cnum) (OPEN_CNUM(cnum) && lp_map_hidden(SNUM(cnum))) +#define MAP_SYSTEM(cnum) (OPEN_CNUM(cnum) && lp_map_system(SNUM(cnum))) +#define MAP_ARCHIVE(cnum) (OPEN_CNUM(cnum) && lp_map_archive(SNUM(cnum))) +#define CREATE_MODE(cnum) (lp_create_mode(SNUM(cnum)) | 0700) +#ifdef SMB_PASSWD +#define SMBENCRYPT() (lp_encrypted_passwords()) +#else +#define SMBENCRYPT() (False) +#endif + +/* the basic packet size, assuming no words or bytes */ +#define smb_size 39 + +/* offsets into message for common items */ +#define smb_com 8 +#define smb_rcls 9 +#define smb_reh 10 +#define smb_err 11 +#define smb_flg 13 +#define smb_flg2 14 +#define smb_reb 13 +#define smb_tid 28 +#define smb_pid 30 +#define smb_uid 32 +#define smb_mid 34 +#define smb_wct 36 +#define smb_vwv 37 +#define smb_vwv0 37 +#define smb_vwv1 39 +#define smb_vwv2 41 +#define smb_vwv3 43 +#define smb_vwv4 45 +#define smb_vwv5 47 +#define smb_vwv6 49 +#define smb_vwv7 51 +#define smb_vwv8 53 +#define smb_vwv9 55 +#define smb_vwv10 57 +#define smb_vwv11 59 +#define smb_vwv12 61 +#define smb_vwv13 63 +#define smb_vwv14 65 +#define smb_vwv15 67 +#define smb_vwv16 69 +#define smb_vwv17 71 + + +/* the complete */ +#define SMBmkdir 0x00 /* create directory */ +#define SMBrmdir 0x01 /* delete directory */ +#define SMBopen 0x02 /* open file */ +#define SMBcreate 0x03 /* create file */ +#define SMBclose 0x04 /* close file */ +#define SMBflush 0x05 /* flush file */ +#define SMBunlink 0x06 /* delete file */ +#define SMBmv 0x07 /* rename file */ +#define SMBgetatr 0x08 /* get file attributes */ +#define SMBsetatr 0x09 /* set file attributes */ +#define SMBread 0x0A /* read from file */ +#define SMBwrite 0x0B /* write to file */ +#define SMBlock 0x0C /* lock byte range */ +#define SMBunlock 0x0D /* unlock byte range */ +#define SMBctemp 0x0E /* create temporary file */ +#define SMBmknew 0x0F /* make new file */ +#define SMBchkpth 0x10 /* check directory path */ +#define SMBexit 0x11 /* process exit */ +#define SMBlseek 0x12 /* seek */ +#define SMBtcon 0x70 /* tree connect */ +#define SMBtconX 0x75 /* tree connect and X*/ +#define SMBtdis 0x71 /* tree disconnect */ +#define SMBnegprot 0x72 /* negotiate protocol */ +#define SMBdskattr 0x80 /* get disk attributes */ +#define SMBsearch 0x81 /* search directory */ +#define SMBsplopen 0xC0 /* open print spool file */ +#define SMBsplwr 0xC1 /* write to print spool file */ +#define SMBsplclose 0xC2 /* close print spool file */ +#define SMBsplretq 0xC3 /* return print queue */ +#define SMBsends 0xD0 /* send single block message */ +#define SMBsendb 0xD1 /* send broadcast message */ +#define SMBfwdname 0xD2 /* forward user name */ +#define SMBcancelf 0xD3 /* cancel forward */ +#define SMBgetmac 0xD4 /* get machine name */ +#define SMBsendstrt 0xD5 /* send start of multi-block message */ +#define SMBsendend 0xD6 /* send end of multi-block message */ +#define SMBsendtxt 0xD7 /* send text of multi-block message */ + +/* Core+ protocol */ +#define SMBlockread 0x13 /* Lock a range and read */ +#define SMBwriteunlock 0x14 /* Unlock a range then write */ +#define SMBreadbraw 0x1a /* read a block of data with no smb header */ +#define SMBwritebraw 0x1d /* write a block of data with no smb header */ +#define SMBwritec 0x20 /* secondary write request */ +#define SMBwriteclose 0x2c /* write a file then close it */ + +/* dos extended protocol */ +#define SMBreadBraw 0x1A /* read block raw */ +#define SMBreadBmpx 0x1B /* read block multiplexed */ +#define SMBreadBs 0x1C /* read block (secondary response) */ +#define SMBwriteBraw 0x1D /* write block raw */ +#define SMBwriteBmpx 0x1E /* write block multiplexed */ +#define SMBwriteBs 0x1F /* write block (secondary request) */ +#define SMBwriteC 0x20 /* write complete response */ +#define SMBsetattrE 0x22 /* set file attributes expanded */ +#define SMBgetattrE 0x23 /* get file attributes expanded */ +#define SMBlockingX 0x24 /* lock/unlock byte ranges and X */ +#define SMBtrans 0x25 /* transaction - name, bytes in/out */ +#define SMBtranss 0x26 /* transaction (secondary request/response) */ +#define SMBioctl 0x27 /* IOCTL */ +#define SMBioctls 0x28 /* IOCTL (secondary request/response) */ +#define SMBcopy 0x29 /* copy */ +#define SMBmove 0x2A /* move */ +#define SMBecho 0x2B /* echo */ +#define SMBopenX 0x2D /* open and X */ +#define SMBreadX 0x2E /* read and X */ +#define SMBwriteX 0x2F /* write and X */ +#define SMBsesssetupX 0x73 /* Session Set Up & X (including User Logon) */ +#define SMBffirst 0x82 /* find first */ +#define SMBfunique 0x83 /* find unique */ +#define SMBfclose 0x84 /* find close */ +#define SMBinvalid 0xFE /* invalid command */ + +/* Extended 2.0 protocol */ +#define SMBtrans2 0x32 /* TRANS2 protocol set */ +#define SMBtranss2 0x33 /* TRANS2 protocol set, secondary command */ +#define SMBfindclose 0x34 /* Terminate a TRANSACT2_FINDFIRST */ +#define SMBfindnclose 0x35 /* Terminate a TRANSACT2_FINDNOTIFYFIRST */ +#define SMBulogoffX 0x74 /* user logoff */ + + +/* these are the TRANS2 sub commands */ +#define TRANSACT2_OPEN 0 +#define TRANSACT2_FINDFIRST 1 +#define TRANSACT2_FINDNEXT 2 +#define TRANSACT2_QFSINFO 3 +#define TRANSACT2_SETFSINFO 4 +#define TRANSACT2_QPATHINFO 5 +#define TRANSACT2_SETPATHINFO 6 +#define TRANSACT2_QFILEINFO 7 +#define TRANSACT2_SETFILEINFO 8 +#define TRANSACT2_FSCTL 9 +#define TRANSACT2_IOCTL 10 +#define TRANSACT2_FINDNOTIFYFIRST 11 +#define TRANSACT2_FINDNOTIFYNEXT 12 +#define TRANSACT2_MKDIR 13 + + +/* these are the trans2 sub fields for primary requests */ +#define smb_tpscnt smb_vwv0 +#define smb_tdscnt smb_vwv1 +#define smb_mprcnt smb_vwv2 +#define smb_mdrcnt smb_vwv3 +#define smb_msrcnt smb_vwv4 +#define smb_flags smb_vwv5 +#define smb_timeout smb_vwv6 +#define smb_pscnt smb_vwv9 +#define smb_psoff smb_vwv10 +#define smb_dscnt smb_vwv11 +#define smb_dsoff smb_vwv12 +#define smb_suwcnt smb_vwv13 +#define smb_setup smb_vwv14 +#define smb_setup0 smb_setup +#define smb_setup1 (smb_setup+2) +#define smb_setup2 (smb_setup+4) + +/* these are for the secondary requests */ +#define smb_spscnt smb_vwv2 +#define smb_spsoff smb_vwv3 +#define smb_spsdisp smb_vwv4 +#define smb_sdscnt smb_vwv5 +#define smb_sdsoff smb_vwv6 +#define smb_sdsdisp smb_vwv7 +#define smb_sfid smb_vwv8 + +/* and these for responses */ +#define smb_tprcnt smb_vwv0 +#define smb_tdrcnt smb_vwv1 +#define smb_prcnt smb_vwv3 +#define smb_proff smb_vwv4 +#define smb_prdisp smb_vwv5 +#define smb_drcnt smb_vwv6 +#define smb_droff smb_vwv7 +#define smb_drdisp smb_vwv8 + +/* where to find the base of the SMB packet proper */ +#define smb_base(buf) (((char *)(buf))+4) + + +#define SUCCESS 0 /* The request was successful. */ +#define ERRDOS 0x01 /* Error is from the core DOS operating system set. */ +#define ERRSRV 0x02 /* Error is generated by the server network file manager.*/ +#define ERRHRD 0x03 /* Error is an hardware error. */ +#define ERRCMD 0xFF /* Command was not in the "SMB" format. */ + +/* structure used to hold the incoming hosts info */ +struct from_host { + char *name; /* host name */ + char *addr; /* host address */ + struct sockaddr_in *sin; /* their side of the link */ +}; + +/* and a few prototypes */ +BOOL user_ok(char *user,int snum); +int sys_rename(char *from, char *to); +int sys_select(fd_set *fds,struct timeval *tval); +int sys_unlink(char *fname); +int sys_open(char *fname,int flags,int mode); +DIR *sys_opendir(char *dname); +int sys_stat(char *fname,struct stat *sbuf); +int sys_lstat(char *fname,struct stat *sbuf); +int sys_mkdir(char *dname,int mode); +int sys_rmdir(char *dname); +int sys_chdir(char *dname); +int sys_utime(char *fname,struct utimbuf *times); +int sys_disk_free(char *path,int *bsize,int *dfree,int *dsize); +void lpq_reset(int); +void status_printjob(int cnum,int snum,int jobid,int status); +void DirCacheAdd(char *path,char *name,char *dname,int snum); +char *DirCacheCheck(char *path,char *name,int snum); +void DirCacheFlush(int snum); +int interpret_character_set(char *str, int def); +char *dos2unix_format(char *, BOOL); +char *unix2dos_format(char *, BOOL); +BOOL fcntl_lock(int fd,int op,uint32 offset,uint32 count,int type); +void BlockSignals(BOOL block); +void msleep(int t); +int file_lock(char *name,int timeout); +void file_unlock(int fd); +int find_service(char *service); +int TvalDiff(struct timeval *tvalold,struct timeval *tvalnew); +int smb_offset(char *p,char *buf); +void sync_file(int fnum); +int PutUniCode(char *dst,char *src); +void map_username(char *user); +void close_low_fds(void); +void clean_share_files(void); +int write_socket(int fd,char *buf,int len); +char *readdirname(void *p); +int dos_chmod(int cnum,char *fname,int mode,struct stat *st); +int smb_numwords(char *buf); +int get_share_mode(int cnum,struct stat *sbuf,int *pid); +void del_share_mode(int fnum); +BOOL set_share_mode(int fnum,int mode); +int DSTDiff(time_t t); +void TimeInit(void); +void put_long_date(char *p,time_t t); +time_t interpret_long_date(char *p); +void dptr_idlecnum(int cnum); +void dptr_closecnum(int cnum); +void init_dptrs(void); +void fault_setup(); +void set_socket_options(int fd, char *options); +void putip(void *dest,void *src); +void standard_sub_basic(char *s); +void *OpenDir(char *name); +void CloseDir(void *p); +char *ReadDirName(void *p); +BOOL SeekDir(void *p,int pos); +int TellDir(void *p); +int write_data(int fd,char *buffer,int N); +BOOL server_cryptkey(char *buf); +BOOL server_validate(char *buf); +BOOL become_service(int cnum,BOOL do_chdir); +BOOL snum_used(int snum); +BOOL reload_services(BOOL test); +void reopen_logs(void); +int transfer_file(int infd,int outfd,int n,char *header,int headlen,int align); +int str_checksum(char *s); +time_t file_modtime(char *fname); +BOOL do_match(char *str, char *regexp, int case_sig); +BOOL is_a_socket(int fd); +void _smb_setlen(char *buf,int len); +void valid_initialise(void); +BOOL is_8_3(char *fname); +BOOL is_mangled(char *s); +void standard_sub(int cnum,char *s); +void del_printqueue(int cnum,int snum,int jobid); +BOOL strisnormal(char *s); +BOOL check_mangled_stack(char *s); +int sys_chown(char *fname,int uid,int gid); +int sys_chroot(char *dname); +BOOL next_token(char **ptr,char *buff,char *sep); +void invalidate_uid(int uid); +char *fgets_slash(char *s,int maxlen,FILE *f); +int read_udp_socket(int fd,char *buf,int len); +void exit_server(char *reason); +BOOL process_exists(int pid); +BOOL chgpasswd(char *name,char *oldpass,char *newpass); +void array_promote(char *array,int elsize,int element); +void string_replace(char *s,char oldc,char newc); +BOOL user_in_list(char *user,char *list); +BOOL string_sub(char *s,char *pattern,char *insert); +char *StrnCpy(char *dest,const char *src,int n); +char *validated_username(int vuid); +BOOL set_user_password(char *user,char *oldpass,char *newpass); +int smb_buf_ofs(char *buf); +char *skip_string(char *buf,int n); +BOOL is_locked(int fnum,int cnum,uint32 count,uint32 offset); +int read_file(int fnum,char *data,int pos,int mincnt,int maxcnt,int timeout,BOOL exact); +int write_file(int fnum,char *data,int n); +BOOL do_lock(int fnum,int cnum,uint32 count,uint32 offset,int *eclass,uint32 *ecode); +int seek_file(int fnum,int pos); +BOOL do_unlock(int fnum,int cnum,uint32 count,uint32 offset,int *eclass,uint32 *ecode); +int get_printqueue(int snum,int cnum,print_queue_struct **queue,print_status_struct *status); +void parse_connect(char *buf,char *service,char *user,char *password,int *pwlen,char *dev); +int setup_groups(char *user,int uid, int gid, int *p_ngroups, + int **p_igroups, gid_t **p_groups); +int make_connection(char *service,char *user,char *password, int pwlen, char *dev,int vuid); +char *dptr_path(int key); +char *dptr_wcard(int key); +BOOL dptr_set_wcard(int key, char *wcard); +BOOL dptr_set_attr(int key, uint16 attr); +uint16 dptr_attr(int key); +void dptr_close(int key); +void dptr_closepath(char *path,int pid); +int dptr_create(int cnum,char *path, BOOL expect_close,int pid); +BOOL dptr_fill(char *buf,unsigned int key); +BOOL dptr_zero(char *buf); +void *dptr_fetch(char *buf,int *num); +void *dptr_fetch_lanman2(char *params,int dptr_num); +BOOL get_dir_entry(int cnum,char *mask,int dirtype,char *fname,int *size,int *mode,time_t *date,BOOL check_descend); +void open_file(int fnum,int cnum,char *fname,int flags,int mode); +void open_file_shared(int fnum,int cnum,char *fname,int share_mode,int ofun,int mode,int *Access,int *action); +void close_file(int fnum); +int reply_trans2(char *inbuf,char *outbuf,int length,int bufsize); +int reply_trans(char *inbuf,char *outbuf); +char *ufc_crypt(char *key,char *salt); +BOOL authorise_login(int snum,char *user,char *password, int pwlen, + BOOL *guest,BOOL *force,int vuid); +void add_session_user(char *user); +int valid_uid(int uid); +user_struct *get_valid_user_struct(int uid); +BOOL password_ok(char *user,char *password, int pwlen, struct passwd *pwd, BOOL nt_password); +void register_uid(int uid,int gid,char *name,BOOL guest); +BOOL fromhost(int sock,struct from_host *f); +BOOL strhasupper(char *s); +BOOL strhaslower(char *s); +int disk_free(char *path,int *bsize,int *dfree,int *dsize); +char *uidtoname(int uid); +char *gidtoname(int gid); +int get_share_mode_byname(int cnum,char *fname,int *pid); +int get_share_mode_by_fnum(int cnum,int fnum,int *pid); +BOOL check_file_sharing(int cnum,char *fname); +char *StrCpy(char *dest,char *src); +int unix_error_packet(char *inbuf,char *outbuf,int def_class,uint32 def_code,int line); +time_t make_unix_date2(void *date_ptr); +int cached_error_packet(char *inbuf,char *outbuf,int fnum,int line); +mode_t unix_mode(int cnum,int dosmode); +BOOL check_name(char *name,int cnum); +int error_packet(char *inbuf,char *outbuf,int error_class,uint32 error_code,int line); +int find_free_file(void ); +BOOL unix_convert(char *name,int cnum); +void unix_convert_lanman2(char *s,char *home,BOOL case_is_sig); +void print_file(int fnum); +int read_smb_length(int fd,char *inbuf,int timeout); +int read_predict(int fd,int offset,char *buf,char **ptr,int num); +void invalidate_read_prediction(int fd); +void do_read_prediction(); +BOOL claim_connection(int cnum,char *name,int max_connections,BOOL Clear); +BOOL yield_connection(int cnum,char *name,int max_connections); +int count_chars(char *s,char c); +int smbrun(char *,char *); +BOOL name_map_mangle(char *OutName,BOOL need83,int snum); +struct hostent *Get_Hostbyname(char *name); +struct passwd *Get_Pwnam(char *user,BOOL allow_change); +void Abort(void); +void *Realloc(void *p,int size); +void smb_setlen(char *buf,int len); +int set_message(char *buf,int num_words,int num_bytes,BOOL zero); +BOOL check_access(int snum); +BOOL in_group(gid_t group, int current_gid, int ngroups, int *groups); +BOOL string_set(char **dest,char *src); +BOOL string_init(char **dest,char *src); +void string_free(char **s); +char *attrib_string(int mode); +void unix_format(char *fname); +BOOL directory_exist(char *dname,struct stat *st); +time_t make_unix_date3(void *date_ptr); +void put_dos_date3(char *buf,int offset,time_t unixdate); +void make_dir_struct(char *buf,char *mask,char *fname,unsigned int size,int mode,time_t date); +BOOL in_list(char *s,char *list,BOOL case_sensitive); +void strupper(char *s); +BOOL file_exist(char *fname,struct stat *sbuf); +int read_with_timeout(int fd,char *buf,int mincnt,int maxcnt, long time_out, BOOL exact); +void close_sockets(void ); +BOOL send_smb(int fd,char *buffer); +BOOL send_keepalive(int client); +int read_data(int fd,char *buffer,int N); +int smb_len(char *buf); +BOOL receive_smb(int fd,char *buffer,int timeout); +void show_msg(char *buf); +BOOL big_endian(void ); +BOOL become_user(int cnum, int uid); +BOOL unbecome_user(void); +void become_daemon(void); +BOOL reduce_name(char *s,char *dir,BOOL widelinks); +void strlower(char *s); +void strnorm(char *s); +char *smb_buf(char *buf); +char *smb_trans2_param(char *buf); +char *smb_trans2_data(char *buf); +BOOL strequal(char *,char *); +BOOL strnequal(char *,char *,int n); +BOOL strcsequal(char *,char *); +BOOL mask_match( char *str, char *regexp, int case_sig, BOOL trans2); +int dos_mode(int ,char *,struct stat *); +char *timestring(); +BOOL ip_equal(struct in_addr ip1,struct in_addr ip2); +BOOL send_one_packet(char *buf,int len,struct in_addr ip,int port,int type); +char *get_home_dir(char *); +int set_filelen(int fd, long len); +void put_dos_date(char *buf,int offset,time_t unixdate); +void put_dos_date2(char *buf,int offset,time_t unixdate); +int lp_keepalive(void); +int name_len(char *s); +void dos_clean_name(char *s); +void unix_clean_name(char *s); +time_t make_unix_date(void *date_ptr); +BOOL lanman2_match( char *str, char *regexp, int case_sig, BOOL autoext); +BOOL trim_string(char *s,char *front,char *back); +int byte_checksum(char *buf,int len); +BOOL yesno(char *p); +uint32 file_size(char *file_name); +void dos_format(char *fname); +char *GetWd(char *s); +int name_mangle(char *in,char *out,char name_type); +int name_len(char *s); +void create_mangled_stack(int size); +int name_extract(char *buf,int ofs,char *name); +void get_broadcast(struct in_addr *if_ipaddr, struct in_addr *if_bcast, struct in_addr *if_nmask); +BOOL allow_access(char *deny_list,char *allow_list,struct from_host *client); +#ifdef __STDC__ +int Debug1(char *, ...); +#else +int Debug1(); +#endif +BOOL check_hosts_equiv(char *user); +int chain_reply(int type,char *inbuf,char *inbuf2,char *outbuf,char *outbuf2,int size,int bufsize); +void close_cnum(int cnum,int uid); +char *smb_errstr(char *inbuf); +void GetTimeOfDay(struct timeval *tval); +struct tm *LocalTime(time_t *t,int); +int TimeDiff(time_t t); +BOOL set_filetime(char *fname,time_t mtime); +char *dirname_dos(char *path,char *buf); +BOOL get_myname(char *myname,struct in_addr *ip); +void expand_mask(char *Mask, BOOL); +BOOL sane_unix_date(time_t unixdate); +time_t start_of_month(void); +char *smb_fn_name(int cnum); +void get_machine_info(void); +int open_socket_in(int type, int port, int dlevel); +int open_socket_out(int type,struct in_addr *addr, int port ); +struct in_addr *interpret_addr2(char *str); +BOOL zero_ip(struct in_addr ip); +int read_max_udp(int fd,char *buffer,int bufsize,int maxtime); +int interpret_protocol(char *str,int def); +int interpret_security(char *str,int def); +int ChDir(char *path); +int smb_buflen(char *buf); +unsigned long interpret_addr(char *str); +void mangle_name_83(char *s); +BOOL lp_casesignames(void); +void setup_logging(char *pname,BOOL interactive); +#ifdef DFS_AUTH +void dfs_unlogin(void); +extern int dcelogin_atmost_once; +#endif +#if AJT +void ajt_panic(void); +#endif +#ifdef NOSTRDUP +char *strdup(char *s); +#endif +#ifdef REPLACE_STRLEN +int Strlen(char *); +#endif +#ifdef REPLACE_STRSTR +char *Strstr(char *s, char *p); +#endif + +#ifndef MIN +#define MIN(a,b) ((a)<(b)?(a):(b)) +#endif +#ifndef MAX +#define MAX(a,b) ((a)>(b)?(a):(b)) +#endif + +#ifndef ABS +#define ABS(a) ((a)>0?(a):(-(a))) +#endif + +#ifndef SIGNAL_CAST +#define SIGNAL_CAST +#endif + +#ifndef SELECT_CAST +#define SELECT_CAST +#endif + + +/* Some POSIX definitions for those without */ + +#ifndef S_IFDIR +#define S_IFDIR 0x4000 +#endif +#ifndef S_ISDIR +#define S_ISDIR(mode) ((mode & 0xF000) == S_IFDIR) +#endif +#ifndef S_IRWXU +#define S_IRWXU 00700 /* read, write, execute: owner */ +#endif +#ifndef S_IRUSR +#define S_IRUSR 00400 /* read permission: owner */ +#endif +#ifndef S_IWUSR +#define S_IWUSR 00200 /* write permission: owner */ +#endif +#ifndef S_IXUSR +#define S_IXUSR 00100 /* execute permission: owner */ +#endif +#ifndef S_IRWXG +#define S_IRWXG 00070 /* read, write, execute: group */ +#endif +#ifndef S_IRGRP +#define S_IRGRP 00040 /* read permission: group */ +#endif +#ifndef S_IWGRP +#define S_IWGRP 00020 /* write permission: group */ +#endif +#ifndef S_IXGRP +#define S_IXGRP 00010 /* execute permission: group */ +#endif +#ifndef S_IRWXO +#define S_IRWXO 00007 /* read, write, execute: other */ +#endif +#ifndef S_IROTH +#define S_IROTH 00004 /* read permission: other */ +#endif +#ifndef S_IWOTH +#define S_IWOTH 00002 /* write permission: other */ +#endif +#ifndef S_IXOTH +#define S_IXOTH 00001 /* execute permission: other */ +#endif + + +/* these are used in NetServerEnum to choose what to receive */ +#define SV_TYPE_WORKSTATION 0x00000001 +#define SV_TYPE_SERVER 0x00000002 +#define SV_TYPE_SQLSERVER 0x00000004 +#define SV_TYPE_DOMAIN_CTRL 0x00000008 +#define SV_TYPE_DOMAIN_BAKCTRL 0x00000010 +#define SV_TYPE_TIME_SOURCE 0x00000020 +#define SV_TYPE_AFP 0x00000040 +#define SV_TYPE_NOVELL 0x00000080 +#define SV_TYPE_DOMAIN_MEMBER 0x00000100 +#define SV_TYPE_PRINTQ_SERVER 0x00000200 +#define SV_TYPE_DIALIN_SERVER 0x00000400 +#define SV_TYPE_SERVER_UNIX 0x00000800 +#define SV_TYPE_NT 0x00001000 +#define SV_TYPE_WFW 0x00002000 +#define SV_TYPE_SERVER_MFPN 0x00004000 +#define SV_TYPE_SERVER_NT 0x00008000 +#define SV_TYPE_POTENTIAL_BROWSER 0x00010000 +#define SV_TYPE_BACKUP_BROWSER 0x00020000 +#define SV_TYPE_MASTER_BROWSER 0x00040000 +#define SV_TYPE_DOMAIN_MASTER 0x00080000 +#define SV_TYPE_SERVER_OSF 0x00100000 +#define SV_TYPE_SERVER_VMS 0x00200000 +#define SV_TYPE_ALTERNATE_XPORT 0x20000000 +#define SV_TYPE_LOCAL_LIST_ONLY 0x40000000 +#define SV_TYPE_DOMAIN_ENUM 0x80000000 +#define SV_TYPE_ALL 0xFFFFFFFF + + + +/* protocol types. It assumes that higher protocols include lower protocols + as subsets */ +enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANMAN1,PROTOCOL_LANMAN2,PROTOCOL_NT1}; + +/* security levels */ +enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER}; + +/* printing types */ +enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX,PRINT_QNX}; + + +/* case handling */ +enum case_handling {CASE_LOWER,CASE_UPPER}; + + +/* Macros to get at offsets within smb_lkrng and smb_unlkrng + structures. We cannot define these as actual structures + due to possible differences in structure packing + on different machines/compilers. */ + +#define SMB_LPID_OFFSET(indx) (10 * (indx)) +#define SMB_LKOFF_OFFSET(indx) ( 2 + (10 * (indx))) +#define SMB_LKLEN_OFFSET(indx) ( 6 + (10 * (indx))) + +/* Macro to cache an error in a write_bmpx_struct */ +#define CACHE_ERROR(w,c,e) ((w)->wr_errclass = (c), (w)->wr_error = (e), \ + w->wr_discard = True, -1) +/* Macro to test if an error has been cached for this fnum */ +#define HAS_CACHED_ERROR(fnum) (Files[(fnum)].open && \ + Files[(fnum)].wbmpx_ptr && \ + Files[(fnum)].wbmpx_ptr->wr_discard) +/* Macro to turn the cached error into an error packet */ +#define CACHED_ERROR(fnum) cached_error_packet(inbuf,outbuf,fnum,__LINE__) + +/* these are the datagram types */ +#define DGRAM_DIRECT_UNIQUE 0x10 + +#define ERROR(class,x) error_packet(inbuf,outbuf,class,x,__LINE__) + +/* this is how errors are generated */ +#define UNIXERROR(defclass,deferror) unix_error_packet(inbuf,outbuf,defclass,deferror,__LINE__) + +#define ROUNDUP(x,g) (((x)+((g)-1))&~((g)-1)) + +#endif +/* _SMB_H */ -- cgit From 58734631b4233ec08b7a262587e400792f31f185 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 31 May 1996 15:13:29 +0000 Subject: Lots of changes! - add faq info on NT printer handling - add "delete readonly" option to help rcs users - add stuff to man pages on new printer options - add "proxy name resolution" option - add "command string" -c option to smbclient (thanks Ken) - split time functions into time.c - rearrange the quotas stuff a bit and fix some bugs - complete rehash of the time handling code thanks to Paul Eggert - fix nmblookup output a bit - add plp print queue parsing from Bertrand Wallrich (This used to be commit 635b56f19c817527c52e9bbde31faa6a8a47777b) --- source3/include/smb.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index b7faffa9e9..4d99529ef6 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -624,7 +624,6 @@ int smb_numwords(char *buf); int get_share_mode(int cnum,struct stat *sbuf,int *pid); void del_share_mode(int fnum); BOOL set_share_mode(int fnum,int mode); -int DSTDiff(time_t t); void TimeInit(void); void put_long_date(char *p,time_t t); time_t interpret_long_date(char *p); @@ -822,14 +821,12 @@ int chain_reply(int type,char *inbuf,char *inbuf2,char *outbuf,char *outbuf2,int void close_cnum(int cnum,int uid); char *smb_errstr(char *inbuf); void GetTimeOfDay(struct timeval *tval); -struct tm *LocalTime(time_t *t,int); +struct tm *LocalTime(time_t *t); int TimeDiff(time_t t); BOOL set_filetime(char *fname,time_t mtime); char *dirname_dos(char *path,char *buf); BOOL get_myname(char *myname,struct in_addr *ip); void expand_mask(char *Mask, BOOL); -BOOL sane_unix_date(time_t unixdate); -time_t start_of_month(void); char *smb_fn_name(int cnum); void get_machine_info(void); int open_socket_in(int type, int port, int dlevel); @@ -966,7 +963,8 @@ enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANM enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER}; /* printing types */ -enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX,PRINT_QNX}; +enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX, + PRINT_QNX,PRINT_PLP}; /* case handling */ -- cgit From 81e398963dbaed9c6661c336fe98329098576b94 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 1 Jun 1996 15:25:30 +0000 Subject: - moved the uid handling to uid.c - added setfsuid() support (for Linux) - started adding some of Lukes changes, just the loadparm and ipc ones so far (This used to be commit 72543810ce3eb5ea7b141f957edf38b4c46b1ea4) --- source3/include/smb.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 4d99529ef6..3e38f4c37e 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -583,6 +583,8 @@ struct from_host { }; /* and a few prototypes */ +BOOL become_guest(void); +void init_uid(void); BOOL user_ok(char *user,int snum); int sys_rename(char *from, char *to); int sys_select(fd_set *fds,struct timeval *tval); -- cgit From a2c1623827406667a4f2f058c24f1d971f6627f8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 4 Jun 1996 06:42:03 +0000 Subject: a huge pile of changes :-) The biggest thing is the integration of Lukes new nmbd. Its still largely untested, so we will really need some feedback I've also added auto prototype generation and cleaned up a lot of minor things as a result (This used to be commit 0d8dcfa13c527ec2c8aca39ba49c09e4e694b26c) --- source3/include/smb.h | 298 +++++++------------------------------------------- 1 file changed, 41 insertions(+), 257 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 3e38f4c37e..0be860d6a3 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -40,6 +40,10 @@ # define EXTERN extern #endif +#define NMB_PORT 137 +#define DGRAM_PORT 138 +#define SMB_PORT 139 + #define False (0) #define True (1) #define BOOLSTR(b) ((b) ? "Yes" : "No") @@ -72,6 +76,19 @@ typedef unsigned short uint16; typedef unsigned int uint32; #endif +#ifndef uchar +#define uchar unsigned char +#endif +#ifndef int16 +#define int16 short +#endif +#ifndef uint16 +#define uint16 unsigned short +#endif +#ifndef uint32 +#define uint32 unsigned int +#endif + #define SIZEOFWORD 2 #ifndef DEF_CREATE_MASK @@ -216,6 +233,15 @@ typedef char pstring[1024]; typedef char fstring[128]; typedef fstring string; + +struct current_user { + int cnum, id; + int uid, gid; + int ngroups; + gid_t *groups; + int *igroups; +}; + typedef struct { int size; @@ -332,6 +358,16 @@ typedef struct int status; } print_status_struct; +/* used for server information: client, nameserv and ipc */ +struct server_info_struct +{ + fstring name; + uint32 type; + fstring comment; + fstring domain; /* used ONLY in ipc.c NOT namework.c */ + BOOL server_added; /* used ONLY in ipc.c NOT namework.c */ +}; + /* this is used for smbstatus */ struct connect_record @@ -582,281 +618,29 @@ struct from_host { struct sockaddr_in *sin; /* their side of the link */ }; -/* and a few prototypes */ -BOOL become_guest(void); -void init_uid(void); -BOOL user_ok(char *user,int snum); -int sys_rename(char *from, char *to); -int sys_select(fd_set *fds,struct timeval *tval); -int sys_unlink(char *fname); -int sys_open(char *fname,int flags,int mode); -DIR *sys_opendir(char *dname); -int sys_stat(char *fname,struct stat *sbuf); -int sys_lstat(char *fname,struct stat *sbuf); -int sys_mkdir(char *dname,int mode); -int sys_rmdir(char *dname); -int sys_chdir(char *dname); -int sys_utime(char *fname,struct utimbuf *times); -int sys_disk_free(char *path,int *bsize,int *dfree,int *dsize); -void lpq_reset(int); -void status_printjob(int cnum,int snum,int jobid,int status); -void DirCacheAdd(char *path,char *name,char *dname,int snum); -char *DirCacheCheck(char *path,char *name,int snum); -void DirCacheFlush(int snum); -int interpret_character_set(char *str, int def); -char *dos2unix_format(char *, BOOL); -char *unix2dos_format(char *, BOOL); -BOOL fcntl_lock(int fd,int op,uint32 offset,uint32 count,int type); -void BlockSignals(BOOL block); -void msleep(int t); -int file_lock(char *name,int timeout); -void file_unlock(int fd); -int find_service(char *service); -int TvalDiff(struct timeval *tvalold,struct timeval *tvalnew); -int smb_offset(char *p,char *buf); -void sync_file(int fnum); -int PutUniCode(char *dst,char *src); -void map_username(char *user); -void close_low_fds(void); -void clean_share_files(void); -int write_socket(int fd,char *buf,int len); -char *readdirname(void *p); -int dos_chmod(int cnum,char *fname,int mode,struct stat *st); -int smb_numwords(char *buf); -int get_share_mode(int cnum,struct stat *sbuf,int *pid); -void del_share_mode(int fnum); -BOOL set_share_mode(int fnum,int mode); -void TimeInit(void); -void put_long_date(char *p,time_t t); -time_t interpret_long_date(char *p); -void dptr_idlecnum(int cnum); -void dptr_closecnum(int cnum); -void init_dptrs(void); -void fault_setup(); -void set_socket_options(int fd, char *options); -void putip(void *dest,void *src); -void standard_sub_basic(char *s); -void *OpenDir(char *name); -void CloseDir(void *p); -char *ReadDirName(void *p); -BOOL SeekDir(void *p,int pos); -int TellDir(void *p); -int write_data(int fd,char *buffer,int N); -BOOL server_cryptkey(char *buf); -BOOL server_validate(char *buf); -BOOL become_service(int cnum,BOOL do_chdir); -BOOL snum_used(int snum); -BOOL reload_services(BOOL test); -void reopen_logs(void); -int transfer_file(int infd,int outfd,int n,char *header,int headlen,int align); -int str_checksum(char *s); -time_t file_modtime(char *fname); -BOOL do_match(char *str, char *regexp, int case_sig); -BOOL is_a_socket(int fd); -void _smb_setlen(char *buf,int len); -void valid_initialise(void); -BOOL is_8_3(char *fname); -BOOL is_mangled(char *s); -void standard_sub(int cnum,char *s); -void del_printqueue(int cnum,int snum,int jobid); -BOOL strisnormal(char *s); -BOOL check_mangled_stack(char *s); -int sys_chown(char *fname,int uid,int gid); -int sys_chroot(char *dname); -BOOL next_token(char **ptr,char *buff,char *sep); -void invalidate_uid(int uid); -char *fgets_slash(char *s,int maxlen,FILE *f); -int read_udp_socket(int fd,char *buf,int len); -void exit_server(char *reason); -BOOL process_exists(int pid); -BOOL chgpasswd(char *name,char *oldpass,char *newpass); -void array_promote(char *array,int elsize,int element); -void string_replace(char *s,char oldc,char newc); -BOOL user_in_list(char *user,char *list); -BOOL string_sub(char *s,char *pattern,char *insert); -char *StrnCpy(char *dest,const char *src,int n); -char *validated_username(int vuid); -BOOL set_user_password(char *user,char *oldpass,char *newpass); -int smb_buf_ofs(char *buf); -char *skip_string(char *buf,int n); -BOOL is_locked(int fnum,int cnum,uint32 count,uint32 offset); -int read_file(int fnum,char *data,int pos,int mincnt,int maxcnt,int timeout,BOOL exact); -int write_file(int fnum,char *data,int n); -BOOL do_lock(int fnum,int cnum,uint32 count,uint32 offset,int *eclass,uint32 *ecode); -int seek_file(int fnum,int pos); -BOOL do_unlock(int fnum,int cnum,uint32 count,uint32 offset,int *eclass,uint32 *ecode); -int get_printqueue(int snum,int cnum,print_queue_struct **queue,print_status_struct *status); -void parse_connect(char *buf,char *service,char *user,char *password,int *pwlen,char *dev); -int setup_groups(char *user,int uid, int gid, int *p_ngroups, - int **p_igroups, gid_t **p_groups); -int make_connection(char *service,char *user,char *password, int pwlen, char *dev,int vuid); -char *dptr_path(int key); -char *dptr_wcard(int key); -BOOL dptr_set_wcard(int key, char *wcard); -BOOL dptr_set_attr(int key, uint16 attr); -uint16 dptr_attr(int key); -void dptr_close(int key); -void dptr_closepath(char *path,int pid); -int dptr_create(int cnum,char *path, BOOL expect_close,int pid); -BOOL dptr_fill(char *buf,unsigned int key); -BOOL dptr_zero(char *buf); -void *dptr_fetch(char *buf,int *num); -void *dptr_fetch_lanman2(char *params,int dptr_num); -BOOL get_dir_entry(int cnum,char *mask,int dirtype,char *fname,int *size,int *mode,time_t *date,BOOL check_descend); -void open_file(int fnum,int cnum,char *fname,int flags,int mode); -void open_file_shared(int fnum,int cnum,char *fname,int share_mode,int ofun,int mode,int *Access,int *action); -void close_file(int fnum); -int reply_trans2(char *inbuf,char *outbuf,int length,int bufsize); -int reply_trans(char *inbuf,char *outbuf); -char *ufc_crypt(char *key,char *salt); -BOOL authorise_login(int snum,char *user,char *password, int pwlen, - BOOL *guest,BOOL *force,int vuid); -void add_session_user(char *user); -int valid_uid(int uid); -user_struct *get_valid_user_struct(int uid); -BOOL password_ok(char *user,char *password, int pwlen, struct passwd *pwd, BOOL nt_password); -void register_uid(int uid,int gid,char *name,BOOL guest); -BOOL fromhost(int sock,struct from_host *f); -BOOL strhasupper(char *s); -BOOL strhaslower(char *s); -int disk_free(char *path,int *bsize,int *dfree,int *dsize); -char *uidtoname(int uid); -char *gidtoname(int gid); -int get_share_mode_byname(int cnum,char *fname,int *pid); -int get_share_mode_by_fnum(int cnum,int fnum,int *pid); -BOOL check_file_sharing(int cnum,char *fname); -char *StrCpy(char *dest,char *src); -int unix_error_packet(char *inbuf,char *outbuf,int def_class,uint32 def_code,int line); -time_t make_unix_date2(void *date_ptr); -int cached_error_packet(char *inbuf,char *outbuf,int fnum,int line); -mode_t unix_mode(int cnum,int dosmode); -BOOL check_name(char *name,int cnum); -int error_packet(char *inbuf,char *outbuf,int error_class,uint32 error_code,int line); -int find_free_file(void ); -BOOL unix_convert(char *name,int cnum); -void unix_convert_lanman2(char *s,char *home,BOOL case_is_sig); -void print_file(int fnum); -int read_smb_length(int fd,char *inbuf,int timeout); -int read_predict(int fd,int offset,char *buf,char **ptr,int num); -void invalidate_read_prediction(int fd); -void do_read_prediction(); -BOOL claim_connection(int cnum,char *name,int max_connections,BOOL Clear); -BOOL yield_connection(int cnum,char *name,int max_connections); -int count_chars(char *s,char c); -int smbrun(char *,char *); -BOOL name_map_mangle(char *OutName,BOOL need83,int snum); -struct hostent *Get_Hostbyname(char *name); -struct passwd *Get_Pwnam(char *user,BOOL allow_change); -void Abort(void); -void *Realloc(void *p,int size); -void smb_setlen(char *buf,int len); -int set_message(char *buf,int num_words,int num_bytes,BOOL zero); -BOOL check_access(int snum); -BOOL in_group(gid_t group, int current_gid, int ngroups, int *groups); -BOOL string_set(char **dest,char *src); -BOOL string_init(char **dest,char *src); -void string_free(char **s); -char *attrib_string(int mode); -void unix_format(char *fname); -BOOL directory_exist(char *dname,struct stat *st); -time_t make_unix_date3(void *date_ptr); -void put_dos_date3(char *buf,int offset,time_t unixdate); -void make_dir_struct(char *buf,char *mask,char *fname,unsigned int size,int mode,time_t date); -BOOL in_list(char *s,char *list,BOOL case_sensitive); -void strupper(char *s); -BOOL file_exist(char *fname,struct stat *sbuf); -int read_with_timeout(int fd,char *buf,int mincnt,int maxcnt, long time_out, BOOL exact); -void close_sockets(void ); -BOOL send_smb(int fd,char *buffer); -BOOL send_keepalive(int client); -int read_data(int fd,char *buffer,int N); -int smb_len(char *buf); -BOOL receive_smb(int fd,char *buffer,int timeout); -void show_msg(char *buf); -BOOL big_endian(void ); -BOOL become_user(int cnum, int uid); -BOOL unbecome_user(void); -void become_daemon(void); -BOOL reduce_name(char *s,char *dir,BOOL widelinks); -void strlower(char *s); -void strnorm(char *s); -char *smb_buf(char *buf); -char *smb_trans2_param(char *buf); -char *smb_trans2_data(char *buf); -BOOL strequal(char *,char *); -BOOL strnequal(char *,char *,int n); -BOOL strcsequal(char *,char *); -BOOL mask_match( char *str, char *regexp, int case_sig, BOOL trans2); -int dos_mode(int ,char *,struct stat *); -char *timestring(); -BOOL ip_equal(struct in_addr ip1,struct in_addr ip2); -BOOL send_one_packet(char *buf,int len,struct in_addr ip,int port,int type); -char *get_home_dir(char *); -int set_filelen(int fd, long len); -void put_dos_date(char *buf,int offset,time_t unixdate); -void put_dos_date2(char *buf,int offset,time_t unixdate); -int lp_keepalive(void); -int name_len(char *s); -void dos_clean_name(char *s); -void unix_clean_name(char *s); -time_t make_unix_date(void *date_ptr); -BOOL lanman2_match( char *str, char *regexp, int case_sig, BOOL autoext); -BOOL trim_string(char *s,char *front,char *back); -int byte_checksum(char *buf,int len); -BOOL yesno(char *p); -uint32 file_size(char *file_name); -void dos_format(char *fname); -char *GetWd(char *s); -int name_mangle(char *in,char *out,char name_type); -int name_len(char *s); -void create_mangled_stack(int size); -int name_extract(char *buf,int ofs,char *name); -void get_broadcast(struct in_addr *if_ipaddr, struct in_addr *if_bcast, struct in_addr *if_nmask); -BOOL allow_access(char *deny_list,char *allow_list,struct from_host *client); #ifdef __STDC__ int Debug1(char *, ...); #else int Debug1(); #endif -BOOL check_hosts_equiv(char *user); -int chain_reply(int type,char *inbuf,char *inbuf2,char *outbuf,char *outbuf2,int size,int bufsize); -void close_cnum(int cnum,int uid); -char *smb_errstr(char *inbuf); -void GetTimeOfDay(struct timeval *tval); -struct tm *LocalTime(time_t *t); -int TimeDiff(time_t t); -BOOL set_filetime(char *fname,time_t mtime); -char *dirname_dos(char *path,char *buf); -BOOL get_myname(char *myname,struct in_addr *ip); -void expand_mask(char *Mask, BOOL); -char *smb_fn_name(int cnum); -void get_machine_info(void); -int open_socket_in(int type, int port, int dlevel); -int open_socket_out(int type,struct in_addr *addr, int port ); -struct in_addr *interpret_addr2(char *str); -BOOL zero_ip(struct in_addr ip); -int read_max_udp(int fd,char *buffer,int bufsize,int maxtime); -int interpret_protocol(char *str,int def); -int interpret_security(char *str,int def); -int ChDir(char *path); -int smb_buflen(char *buf); -unsigned long interpret_addr(char *str); -void mangle_name_83(char *s); -BOOL lp_casesignames(void); -void setup_logging(char *pname,BOOL interactive); + #ifdef DFS_AUTH void dfs_unlogin(void); extern int dcelogin_atmost_once; #endif + #if AJT void ajt_panic(void); #endif + #ifdef NOSTRDUP char *strdup(char *s); #endif + #ifdef REPLACE_STRLEN int Strlen(char *); #endif + #ifdef REPLACE_STRSTR char *Strstr(char *s, char *p); #endif -- cgit From 7e3b4a1c0df1434eb3d02f93c736ce065f9898d8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 10 Jun 1996 04:38:24 +0000 Subject: got rid of a lot of redundent header files as we now globally generate prototypes automatically using "make proto". This is much less prone to error than the old method of manually adding prototypes (This used to be commit b551dc98f7cc194a5fc2e67a4ebae7fd67a01bbc) --- source3/include/smb.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 0be860d6a3..5fd2e0846b 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -234,6 +234,15 @@ typedef char fstring[128]; typedef fstring string; +struct smb_passwd { + int smb_userid; + char *smb_name; + unsigned char *smb_passwd; /* Null if no password */ + unsigned char *smb_nt_passwd; /* Null if no password */ + /* Other fields / flags may be added later */ +}; + + struct current_user { int cnum, id; int uid, gid; -- cgit From a521fe8a274c8a043cf77641dd4160fdef803533 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 10 Jun 1996 05:16:19 +0000 Subject: a cleanup of the receive_smb() usage, adding timeouts in some places also added paranoid code in the main process() loop of smbd to detect when smbd is looping uselessly. This should stop the "smbd is chewing lots of cpu" reports (This used to be commit 8e9dce34d50d673cb50531f0c4c7672ce2522cef) --- source3/include/smb.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 5fd2e0846b..b9dd13a802 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -99,6 +99,9 @@ typedef unsigned int uint32; #define DEFAULT_PIPE_TIMEOUT 10000000 /* Ten seconds */ #endif +/* how long to wait for secondary SMB packets (seconds) */ +#define SMB_SECONDARY_WAIT 30 + /* debugging code */ #ifndef SYSLOG #define DEBUG(level,body) ((DEBUGLEVEL>=(level))?(Debug1 body):0) -- cgit From ed2639ebe21dde49af816a96ec6ea1e40f76e768 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Sat, 29 Jun 1996 18:49:20 +0000 Subject: luke's first attempt at using cvs accidentally updated the Makefile updated the name database structure (again!). this time, there is one name database per local interface. there is also a pseudo-interface on ip 255.255.255.255. its purpose is to store WINS name entries. all the local interface name databases store SELF names only. the WINS name database stores non-special browser names. added wins.dat file: records WINS entries in ascii format. this is reloaded when nmbd restarts. added repeating code for response packets. timer is in seconds only at the moment. updated the response queue code to deal with samba registering with a WINS server a bit better (added more cases when a response isn't received). tidied up the response packet processing code and expire_response_queue() code. added cross references between response received and await-response expired code. added over-zealous code that checks all machines that register with samba as a WINS server (every 10 minutes i think): to see whether they are still alive or not (see rfc1001.txt) bug reported by terry@ren.pc.athabascau.ca: DNSFAILed names _stay_ as DNSFAIL, even though the machine may come back up and REGISTER. removed update_from_reg() function. it's not necessary, and it does too much. added code that announces on each local interface samba's ttl as zero and servertype as zero when nmbd is kill -TERMed first attempt at putting the first functionality of samba browsing back in (remote subnets should have samba appear in a workgroup specified through the lmhosts file) lots of other miscellaneous tidying up / chopping about. (This used to be commit 7e8c60cfe54060860e5ce20b1c3b8ec6aa5c54da) --- source3/include/smb.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index b9dd13a802..0e9c9983d2 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -381,6 +381,15 @@ struct server_info_struct }; +/* used for network interfaces */ +struct interface +{ + struct interface *next; + struct in_addr ip; + struct in_addr bcast; + struct in_addr nmask; +}; + /* this is used for smbstatus */ struct connect_record { -- cgit From b6037f01a01e040e518eca0ea75c53a475e36b0c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 18 Jul 1996 10:20:51 +0000 Subject: minor cleanups ready for another release (This used to be commit 153d324c7be345ae87f99e62123e9a7dbaf74aee) --- source3/include/smb.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 0e9c9983d2..05924de35e 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -108,10 +108,16 @@ typedef unsigned int uint32; #else EXTERN int syslog_level; -#define DEBUG(level,body) ((DEBUGLEVEL>=(level))? \ - (syslog_level = (level), Debug1 body):0) +#define DEBUG(level,body) ((DEBUGLEVEL>=(level))? (syslog_level = (level), Debug1 body):0) #endif +/* this defines the error codes that receive_smb can put in smberrcode */ +#define SMBERR_OK 0 +#define SMBERR_TIMEOUT 1 +#define SMBERR_EOF 2 +#define SMBERR_ERROR 3 + + #define DIR_STRUCT_SIZE 43 /* these define all the command types recognised by the server - there -- cgit From 2b4b7b4e1adbd2aac9aab89b28df82fc145a6d87 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 30 Jul 1996 15:47:30 +0000 Subject: fix a bug that we've had for a long time where we don't handle EOF properly from clients, and end up looping like mad. At least I _hope_ this is fixed. (This used to be commit a7c7d7afe2ef81f4a74584ce9b71e54442f7e484) --- source3/include/smb.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 05924de35e..317f31b19e 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -111,11 +111,10 @@ EXTERN int syslog_level; #define DEBUG(level,body) ((DEBUGLEVEL>=(level))? (syslog_level = (level), Debug1 body):0) #endif -/* this defines the error codes that receive_smb can put in smberrcode */ -#define SMBERR_OK 0 -#define SMBERR_TIMEOUT 1 -#define SMBERR_EOF 2 -#define SMBERR_ERROR 3 +/* this defines the error codes that receive_smb can put in smb_read_error */ +#define READ_TIMEOUT 1 +#define READ_EOF 2 +#define READ_ERROR 3 #define DIR_STRUCT_SIZE 43 -- cgit From 47673b32ed4a907b380b70d5f4f366ba8be301d2 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 15 Aug 1996 15:11:34 +0000 Subject: - added FAST_SHARE_MODES code - added some named pipe code from Jim (This used to be commit c94866e9e44ea1eb72da06bc65ef1c032ae8e0c9) --- source3/include/smb.h | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 317f31b19e..c9180dd50c 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -36,8 +36,9 @@ #define BUFFER_SIZE (0xFFFF) #define SAFETY_MARGIN 1024 -#ifndef EXTERN -# define EXTERN extern +/* size of shared memory used for share mode locking */ +#ifndef SHMEM_SIZE +#define SHMEM_SIZE 102400 #endif #define NMB_PORT 137 @@ -53,6 +54,11 @@ typedef int BOOL; +/* offset in shared memory */ +typedef int shm_offset_t; +#define NULL_OFFSET (shm_offset_t)(0) + + /* Samba needs type definitions for int16, int32, uint16 and uint32. @@ -106,7 +112,7 @@ typedef unsigned int uint32; #ifndef SYSLOG #define DEBUG(level,body) ((DEBUGLEVEL>=(level))?(Debug1 body):0) #else -EXTERN int syslog_level; +extern int syslog_level; #define DEBUG(level,body) ((DEBUGLEVEL>=(level))? (syslog_level = (level), Debug1 body):0) #endif @@ -395,6 +401,20 @@ struct interface struct in_addr nmask; }; +/* share mode record in shared memory */ +typedef struct +{ + shm_offset_t next_offset; /* offset of next record in list in shared mem */ + int locking_version; + int share_mode; + time_t time; + int pid; + dev_t st_dev; + ino_t st_ino; + char file_name[1]; /* dynamically allocated with correct size */ +} share_mode_record; + + /* this is used for smbstatus */ struct connect_record { -- cgit From 0c33046a0aa0461a5e932dd7b0b6e38ab9708867 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 19 Aug 1996 11:17:29 +0000 Subject: - added "netbios name" option in smb.conf to make controlling the name that samba uses possible - added "socket address" option to allow virtual SMB servers (on systems with IP aliasing line Linux) - disabled FAST_SHARE_MODES by default in Linux as older Linux boxes can't do shared writeable mappings. We really need autoconf ... - added new option types in loadparm so a string type can be specified ot be uppercase only, this is used for the workgroup and netbios name options - auto-create the lock directory if it doesn't exist in shared mem startup - get rid of announce_backup() - change a few comments in nmbd code - rewrote the chaining code completely. Hopefully it will handle any depth chains now. - added LPRng support (This used to be commit e9eac6cd49c352349580ddb13d720cb201aecc48) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index c9180dd50c..349d406b49 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -796,7 +796,7 @@ enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER}; /* printing types */ enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX, - PRINT_QNX,PRINT_PLP}; + PRINT_QNX,PRINT_PLP,PRINT_LPRNG}; /* case handling */ -- cgit From b5a64bb74056fad43afedcb05d29000618170ef4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 21 Aug 1996 06:09:00 +0000 Subject: - new handling of ST_TYPE bits, they are now consolidated much more in DFLT_SERVER_TYPE in nameserv.h - got rid of a lot of spurious domain controller stuff. Samba is not a domain controller yet, but it can be a domain master. We were claiming to be a domain controller in some packets which may have caused problems - don't do preferred master startups on the WINS pseudo-net - don't do election requests on the WINS pseudo-net - fix a nasty bug in become_non_master() which wiped out the bits in remove_type before using them. The result was that samba didn't like losing its master status. - changed the logic in the election packet handling to enable us to become a non-master whenever we receive a winning election frame, even if we aren't expecting it - get another packet from the socket in nmbd when we reject one of our own packets, this stops us from going into the packet reading code too often and makes nmbd much snappier - always remove a name immediately when we try to release it, don't wait for the lack of response from the network, otherwise we will end up replying to name that we don't really own. We still send the dereg packets, we just don't wait for them to time out. (This used to be commit eb84f2f342375439d94481a0ccf47c9593544e32) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 349d406b49..7e002122cc 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -785,6 +785,7 @@ char *Strstr(char *s, char *p); #define SV_TYPE_DOMAIN_ENUM 0x80000000 #define SV_TYPE_ALL 0xFFFFFFFF +/* what server type are we currently */ /* protocol types. It assumes that higher protocols include lower protocols -- cgit From 3d088fd65e3e49949dfd98b464ad6e08f6115099 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 21 Aug 1996 14:15:09 +0000 Subject: - fix a bug handling readraw packets that caused the timeout to be 30 milliseconds instead of 30 seconds as was intended. Thanks to Paul Nelson for finding this bug. (This used to be commit 78f62c83be5df6b66aa0b5e83b2d290f97ce53c2) --- source3/include/smb.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 7e002122cc..f5d35d5261 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -101,12 +101,8 @@ typedef unsigned int uint32; #define DEF_CREATE_MASK (0755) #endif -#ifndef DEFAULT_PIPE_TIMEOUT -#define DEFAULT_PIPE_TIMEOUT 10000000 /* Ten seconds */ -#endif - -/* how long to wait for secondary SMB packets (seconds) */ -#define SMB_SECONDARY_WAIT 30 +/* how long to wait for secondary SMB packets (milli-seconds) */ +#define SMB_SECONDARY_WAIT (60*1000) /* debugging code */ #ifndef SYSLOG -- cgit From 5a2f52b79e28530c454cb488a44588147640f061 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 2 Oct 1996 14:09:22 +0000 Subject: - a huge pile of changes from Luke which implement the browse.conf stuff and also fix a pile of nmbd bugs. Unfortunately I found it very hard to disentangle the new features from the bug fixes so I am putting in the new code. I hope this is the last big pile of changes to the 1.9.16 series! (This used to be commit 20b6203dac4bbb43e4e7bea0b214496d76d679d9) --- source3/include/smb.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index f5d35d5261..56ad8cbacd 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -380,10 +380,10 @@ typedef struct /* used for server information: client, nameserv and ipc */ struct server_info_struct { - fstring name; + char name[17]; uint32 type; - fstring comment; - fstring domain; /* used ONLY in ipc.c NOT namework.c */ + char comment[50]; + char domain[17]; /* used ONLY in ipc.c NOT namework.c */ BOOL server_added; /* used ONLY in ipc.c NOT namework.c */ }; -- cgit From afd08462ad5ff6b3c4bf621e39c55853a608175e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 2 Oct 1996 15:41:30 +0000 Subject: backout all the changes to nmbd. The 1.9.16 tree is now back to 1.9.16p2 as far as nmbd is concerned apart from a small change that fixes the announce type in two places. (This used to be commit 45e66a69d320024877c8b13f12b21bf895e04410) --- source3/include/smb.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 56ad8cbacd..f5d35d5261 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -380,10 +380,10 @@ typedef struct /* used for server information: client, nameserv and ipc */ struct server_info_struct { - char name[17]; + fstring name; uint32 type; - char comment[50]; - char domain[17]; /* used ONLY in ipc.c NOT namework.c */ + fstring comment; + fstring domain; /* used ONLY in ipc.c NOT namework.c */ BOOL server_added; /* used ONLY in ipc.c NOT namework.c */ }; -- cgit From e5893bdfbef0ac16772199d7ec6fac7d3e4f8431 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 5 Oct 1996 10:41:13 +0000 Subject: I have fixed quite a few important bugs in this commit. Luke, can you take special note of the bug fixes to nmbd so you can propogate them to your new code. - rewrote the code that used to use fromhost(). We now call gethostbyaddr() only if necessary and a maximum of once per connection. Calling gethostbyaddr() causes problems on some systems so avoiding it if possible is a good thing :-) - added the "fake oplocks" option. See the docs in smb.conf(5) and Speed.txt - fixed a serious bug in nmbd where it would try a DNS lookup on FIND_SELF queries. This caused a lot of unnecessary (and incorrect) DNS lookups to happen. FIND_SELF queries should only go to the internal name tables. - don't set FIND_SELF for name queries if we are a wins proxy, as we are supposed to be answering queries for other hosts. - fixed a bug in nmbd which had "if (search | FIND_LOCAL)" instead of "if (search & FIND_LOCAL)". Luke, this was in nameservreply.c - the above 3 bugs together meant that DNS queries were being cached, but the cache wasn't being used, so every query was going to DNS, no wonder nmbd has been chewing so much CPU time! Another side effect was that queries on names in lmhosts weren't being answered for bcast queries with "wins proxy" set. - ignore the maxxmit for seconday session setups (see CIFS spec) - close user opened files in a uLogoffX for user level security (see CIFS spec) - added uid into the files struct to support the above change (This used to be commit ea472b7217b7693627a13a7b1e428a0a6a3d8755) --- source3/include/smb.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index f5d35d5261..af6e24c4ab 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -293,6 +293,7 @@ typedef struct int pos; int size; int mode; + int uid; char *mmap_ptr; int mmap_size; write_bmpx_struct *wbmpx_ptr; @@ -653,13 +654,6 @@ struct connect_record #define ERRHRD 0x03 /* Error is an hardware error. */ #define ERRCMD 0xFF /* Command was not in the "SMB" format. */ -/* structure used to hold the incoming hosts info */ -struct from_host { - char *name; /* host name */ - char *addr; /* host address */ - struct sockaddr_in *sin; /* their side of the link */ -}; - #ifdef __STDC__ int Debug1(char *, ...); #else -- cgit From 134c804497c24891fd7d75c07086cab131e91af9 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Fri, 25 Oct 1996 20:48:25 +0000 Subject: Added definitions for vuid offset and invalid user smb_uid. Added vuid to connections struct. jra@cygnus.com (This used to be commit 555f6cda319559ebcb0b566f7f4042cf6a734e01) --- source3/include/smb.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index af6e24c4ab..f499459f98 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -319,8 +319,6 @@ typedef struct { int service; BOOL force_user; - int uid; /* uid of user who *opened* this connection */ - int gid; /* gid of user who *opened* this connection */ struct uid_cache uid_cache; void *dirptr; BOOL open; @@ -332,6 +330,9 @@ typedef struct char *connectpath; char *origpath; char *user; /* name of user who *opened* this connection */ + int uid; /* uid of user who *opened* this connection */ + int gid; /* gid of user who *opened* this connection */ + uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */ /* following groups stuff added by ih */ /* This groups info is valid for the user that *opened* the connection */ int ngroups; @@ -823,5 +824,13 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; #define ROUNDUP(x,g) (((x)+((g)-1))&~((g)-1)) +/* + * Global value meaing that the smb_uid field should be + * ingored (in share level security and protocol level == CORE) + */ + +#define UID_FIELD_INVALID 0 +#define VUID_OFFSET 100 /* Amount to bias returned vuid numbers */ + #endif /* _SMB_H */ -- cgit From 8bc7d6bebd4fcf8c95cb6d58da14404a5e46de91 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Thu, 9 Jan 1997 18:02:17 +0000 Subject: Makefile: Changes to split Solaris into Solaris2.3 and previous, and 2.4 and after from Paul Eggert. Makefile: Added AMIGA changes from Rask Ingemann Lambertsen . charset.c: Patch for Western European Languages from Josef Hinteregger charset.h: Patch for Western European Languages from Josef Hinteregger clitar.c: Patch to re-sync after read fail from (lost contributor name, sorry). includes.h: Patch for AMIGA from Rask Ingemann Lambertsen includes.h: Patch for SunOS atexit by Jeremy (jra@cygnus.com) interface.c: Patch for AMIGA from Rask Ingemann Lambertsen kanji.h: Patch for Western European Languages from Josef Hinteregger locking.c: Patch to fix file locking from Jeremy (jra@cygnus.com) locking.c: Patch to add granularity of lock files to usec by Jeremy (jra@cygnus.com) pipes.c: Patch to fix file locking from Jeremy (jra@cygnus.com) proto.h: Patch to fix file locking from Jeremy (jra@cygnus.com) reply.c: Patch to fix file locking from Jeremy (jra@cygnus.com) server.c: Patch to fix file locking from Jeremy (jra@cygnus.com) server.c: Patch for FAST_SHARE_MODE fix from (lost contributor name, sorry). smb.h: Patch to fix file locking from Jeremy (jra@cygnus.com) smb.h: Patch to add granularity of lock files to usec by Jeremy (jra@cygnus.com) status.c: Patch to fix file locking from Jeremy (jra@cygnus.com) statuc.c: Patch to add granularity of lock files to usec by Jeremy (jra@cygnus.com) system.c: Patch for Western European Languages from Josef Hinteregger trans2.c: Patch to fix file locking from Jeremy (jra@cygnus.com) trans2.c: Patch to fix volume name reported to Win95 from Jeremy (jra@cygnus.com) util.c: Patch for Western European Languages from Josef Hinteregger util.c: Patch to fix client_name from continuously returning UNKNOWN (from various contributors). version.h: Update to 1.9.16p10. (This used to be commit 03d28fa32eb094affa33133ebe2602fdb70f6361) --- source3/include/smb.h | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index f499459f98..bbb477f5f7 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -286,10 +286,27 @@ typedef struct BOOL wr_discard; /* discard all further data */ } write_bmpx_struct; +/* + * Structure used to indirect fd's from the files_struct. + * Needed as POSIX locking is based on file and process, not + * file descriptor and process. + */ + typedef struct { - int cnum; + uint16 ref_count; + int32 dev; + int32 inode; int fd; + int fd_readonly; + int fd_writeonly; + int real_open_flags; +} file_fd_struct; + +typedef struct +{ + int cnum; + file_fd_struct *fd_ptr; int pos; int size; int mode; @@ -297,7 +314,7 @@ typedef struct char *mmap_ptr; int mmap_size; write_bmpx_struct *wbmpx_ptr; - time_t open_time; + struct timeval open_time; BOOL open; BOOL can_lock; BOOL can_read; @@ -405,7 +422,7 @@ typedef struct shm_offset_t next_offset; /* offset of next record in list in shared mem */ int locking_version; int share_mode; - time_t time; + struct timeval time; int pid; dev_t st_dev; ino_t st_ino; @@ -428,7 +445,7 @@ struct connect_record }; -#define LOCKING_VERSION 2 +#define LOCKING_VERSION 3 /* these are useful macros for checking validity of handles */ #define VALID_FNUM(fnum) (((fnum) >= 0) && ((fnum) < MAX_OPEN_FILES)) -- cgit From 869f24e0b1915ec8d3e14f8850417474200e687e Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Wed, 15 Jan 1997 01:53:25 +0000 Subject: locking.c proto.h shmem.c smb.h status.c : Changed shm_ prefixes to smb_shm_ prefixes as shm_ is a POSIX.4 prefix. Updated fd code in FAST_SHARE_MODE code to work with new fd indirection. quotas.c: Fixed #ifdef not on position zero. Jeremy. (jra@cygnus.com). (This used to be commit c9a9d56642cc34369a42f48a28116e466240d303) --- source3/include/smb.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index bbb477f5f7..543cc73adb 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -55,8 +55,8 @@ typedef int BOOL; /* offset in shared memory */ -typedef int shm_offset_t; -#define NULL_OFFSET (shm_offset_t)(0) +typedef int smb_shm_offset_t; +#define NULL_OFFSET (smb_shm_offset_t)(0) /* @@ -419,7 +419,7 @@ struct interface /* share mode record in shared memory */ typedef struct { - shm_offset_t next_offset; /* offset of next record in list in shared mem */ + smb_shm_offset_t next_offset; /* offset of next record in list in shared mem */ int locking_version; int share_mode; struct timeval time; -- cgit From f1a494b74eab45311153d43d75829985a1ba744f Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Sat, 22 Feb 1997 15:24:31 +0000 Subject: JHT ===> Updated SV_TYPE defines in smb.h (added WIN95 entry) nameserv.h returned to original state. (This used to be commit e313de4619dcfde53db49ca4f7d6f78603504040) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 543cc73adb..eea5b5bc8c 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -788,6 +788,7 @@ char *Strstr(char *s, char *p); #define SV_TYPE_DOMAIN_MASTER 0x00080000 #define SV_TYPE_SERVER_OSF 0x00100000 #define SV_TYPE_SERVER_VMS 0x00200000 +#define SV_TYPE_WIN95_PLUS 0x00400000 #define SV_TYPE_ALTERNATE_XPORT 0x20000000 #define SV_TYPE_LOCAL_LIST_ONLY 0x40000000 #define SV_TYPE_DOMAIN_ENUM 0x80000000 -- cgit From b581d0324098f12a5bcb1941e698339a84e44a93 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Sun, 9 Mar 1997 14:58:22 +0000 Subject: 1) updated ipc.c NetUserGetInfo - load \\%L\%U instead of \\%L\HOMES because the share must be browseable by a w95 client 2) send_mailslot_reply - unique or group datagram argument added. 3) netlogon.c - rewrote response packet to do the right thing for w95. 4) server.c reply_nt1() - added OEMDomainstring to the end. 5) (deep breath) reworked the nmbd-browsing code a little bit. i discovered two months ago that becoming a primary domain controller (and domain master browser) is done independently of becoming a backup domain controller (logon server) is done independently of becoming a local master browser. therefore, three sets of state-machines (instead of just one) are in place - each of which is responsible for taking samba through the required stages to become: a logon server; a domain master browser; and a local master browser. each of these three things can occur independently on each interface, _including_ the wins pseudo-interface. the only slight caveat is that the wins pseudo-interface, by virtue of _not_ being a broadcast interface, does _not_ register as a local master browser with the wins server, as this doesn't make sense. lkcl (This used to be commit 88c6a00c3c1b430307f512986185b5ed7aea7181) --- source3/include/smb.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index eea5b5bc8c..e9d74befc2 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -797,6 +797,21 @@ char *Strstr(char *s, char *p); /* what server type are we currently */ +/* Capabilities. see ftp.microsoft.com/developr/drg/cifs/cifs/cifs4.txt */ + +#define CAP_RAW_MODE 0x0001 +#define CAP_MPX_MODE 0x0002 +#define CAP_UNICODE 0x0004 +#define CAP_LARGE_FILES 0x0008 +#define CAP_NT_SMBS 0x0010 +#define CAP_RPC_REMOTE_APIS 0x0020 +#define CAP_STATUS32 0x0040 +#define CAP_LEVEL_II_OPLOCKS 0x0080 +#define CAP_LOCK_AND_READ 0x0100 +#define CAP_NT_FIND 0x0200 +#define CAP_DFS 0x1000 +#define CAP_LARGE_READX 0x4000 + /* protocol types. It assumes that higher protocols include lower protocols as subsets */ enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANMAN1,PROTOCOL_LANMAN2,PROTOCOL_NT1}; -- cgit From aaba4712c8dbf61043d9fe6e1d6773bbd835e3b2 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Sat, 15 Mar 1997 14:47:00 +0000 Subject: JHT ===> Moved MAJOR_VERSION and MINOR_VERSION defines to smb.h Made version info consistent in ipc.c and nameannounce.c Added define for BROWSER_ELECTION_VALUE and BROWSER_CONSTANT (see do_announce_host() in nameannounce.c). Sniffing with the latest bloodhound I found that the byte range occupied by the BROWSER_ELECTION_VALUE is interpreted depending on the type of announcement being made. In a Local_Master_Announcement it is BROWSER_ELECTION_VALUE but in both Workgroup_Announcement and Host_Announcement this is seen as Comment_String_Pointer. What does this mean? We need to know? (This used to be commit 86b0018cc7e246910a9a621b2bf379f782506a08) --- source3/include/smb.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index e9d74befc2..506bbb9b16 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -794,7 +794,15 @@ char *Strstr(char *s, char *p); #define SV_TYPE_DOMAIN_ENUM 0x80000000 #define SV_TYPE_ALL 0xFFFFFFFF -/* what server type are we currently */ +/* what server type are we currently - JHT Says we ARE 4.10 */ +/* this was set by JHT in liaison with Andrew Tridgell early 1996 */ +/* setting to 4.10 at same time as announcing ourselves as NT Server */ +#define MAJOR_VERSION 0x04 +#define MINOR_VERSION 0x01 + +/* Browser Election Values */ +#define BROWSER_ELECT_VERSION 0x010f +#define BROWSER_CONSTANT 0xaa55 /* Capabilities. see ftp.microsoft.com/developr/drg/cifs/cifs/cifs4.txt */ -- cgit From 9f1d339309406a2beb8469a3190a10e4f3dbdd0d Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Sat, 15 Mar 1997 14:58:30 +0000 Subject: JHT ===> Blasted typos. BROWSER_ELECT_VERSION in smb.h should have been BROWSER_ELECTION_VERSION. (This used to be commit 377bfdecfcf618322004bfdcbdf9e520c0ebe8b5) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 506bbb9b16..50a778ad7e 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -801,7 +801,7 @@ char *Strstr(char *s, char *p); #define MINOR_VERSION 0x01 /* Browser Election Values */ -#define BROWSER_ELECT_VERSION 0x010f +#define BROWSER_ELECTION_VERSION 0x010f #define BROWSER_CONSTANT 0xaa55 -- cgit From 121c81e3d68f1748f114a2530a9eb67f7f658fda Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Wed, 7 May 1997 17:56:46 +0000 Subject: added automount home directory support. contributed by simeon@bangor.co.uk and a mini bug-fix by rob.nacarrato@sheridanc.on.ca reads in an entry from the auto.home file for the user when they log in, and mounts their home directory as the default path for the [homes] service. i might add this as to the %substitution system, so that you can specify subdirectories for the user profiles, mainly. lkcl (This used to be commit 0bb6acc358243c49e19de9d5cc95f5124ac11b7c) --- source3/include/smb.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 50a778ad7e..fc9ac2048e 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -372,6 +372,10 @@ typedef struct int user_ngroups; gid_t *user_groups; int *user_igroups; /* an integer version - some OSes are broken :-( */ +#if (defined(NETGROUP) && defined(AUTOMOUNT)) + char *home_share; /* to store NIS home of a user - simeon */ +#endif + char *real_name; /* to store real name from password file - simeon */ } user_struct; -- cgit From 0f1f0ceb9519368188f695e18e2341ccfd1b2d15 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Thu, 8 May 1997 01:14:17 +0000 Subject: 'The mother of all checkins' :-). Jeremy Allison (jallison@whistle.com) Wed May 7 1997: Update for 1.9.17alpha1 release - 'browsefix release' designed to make browsing across subnets work. byteorder.h: Updated copyright to 1997. charcnv.c: Updated copyright to 1997. charset.c Updated copyright to 1997. charset.h Updated copyright to 1997. client.c Updated copyright to 1997. clientutil.c Updated copyright to 1997. dir.c Updated copyright to 1997. fault.c Updated copyright to 1997. includes.h Updated copyright to 1997. interface.c Updated copyright to 1997. ipc.c Updated copyright to 1997. kanji.c Updated copyright to 1997. kanji.h Updated copyright to 1997. loadparm.c Updated copyright to 1997. locking.c Updated copyright to 1997. mangle.c Updated copyright to 1997. message.c Updated copyright to 1997. nameannounce.c Made use of WINS subnet explicit. Added reset_announce_timer() so announcement can be made immediately when we become a master. Expanded code to do sync with dmb. namebrowse.c Removed redundent checks for AM_MASTER in sync code. Made use of WINS subnet explicit. namedbname.c Made use of WINS subnet explicit. namedbresp.c Made use of WINS subnet explicit. namedbserver.c Made use of WINS subnet explicit. namedbsubnet.c Explicitly add workgroup to WINS subnet when we become a dmb. Made use of WINS subnet explicit. namedbwork.c Made use of WINS subnet explicit. Removed redundent check_work_servertype() function. nameelect.c Explicitly add workgroup to WINS subnet when we become a master browser. Made use of WINS subnet explicit. namelogon.c Updated copyright to 1997. namepacket.c Updated copyright to 1997. namequery.c Updated copyright to 1997. nameresp.c Made use of WINS subnet explicit. Made nmbd fail if configured as master browser and one exists already. nameserv.c Made use of WINS subnet explicit. Remove redundent logon server and domain master code. nameserv.h Add emumerate subnet macros. nameservreply.c Made use of WINS subnet explicit. nameservresp.c Updated copyright to 1997. namework.c Made use of WINS subnet explicit. Updated code to add sync browser entries to add subnet parameter. nmbd.c Added sanity check for misconfigured nmbd. nmblib.c Updated copyright to 1997. nmblookup.c Updated copyright to 1997. nmbsync.c Removed redundent AM_ANY_MASTER check. params.c Updated copyright to 1997. password.c Updated copyright to 1997. pipes.c Updated copyright to 1997. predict.c Updated copyright to 1997. printing.c Updated copyright to 1997. proto.h Changed protos for new nmbd code. quotas.c Updated copyright to 1997. replace.c Updated copyright to 1997. reply.c Updated copyright to 1997. server.c Updated copyright to 1997. shmem.c Updated copyright to 1997. smb.h Updated copyright to 1997. smbencrypt.c Updated copyright to 1997. smbpasswd.c Updated copyright to 1997. smbrun.c Updated copyright to 1997. status.c Updated copyright to 1997. system.c Updated copyright to 1997. testparm.c Updated copyright to 1997. testprns.c Updated copyright to 1997. time.c Updated copyright to 1997. trans2.c Updated copyright to 1997. trans2.h Updated copyright to 1997. uid.c Updated copyright to 1997. username.c Updated copyright to 1997. util.c Updated copyright to 1997. version.h Changed to 1.9.17alpha1. (This used to be commit cf23a155a1315f50d488794a2caf88402bf3e3e6) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index fc9ac2048e..a6be0f16d5 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -2,7 +2,7 @@ Unix SMB/Netbios implementation. Version 1.9. SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-1995 + Copyright (C) Andrew Tridgell 1992-1997 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 -- cgit From ad30487281463b3afaf7382d3290202b58bd7df4 Mon Sep 17 00:00:00 2001 From: John Terpstra Date: Sun, 11 May 1997 12:21:44 +0000 Subject: Updated Samba minor version so it announces itself as NT Server version 4.20. This indicates that the browsing code has been updated (changed). (This used to be commit 7d106024f172c8e6ffd3f355aceb0d867d74b3f8) --- source3/include/smb.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index a6be0f16d5..7cd2f5b0fe 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -798,11 +798,14 @@ char *Strstr(char *s, char *p); #define SV_TYPE_DOMAIN_ENUM 0x80000000 #define SV_TYPE_ALL 0xFFFFFFFF -/* what server type are we currently - JHT Says we ARE 4.10 */ -/* this was set by JHT in liaison with Andrew Tridgell early 1996 */ -/* setting to 4.10 at same time as announcing ourselves as NT Server */ +/* What server type are we currently - JHT Says we ARE 4.20 */ +/* History: */ +/* Version 4.0 - never made public */ +/* Version 4.10 - New to 1.9.16p2, lost in space 1.9.16p3 to 1.9.16p9 */ +/* - Reappeared in 1.9.16p11 with fixed smbd services */ +/* Version 4.20 - To indicate that nmbd and browsing now works better */ #define MAJOR_VERSION 0x04 -#define MINOR_VERSION 0x01 +#define MINOR_VERSION 0x02 /* Browser Election Values */ #define BROWSER_ELECTION_VERSION 0x010f -- cgit From aa864415c5183c948fe9ae221023d40265c38013 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Tue, 20 May 1997 00:32:51 +0000 Subject: dir.c: Fixed double slash issue. includes.h: Changed to ifdef FAST_SHARE_MODES. ipc.c: Changed lp_workgroup() to myworkgroup. loadparm.c: Added new shared mem parameters. Added Luke's fix. locking.c: Rewrite to do share modes better (both fast and slow modes). nameannounce.c: Changed lp_workgroup() to myworkgroup. Added Luke's fix. nameconf.c: Changed lp_workgroup() to myworkgroup. namedbname.c: Improved debug. namedbserver.c: Changed lp_workgroup() to myworkgroup. namedbsubnet.c: Added Luke's fix - rewritten somewhat. namedbwork.c: Changed lp_workgroup() to myworkgroup. nameelect.c: Added Luke's fix - rewritten somewhat. nameresp.c: Stoped shadowing global. nameserv.c: Added Luke's fix - Improved debug. nameservreply.c: Improved debug. namework.c: Changed lp_workgroup() to myworkgroup. nmbd.c: Added Luke's fix - Changed lp_workgroup() to myworkgroup. pipes.c: Changed lp_workgroup() to myworkgroup. proto.h: Added Luke's fix, added smb_shm_ proto's. reply.c: Changed lp_workgroup() to myworkgroup. server.c: Rewrite to do share modes better (both fast and slow modes). shmem.c: Rewrite to do share modes better (both fast and slow modes). smb.h: Rewrite to do share modes better (both fast and slow modes). status.c: Rewrite to do share modes better (both fast and slow modes). trans2.c: Fixed double slash issue. util.c: Tidied up, created myworkgroup. Jeremy Allison (jallison@whistle.com). (This used to be commit 2a1711eaaf08bb6776770cd3c96b3010f431a677) --- source3/include/smb.h | 50 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 11 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 7cd2f5b0fe..e0c08183db 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -36,11 +36,16 @@ #define BUFFER_SIZE (0xFFFF) #define SAFETY_MARGIN 1024 -/* size of shared memory used for share mode locking */ +/* Default size of shared memory used for share mode locking */ #ifndef SHMEM_SIZE #define SHMEM_SIZE 102400 #endif +/* Default number of hash buckets used in shared memory share mode */ +#ifndef SHMEM_HASH_SIZE +#define SHMEM_HASH_SIZE 113 +#endif + #define NMB_PORT 137 #define DGRAM_PORT 138 #define SMB_PORT 139 @@ -295,8 +300,8 @@ typedef struct typedef struct { uint16 ref_count; - int32 dev; - int32 inode; + uint32 dev; + uint32 inode; int fd; int fd_readonly; int fd_writeonly; @@ -320,7 +325,6 @@ typedef struct BOOL can_read; BOOL can_write; BOOL share_mode; - BOOL share_pending; BOOL print_file; BOOL modified; char *name; @@ -420,19 +424,40 @@ struct interface struct in_addr nmask; }; -/* share mode record in shared memory */ +/* share mode record pointed to in shared memory hash bucket */ typedef struct { - smb_shm_offset_t next_offset; /* offset of next record in list in shared mem */ + smb_shm_offset_t next_offset; /* offset of next record in chain from hash bucket */ int locking_version; + int32 st_dev; + int32 st_ino; + int num_share_mode_entries; + smb_shm_offset_t share_mode_entries; /* Chain of share mode entries for this file */ + char file_name[1]; +} share_mode_record; + +/* share mode entry pointed to by share_mode_record struct */ +typedef struct +{ + smb_shm_offset_t next_share_mode_entry; + int pid; int share_mode; struct timeval time; +} share_mode_entry; + +/* struct returned by get_share_modes */ +typedef struct +{ int pid; - dev_t st_dev; - ino_t st_ino; - char file_name[1]; /* dynamically allocated with correct size */ -} share_mode_record; + int share_mode; + struct timeval time; +} min_share_mode_entry; + +/* Token returned by lock_share_entry (actually ignored by FAST_SHARE_MODES code) */ +typedef int share_lock_token; +/* Conversion to hash entry index from device and inode numbers. */ +#define HASH_ENTRY(dev,ino) ((( (uint32)(dev) )* ( (uint32)(ino) )) % lp_shmem_hash_size()) /* this is used for smbstatus */ struct connect_record @@ -798,12 +823,15 @@ char *Strstr(char *s, char *p); #define SV_TYPE_DOMAIN_ENUM 0x80000000 #define SV_TYPE_ALL 0xFFFFFFFF -/* What server type are we currently - JHT Says we ARE 4.20 */ +/* what server type are we currently - JHT Says we ARE 4.20 */ +/* this was set by JHT in liaison with Jeremy Allison early 1997 */ +/* setting to 4.20 at same time as announcing ourselves as NT Server */ /* History: */ /* Version 4.0 - never made public */ /* Version 4.10 - New to 1.9.16p2, lost in space 1.9.16p3 to 1.9.16p9 */ /* - Reappeared in 1.9.16p11 with fixed smbd services */ /* Version 4.20 - To indicate that nmbd and browsing now works better */ + #define MAJOR_VERSION 0x04 #define MINOR_VERSION 0x02 -- cgit From c6e63aa896a10656f6205828e744b722fc72f8ac Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Wed, 11 Jun 1997 01:03:06 +0000 Subject: Makefile: Added quoata changes for Linux from Thorvald Natvig Makefile.RPM: Added quoata changes for Linux from Thorvald Natvig charset.c: Large changes to add multiple client code pages. charset.h: Changed charset_initialise() proto. client.c: Fixed message sending bug. Changed charset_initialise(). ipc.c: Fixed #ifdef compile problems. loadparm.c: Added "client code page" option. nmbd.c: Changed charset_initialise(). Fixed lmhosts read. nmblookup.c: Changed charset_initialise(). proto.h: Added lp_client_code_page(void). quotas.c: Added quoata changes for Linux from Thorvald Natvig reply.c: Changed debug level. Made SMBecho ignore tid. server.c: Changed charset_initialise(). smb.h: Added DEFAULT_CLIENT_CODE_PAGE as 850. smbpasswd.c: Changed charset_initialise(). status.c: Changed charset_initialise(). testparm.c: Changed charset_initialise(). testprns.c: Changed charset_initialise(). Jeremy Allison (jallison@whistle.com) (This used to be commit 957025bace1bcff34d21a6caeca498e85abccb23) --- source3/include/smb.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index e0c08183db..9af653220a 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -909,4 +909,8 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; #define VUID_OFFSET 100 /* Amount to bias returned vuid numbers */ #endif + +/* Default client code page - 850 - Western European */ +#define DEFAULT_CLIENT_CODE_PAGE 850 + /* _SMB_H */ -- cgit From 434d26acfe3bea62217b5ceaafc8b7b9cbe6e914 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Thu, 19 Jun 1997 00:18:23 +0000 Subject: loadparm.c: Added "force create mode" and "force directory mode" params. proto.h: Added lp_force_create_mode() and lp_force_dir_mode(). server.c: Fixed application of mode bits to be regular across files and directories. smb.h: Removed unused CREATE_MODE macro. Jeremy (jallison@whistle.com) (This used to be commit 2c928212500e1de27550d9fccb0939fd2e450515) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source3/include/smb.h | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 9af653220a..2dc2624566 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -511,7 +511,6 @@ struct connect_record #define MAP_HIDDEN(cnum) (OPEN_CNUM(cnum) && lp_map_hidden(SNUM(cnum))) #define MAP_SYSTEM(cnum) (OPEN_CNUM(cnum) && lp_map_system(SNUM(cnum))) #define MAP_ARCHIVE(cnum) (OPEN_CNUM(cnum) && lp_map_archive(SNUM(cnum))) -#define CREATE_MODE(cnum) (lp_create_mode(SNUM(cnum)) | 0700) #ifdef SMB_PASSWD #define SMBENCRYPT() (lp_encrypted_passwords()) #else -- cgit From fb1429c1970bc123e191f0cb7cc764faf4b86998 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Tue, 1 Jul 1997 01:19:13 +0000 Subject: client.c: New print queue query code from Jeff C. Foster " ipc.c: Added code for returning restricted lists of servers. loadparm.c: Changed default for force create mode to 000. Changed default maxmux to 50 to comply with NT. locking.c: Fixed silly crash bug with slow share mode code. nameannounce.c: Added code for returning restricted lists of servers. namedbserver.c: Added code for returning restricted lists of servers. nameelect.c: Added code for returning restricted lists of servers. namework.c: Added code for returning restricted lists of servers. nmbsync.c: Added code for returning restricted lists of servers. server.c: Added quota fix Albrecht Gebhardt smb.h: Added define for COPYBUF_SIZE. system.c: Rename across filesystems Patch from Warren Birnbaum util.c: Minor fix for warning. (This used to be commit 1c6e433caa22813a699c9766847886eb59755f8b) --- source3/include/smb.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 2dc2624566..ddbd05792d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -912,4 +912,7 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; /* Default client code page - 850 - Western European */ #define DEFAULT_CLIENT_CODE_PAGE 850 +/* Size of buffer to use when moving files across filesystems. */ +#define COPYBUF_SIZE (8*1024) + /* _SMB_H */ -- cgit From 738d29667f9cd1ce312ec011f5e37ce584d7173d Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Tue, 1 Jul 1997 19:02:43 +0000 Subject: added "hide files" option. lkcl (This used to be commit 6e594ce0e5a3af5e7311380d18ff0d19ba9698a7) --- source3/include/smb.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index ddbd05792d..b36943bfe2 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -915,4 +915,11 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; /* Size of buffer to use when moving files across filesystems. */ #define COPYBUF_SIZE (8*1024) +/* Default files that will be hidden, but accessible. intended + to replace the "hide dot files" parameter if the "hide files" + parameter moves to the service section instead of the global + section. + */ +#define DEFAULT_FILES_TO_HIDE ".*" + /* _SMB_H */ -- cgit From 1599e41ec42998fdf05a3b22c3f3a93f8b4832ed Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Tue, 1 Jul 1997 20:50:57 +0000 Subject: Rolled back Lukes changes. Not quite ready for prime time. Jeremy (jallison@whistle.com) (This used to be commit ed04ec7ab8b8e73b5442bdef03d5a3c994247b4e) --- source3/include/smb.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index b36943bfe2..ddbd05792d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -915,11 +915,4 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; /* Size of buffer to use when moving files across filesystems. */ #define COPYBUF_SIZE (8*1024) -/* Default files that will be hidden, but accessible. intended - to replace the "hide dot files" parameter if the "hide files" - parameter moves to the service section instead of the global - section. - */ -#define DEFAULT_FILES_TO_HIDE ".*" - /* _SMB_H */ -- cgit From 1fe89d0b716ccd9fca4abe4daf89df063b38f4b3 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Sun, 6 Jul 1997 13:48:10 +0000 Subject: added, tested and debugged new "hide files" option. lkcl (This used to be commit 60af320a436c3a26230fd7ac71856e67ef64e819) --- source3/include/smb.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index ddbd05792d..d4ad9105fe 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -915,4 +915,7 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; /* Size of buffer to use when moving files across filesystems. */ #define COPYBUF_SIZE (8*1024) +/* service-based parameter - files are not visible, but are accessible */ +#define DEFAULT_FILES_TO_HIDE "*/.*" + /* _SMB_H */ -- cgit From 25eae02948b40667495fbb021dd130180180a05e Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Tue, 8 Jul 1997 16:54:44 +0000 Subject: Makefile: Added AIX targets from Ole Holm Nielsen chgpasswd.c: Added Samba/GPL notice (for obvious reasons). clitar.c: Updated Copyright date to include 1997 (for obvious reasons). getsmbpass.c: Updated Copyright date to include 1997 (for obvious reasons). includes.h: Added stropts for solaris. loadparm.c: Changed comment for hide files option. nameconf.c: Updated Copyright date to include 1997 (for obvious reasons). nmbd.c: Updated Copyright date to include 1997 (for obvious reasons). pcap.c: Updated Copyright date to include 1997 (for obvious reasons). proto.h: Re-added accidentaly deleted smb_shm_ calls. quotas.c: Added AIX quota patch from Ole Holm Nielsen server.c: Optimization on calling is_hidden_path. Updated Copyrights. smb.h: Changed DEFAULT_FILES_TO_HIDE from "*/.*" to ".*". smbpass.c: Updated Copyright date to include 1997 (for obvious reasons). ufc.c: Updated Copyright date to include 1997 (for obvious reasons). util.c: Added last component code to is_in_path(). Jeremy (jallison@whistle.com) (This used to be commit 9385ae1005f13c8ed51f1319e3949b5c8571e62d) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index d4ad9105fe..463dcb1373 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -916,6 +916,6 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; #define COPYBUF_SIZE (8*1024) /* service-based parameter - files are not visible, but are accessible */ -#define DEFAULT_FILES_TO_HIDE "*/.*" +#define DEFAULT_FILES_TO_HIDE ".*" /* _SMB_H */ -- cgit From cec799512da39b880a80449952a30c255d7eb972 Mon Sep 17 00:00:00 2001 From: John Terpstra Date: Wed, 9 Jul 1997 11:04:45 +0000 Subject: JHT ==> Added copyright notations for my works. This is regretably needed! (This used to be commit c80111cdf54218f23b230dc91bd6d814e6a4afcc) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 463dcb1373..1d53942fa7 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -3,6 +3,7 @@ Version 1.9. SMB parameters and setup Copyright (C) Andrew Tridgell 1992-1997 + Copyright (C) John H Terpstra 1996-1997 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 -- cgit From 15ae50ca5203bc4c04567e400ba041a4d1757b2b Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Thu, 24 Jul 1997 17:25:11 +0000 Subject: Makefile: Added UNIXWARE 2.x with shadow passwords from fja@extratech.com client.c: Made prompt appear at debug level 0. Fixed strcasecmp redefinition. Caused client to use set_blocking rather than making fcntl calls itself. dir.c: Removed redundent snum parameters. includes.h: Added SCO fixes. loadparm.c: Made default 'files to hide' a null string. nmbd.c: Removed O_NONBLOCK from pid file open for platforms that dont have it. proto.h: Changed snum to cnum where needed. Changed is_xx_path to is_in_path (now called via MACRO). quotas.c: Swapped setuid/seteuid calls when restoring uid. reply.c: Removed redundent snum parameters. server.c: Changed snum to cnum where needed. Setup new veto_list, hide_list namelists. Added standard_sub changes from Stefaan A Eeckels and Paul Rippin shmem.c: Changed cast for sizeof to be int before negating. smb.h: Added new veto_list, hide_list entries to connections. Added IS_PRINT, IS_HIDDEN_PATH, IS_VETO_PATH macros. trans2.c: Removed redundent snum parameters. util.c: Added standard_sub_basic changes from Stefaan A Eeckels and Paul Rippin Fixed up veto/hidden path processing so the paths are pres-parsed and checked for wildcards (for speed). Jeremy (jallison@whistle.com) (This used to be commit 9afa36f7874cfd527aa6ef1e7965c1d35d46ab1f) --- source3/include/smb.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 1d53942fa7..c7ff549fe5 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -337,6 +337,12 @@ struct uid_cache { int list[UID_CACHE_SIZE]; }; +typedef struct +{ + char *name; + BOOL is_wild; +} name_compare_entry; + typedef struct { int service; @@ -363,6 +369,8 @@ typedef struct time_t lastused; BOOL used; 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). */ } connection_struct; @@ -483,6 +491,7 @@ struct connect_record #define VALID_CNUM(cnum) (((cnum) >= 0) && ((cnum) < MAX_CONNECTIONS)) #define OPEN_CNUM(cnum) (VALID_CNUM(cnum) && Connections[cnum].open) #define IS_IPC(cnum) (VALID_CNUM(cnum) && Connections[cnum].ipc) +#define IS_PRINT(cnum) (VALID_CNUM(cnum) && Connections[cnum].printer) #define FNUM_OK(fnum,c) (OPEN_FNUM(fnum) && (c)==Files[fnum].cnum) #define CHECK_FNUM(fnum,c) if (!FNUM_OK(fnum,c)) \ @@ -512,6 +521,9 @@ struct connect_record #define MAP_HIDDEN(cnum) (OPEN_CNUM(cnum) && lp_map_hidden(SNUM(cnum))) #define MAP_SYSTEM(cnum) (OPEN_CNUM(cnum) && lp_map_system(SNUM(cnum))) #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)) + #ifdef SMB_PASSWD #define SMBENCRYPT() (lp_encrypted_passwords()) #else @@ -916,7 +928,4 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; /* Size of buffer to use when moving files across filesystems. */ #define COPYBUF_SIZE (8*1024) -/* service-based parameter - files are not visible, but are accessible */ -#define DEFAULT_FILES_TO_HIDE ".*" - /* _SMB_H */ -- cgit From 75bbf35a8626ea30ac31546d0ceb9e2801ab7eae Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Wed, 30 Jul 1997 19:17:51 +0000 Subject: client.c: Minor change to cast parameters for DEC unix. clientutil.c: Minor change to cast parameters for DEC unix. ipc.c: Fixes to parameterise the stuff John wants. loadparm.c: Fixes to parameterise the stuff John wants. nameannounce.c: Fixes to parameterise the stuff John wants. namedbwork.c: Fixes to parameterise the stuff John wants. nameserv.h: Fixes to parameterise the stuff John wants. proto.h: Fixes to parameterise the stuff John wants. smb.h: Fixes to parameterise the stuff John wants. util.c: tidy. Jeremy (jallison@whistle.com) (This used to be commit 9fbca2594ba775450d5dca13cbce257b4362ca66) --- source3/include/smb.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index c7ff549fe5..2b6888b8a7 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -844,8 +844,8 @@ char *Strstr(char *s, char *p); /* - Reappeared in 1.9.16p11 with fixed smbd services */ /* Version 4.20 - To indicate that nmbd and browsing now works better */ -#define MAJOR_VERSION 0x04 -#define MINOR_VERSION 0x02 +#define DEFAULT_MAJOR_VERSION 0x04 +#define DEFAULT_MINOR_VERSION 0x02 /* Browser Election Values */ #define BROWSER_ELECTION_VERSION 0x010f -- cgit From e9269c67a59ffa741123cb2ce3ab8dfb97136dec Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Tue, 19 Aug 1997 19:22:26 +0000 Subject: Makefile: Changed for HPUX10 tidyup. includes.h: Changed for HPUX10 tidyup. ipc.c: Fixed bug where getting local server list from NT browsers would fail. nmbsync.c: Fixed bug where getting local server list from NT browsers would fail. proto.h: Changed for crash bug on SCO with USE_MMAP. quotas.c: Added OSF quotas (patch from Bret Giddings ). Rolled back solaris uid change - I think it was wrong. reply.c: Changed for crash bug on SCO with USE_MMAP. server.c: Removed Lukes changes. Changed for crash bug on SCO with USE_MMAP. smb.h: Changed for crash bug on SCO with USE_MMAP. smbpasswd.c:Fixed crash bug with Lukes changes. uid.c: Removed Lukes changes. util.c: Fixed I18N bug with extended char filenames and widelinks = no. Jeremy (jallison@whistle.com) (This used to be commit bf1c79f7fd7f9beec4f9f4e58337cadceeb1cb38) --- source3/include/smb.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 2b6888b8a7..0f2dc01865 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -314,11 +314,11 @@ typedef struct int cnum; file_fd_struct *fd_ptr; int pos; - int size; + uint32 size; int mode; int uid; char *mmap_ptr; - int mmap_size; + uint32 mmap_size; write_bmpx_struct *wbmpx_ptr; struct timeval open_time; BOOL open; -- cgit From 46dbd8c06009ad9e64251ae844fb16f2a30f5ab7 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Wed, 20 Aug 1997 20:32:23 +0000 Subject: Changes to allow Samba to return the same error code as Windows NT. Takes care of the cases where a Windows program is parsing a pathname component by component and expects 2 different errors. ERRbadpath - if a component in the path doesn't exist. ERRbaddirectory - if a component in the path exists but is not a directory. Extra error code added to smb.h to support this. Code based on suggestions from "Christian Groessler" . Jeremy (jallison@whistle.com) (This used to be commit 28b3c6db8a81b41b448a4f3cd98e9cd2c4b5fb2e) --- source3/include/smb.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 0f2dc01865..1dbe04abc8 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -175,14 +175,15 @@ implemented */ #define ERRbadshare 32 /* Share mode on file conflict with open mode */ #define ERRlock 33 /* Lock request conflicts with existing lock */ #define ERRfilexists 80 /* File in operation already exists */ +#define ERRunknownlevel 124 #define ERRbadpipe 230 /* Named pipe invalid */ #define ERRpipebusy 231 /* All instances of pipe are busy */ #define ERRpipeclosing 232 /* named pipe close in progress */ #define ERRnotconnected 233 /* No process on other end of named pipe */ #define ERRmoredata 234 /* More data to be returned */ +#define ERRbaddirectory 267 /* Invalid directory name in a path. */ #define ERROR_EAS_DIDNT_FIT 275 /* Extended attributes didn't fit */ #define ERROR_EAS_NOT_SUPPORTED 282 /* Extended attributes not suppored */ -#define ERRunknownlevel 124 #define ERRunknownipc 2142 @@ -928,4 +929,7 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; /* Size of buffer to use when moving files across filesystems. */ #define COPYBUF_SIZE (8*1024) +/* Integers used to override error codes. */ +extern int unix_ERR_class; +extern int unix_ERR_code; /* _SMB_H */ -- cgit From 4c319ad04699b236d038d141323c7586c5bf0983 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Mon, 25 Aug 1997 22:18:31 +0000 Subject: charset.c : Add mapping for code page 932 (KANJI). client.c : Fix crash bug. Add code to use BUFFER_SIZE for NetServerEnum calls. namepacket.c: Fixed cast. nmbsync.c : Add code to use BUFFER_SIZE for NetServerEnum calls. smb.h : Set default client code page to 932 for KANJI. system.c : Remove vendor specific code that crept in :-). util.c : Added #define to allow Samba to behave as Win95 when doing KANJI case insensitivity tests. Jeremy (jallison@whistle.com) (This used to be commit 7f7d2faa07b81ad435b2acc9318bc39d813020c6) --- source3/include/smb.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 1dbe04abc8..540aa0798d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -923,8 +923,13 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; #endif +#ifdef KANJI +/* Default client code page - 932 - Japanese */ +#define DEFAULT_CLIENT_CODE_PAGE 932 +#else /* KANJI */ /* Default client code page - 850 - Western European */ #define DEFAULT_CLIENT_CODE_PAGE 850 +#endif /* KANJI */ /* Size of buffer to use when moving files across filesystems. */ #define COPYBUF_SIZE (8*1024) -- cgit From 41bbc5e21fbac555b26bd751dd93d09969715199 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Tue, 26 Aug 1997 01:28:27 +0000 Subject: smb.h: Added error code used for OS2 WPS. trans2.c: Added OS2 WPS fix - but ifdefed out for now. Will turn on after 1.9.17 release. Jeremy (jallison@whistle.com) (This used to be commit 9d5d347686ca1c8a25088b882dcc5065b6d9c564) --- source3/include/smb.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 540aa0798d..f0390230e5 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -175,6 +175,7 @@ implemented */ #define ERRbadshare 32 /* Share mode on file conflict with open mode */ #define ERRlock 33 /* Lock request conflicts with existing lock */ #define ERRfilexists 80 /* File in operation already exists */ +#define ERRcannotopen 110 /* Cannot open the file specified */ #define ERRunknownlevel 124 #define ERRbadpipe 230 /* Named pipe invalid */ #define ERRpipebusy 231 /* All instances of pipe are busy */ @@ -183,7 +184,7 @@ implemented */ #define ERRmoredata 234 /* More data to be returned */ #define ERRbaddirectory 267 /* Invalid directory name in a path. */ #define ERROR_EAS_DIDNT_FIT 275 /* Extended attributes didn't fit */ -#define ERROR_EAS_NOT_SUPPORTED 282 /* Extended attributes not suppored */ +#define ERROR_EAS_NOT_SUPPORTED 282 /* Extended attributes not supported */ #define ERRunknownipc 2142 -- cgit From f5302af621d91536a72b437ae2b80f9dedb46920 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 4 Sep 1997 20:26:07 +0000 Subject: Fixed up determination of client type for PROTOCOL_NT1. Uses client capabilities bits in session_setup_and_X to decide. Made remote_arch an enum as well as a string, for easier use. Jeremy (jallison@whistle.com) (This used to be commit 99080705a2d0adcb25e1eecbe517a2fac2779baa) --- source3/include/smb.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index f0390230e5..b55c180f36 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -880,6 +880,8 @@ enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER}; enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX, PRINT_QNX,PRINT_PLP,PRINT_LPRNG}; +/* Remote architectures we know about. */ +enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_SAMBA}; /* case handling */ enum case_handling {CASE_LOWER,CASE_UPPER}; -- cgit From 30416c0b8a0f54f6cc1179c2e00860eaf5f58401 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 11 Sep 1997 20:17:32 +0000 Subject: charcnv.c client.c clitar.c kanji.c kanji.h loadparm.c mangle.c smb.h util.c: Big merge to allow KANJI support to be in the main binary without explicitly compiling with it. locking.c: Fix for smbstatus not being able to read files. namepacket.c: Removed unneccesary debug statement. trans2.c: Added Luke's proposed fix (ifdefed out until further testing). nmblookup.c: Fixed bug where query fails and status is done on bogus IP. Jeremy (jallison@whistle.com) (This used to be commit 9196255022ae8c51b527412747b324819bea2c13) --- source3/include/smb.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index b55c180f36..47fbf32f83 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -926,14 +926,16 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; #endif +/* Defines needed for multi-codepage support. */ +#define KANJI_CODEPAGE 932 + #ifdef KANJI -/* Default client code page - 932 - Japanese */ -#define DEFAULT_CLIENT_CODE_PAGE 932 +/* Default client code page - Japanese */ +#define DEFAULT_CLIENT_CODE_PAGE KANJI_CODEPAGE #else /* KANJI */ /* Default client code page - 850 - Western European */ #define DEFAULT_CLIENT_CODE_PAGE 850 #endif /* KANJI */ - /* Size of buffer to use when moving files across filesystems. */ #define COPYBUF_SIZE (8*1024) -- cgit From 33a003de4056532be0c9a199d4857b9da1b18034 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 14 Sep 1997 16:37:18 +0000 Subject: This commit does 3 main things: 1) put the encryption code in by default, with no #ifdef. It is still disabled by default so you need to add "encrypt passwords = yes" in smb.conf but at least all binaries will have it. 2) cleanup the kanji code so it compiles with no warnings 3) get rid of lots of uses of ugly non-portable C code. The main offender being things like "register" but also remove uses of the "const" keyword as there are compilers out there that don't support it and even those that do often complain about its usage. Users don't like warnings :-( There is still some work to do. We need to replace the md4 code with our own implementation. The current code (from rfc1186) is PD but is not very portable. The new RFC (rfc1320) is more portable but adds copyright restrictions. I'll do a from-scratch MD4 soon. We also need to test that what I've implemented is portable. It should be, but I'm too tired right now to test it on anything other than intel linux. (This used to be commit db917c62c14315afe6f0745a8097c1bca25cbf07) --- source3/include/smb.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 47fbf32f83..6ef0e6f9d0 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -526,11 +526,7 @@ struct connect_record #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)) -#ifdef SMB_PASSWD #define SMBENCRYPT() (lp_encrypted_passwords()) -#else -#define SMBENCRYPT() (False) -#endif /* the basic packet size, assuming no words or bytes */ #define smb_size 39 -- cgit From b3c610541b7284cbd59827b13af86a457268ae96 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 23 Sep 1997 16:09:12 +0000 Subject: added code from Philip A Prindeville which expands the interfaces option to this: "interfaces = le0 le1" or "interfaces = all". it uses SIOCGIFxxxx ioctl calls. (This used to be commit 39071415ba6f8a00e2909e443261d0059fe27e82) --- source3/include/smb.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 6ef0e6f9d0..05f73f7f45 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -433,6 +433,9 @@ struct interface struct in_addr ip; struct in_addr bcast; struct in_addr nmask; + char *name; + size_t mtu; /* may be useful in future... */ + short flags; }; /* share mode record pointed to in shared memory hash bucket */ -- cgit From 6dd6b1383c0ed10c0897dea44f247befc15b03cc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 25 Sep 1997 00:25:44 +0000 Subject: Makefile: Removed earlier errors. includes.h: Added INADDR_LOOPBACK define. locking.c: More code to support oplocks. proto.h: Updated. server.c: More code to support oplocks. Moved processing of an SMB out of process() into a separate function so it is easier to call from an oplock break. smb.h: Added oplock fields. Jeremy (jallison@whistle.com) (This used to be commit f46dbaf08eb8e06a7545d2c19dce9e2dda9dcc78) --- source3/include/smb.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 05f73f7f45..a67b3c02c9 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -433,9 +433,6 @@ struct interface struct in_addr ip; struct in_addr bcast; struct in_addr nmask; - char *name; - size_t mtu; /* may be useful in future... */ - short flags; }; /* share mode record pointed to in shared memory hash bucket */ @@ -455,6 +452,9 @@ typedef struct { smb_shm_offset_t next_share_mode_entry; int pid; +#ifdef USE_OPLOCKS + uint16 op_port; +#endif /* USE_OPLOCKS */ int share_mode; struct timeval time; } share_mode_entry; @@ -463,6 +463,9 @@ typedef struct typedef struct { int pid; +#ifdef USE_OPLOCKS + uint16 op_port; +#endif /* USE_OPLOCKS */ int share_mode; struct timeval time; } min_share_mode_entry; @@ -487,8 +490,13 @@ struct connect_record time_t start; }; - +#ifndef LOCKING_VERSION +#ifdef USE_OPLOCKS +#define LOCKING_VERSION 4 +#else /* USE_OPLOCKS */ #define LOCKING_VERSION 3 +#endif /* USE_OPLOCKS */ +#endif /* LOCKING_VERSION */ /* these are useful macros for checking validity of handles */ #define VALID_FNUM(fnum) (((fnum) >= 0) && ((fnum) < MAX_OPEN_FILES)) -- cgit From 776674812b426609958f5802c1573ba812f7426c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 25 Sep 1997 17:36:21 +0000 Subject: Added missing slow share mode offset defines. Somehow they got lost. Jeremy (jallison@whistle.com). (This used to be commit ce9cdc2f6175e4a6195f8875360cd945ae60052c) --- source3/include/smb.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index a67b3c02c9..435b71f4db 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -498,6 +498,40 @@ struct connect_record #endif /* USE_OPLOCKS */ #endif /* LOCKING_VERSION */ +#if !defined(FAST_SHARE_MODES) +/* + * Defines for slow share modes. + */ + +/* + * Locking file header lengths & offsets. + */ +#define SMF_VERSION_OFFSET 0 +#define SMF_NUM_ENTRIES_OFFSET 4 +#define SMF_FILENAME_LEN_OFFSET 8 +#define SMF_HEADER_LENGTH 10 + +#ifdef USE_OPLOCKS +#define SMF_ENTRY_LENGTH 16 +#else /* USE_OPLOCKS */ +#define SMF_ENTRY_LENGTH 18 +#endif /* USE_OPLOCKS */ + +/* + * Share mode record offsets. + */ + +#define SME_SEC_OFFSET 0 +#define SME_USEC_OFFSET 4 +#define SME_SHAREMODE_OFFSET 8 +#define SME_PID_OFFSET 12 + +#ifdef USE_OPLOCKS +#define SME_PORT_OFFSET 16 +#endif /* USE_OPLOCKS */ + +#endif /* FAST_SHARE_MODES */ + /* these are useful macros for checking validity of handles */ #define VALID_FNUM(fnum) (((fnum) >= 0) && ((fnum) < MAX_OPEN_FILES)) #define OPEN_FNUM(fnum) (VALID_FNUM(fnum) && Files[fnum].open) -- cgit From dff16872ca39c007d32d114af82d3ccd97f9d47a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 26 Sep 1997 19:26:56 +0000 Subject: Syncing up current oplock work in progress. #ifdef'ed out so should have no effect on other work. Jeremy (jallison@whistle.com) (This used to be commit 7e3d4c8b21f63a06d32605d230129e36883ad08c) --- source3/include/smb.h | 50 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 5 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 435b71f4db..07614194f7 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -330,6 +330,7 @@ typedef struct BOOL share_mode; BOOL print_file; BOOL modified; + BOOL granted_oplock; char *name; } files_struct; @@ -454,6 +455,7 @@ typedef struct int pid; #ifdef USE_OPLOCKS uint16 op_port; + uint16 op_type; #endif /* USE_OPLOCKS */ int share_mode; struct timeval time; @@ -465,6 +467,7 @@ typedef struct int pid; #ifdef USE_OPLOCKS uint16 op_port; + uint16 op_type; #endif /* USE_OPLOCKS */ int share_mode; struct timeval time; @@ -514,7 +517,7 @@ struct connect_record #ifdef USE_OPLOCKS #define SMF_ENTRY_LENGTH 16 #else /* USE_OPLOCKS */ -#define SMF_ENTRY_LENGTH 18 +#define SMF_ENTRY_LENGTH 20 #endif /* USE_OPLOCKS */ /* @@ -528,6 +531,7 @@ struct connect_record #ifdef USE_OPLOCKS #define SME_PORT_OFFSET 16 +#define SME_OPLOCK_TYPE_OFFSET 18 #endif /* USE_OPLOCKS */ #endif /* FAST_SHARE_MODES */ @@ -971,16 +975,52 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; #define KANJI_CODEPAGE 932 #ifdef KANJI -/* Default client code page - Japanese */ +/* + * Default client code page - Japanese + */ #define DEFAULT_CLIENT_CODE_PAGE KANJI_CODEPAGE #else /* KANJI */ -/* Default client code page - 850 - Western European */ +/* + * Default client code page - 850 - Western European + */ #define DEFAULT_CLIENT_CODE_PAGE 850 #endif /* KANJI */ -/* Size of buffer to use when moving files across filesystems. */ + +/* + * Size of buffer to use when moving files across filesystems. + */ #define COPYBUF_SIZE (8*1024) -/* Integers used to override error codes. */ +/* + * Integers used to override error codes. + */ extern int unix_ERR_class; extern int unix_ERR_code; + +/* + * Map the Core and Extended Oplock requesst bits down + * to common bits (EXCLUSIVE_OPLOCK & BATCH_OPLOCK). + */ + +/* + * Core protocol. + */ +#define CORE_OPLOCK_REQUEST(inbuf) (((CVAL(inbuf,smb_flg)|(1<<5))>>5) | \ + ((CVAL(inbuf,smb_flg)|(1<<6))>>5)) + +/* + * Extended protocol. + */ +#define EXTENDED_OPLOCK_REQUEST(inbuf) (((SVAL(inbuf,smb_vwv2)|(1<<1))>>1) | \ + ((SVAL(inbuf,smb_vwv2)|(1<<2))>>1)) + +/* + * Bits we test with. + */ +#define EXCLUSIVE_OPLOCK 1 +#define BATCH_OPLOCK 2 + +#define CORE_OPLOCK_GRANTED (1<<5) +#define EXTENDED_OPLOCK_GRANTED (1<<15) + /* _SMB_H */ -- cgit From a0cd12e221af54e00aa7dd971c080881da8b32ac Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 30 Sep 1997 02:38:19 +0000 Subject: dir.c: more pstrcpys. local.h: Add OPLOCK_BREAK_TIMEOUT. password.c: Fix for paranoia password server security bug. proto.h: Updated. reply.c: Oplock changes. server.c: Massive oplock changes - nearly there.... smb.h: oplock definitions. util.c: Add local message processing queues for oplocks. Jeremy (jallison@whistle.com) (This used to be commit 92f1553db2cdf6f32881eb984a87050cf3e4760b) --- source3/include/smb.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 07614194f7..c8de001fda 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1014,6 +1014,17 @@ extern int unix_ERR_code; #define EXTENDED_OPLOCK_REQUEST(inbuf) (((SVAL(inbuf,smb_vwv2)|(1<<1))>>1) | \ ((SVAL(inbuf,smb_vwv2)|(1<<2))>>1)) +/* Lock types. */ +#define LOCKING_ANDX_SHARED_LOCK 0x1 +#define LOCKING_ANDX_OPLOCK_RELEASE 0x2 +#define LOCKING_ANDX_CHANGE_LOCKTYPE 0x4 +#define LOCKING_ANDX_CANCEL_LOCK 0x8 +#define LOCKING_ANDX_LARGE_FILES 0x10 + +/* Oplock levels */ +#define OPLOCKLEVEL_NONE 0 +#define OPLOCKLEVEL_II 1 + /* * Bits we test with. */ @@ -1023,4 +1034,34 @@ extern int unix_ERR_code; #define CORE_OPLOCK_GRANTED (1<<5) #define EXTENDED_OPLOCK_GRANTED (1<<15) +/* + * Loopback command offsets. + */ + +#define UDP_CMD_LEN_OFFSET 0 +#define UDP_CMD_PORT_OFFSET 4 +#define UDP_CMD_HEADER_LEN 6 + +#define UDP_MESSAGE_CMD_OFFSET 0 + +/* + * Oplock break command code to send over the udp socket. + * + * Form of this is : + * + * 0 2 6 10 + * +----+--------+--------+--------+ + * | cmd| pid | dev | inode | + * +----+--------+--------+--------+ + */ + +#define OPLOCK_BREAK_CMD 0x1 +#define OPLOCK_BREAK_PID_OFFSET 2 +#define OPLOCK_BREAK_DEV_OFFSET 6 +#define OPLOCK_BREAK_INODE_OFFSET 10 +#define OPLOCK_BREAK_MSG_LEN 14 + + +#define CMD_REPLY 0x8000 + /* _SMB_H */ -- cgit From 5864551aef50295addd1c8aa690a52870f70626d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 1 Oct 1997 23:32:22 +0000 Subject: OPLOCK CHECK-IN - oplocks are now *OPERATIONAL* !!!! Yipeee. At least as far as I can check in a short time :-). local.h: Changed OPLOCK_BREAK_TIMEOUT to 30 seconds. locking.c: Big changes to delete oplocks on a share mode entry. proto.h: updated. reply.c: Added oplock break code in lockingX reply & readbraw reply. server.c: Add batch oplock code. Force server shutdown if client fails to respond to oplock break. smb.h: Fix silly slow share mode oplock define bug. status.c: Add oplock status info. Jeremy (jallison@whistle.com) (This used to be commit 4c83d37239f15f855fc10f01d7b4bf4217fb9eda) --- source3/include/smb.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index c8de001fda..509c1e1cf1 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -515,9 +515,9 @@ struct connect_record #define SMF_HEADER_LENGTH 10 #ifdef USE_OPLOCKS -#define SMF_ENTRY_LENGTH 16 -#else /* USE_OPLOCKS */ #define SMF_ENTRY_LENGTH 20 +#else /* USE_OPLOCKS */ +#define SMF_ENTRY_LENGTH 16 #endif /* USE_OPLOCKS */ /* -- cgit From 4438d7b57e459e091017fcbe18547a8b69be4d80 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 3 Oct 1997 03:15:24 +0000 Subject: proto.h: Updated. server.c: Updated after netbench observation. Oplocks must be broken *before* share modes are checked, not after. Netbench seems to be working now. smb.h: Added offsets for oplock break time fields. trans2.c: Upped debug messages. util.c: Upped debug messages. Jeremy (jallison@whistle.com) (This used to be commit bc4b70c566ed5fa926441fb64a0f756a6137d8d0) --- source3/include/smb.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 509c1e1cf1..66da2099c7 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1049,17 +1049,19 @@ extern int unix_ERR_code; * * Form of this is : * - * 0 2 6 10 - * +----+--------+--------+--------+ - * | cmd| pid | dev | inode | - * +----+--------+--------+--------+ + * 0 2 6 10 14 18 22 + * +----+--------+--------+--------+-------+--------+ + * | cmd| pid | dev | inode | sec | usec | + * +----+--------+--------+--------+-------+--------+ */ #define OPLOCK_BREAK_CMD 0x1 #define OPLOCK_BREAK_PID_OFFSET 2 #define OPLOCK_BREAK_DEV_OFFSET 6 #define OPLOCK_BREAK_INODE_OFFSET 10 -#define OPLOCK_BREAK_MSG_LEN 14 +#define OPLOCK_BREAK_SEC_OFFSET 14 +#define OPLOCK_BREAK_USEC_OFFSET 18 +#define OPLOCK_BREAK_MSG_LEN 22 #define CMD_REPLY 0x8000 -- cgit From 87a3971233c684081ababc826958a917b1c5c4bd Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 4 Oct 1997 16:26:02 +0000 Subject: added structures readable and writeable by smbparse.c routines into and out of SMB or Mailslot packets. (This used to be commit 4b3f9b281b3b1c1064992d19fef1d782dc6f1ff1) --- source3/include/smb.h | 182 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 66da2099c7..37474436ca 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -252,6 +252,188 @@ typedef char fstring[128]; typedef fstring string; +/* 32 bit time (sec) since 01jan1970 - cifs6.txt, section 3.5, page 30 */ +typedef uint32 UTIME; + +/* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */ +typedef struct nttime +{ + uint32 low; + uint32 high; + +} NTTIME; + + +#define MAXSUBAUTHS 10 /* max sub authorities in a SID */ + +/* DOM_SID - security id */ +typedef struct sid_info +{ + uint8 sid_no; /* SID revision number */ + uint8 num_auths; /* number of sub-authorities */ + uint8 id_auth[6]; /* Identifier Authority */ + uint16 sub_auths[MAXSUBAUTHS]; /* pointer to sub-authorities. */ + +} DOM_SID; + +/* UNIHDR - unicode string header */ +typedef struct unihdr_info +{ + uint16 uni_max_len; + uint16 uni_str_len; + uint32 undoc; /* usually has a value of 4 */ + +} UNIHDR; + +/* UNIHDR2 - unicode string header and undocumented buffer */ +typedef struct unihdr2_info +{ + UNIHDR unihdr; + uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */ + +} UNIHDR2; + +/* clueless as to what maximum length should be */ +#define MAX_UNISTRLEN 1024 + +/* UNISTR - unicode string size and buffer */ +typedef struct unistr_info +{ + uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. ***MUST*** be null-terminated */ + +} UNISTR; + +/* UNISTR2 - unicode string size and buffer */ +typedef struct unistr2_info +{ + uint32 uni_max_len; + uint32 undoc; + uint32 uni_str_len; + uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. **NOT** necessarily null-terminated */ + +} UNISTR2; + +/* DOM_SID2 - domain SID structure - SIDs stored in unicode */ +typedef struct domsid2_info +{ + uint32 type; /* value is 5 */ + uint32 undoc; /* value is 0 */ + UNIHDR2 hdr; /* XXXX conflict between hdr and str for length */ + UNISTR str; /* XXXX conflict between hdr and str for length */ + +} DOM_SID2; + +/* DOM_RID2 - domain RID structure */ +typedef struct domrid2_info +{ + uint32 type; /* value is 5 */ + uint32 undoc; /* value is 5 */ + uint32 rid; + uint32 rid_idx; /* don't know what this is */ + +} DOM_RID2; + +/* DOM_LOG_INFO - login info */ +typedef struct log_info +{ + uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */ + UNISTR2 uni_logon_srv; /* logon server name */ + UNISTR2 uni_acct_name; /* account name */ + uint16 sec_chan; /* secure channel type */ + UNISTR2 uni_comp_name; /* client machine name */ + +} DOM_LOG_INFO; + +/* DOM_CREDs - client or server credentials */ +typedef struct cred_info +{ + uint8 data[8]; /* credentials */ + UTIME timestamp; /* credential time-stamp */ + +} DOM_CRED; + +/* DOM_CLNT_INFO - client info */ +typedef struct clnt_info +{ + DOM_LOG_INFO login; + DOM_CRED cred; + +} DOM_CLNT_INFO; + +/* DOM_LOGON_ID - logon id */ +typedef struct logon_info +{ + uint32 low; + uint32 high; + +} DOM_LOGON_ID; + +/* RC4_OWF */ +typedef struct rc4_owf_info +{ + uint8 data[16]; + +} RC4_OWF; + + +/* DOM_ID_INFO_1 */ +typedef struct id_info_1 +{ + UNIHDR hdr_domain_name; /* domain name unicode header */ + uint32 param; /* param control */ + DOM_LOGON_ID logon_id; /* logon ID */ + UNIHDR hdr_user_name; /* user name unicode header */ + UNIHDR hdr_workgroup_name; /* workgroup name unicode header */ + RC4_OWF rc4_lm_owf; /* rc4 LM OWF Password */ + RC4_OWF rc4_nt_owf; /* rc4 NT OWF Password */ + UNISTR2 uni_domain_name; /* domain name unicode string */ + UNISTR2 uni_user_name; /* user name unicode string */ + UNISTR2 uni_workgroup_name; /* workgroup name unicode string */ + +} DOM_ID_INFO_1; + +/* SAM_INFO - sam logon/off id structure */ +typedef struct sam_info +{ + DOM_CLNT_INFO client; + DOM_CRED rtn_cred; /* return credentials */ + uint16 logon_level; + uint32 auth_level; /* undocumented */ + + union + { + DOM_ID_INFO_1 id1; /* auth-level 1 */ + + } auth; + +} DOM_SAM_INFO; + +/* DOM_GID - group id + user attributes */ +typedef struct gid_info +{ + uint32 gid; /* group id */ + uint32 attr; + +} DOM_GID; + +/* RPC_HEADER - ms rpc header */ +typedef struct rpc_hdr_info +{ + uint8 major; /* 5 - RPC major version */ + uint8 minor; /* 0 - RPC minor version */ + uint8 pkt_type; /* 2 - RPC response packet */ + uint8 frag; /* 3 - first frag + last frag */ + uint32 pack_type; /* 0x0000 0010 - packed data representation */ + uint16 frag_len; /* fragment length - data size (bytes) inc header and tail. */ + uint16 auth_len; /* 0 - authentication length */ + uint32 call_id; /* call identifier. matches 12th uint32 of incoming RPC data. */ + uint32 alloc_hint; /* allocation hint - data size (bytes) minus header and tail. */ + uint16 context_id; /* 0 - presentation context identifier */ + uint8 cancel_count; /* 0 - cancel count */ + uint8 reserved; /* 0 - reserved */ +} RPC_HEADER; + + struct smb_passwd { int smb_userid; char *smb_name; -- cgit From 07cc8fd8e8edd58110800f3b6b7aaec94687b579 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 4 Oct 1997 16:51:43 +0000 Subject: proto.h: - recreated, as usual. smb.h: - added RPC_HDR structure - the 18 byte MSRPC header smbparse.c: - added smb_io_rpc_hdr() function to read/write the RPC_HDR structure. util.c: - added align2, align4, align_offset functions. - added skip_unicode_string, unistrcpy, unistrncpy functions. - modified unistrcpy and unistrncpy to return the number of unicode characters returned, effectively making skip_unicode_string redundant. (This used to be commit b0ad811cda3dcffed5b24104229813cdb17b014f) --- source3/include/smb.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 37474436ca..b999c13667 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -80,6 +80,10 @@ typedef short int16; typedef int int32; #endif +#ifndef uint8 +typedef unsigned char uint8; +#endif + #ifndef uint16 typedef unsigned short uint16; #endif @@ -416,7 +420,7 @@ typedef struct gid_info } DOM_GID; -/* RPC_HEADER - ms rpc header */ +/* RPC_HDR - ms rpc header */ typedef struct rpc_hdr_info { uint8 major; /* 5 - RPC major version */ @@ -431,7 +435,7 @@ typedef struct rpc_hdr_info uint16 context_id; /* 0 - presentation context identifier */ uint8 cancel_count; /* 0 - cancel count */ uint8 reserved; /* 0 - reserved */ -} RPC_HEADER; +} RPC_HDR; struct smb_passwd { -- cgit From 29dfcb86e05144029f976ef187b875daa9811c59 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 5 Oct 1997 11:56:08 +0000 Subject: smb.h: added more structures, this time for the use in the query and response of the LSA_XXXX functions. next target: the NTLOGON mailslots (10 minutes work). smbparse.c: tidying. adding some more sub-structure functions. (This used to be commit 095edfca783a6f99eb7897d4c925ce8bc1ea0a3e) --- source3/include/smb.h | 377 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 373 insertions(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index b999c13667..eb20a16cd3 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -257,10 +257,14 @@ typedef fstring string; /* 32 bit time (sec) since 01jan1970 - cifs6.txt, section 3.5, page 30 */ -typedef uint32 UTIME; +typedef struct time_info +{ + uint32 time; + +} UTIME; /* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */ -typedef struct nttime +typedef struct nttime_info { uint32 low; uint32 high; @@ -348,10 +352,17 @@ typedef struct log_info } DOM_LOG_INFO; -/* DOM_CREDs - client or server credentials */ -typedef struct cred_info +/* DOM_CHAL - challenge info */ +typedef struct chal_info { uint8 data[8]; /* credentials */ + +} DOM_CHAL; + +/* DOM_CREDs - timestamped client or server credentials */ +typedef struct cred_info +{ + DOM_CHAL challenge; /* credentials */ UTIME timestamp; /* credential time-stamp */ } DOM_CRED; @@ -437,6 +448,364 @@ typedef struct rpc_hdr_info uint8 reserved; /* 0 - reserved */ } RPC_HDR; +/* DOM_QUERY_5 - info class 5 LSA Query response */ +typedef struct dom_query_5_info +{ + uint16 uni_dom_max_len; /* domain name string length * 2 */ + uint16 uni_dom_str_len; /* domain name string length * 2 */ + uint32 buffer_dom_name; /* undocumented domain name string buffer pointer */ + uint32 buffer_dom_sid; /* undocumented domain SID string buffer pointer */ + UNISTR uni_domain_name; /* domain name (unicode string) */ + DOM_SID dom_sid; /* domain SID */ + +} DOM_QUERY_5; + +/* level 5 is same as level 3. we hope. */ +typedef DOM_QUERY_5 DOM_QUERY_3; + +/* LSA_POL_HND */ +typedef struct lsa_policy_info +{ + uint8 data[20]; /* policy handle */ + +} LSA_POL_HND; + + +/* LSA_Q_QUERY_INFO - LSA query info policy */ +typedef struct lsa_query_info +{ + uint16 info_class; /* info class (also a policy handle?) */ + +} LSA_Q_QUERY_INFO; + +/* LSA_R_QUERY_INFO - response to LSA query info policy */ +typedef struct lsa_r_query_info +{ + uint32 undoc_buffer; /* undocumented buffer pointer */ + uint16 info_class; /* info class (same as info class in request) */ + + union + { + DOM_QUERY_3 id3; + DOM_QUERY_5 id5; + } dom; + +} LSA_R_QUERY_INFO; + +#define MAX_REF_DOMAINS 10 + +/* DOM_R_REF */ +typedef struct dom_ref_info +{ + uint32 undoc_buffer; /* undocumented buffer pointer. */ + uint32 num_ref_doms_1; /* num referenced domains? */ + uint32 buffer_dom_name; /* undocumented domain name buffer pointer. */ + uint32 max_entries; /* 32 - max number of entries */ + uint32 num_ref_doms_2; /* 4 - num referenced domains? */ + + UNIHDR2 hdr_dom_name; /* domain name unicode string header */ + UNIHDR2 hdr_ref_dom[MAX_REF_DOMAINS]; /* referenced domain unicode string headers */ + + UNISTR uni_dom_name; /* domain name unicode string */ + DOM_SID uni_dom_sid; /* domain SID */ + DOM_SID uni_ref_dom[MAX_REF_DOMAINS]; /* referenced domain SIDs */ + +} DOM_R_REF; + +#define MAX_LOOKUP_SIDS 10 + +/* LSA_Q_LOOKUP_SIDS - LSA Lookup SIDs */ +typedef struct lsa_q_lookup_sids +{ + + LSA_POL_HND pol_hnd; /* policy handle */ + uint32 num_entries; + uint32 buffer_dom_sid; /* undocumented domain SID buffer pointer */ + uint32 buffer_dom_name; /* undocumented domain name buffer pointer */ + uint32 buffer_lookup_sids[MAX_LOOKUP_SIDS]; /* undocumented domain SID pointers to be looked up. */ + DOM_SID dom_sids[MAX_LOOKUP_SIDS]; /* domain SIDs to be looked up. */ + uint8 undoc[16]; /* completely undocumented 16 bytes */ + +} LSA_Q_LOOKUP_SIDS; + +/* LSA_R_LOOKUP_SIDS - response to LSA Lookup SIDs */ +typedef struct lsa_r_lookup_sids +{ + DOM_R_REF dom_ref; /* domain reference info */ + + uint32 num_entries; + uint32 undoc_buffer2; /* undocumented buffer pointer */ + uint32 num_entries2; + + DOM_SID2 dom_sid[MAX_LOOKUP_SIDS]; /* domain SIDs being looked up */ + + uint32 num_entries3; + +} LSA_R_LOOKUP_SIDS; + +/* DOM_NAME - XXXX not sure about this structure */ +typedef struct dom_name_info +{ + uint32 uni_str_len; + uint16 buffer[MAX_UNISTRLEN]; + +} DOM_NAME; + + +#define UNKNOWN_LEN 1 + +/* LSA_Q_LOOKUP_RIDS - LSA Lookup RIDs */ +typedef struct lsa_q_lookup_rids +{ + + LSA_POL_HND pol_hnd; /* policy handle */ + uint32 num_entries; + uint32 num_entries2; + uint32 buffer_dom_sid; /* undocumented domain SID buffer pointer */ + uint32 buffer_dom_name; /* undocumented domain name buffer pointer */ + DOM_NAME lookup_name[MAX_LOOKUP_SIDS]; /* names to be looked up */ + uint8 undoc[UNKNOWN_LEN]; /* completely undocumented bytes of unknown length */ + +} LSA_Q_LOOKUP_RIDS; + +/* LSA_R_LOOKUP_RIDS - response to LSA Lookup Names */ +typedef struct lsa_r_lookup_rids +{ + + uint32 num_entries; + uint32 undoc_buffer2; /* undocumented buffer pointer */ + + uint32 num_entries2; + DOM_RID2 dom_rid[MAX_LOOKUP_SIDS]; /* domain RIDs being looked up */ + + uint32 num_entries3; + +} LSA_R_LOOKUP_RIDS; + + + +/* NEG_FLAGS */ +typedef struct lsa_neg_flags_info +{ + uint32 neg_flags; /* negotiated flags */ + +} NEG_FLAGS; + + +/* LSA_Q_REQ_CHAL */ +typedef struct lsa_q_req_chal_info +{ + uint32 undoc_buffer; /* undocumented buffer pointer */ + UNISTR2 uni_logon_srv; /* logon server unicode string */ + UNISTR2 uni_logon_clnt; /* logon client unicode string */ + DOM_CHAL clnt_chal; /* client challenge */ + +} LSA_Q_REQ_CHAL; + + +/* LSA_R_REQ_CHAL */ +typedef struct lsa_r_req_chal_info +{ + DOM_CHAL srv_chal; /* server challenge */ + +} LSA_R_REQ_CHAL; + + + +/* LSA_Q_AUTH_2 */ +typedef struct lsa_q_auth2_info +{ + DOM_LOG_INFO clnt_id; /* client identification info */ + DOM_CHAL clnt_chal; /* client-calculated credentials */ + + NEG_FLAGS clnt_flgs; /* usually 0x0000 01ff */ + +} LSA_Q_AUTH_2; + + +/* LSA_R_AUTH_2 */ +typedef struct lsa_r_auth2_info +{ + DOM_CHAL srv_chal; /* server-calculated credentials */ + NEG_FLAGS srv_flgs; /* usually 0x0000 01ff */ + +} LSA_R_AUTH_2; + + +/* LSA_Q_SRV_PWSET */ +typedef struct lsa_q_srv_pwset_info +{ + DOM_CLNT_INFO clnt_id; /* client identification/authentication info */ + char pwd[16]; /* new password - undocumented. */ + +} LSA_Q_SRV_PWSET; + +/* LSA_R_SRV_PWSET */ +typedef struct lsa_r_srv_pwset_info +{ + DOM_CHAL srv_chal; /* server-calculated credentials */ + +} LSA_R_SRV_PWSET; + +#define LSA_MAX_GROUPS 32 + +/* LSA_USER_INFO */ +typedef struct lsa_q_user_info +{ + uint32 undoc_buffer; + + NTTIME logon_time; /* logon time */ + NTTIME logoff_time; /* logoff time */ + NTTIME kickoff_time; /* kickoff time */ + NTTIME pass_last_set_time; /* password last set time */ + NTTIME pass_can_change_time; /* password can change time */ + NTTIME pass_must_change_time; /* password must change time */ + + UNIHDR hdr_user_name; /* username unicode string header */ + UNIHDR hdr_full_name; /* user's full name unicode string header */ + UNIHDR hdr_logon_script; /* logon script unicode string header */ + UNIHDR hdr_profile_path; /* profile path unicode string header */ + UNIHDR hdr_home_dir; /* home directory unicode string header */ + UNIHDR hdr_dir_drive; /* home directory drive unicode string header */ + + uint16 logon_count; /* logon count */ + uint16 bad_pw_count; /* bad password count */ + + uint32 user_id; /* User ID */ + uint32 group_id; /* Group ID */ + uint32 num_groups; /* num groups */ + uint32 buffer_groups; /* undocumented buffer pointer to groups. */ + uint32 user_flgs; /* user flags */ + + char sess_key[16]; /* unused user session key */ + + UNIHDR hdr_logon_srv; /* logon server unicode string header */ + UNIHDR hdr_logon_dom; /* logon domain unicode string header */ + + uint32 buffer_dom_id; /* undocumented logon domain id pointer */ + char padding[40]; /* unused padding bytes? */ + + uint32 num_sids; /* 0 - num_sids */ + uint32 buffer_sids; /* NULL - undocumented pointer to SIDs. */ + + UNISTR2 uni_user_name; /* username unicode string */ + UNISTR2 uni_full_name; /* user's full name unicode string */ + UNISTR2 uni_logon_script; /* logon script unicode string */ + UNISTR2 uni_profile_path; /* profile path unicode string */ + UNISTR2 uni_home_dir; /* home directory unicode string */ + UNISTR2 uni_dir_drive; /* home directory drive unicode string */ + + uint32 num_groups2; /* num groups */ + DOM_GID gids[LSA_MAX_GROUPS]; /* group info */ + + UNISTR2 uni_logon_srv; /* logon server unicode string */ + UNISTR2 uni_logon_dom; /* logon domain unicode string */ + + DOM_SID undoc_dom_sids[2]; /* undocumented - domain SIDs */ + DOM_SID dom_sid; /* domain SID */ + +} LSA_USER_INFO; + + +/* LSA_Q_SAM_LOGON */ +typedef struct lsa_q_sam_logon_info +{ + DOM_SAM_INFO sam_id; + +} LSA_Q_SAM_LOGON; + +/* LSA_R_SAM_LOGON */ +typedef struct lsa_r_sam_logon_info +{ + uint32 buffer_creds; /* undocumented buffer pointer */ + DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */ + + uint32 buffer_user; + LSA_USER_INFO user; + + uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */ + +} LSA_R_SAM_LOGON; + + +/* LSA_Q_SAM_LOGOFF */ +typedef struct lsa_q_sam_logoff_info +{ + DOM_SAM_INFO sam_id; + +} LSA_Q_SAM_LOGOFF; + +/* LSA_R_SAM_LOGOFF */ +typedef struct lsa_r_sam_logoff_info +{ + uint32 buffer_creds; /* undocumented buffer pointer */ + DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */ + +} LSA_R_SAM_LOGOFF; + +/* + +Yet to be turned into structures: + +6) \\MAILSLOT\NET\NTLOGON +------------------------- + +6.1) Query for PDC +------------------ + +Request: + + uint16 0x0007 - Query for PDC + STR machine name + STR response mailslot + uint8[] padding to 2-byte align with start of mailslot. + UNISTR machine name + uint32 NTversion + uint16 LMNTtoken + uint16 LM20token + +Response: + + uint16 0x000A - Respose to Query for PDC + STR machine name (in uppercase) + uint8[] padding to 2-byte align with start of mailslot. + UNISTR machine name + UNISTR domain name + uint32 NTversion (same as received in request) + uint16 LMNTtoken (same as received in request) + uint16 LM20token (same as received in request) + + +6.2) SAM Logon +-------------- + +Request: + + uint16 0x0012 - SAM Logon + uint16 request count + UNISTR machine name + UNISTR user name + STR response mailslot + uint32 alloweable account + uint32 domain SID size + char[sid_size] domain SID, of sid_size bytes. + uint8[] ???? padding to 4? 2? -byte align with start of mailslot. + uint32 NTversion + uint16 LMNTtoken + uint16 LM20token + +Response: + + uint16 0x0013 - Response to SAM Logon + UNISTR machine name + UNISTR user name - workstation trust account + UNISTR domain name + uint32 NTversion + uint16 LMNTtoken + uint16 LM20token + +*/ + struct smb_passwd { int smb_userid; -- cgit From 84e362dd132e250ddb5ca0223e2b27dc484b3ff7 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 5 Oct 1997 14:17:53 +0000 Subject: updating lsa and smb parsing routines and structures. (This used to be commit 2f722fe289051558dbe77aeb0a830bb3ded10a83) --- source3/include/smb.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index eb20a16cd3..a3a6d326e0 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -331,6 +331,16 @@ typedef struct domsid2_info } DOM_SID2; +/* DOM_SID3 - domain SID structure - SIDs stored in unicode */ +typedef struct domsid3_info +{ + UNISTR str; /* domain SID unicode string */ + uint32 undoc; /* value is 0 */ + uint32 type1; /* value is 1 */ + uint32 type2; /* value is 5 or 3 */ + +} DOM_SID3; + /* DOM_RID2 - domain RID structure */ typedef struct domrid2_info { @@ -446,10 +456,11 @@ typedef struct rpc_hdr_info uint16 context_id; /* 0 - presentation context identifier */ uint8 cancel_count; /* 0 - cancel count */ uint8 reserved; /* 0 - reserved */ + } RPC_HDR; -/* DOM_QUERY_5 - info class 5 LSA Query response */ -typedef struct dom_query_5_info +/* DOM_QUERY - info class 3 and 5 LSA Query response */ +typedef struct dom_query_info { uint16 uni_dom_max_len; /* domain name string length * 2 */ uint16 uni_dom_str_len; /* domain name string length * 2 */ @@ -458,10 +469,11 @@ typedef struct dom_query_5_info UNISTR uni_domain_name; /* domain name (unicode string) */ DOM_SID dom_sid; /* domain SID */ -} DOM_QUERY_5; +} DOM_QUERY; /* level 5 is same as level 3. we hope. */ -typedef DOM_QUERY_5 DOM_QUERY_3; +typedef DOM_QUERY DOM_QUERY_3; +typedef DOM_QUERY DOM_QUERY_5; /* LSA_POL_HND */ typedef struct lsa_policy_info @@ -507,8 +519,7 @@ typedef struct dom_ref_info UNIHDR2 hdr_ref_dom[MAX_REF_DOMAINS]; /* referenced domain unicode string headers */ UNISTR uni_dom_name; /* domain name unicode string */ - DOM_SID uni_dom_sid; /* domain SID */ - DOM_SID uni_ref_dom[MAX_REF_DOMAINS]; /* referenced domain SIDs */ + DOM_SID ref_dom[MAX_REF_DOMAINS]; /* referenced domain SIDs */ } DOM_R_REF; -- cgit From 0e151792c3289ce2253d1940d07f6caa12774118 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 6 Oct 1997 13:30:54 +0000 Subject: Makefile: added lsaparse.c and smbparse.c lsaparse.c, smbparse.c, smb.h: more functions / structures. proto.h: the usual. (This used to be commit a1c718728c46ebf8916af8985b4dae4d099f4ec2) --- source3/include/smb.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index a3a6d326e0..280147b41f 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -545,7 +545,7 @@ typedef struct lsa_r_lookup_sids DOM_R_REF dom_ref; /* domain reference info */ uint32 num_entries; - uint32 undoc_buffer2; /* undocumented buffer pointer */ + uint32 undoc_buffer; /* undocumented buffer pointer */ uint32 num_entries2; DOM_SID2 dom_sid[MAX_LOOKUP_SIDS]; /* domain SIDs being looked up */ @@ -558,7 +558,11 @@ typedef struct lsa_r_lookup_sids typedef struct dom_name_info { uint32 uni_str_len; +#if 1 /* don't know if buffer is null-terminated */ + UNISTR buffer; +#else /* or length indicated by uni_str_len member */ uint16 buffer[MAX_UNISTRLEN]; +#endif } DOM_NAME; @@ -582,9 +586,10 @@ typedef struct lsa_q_lookup_rids /* LSA_R_LOOKUP_RIDS - response to LSA Lookup Names */ typedef struct lsa_r_lookup_rids { + DOM_R_REF dom_ref; /* domain reference info */ uint32 num_entries; - uint32 undoc_buffer2; /* undocumented buffer pointer */ + uint32 undoc_buffer; /* undocumented buffer pointer */ uint32 num_entries2; DOM_RID2 dom_rid[MAX_LOOKUP_SIDS]; /* domain RIDs being looked up */ -- cgit From 8429cec72ff15efdd5ab742ba71ede36db43ef14 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 6 Oct 1997 14:52:26 +0000 Subject: lsaparse.c smb.h: added 32 bit "return status" to the response structures. (This used to be commit 5bc75c6c626251dc8ba04ff4a83e81b92d93d2d6) --- source3/include/smb.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 280147b41f..1b8f04f02e 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -502,6 +502,8 @@ typedef struct lsa_r_query_info DOM_QUERY_5 id5; } dom; + uint32 status; /* return code */ + } LSA_R_QUERY_INFO; #define MAX_REF_DOMAINS 10 @@ -552,6 +554,8 @@ typedef struct lsa_r_lookup_sids uint32 num_entries3; + uint32 status; /* return code */ + } LSA_R_LOOKUP_SIDS; /* DOM_NAME - XXXX not sure about this structure */ @@ -596,6 +600,8 @@ typedef struct lsa_r_lookup_rids uint32 num_entries3; + uint32 status; /* return code */ + } LSA_R_LOOKUP_RIDS; @@ -624,6 +630,8 @@ typedef struct lsa_r_req_chal_info { DOM_CHAL srv_chal; /* server challenge */ + uint32 status; /* return code */ + } LSA_R_REQ_CHAL; @@ -645,6 +653,8 @@ typedef struct lsa_r_auth2_info DOM_CHAL srv_chal; /* server-calculated credentials */ NEG_FLAGS srv_flgs; /* usually 0x0000 01ff */ + uint32 status; /* return code */ + } LSA_R_AUTH_2; @@ -661,6 +671,8 @@ typedef struct lsa_r_srv_pwset_info { DOM_CHAL srv_chal; /* server-calculated credentials */ + uint32 status; /* return code */ + } LSA_R_SRV_PWSET; #define LSA_MAX_GROUPS 32 @@ -741,6 +753,8 @@ typedef struct lsa_r_sam_logon_info uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */ + uint32 status; /* return code */ + } LSA_R_SAM_LOGON; @@ -757,6 +771,8 @@ typedef struct lsa_r_sam_logoff_info uint32 buffer_creds; /* undocumented buffer pointer */ DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */ + uint32 status; /* return code */ + } LSA_R_SAM_LOGOFF; /* -- cgit From 2e92be3aaf01c574d32d1a10e1359888638b68bc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 6 Oct 1997 17:52:25 +0000 Subject: client.c: Changed shadowed variable. locking.c: Removed USE_OPLOCKS - now the default. params.c: Removed unused variable. proto.h: Updated. reply.c: Removed USE_OPLOCKS - now the default. server.c: Removed USE_OPLOCKS - now the default. smb.h: Removed USE_OPLOCKS - now the default. smbparse.c: Changed shadowed variable. status.c: Removed USE_OPLOCKS - now the default. util.c: Removed USE_OPLOCKS - now the default. Jeremy (jallison@whistle.com) (This used to be commit b93509846d6291771787af457500eec8984ee6bd) --- source3/include/smb.h | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 1b8f04f02e..43e402359f 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -393,12 +393,12 @@ typedef struct logon_info } DOM_LOGON_ID; -/* RC4_OWF */ -typedef struct rc4_owf_info +/* ARC4_OWF */ +typedef struct arc4_owf_info { uint8 data[16]; -} RC4_OWF; +} ARC4_OWF; /* DOM_ID_INFO_1 */ @@ -409,8 +409,8 @@ typedef struct id_info_1 DOM_LOGON_ID logon_id; /* logon ID */ UNIHDR hdr_user_name; /* user name unicode header */ UNIHDR hdr_workgroup_name; /* workgroup name unicode header */ - RC4_OWF rc4_lm_owf; /* rc4 LM OWF Password */ - RC4_OWF rc4_nt_owf; /* rc4 NT OWF Password */ + ARC4_OWF arc4_lm_owf; /* arc4 LM OWF Password */ + ARC4_OWF arc4_nt_owf; /* arc4 NT OWF Password */ UNISTR2 uni_domain_name; /* domain name unicode string */ UNISTR2 uni_user_name; /* user name unicode string */ UNISTR2 uni_workgroup_name; /* workgroup name unicode string */ @@ -1040,10 +1040,8 @@ typedef struct { smb_shm_offset_t next_share_mode_entry; int pid; -#ifdef USE_OPLOCKS uint16 op_port; uint16 op_type; -#endif /* USE_OPLOCKS */ int share_mode; struct timeval time; } share_mode_entry; @@ -1052,10 +1050,8 @@ typedef struct typedef struct { int pid; -#ifdef USE_OPLOCKS uint16 op_port; uint16 op_type; -#endif /* USE_OPLOCKS */ int share_mode; struct timeval time; } min_share_mode_entry; @@ -1081,11 +1077,7 @@ struct connect_record }; #ifndef LOCKING_VERSION -#ifdef USE_OPLOCKS #define LOCKING_VERSION 4 -#else /* USE_OPLOCKS */ -#define LOCKING_VERSION 3 -#endif /* USE_OPLOCKS */ #endif /* LOCKING_VERSION */ #if !defined(FAST_SHARE_MODES) @@ -1101,11 +1093,7 @@ struct connect_record #define SMF_FILENAME_LEN_OFFSET 8 #define SMF_HEADER_LENGTH 10 -#ifdef USE_OPLOCKS #define SMF_ENTRY_LENGTH 20 -#else /* USE_OPLOCKS */ -#define SMF_ENTRY_LENGTH 16 -#endif /* USE_OPLOCKS */ /* * Share mode record offsets. @@ -1116,10 +1104,8 @@ struct connect_record #define SME_SHAREMODE_OFFSET 8 #define SME_PID_OFFSET 12 -#ifdef USE_OPLOCKS #define SME_PORT_OFFSET 16 #define SME_OPLOCK_TYPE_OFFSET 18 -#endif /* USE_OPLOCKS */ #endif /* FAST_SHARE_MODES */ -- cgit From a3b7bdd7b997fd6d41b8b96676eb58471112d931 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 7 Oct 1997 14:58:07 +0000 Subject: pipes.c: some routines to create LSA RPC packets. none of them are used. lsaparse.c: smbparse.c: smb.h: more tidy-up. (This used to be commit b37e21273e81b875876e8e8ddf6804714044ffd8) --- source3/include/smb.h | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 43e402359f..4850b33e49 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -331,16 +331,6 @@ typedef struct domsid2_info } DOM_SID2; -/* DOM_SID3 - domain SID structure - SIDs stored in unicode */ -typedef struct domsid3_info -{ - UNISTR str; /* domain SID unicode string */ - uint32 undoc; /* value is 0 */ - uint32 type1; /* value is 1 */ - uint32 type2; /* value is 5 or 3 */ - -} DOM_SID3; - /* DOM_RID2 - domain RID structure */ typedef struct domrid2_info { @@ -409,8 +399,8 @@ typedef struct id_info_1 DOM_LOGON_ID logon_id; /* logon ID */ UNIHDR hdr_user_name; /* user name unicode header */ UNIHDR hdr_workgroup_name; /* workgroup name unicode header */ - ARC4_OWF arc4_lm_owf; /* arc4 LM OWF Password */ - ARC4_OWF arc4_nt_owf; /* arc4 NT OWF Password */ + ARC4_OWF arc4_lm_owf; /* rc4 LM OWF Password */ + ARC4_OWF arc4_nt_owf; /* rc4 NT OWF Password */ UNISTR2 uni_domain_name; /* domain name unicode string */ UNISTR2 uni_user_name; /* user name unicode string */ UNISTR2 uni_workgroup_name; /* workgroup name unicode string */ @@ -463,10 +453,11 @@ typedef struct rpc_hdr_info typedef struct dom_query_info { uint16 uni_dom_max_len; /* domain name string length * 2 */ + uint16 padding; /* 2 padding bytes? */ uint16 uni_dom_str_len; /* domain name string length * 2 */ uint32 buffer_dom_name; /* undocumented domain name string buffer pointer */ uint32 buffer_dom_sid; /* undocumented domain SID string buffer pointer */ - UNISTR uni_domain_name; /* domain name (unicode string) */ + UNISTR2 uni_domain_name; /* domain name (unicode string) */ DOM_SID dom_sid; /* domain SID */ } DOM_QUERY; @@ -475,14 +466,25 @@ typedef struct dom_query_info typedef DOM_QUERY DOM_QUERY_3; typedef DOM_QUERY DOM_QUERY_5; +#define POL_HND_SIZE 20 + /* LSA_POL_HND */ typedef struct lsa_policy_info { - uint8 data[20]; /* policy handle */ + uint8 data[POL_HND_SIZE]; /* policy handle */ } LSA_POL_HND; +/* LSA_R_OPEN_POL - response to LSA Open Policy */ +typedef struct lsa_r_open_pol_info +{ + LSA_POL_HND pol; /* policy handle */ + + uint32 status; /* return code */ + +} LSA_R_OPEN_POL; + /* LSA_Q_QUERY_INFO - LSA query info policy */ typedef struct lsa_query_info { @@ -530,7 +532,6 @@ typedef struct dom_ref_info /* LSA_Q_LOOKUP_SIDS - LSA Lookup SIDs */ typedef struct lsa_q_lookup_sids { - LSA_POL_HND pol_hnd; /* policy handle */ uint32 num_entries; uint32 buffer_dom_sid; /* undocumented domain SID buffer pointer */ @@ -669,7 +670,7 @@ typedef struct lsa_q_srv_pwset_info /* LSA_R_SRV_PWSET */ typedef struct lsa_r_srv_pwset_info { - DOM_CHAL srv_chal; /* server-calculated credentials */ + DOM_CRED srv_cred; /* server-calculated credentials */ uint32 status; /* return code */ @@ -1040,8 +1041,10 @@ typedef struct { smb_shm_offset_t next_share_mode_entry; int pid; +#ifdef USE_OPLOCKS uint16 op_port; uint16 op_type; +#endif /* USE_OPLOCKS */ int share_mode; struct timeval time; } share_mode_entry; @@ -1050,8 +1053,10 @@ typedef struct typedef struct { int pid; +#ifdef USE_OPLOCKS uint16 op_port; uint16 op_type; +#endif /* USE_OPLOCKS */ int share_mode; struct timeval time; } min_share_mode_entry; @@ -1077,7 +1082,11 @@ struct connect_record }; #ifndef LOCKING_VERSION +#ifdef USE_OPLOCKS #define LOCKING_VERSION 4 +#else /* USE_OPLOCKS */ +#define LOCKING_VERSION 3 +#endif /* USE_OPLOCKS */ #endif /* LOCKING_VERSION */ #if !defined(FAST_SHARE_MODES) @@ -1093,7 +1102,11 @@ struct connect_record #define SMF_FILENAME_LEN_OFFSET 8 #define SMF_HEADER_LENGTH 10 +#ifdef USE_OPLOCKS #define SMF_ENTRY_LENGTH 20 +#else /* USE_OPLOCKS */ +#define SMF_ENTRY_LENGTH 16 +#endif /* USE_OPLOCKS */ /* * Share mode record offsets. @@ -1104,8 +1117,10 @@ struct connect_record #define SME_SHAREMODE_OFFSET 8 #define SME_PID_OFFSET 12 +#ifdef USE_OPLOCKS #define SME_PORT_OFFSET 16 #define SME_OPLOCK_TYPE_OFFSET 18 +#endif /* USE_OPLOCKS */ #endif /* FAST_SHARE_MODES */ -- cgit From 577ae65ca562ec05849a2e9e79689d00e0a0bcf2 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 7 Oct 1997 18:18:10 +0000 Subject: pipes.c: more static unused functions in pipes.c for the LSA RPC stream. smb.h: corrections and altercations over the documentation lsaparse.c: reflecting alterations in LSA structures... (This used to be commit bef12478d212a950578843d6d4dece1f153bfd25) --- source3/include/smb.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 4850b33e49..3adb3e5a4c 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -677,6 +677,7 @@ typedef struct lsa_r_srv_pwset_info } LSA_R_SRV_PWSET; #define LSA_MAX_GROUPS 32 +#define LSA_MAX_SIDS 32 /* LSA_USER_INFO */ typedef struct lsa_q_user_info @@ -714,8 +715,8 @@ typedef struct lsa_q_user_info uint32 buffer_dom_id; /* undocumented logon domain id pointer */ char padding[40]; /* unused padding bytes? */ - uint32 num_sids; /* 0 - num_sids */ - uint32 buffer_sids; /* NULL - undocumented pointer to SIDs. */ + uint32 num_other_sids; /* 0 - num_sids */ + uint32 buffer_other_sids; /* NULL - undocumented pointer to SIDs. */ UNISTR2 uni_user_name; /* username unicode string */ UNISTR2 uni_full_name; /* user's full name unicode string */ @@ -730,8 +731,8 @@ typedef struct lsa_q_user_info UNISTR2 uni_logon_srv; /* logon server unicode string */ UNISTR2 uni_logon_dom; /* logon domain unicode string */ - DOM_SID undoc_dom_sids[2]; /* undocumented - domain SIDs */ DOM_SID dom_sid; /* domain SID */ + DOM_SID other_sids[LSA_MAX_SIDS]; /* undocumented - domain SIDs */ } LSA_USER_INFO; @@ -750,7 +751,7 @@ typedef struct lsa_r_sam_logon_info DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */ uint32 buffer_user; - LSA_USER_INFO user; + LSA_USER_INFO *user; uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */ -- cgit From fb27bc139f8d321e50471c595b65b277ee114801 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 7 Oct 1997 18:46:19 +0000 Subject: locking.c: Added fix for race condition in slow share mode code. lsaparse.c: #ifdef'ed out code so this will compile - LUKE PLEASE CHECK THIS. pipes.c: #ifdef'ed out code so this will compile - LUKE PLEASE CHECK THIS. server.c: Fixed last known oplock race condition. smb.h: Re-removed USE_OPLOCK defines - someone checked in an old version. smbparse.c: #ifdef'ed out code so this will compile - LUKE PLEASE CHECK THIS. Jeremy (jallison@whistle.com) (This used to be commit 1e1366ddc5542283a37debdf830ca139bbade1b0) --- source3/include/smb.h | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 3adb3e5a4c..c347202743 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1042,10 +1042,8 @@ typedef struct { smb_shm_offset_t next_share_mode_entry; int pid; -#ifdef USE_OPLOCKS uint16 op_port; uint16 op_type; -#endif /* USE_OPLOCKS */ int share_mode; struct timeval time; } share_mode_entry; @@ -1054,10 +1052,8 @@ typedef struct typedef struct { int pid; -#ifdef USE_OPLOCKS uint16 op_port; uint16 op_type; -#endif /* USE_OPLOCKS */ int share_mode; struct timeval time; } min_share_mode_entry; @@ -1083,11 +1079,7 @@ struct connect_record }; #ifndef LOCKING_VERSION -#ifdef USE_OPLOCKS #define LOCKING_VERSION 4 -#else /* USE_OPLOCKS */ -#define LOCKING_VERSION 3 -#endif /* USE_OPLOCKS */ #endif /* LOCKING_VERSION */ #if !defined(FAST_SHARE_MODES) @@ -1103,11 +1095,7 @@ struct connect_record #define SMF_FILENAME_LEN_OFFSET 8 #define SMF_HEADER_LENGTH 10 -#ifdef USE_OPLOCKS #define SMF_ENTRY_LENGTH 20 -#else /* USE_OPLOCKS */ -#define SMF_ENTRY_LENGTH 16 -#endif /* USE_OPLOCKS */ /* * Share mode record offsets. @@ -1117,11 +1105,8 @@ struct connect_record #define SME_USEC_OFFSET 4 #define SME_SHAREMODE_OFFSET 8 #define SME_PID_OFFSET 12 - -#ifdef USE_OPLOCKS #define SME_PORT_OFFSET 16 #define SME_OPLOCK_TYPE_OFFSET 18 -#endif /* USE_OPLOCKS */ #endif /* FAST_SHARE_MODES */ -- cgit From 8871297885050911aaa802c4e90e282c44e49b84 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 8 Oct 1997 17:12:07 +0000 Subject: loadparm.c proto.h: added lp_domainsid() lsaparse.c smb.h: debugging structures and parsing functions pipes.c: finally got to the functions that will go into the RPC switch statement. (This used to be commit d15aed8a9c58a7cc90befaee2d5a2752708f9327) --- source3/include/smb.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index c347202743..9f5279fca0 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -326,6 +326,7 @@ typedef struct domsid2_info { uint32 type; /* value is 5 */ uint32 undoc; /* value is 0 */ + UNIHDR2 hdr; /* XXXX conflict between hdr and str for length */ UNISTR str; /* XXXX conflict between hdr and str for length */ @@ -488,7 +489,8 @@ typedef struct lsa_r_open_pol_info /* LSA_Q_QUERY_INFO - LSA query info policy */ typedef struct lsa_query_info { - uint16 info_class; /* info class (also a policy handle?) */ + LSA_POL_HND pol; /* policy handle */ + uint16 info_class; /* info class */ } LSA_Q_QUERY_INFO; -- cgit From ad54a5671405374b6308929154c6922bc6a7d0d7 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 9 Oct 1997 14:40:46 +0000 Subject: credentials.c: use UTIME structure (defined and commented in smb.h to be time, secs, since 01jan1970) pipes.c: another sub-function. util.c: added char *unistr2(uint16 *buff) function. same as unistr except it takes uint16* instead of char*. smbparse.c smb.h: more structure sorting. proto.h: the usual. (This used to be commit 72a86f514f0c92b69499718e63f5dd73ebece56e) --- source3/include/smb.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 9f5279fca0..7d7677b3fc 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -565,11 +565,7 @@ typedef struct lsa_r_lookup_sids typedef struct dom_name_info { uint32 uni_str_len; -#if 1 /* don't know if buffer is null-terminated */ - UNISTR buffer; -#else /* or length indicated by uni_str_len member */ - uint16 buffer[MAX_UNISTRLEN]; -#endif + UNISTR str; } DOM_NAME; -- cgit From 5a3ea52d4a567a341c8f2243783afdb392991ea2 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 9 Oct 1997 15:48:40 +0000 Subject: pipes.c: added api_ntlsarpcTNP() function. hooray! smb.h: added LSA #defines needed by above function. (This used to be commit 5437f666987918516032cf8a5dada107e5d14d25) --- source3/include/smb.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 7d7677b3fc..d0baa66992 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -4,6 +4,8 @@ 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 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 @@ -256,6 +258,42 @@ typedef char fstring[128]; typedef fstring string; +/* NETLOGON opcodes and data structures */ + +#define NET_QUERYFORPDC 7 /* Query for PDC */ +#define NET_QUERYFORPDC_R 12 /* Response to Query for PDC */ +#define NET_SAMLOGON 18 +#define NET_SAMLOGON_R 19 + +/* Allowable account control bits */ +#define ACB_DISABLED 1 /* 1 = User account disabled */ +#define ACB_HOMDIRREQ 2 /* 1 = Home directory required */ +#define ACB_PWNOTREQ 4 /* 1 = User password not required */ +#define ACB_TEMPDUP /* 1 = Temporary duplicate account */ +#define ACB_NORMAL /* 1 = Normal user account */ +#define ACB_MNS /* 1 = MNS logon user account */ +#define ACB_DOMTRUST /* 1 = Interdomain trust account */ +#define ACB_WSTRUST /* 1 = Workstation trust account */ +#define ACB_SVRTRUST /* 1 = Server trust account */ +#define ACB_PWNOEXP /* 1 = User password does not expire */ +#define ACB_AUTOLOCK /* 1 = Account auto locked */ + +#define LSA_OPENPOLICY 0x2c +#define LSA_QUERYINFOPOLICY 0x07 +#define LSA_ENUMTRUSTDOM 0x0d +#define LSA_REQCHAL 0x04 +#define LSA_SVRPWSET 0x06 +#define LSA_SAMLOGON 0x02 +#define LSA_AUTH2 0x0f +#define LSA_CLOSE 0x00 + +/* unknown .... */ +#define LSA_OPENSECRET 0xFF +#define LSA_LOOKUPSIDS 0xFE +#define LSA_LOOKUPNAMES 0xFD +#define LSA_SAMLOGOFF 0xFC + + /* 32 bit time (sec) since 01jan1970 - cifs6.txt, section 3.5, page 30 */ typedef struct time_info { -- cgit From 805749baab4e79fbdb9897f22b2c801d9dd9efc2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 10 Oct 1997 01:32:26 +0000 Subject: nmblookup.c: Added -A ability to do status on ip address. smb.h: Added defines we will need for NT SMB calls. trans2.c: Fixed SMB_QUERY_FILE_ALT_NAME_INFO return - this is only for short name returns (and only used when you negotiate NT SMB calls to boot !). Jeremy (jallison@whistle.com) (This used to be commit 53915bd160eda8c099482ddcef74d1d7606e752b) --- source3/include/smb.h | 53 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 19 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index d0baa66992..54ce9e88e8 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -438,8 +438,8 @@ typedef struct id_info_1 DOM_LOGON_ID logon_id; /* logon ID */ UNIHDR hdr_user_name; /* user name unicode header */ UNIHDR hdr_workgroup_name; /* workgroup name unicode header */ - ARC4_OWF arc4_lm_owf; /* rc4 LM OWF Password */ - ARC4_OWF arc4_nt_owf; /* rc4 NT OWF Password */ + ARC4_OWF arc4_lm_owf; /* arc4 LM OWF Password */ + ARC4_OWF arc4_nt_owf; /* arc4 NT OWF Password */ UNISTR2 uni_domain_name; /* domain name unicode string */ UNISTR2 uni_user_name; /* user name unicode string */ UNISTR2 uni_workgroup_name; /* workgroup name unicode string */ @@ -1305,23 +1305,38 @@ struct connect_record #define SMBfindnclose 0x35 /* Terminate a TRANSACT2_FINDNOTIFYFIRST */ #define SMBulogoffX 0x74 /* user logoff */ - -/* these are the TRANS2 sub commands */ -#define TRANSACT2_OPEN 0 -#define TRANSACT2_FINDFIRST 1 -#define TRANSACT2_FINDNEXT 2 -#define TRANSACT2_QFSINFO 3 -#define TRANSACT2_SETFSINFO 4 -#define TRANSACT2_QPATHINFO 5 -#define TRANSACT2_SETPATHINFO 6 -#define TRANSACT2_QFILEINFO 7 -#define TRANSACT2_SETFILEINFO 8 -#define TRANSACT2_FSCTL 9 -#define TRANSACT2_IOCTL 10 -#define TRANSACT2_FINDNOTIFYFIRST 11 -#define TRANSACT2_FINDNOTIFYNEXT 12 -#define TRANSACT2_MKDIR 13 - +/* NT SMB extensions. */ +#define SMBnttrans 0xA0 /* NT transact */ +#define SMBnttranss 0xA1 /* NT transact secondary */ +#define SMBntcreateX 0xA2 /* NT create and X */ +#define SMBntcancel 0xA4 /* NT cancel */ + +/* These are the TRANS2 sub commands */ +#define TRANSACT2_OPEN 0 +#define TRANSACT2_FINDFIRST 1 +#define TRANSACT2_FINDNEXT 2 +#define TRANSACT2_QFSINFO 3 +#define TRANSACT2_SETFSINFO 4 +#define TRANSACT2_QPATHINFO 5 +#define TRANSACT2_SETPATHINFO 6 +#define TRANSACT2_QFILEINFO 7 +#define TRANSACT2_SETFILEINFO 8 +#define TRANSACT2_FSCTL 9 +#define TRANSACT2_IOCTL 0xA +#define TRANSACT2_FINDNOTIFYFIRST 0xB +#define TRANSACT2_FINDNOTIFYNEXT 0xC +#define TRANSACT2_MKDIR 0xD +#define TRANSACT2_SESSION_SETUP 0xE +#define TRANSACT2_GET_DFS_REFERRAL 0x10 +#define TRANSACT2_REPORT_DFS_INCONSISTANCY 0x11 + +/* These are the NT transact sub commands. */ +#define NT_TRANSACT_CREATE 1 +#define NT_TRANSACT_IOCTL 2 +#define NT_TRANSACT_SET_SECURITY_DESC 3 +#define NT_TRANSACT_NOTIFY_CHANGE 4 +#define NT_TRANSACT_RENAME 5 +#define NT_TRANSACT_QUERY_SECURITY_DESC 6 /* these are the trans2 sub fields for primary requests */ #define smb_tpscnt smb_vwv0 -- cgit From c5e739febe5ab3bcc5d147fe791c788ec72531a3 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 10 Oct 1997 14:48:05 +0000 Subject: Makefile: added credentials.c to smbd credentials.c: using credential structures instead of char* password.c uid.c server.c: added sid and attr to user_struct. smbdes.c: smbhash and str_to_key make public instead of private. pipes.c smb.h: lsa structures, sub-functions. proto.h: usual. (This used to be commit 87a0a944855a673d693d934e446bdc231b1c7f02) --- source3/include/smb.h | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 54ce9e88e8..87fcb22cac 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -877,7 +877,8 @@ Response: */ -struct smb_passwd { +struct smb_passwd +{ int smb_userid; char *smb_name; unsigned char *smb_passwd; /* Null if no password */ @@ -886,12 +887,14 @@ struct smb_passwd { }; -struct current_user { +struct current_user +{ int cnum, id; int uid, gid; int ngroups; gid_t *groups; int *igroups; + int *attrs; }; typedef struct @@ -988,35 +991,63 @@ typedef struct char *user; /* name of user who *opened* this connection */ int uid; /* uid of user who *opened* this connection */ int gid; /* gid of user who *opened* this connection */ + uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */ + /* following groups stuff added by ih */ + /* This groups info is valid for the user that *opened* the connection */ int ngroups; gid_t *groups; int *igroups; /* an integer version - some OSes are broken :-( */ + int *attrs; + time_t lastused; BOOL used; 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). */ + } connection_struct; +/* Domain controller authentication protocol info */ +struct dcinfo +{ + DOM_CHAL clnt_chal; /* Initial challenge received from client */ + DOM_CHAL srv_chal; /* Initial server challenge */ + DOM_CHAL clnt_cred; /* Last client credential */ + DOM_CHAL srv_cred; /* Last server credential */ + + char sess_key[8]; /* Session key */ + uchar md4pw[16]; /* md4(machine password) */ +}; typedef struct { int uid; /* uid of a validated user */ int gid; /* gid of a validated user */ + fstring name; /* name of a validated user */ + fstring real_name; /* to store real name from password file - simeon */ BOOL guest; + /* following groups stuff added by ih */ /* This groups info is needed for when we become_user() for this uid */ - int user_ngroups; - gid_t *user_groups; - int *user_igroups; /* an integer version - some OSes are broken :-( */ + int n_groups; + gid_t *groups; + int *igroups; /* an integer version - some OSes are broken :-( */ + int *attrs; /* attributes associated with each gid */ + #if (defined(NETGROUP) && defined(AUTOMOUNT)) char *home_share; /* to store NIS home of a user - simeon */ #endif - char *real_name; /* to store real name from password file - simeon */ + + int n_sids; + int *sids; + + /* per-user authentication information on NT RPCs */ + struct dcinfo dc; + } user_struct; -- cgit From 7f296a8f905cc40972ed249567e5d985c0ce3825 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 10 Oct 1997 18:03:30 +0000 Subject: added lsa_reply_srv_pwset() (This used to be commit 0d043cfef289ee82287bb6014a164ba83ca87f30) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 87fcb22cac..62351da187 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -282,7 +282,7 @@ typedef fstring string; #define LSA_QUERYINFOPOLICY 0x07 #define LSA_ENUMTRUSTDOM 0x0d #define LSA_REQCHAL 0x04 -#define LSA_SVRPWSET 0x06 +#define LSA_SRVPWSET 0x06 #define LSA_SAMLOGON 0x02 #define LSA_AUTH2 0x0f #define LSA_CLOSE 0x00 -- cgit From 78f6bc4eba9f6d68c31b1c7e35243a1b81619b0d Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 12 Oct 1997 17:07:35 +0000 Subject: updated rpc header reply: callid wrong; alloc hint a uint32 not a uint16. still doesn't get rid of the netlogon trans2 request with zero data. (This used to be commit 0cf67955f09d99c452bfc3fdde00dcea98e21db1) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 62351da187..58dfc141bd 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -477,7 +477,7 @@ typedef struct rpc_hdr_info uint8 minor; /* 0 - RPC minor version */ uint8 pkt_type; /* 2 - RPC response packet */ uint8 frag; /* 3 - first frag + last frag */ - uint32 pack_type; /* 0x0000 0010 - packed data representation */ + uint32 pack_type; /* 0x1000 0000 - packed data representation */ uint16 frag_len; /* fragment length - data size (bytes) inc header and tail. */ uint16 auth_len; /* 0 - authentication length */ uint32 call_id; /* call identifier. matches 12th uint32 of incoming RPC data. */ -- cgit From 6084046eede3652d7cabafb33227e940f00f92a8 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 14 Oct 1997 17:01:43 +0000 Subject: credentials, query info reply. (This used to be commit 9b095887df204393090d7da9a47508685ddd5163) --- source3/include/smb.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 58dfc141bd..8e34b06359 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -394,7 +394,7 @@ typedef struct log_info /* DOM_CHAL - challenge info */ typedef struct chal_info { - uint8 data[8]; /* credentials */ + uint32 data[2]; /* credentials */ } DOM_CHAL; @@ -492,7 +492,6 @@ typedef struct rpc_hdr_info typedef struct dom_query_info { uint16 uni_dom_max_len; /* domain name string length * 2 */ - uint16 padding; /* 2 padding bytes? */ uint16 uni_dom_str_len; /* domain name string length * 2 */ uint32 buffer_dom_name; /* undocumented domain name string buffer pointer */ uint32 buffer_dom_sid; /* undocumented domain SID string buffer pointer */ @@ -1018,8 +1017,8 @@ struct dcinfo DOM_CHAL clnt_cred; /* Last client credential */ DOM_CHAL srv_cred; /* Last server credential */ - char sess_key[8]; /* Session key */ - uchar md4pw[16]; /* md4(machine password) */ + uint32 sess_key[2]; /* Session key */ + uchar md4pw[16]; /* md4(machine password) */ }; typedef struct -- cgit From df4afea583a8b53aca46e15dcc75bba1af731f9f Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 15 Oct 1997 16:51:03 +0000 Subject: added srvsvc basic pipe, straight from paul's code. does NETSHAREENUM and NETSERVERGETINFO. (This used to be commit 96b17b829fc787c15cd366eca604c09d68b5b900) --- source3/include/smb.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 8e34b06359..c733f29521 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -293,6 +293,9 @@ typedef fstring string; #define LSA_LOOKUPNAMES 0xFD #define LSA_SAMLOGOFF 0xFC +/* srvsvc pipe */ +#define NETSERVERGETINFO 0x15 +#define NETSHAREENUM 0x0f /* 32 bit time (sec) since 01jan1970 - cifs6.txt, section 3.5, page 30 */ typedef struct time_info -- cgit From d83845241381fb6ff86890d1d43c3d3bf6522a2b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 15 Oct 1997 19:16:38 +0000 Subject: smb.h smbparse.c pipenetlog.c : whoops, the SAM Logon structure was wrong. updated this, and cifsntdomain.txt. more debug info in pipenetlog.c. the crash is somewhere around deal_with_credentials(). byteorder.h : put in uint8, uint16 and uint32 typecasts around debug info, because sign extending was resulting in ffffffe8 being displayed instead of e8. credentials.c : some debugging info, because i'm tracking a coredump. without gdb. nothing like making things difficult. reply.c : whoops, missed this (important) bit from paul's code, which tells the NT workstation that the MACHINE$ entry doesn't already exist, and we're going to create a default entry with a password "machine" right now. proto.h: the usual. (This used to be commit ed606bc7d4e6fb1091e527ea70a3e950d50a1db4) --- source3/include/smb.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index c733f29521..03cdc78e03 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -383,6 +383,16 @@ typedef struct domrid2_info } DOM_RID2; +/* DOM_CLNT_SRV - client / server names */ +typedef struct clnt_srv_info +{ + uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */ + UNISTR2 uni_logon_srv; /* logon server name */ + uint32 undoc_buffer2; /* undocumented 32 bit buffer pointer */ + UNISTR2 uni_comp_name; /* client machine name */ + +} DOM_CLNT_SRV; + /* DOM_LOG_INFO - login info */ typedef struct log_info { @@ -417,6 +427,14 @@ typedef struct clnt_info } DOM_CLNT_INFO; +/* DOM_CLNT_INFO2 - client info */ +typedef struct clnt_info2 +{ + DOM_CLNT_SRV login; + DOM_CRED cred; + +} DOM_CLNT_INFO2; + /* DOM_LOGON_ID - logon id */ typedef struct logon_info { @@ -452,10 +470,10 @@ typedef struct id_info_1 /* SAM_INFO - sam logon/off id structure */ typedef struct sam_info { - DOM_CLNT_INFO client; - DOM_CRED rtn_cred; /* return credentials */ - uint16 logon_level; - uint32 auth_level; /* undocumented */ + DOM_CLNT_INFO2 client; + DOM_CRED rtn_cred; /* return credentials */ + uint16 logon_level; + uint32 auth_level; /* undocumented */ union { -- cgit From eb7f4cb0e24f48bd4a093846ad228f2534a44410 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 16 Oct 1997 16:01:25 +0000 Subject: smb.h : id_info_1 has a pointer at the front of it. so does return credentials, and so does the client credentials. these are all from the sam logon. auth_level is 16 bytes not 32 and is actually called a switch_level. smbparse.c : smb_io_unihdr() - uni_max_len and uni_str_len are 16 bytes not 32. this may have a knock-on effect on smb_in_unihdr2() but we'll see... (This used to be commit ce36bfb3e4ad4b72a9f9759a3c49d2a73175d249) --- source3/include/smb.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 03cdc78e03..e4c2823a19 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -431,6 +431,7 @@ typedef struct clnt_info typedef struct clnt_info2 { DOM_CLNT_SRV login; + uint32 ptr_cred; DOM_CRED cred; } DOM_CLNT_INFO2; @@ -454,8 +455,9 @@ typedef struct arc4_owf_info /* DOM_ID_INFO_1 */ typedef struct id_info_1 { + uint32 ptr_id_info1; /* pointer to id_info_1 */ UNIHDR hdr_domain_name; /* domain name unicode header */ - uint32 param; /* param control */ + uint32 param_ctrl; /* param control */ DOM_LOGON_ID logon_id; /* logon ID */ UNIHDR hdr_user_name; /* user name unicode header */ UNIHDR hdr_workgroup_name; /* workgroup name unicode header */ @@ -471,9 +473,10 @@ typedef struct id_info_1 typedef struct sam_info { DOM_CLNT_INFO2 client; + uint32 ptr_rtn_cred; /* pointer to return credentials */ DOM_CRED rtn_cred; /* return credentials */ uint16 logon_level; - uint32 auth_level; /* undocumented */ + uint16 switch_value; union { -- cgit From f3c37f925ee06bbc76a89035b28dae0cf8c38088 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 17 Oct 1997 13:43:01 +0000 Subject: smbparse.c smb.h : uni_max_len and uni_str_len are the other way round, in UNIHDR. util.c : increased the show_msg() data size from 256 bytes to 512 bytes: the LSA SAM Logon response can be about 500 bytes long. pipenetlog.c : forgot to set the authoritative field to 1. (This used to be commit 71c6678cd7ffe30a5da27766cf99147e1921feae) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index e4c2823a19..80b2f28f4a 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -772,7 +772,7 @@ typedef struct lsa_q_user_info UNIHDR hdr_logon_dom; /* logon domain unicode string header */ uint32 buffer_dom_id; /* undocumented logon domain id pointer */ - char padding[40]; /* unused padding bytes? */ + char padding[40]; /* unused padding bytes. expansion room */ uint32 num_other_sids; /* 0 - num_sids */ uint32 buffer_other_sids; /* NULL - undocumented pointer to SIDs. */ -- cgit From 9e4626593f59ba4f5a678fc6d8d6e239cdff9c39 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 17 Oct 1997 16:46:56 +0000 Subject: pipenetlog.c lsaparse.c smb.h : SAM logon sorting. too many buffer pointers. added in the missing switch value (value of 3). dealing with the buffer pointers to the user info structure in a slightly different way. (This used to be commit 7993e17c9a1edddae6407d3f12790c461def705a) --- source3/include/smb.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 80b2f28f4a..11ec6940a6 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -741,7 +741,7 @@ typedef struct lsa_r_srv_pwset_info /* LSA_USER_INFO */ typedef struct lsa_q_user_info { - uint32 undoc_buffer; + uint32 ptr_user_info; NTTIME logon_time; /* logon time */ NTTIME logoff_time; /* logoff time */ @@ -809,7 +809,7 @@ typedef struct lsa_r_sam_logon_info uint32 buffer_creds; /* undocumented buffer pointer */ DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */ - uint32 buffer_user; + uint16 switch_value; /* 3 - indicates type of USER INFO */ LSA_USER_INFO *user; uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */ -- cgit From b0c148793b8ac4b62e9a66ce7e269ab50b90bf8d Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 19 Oct 1997 14:36:27 +0000 Subject: added the following structures: SH_INFO_1 SH_INFO_1_STR SHARE_INFO_1_CTR SRV_Q_NET_SHARE_ENUM SRV_R_NET_SHARE_ENUM the share info1 container can handle a maximum of 32 shares. the share info1 string structures contain two unicode strings, with 1024 uint16 characters _each_. we're going to _have_ to dynamically allocate the unicode strings, else we'll run out of stack space. rapidly. (This used to be commit e8bedb18bf249d2f06834b0f151ea22df86e2602) --- source3/include/smb.h | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 11ec6940a6..facb059f36 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -836,6 +836,72 @@ typedef struct lsa_r_sam_logoff_info } LSA_R_SAM_LOGOFF; + +/* SH_INFO_1 (pointers to level 1 share info strings) */ +typedef struct ptr_share_info1 +{ + uint32 ptr_shi1_netname; /* pointer to net name. */ + uint32 shi1_type; /* type of share. 0 - undocumented. */ + uint32 ptr_shi1_remark; /* pointer to comment. */ + +} SH_INFO_1; + +/* SH_INFO_1_STR (level 1 share info strings) */ +typedef struct str_share_info1 +{ + UNISTR2 uni_shi1_netname; /* unicode string of net name */ + UNISTR2 uni_shi1_remark; /* unicode string of comment. */ + +} SH_INFO_1_STR; + +/* oops - this is going to take up a *massive* amount of stack. */ +/* the UNISTR2s already have 1024 uint16 chars in them... */ +#define MAX_SHARE_ENTRIES 32 + +/* SHARE_INFO_1_CONTAINER */ +typedef struct share_info_ctr +{ + uint32 num_entries_read; /* EntriesRead */ + uint32 ptr_share_info; /* Buffer */ + SH_INFO_1 info_1 [MAX_SHARE_ENTRIES]; /* share entry pointers */ + SH_INFO_1_STR info_1_str[MAX_SHARE_ENTRIES]; /* share entry strings */ + uint32 num_entries_read2; /* EntriesRead2 */ + +} SHARE_INFO_1_CTR; + + +/* SRV_Q_NET_SHARE_ENUM */ +typedef struct q_net_share_enum_info +{ + uint32 ptr_srv_name; /* pointer (to server name?) */ + UNISTR2 uni_srv_name; /* server name */ + + uint32 share_level; /* share level */ + uint32 switch_value; /* switch value */ + + uint32* ptr_share_info; /* pointer to SHARE_INFO_1_CTR */ + SHARE_INFO_1_CTR share_info; /* share info with 0 entries */ + + uint32 preferred_len; /* preferred maximum length (0xffff ffff) */ + +} SRV_Q_NET_SHARE_ENUM; + + +/* SRV_R_NET_SHARE_ENUM */ +typedef struct r_net_share_enum_info +{ + uint32 share_level; /* share level */ + uint32 switch_value; /* switch value */ + + uint32* ptr_share_info; /* pointer to SHARE_INFO_1_CTR */ + SHARE_INFO_1_CTR share_info; /* share info with 0 entries */ + + uint32 status; /* return status */ + +} SRV_R_NET_SHARE_ENUM; + + + /* Yet to be turned into structures: @@ -931,6 +997,7 @@ typedef struct time_t atime; time_t ctime; pstring name; + } file_info; -- cgit From 54ffd7f5c9251382874d9c47611d5c666f782f6b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 19 Oct 1997 15:33:25 +0000 Subject: Makefile : added srvparse.o and pipesrvsvc.o smb.h : mods to the Net Share Enum stuff srvparse.c : Net Share Enum parsing support. more srvsvc pipe parsing to go here... pipenetlog.c util.c: modified standard_sub_basic() so that you can set a global boolean and use a different string for the %U username substitution. proto.h: the usual. (This used to be commit 22b86b6499b2680d16cb4180a736b4e750147409) --- source3/include/smb.h | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index facb059f36..d847c6f342 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -565,6 +565,7 @@ typedef struct lsa_r_query_info { DOM_QUERY_3 id3; DOM_QUERY_5 id5; + } dom; uint32 status; /* return code */ @@ -840,17 +841,17 @@ typedef struct lsa_r_sam_logoff_info /* SH_INFO_1 (pointers to level 1 share info strings) */ typedef struct ptr_share_info1 { - uint32 ptr_shi1_netname; /* pointer to net name. */ - uint32 shi1_type; /* type of share. 0 - undocumented. */ - uint32 ptr_shi1_remark; /* pointer to comment. */ + uint32 ptr_netname; /* pointer to net name. */ + uint32 type; /* type of share. 0 - undocumented. */ + uint32 ptr_remark; /* pointer to comment. */ } SH_INFO_1; /* SH_INFO_1_STR (level 1 share info strings) */ typedef struct str_share_info1 { - UNISTR2 uni_shi1_netname; /* unicode string of net name */ - UNISTR2 uni_shi1_remark; /* unicode string of comment. */ + UNISTR2 uni_netname; /* unicode string of net name */ + UNISTR2 uni_remark; /* unicode string of comment. */ } SH_INFO_1_STR; @@ -879,8 +880,13 @@ typedef struct q_net_share_enum_info uint32 share_level; /* share level */ uint32 switch_value; /* switch value */ - uint32* ptr_share_info; /* pointer to SHARE_INFO_1_CTR */ - SHARE_INFO_1_CTR share_info; /* share info with 0 entries */ + uint32 ptr_share_info; /* pointer to SHARE_INFO_1_CTR */ + + union + { + SHARE_INFO_1_CTR info1; /* share info with 0 entries */ + + } share; uint32 preferred_len; /* preferred maximum length (0xffff ffff) */ @@ -893,8 +899,12 @@ typedef struct r_net_share_enum_info uint32 share_level; /* share level */ uint32 switch_value; /* switch value */ - uint32* ptr_share_info; /* pointer to SHARE_INFO_1_CTR */ - SHARE_INFO_1_CTR share_info; /* share info with 0 entries */ + uint32 ptr_share_info; /* pointer to SHARE_INFO_1_CTR */ + union + { + SHARE_INFO_1_CTR info1; /* share info container */ + + } share; uint32 status; /* return status */ -- cgit From 7aa5495c18f21eaa1397e8b0751b71810ccf38b7 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 19 Oct 1997 17:01:06 +0000 Subject: creating NetShareEnum parsing / reply creation. compiles, but untested. (This used to be commit 0a191ee5047b2c81c7adb0554c39ec43d8690230) --- source3/include/smb.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index d847c6f342..7fa19eaa19 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -156,10 +156,11 @@ implemented */ #define DENY_FCB 7 /* share types */ -#define STYPE_DISKTREE 0 /* Disk drive */ -#define STYPE_PRINTQ 1 /* Spooler queue */ -#define STYPE_DEVICE 2 /* Serial device */ -#define STYPE_IPC 3 /* Interprocess communication (IPC) */ +#define STYPE_DISKTREE 0 /* Disk drive */ +#define STYPE_PRINTQ 1 /* Spooler queue */ +#define STYPE_DEVICE 2 /* Serial device */ +#define STYPE_IPC 3 /* Interprocess communication (IPC) */ +#define STYPE_HIDDEN 0x80000000 /* share is a hidden one (ends with $) */ /* SMB X/Open error codes for the ERRdos error class */ #define ERRbadfunc 1 /* Invalid function (or system call) */ -- cgit From 0c1d45dfa4d2bd780a4d5c8f2b804018c8b4939b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 19 Oct 1997 17:54:13 +0000 Subject: debugging the srvsvc Net Share Enum. some padding issues; some string length issues. it works! (This used to be commit 80523a3e83191c9e0b930fc71bd502a94a6f1b19) --- source3/include/smb.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 7fa19eaa19..0d10bd5895 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -865,9 +865,11 @@ typedef struct share_info_ctr { uint32 num_entries_read; /* EntriesRead */ uint32 ptr_share_info; /* Buffer */ + uint32 num_entries_read2; /* EntriesRead */ SH_INFO_1 info_1 [MAX_SHARE_ENTRIES]; /* share entry pointers */ SH_INFO_1_STR info_1_str[MAX_SHARE_ENTRIES]; /* share entry strings */ - uint32 num_entries_read2; /* EntriesRead2 */ + uint32 num_entries_read3; /* EntriesRead2 */ + uint32 padding; /* padding */ } SHARE_INFO_1_CTR; -- cgit From 3e670e4057321911c6674b8abe3c0bdcd684fd09 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 20 Oct 1997 08:46:00 +0000 Subject: a major share modes reorganisation. The shares modes code is now split into separate files. The shared memory implementation is in locking_shm.c. The slow implementation is in locking_slow.c It is all controlled by a struct share_ops structure that has function pointers to the implementation of all the functions needed by a share modes implementation. An initialisation function sets up this structure. This will make adding new implementations easy and clean. This also allowed me to get rid of the ugly code in smbstatus. Now status.c links to the locking code and calls methods in share_ops. I also renamed some things and generally organised things in a much cleaner fashion. Defines and structures specific to each implementation have been moved to the appropriate file and out of smb.h. (This used to be commit 65ab9adaa0d356b8041ed8a507ea52117f2a284e) --- source3/include/smb.h | 69 +++++++++++---------------------------------------- 1 file changed, 15 insertions(+), 54 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 0d10bd5895..ff6cc7eb25 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1195,29 +1195,6 @@ struct interface struct in_addr nmask; }; -/* share mode record pointed to in shared memory hash bucket */ -typedef struct -{ - smb_shm_offset_t next_offset; /* offset of next record in chain from hash bucket */ - int locking_version; - int32 st_dev; - int32 st_ino; - int num_share_mode_entries; - smb_shm_offset_t share_mode_entries; /* Chain of share mode entries for this file */ - char file_name[1]; -} share_mode_record; - -/* share mode entry pointed to by share_mode_record struct */ -typedef struct -{ - smb_shm_offset_t next_share_mode_entry; - int pid; - uint16 op_port; - uint16 op_type; - int share_mode; - struct timeval time; -} share_mode_entry; - /* struct returned by get_share_modes */ typedef struct { @@ -1226,14 +1203,26 @@ typedef struct uint16 op_type; int share_mode; struct timeval time; -} min_share_mode_entry; +} share_mode_entry; -/* Token returned by lock_share_entry (actually ignored by FAST_SHARE_MODES code) */ -typedef int share_lock_token; /* Conversion to hash entry index from device and inode numbers. */ #define HASH_ENTRY(dev,ino) ((( (uint32)(dev) )* ( (uint32)(ino) )) % lp_shmem_hash_size()) +/* each implementation of the share mode code needs + to support the following operations */ +struct share_ops { + 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 **); + void (*del_entry)(int , int ); + BOOL (*set_entry)(int , int , uint16 , uint16 ); + BOOL (*remove_oplock)(int , int); + int (*forall)(void (*)(share_mode_entry *, char *)); + void (*status)(FILE *); +}; + /* this is used for smbstatus */ struct connect_record { @@ -1252,34 +1241,6 @@ struct connect_record #define LOCKING_VERSION 4 #endif /* LOCKING_VERSION */ -#if !defined(FAST_SHARE_MODES) -/* - * Defines for slow share modes. - */ - -/* - * Locking file header lengths & offsets. - */ -#define SMF_VERSION_OFFSET 0 -#define SMF_NUM_ENTRIES_OFFSET 4 -#define SMF_FILENAME_LEN_OFFSET 8 -#define SMF_HEADER_LENGTH 10 - -#define SMF_ENTRY_LENGTH 20 - -/* - * Share mode record offsets. - */ - -#define SME_SEC_OFFSET 0 -#define SME_USEC_OFFSET 4 -#define SME_SHAREMODE_OFFSET 8 -#define SME_PID_OFFSET 12 -#define SME_PORT_OFFSET 16 -#define SME_OPLOCK_TYPE_OFFSET 18 - -#endif /* FAST_SHARE_MODES */ - /* these are useful macros for checking validity of handles */ #define VALID_FNUM(fnum) (((fnum) >= 0) && ((fnum) < MAX_OPEN_FILES)) #define OPEN_FNUM(fnum) (VALID_FNUM(fnum) && Files[fnum].open) -- cgit From dc9999ebd0ac568ee8a175cb6ece069603115bd2 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 20 Oct 1997 12:13:04 +0000 Subject: removed home_share from user_info structure. (This used to be commit c59b8cee4721eeeb79f07f48ac17492530d4cdb1) --- source3/include/smb.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index ff6cc7eb25..2b0fc44d24 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1141,10 +1141,6 @@ typedef struct int *igroups; /* an integer version - some OSes are broken :-( */ int *attrs; /* attributes associated with each gid */ -#if (defined(NETGROUP) && defined(AUTOMOUNT)) - char *home_share; /* to store NIS home of a user - simeon */ -#endif - int n_sids; int *sids; -- cgit From 0891bb6a910841455162876be09a92107cd9df00 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 21 Oct 1997 09:34:33 +0000 Subject: rewrote the password server code using the new clientgen.c client interface The new code uses a source netbios name equal to the Samba servers name, not the client name. It also uses NetWkstaUserLogon to do a full network logon. This means it will honour the servers logon restrictions (such as login times etc). (This used to be commit 11de90f972f6d83974425e80014f54e15d495413) --- source3/include/smb.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 2b0fc44d24..7921e77108 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -989,6 +989,32 @@ struct smb_passwd }; +struct cli_state { + int fd; + int cnum; + int pid; + int mid; + int uid; + int protocol; + int sec_mode; + int error; + int privilages; + fstring eff_name; + fstring desthost; + char cryptkey[8]; + uint32 sesskey; + int serverzone; + uint32 servertime; + int readbraw_supported; + int writebraw_supported; + int timeout; + int max_xmit; + char *outbuf; + char *inbuf; + int bufsize; + int initialised; +}; + struct current_user { int cnum, id; -- cgit From efe9b26a7b08cc9ea02cad32a847f71773a6edc4 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 21 Oct 1997 18:25:14 +0000 Subject: loadparm.c : added "domain admin users" parameter added "domain guest users" parameter these two complement the "domain groups" parameter. the "domain groups" parameter should be for your own groups, and well-known aliases. util.c : added ability to do "domain groups = power_users admin_users backup_ops" which are well-known RID aliases, not well-known RID groups. pipenetlog.c : combine the "domain admin users"; "domain guest users" and "domain groups" parameters to give an array of RID groups to include in the SAM Logon response. ipc.c smb.h : moved REALLOC() into smb.h added RID #defines. proto.h: usual. (This used to be commit f2554f231d1f59f30224adcc02b2b3ca4c24e0dd) --- source3/include/smb.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 7921e77108..0965b6b90b 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -66,6 +66,8 @@ typedef int BOOL; typedef int smb_shm_offset_t; #define NULL_OFFSET (smb_shm_offset_t)(0) +/* limiting size of ipc replies */ +#define REALLOC(ptr,size) Realloc(ptr,MAX((size),4*1024)) /* Samba needs type definitions for int16, int32, uint16 and uint32. @@ -298,6 +300,32 @@ typedef fstring string; #define NETSERVERGETINFO 0x15 #define NETSHAREENUM 0x0f +/* well-known RIDs - Relative IDs */ + +/* RIDs - Well-known users ... */ +#define DOMAIN_USER_RID_ADMIN (0x000001F4L) +#define DOMAIN_USER_RID_GUEST (0x000001F5L) + +/* RIDs - well-known groups ... */ +#define DOMAIN_GROUP_RID_ADMINS (0x00000200L) +#define DOMAIN_GROUP_RID_USERS (0x00000201L) +#define DOMAIN_GROUP_RID_GUESTS (0x00000202L) + +/* RIDs - well-known aliases ... */ +#define DOMAIN_ALIAS_RID_ADMINS (0x00000220L) +#define DOMAIN_ALIAS_RID_USERS (0x00000221L) +#define DOMAIN_ALIAS_RID_GUESTS (0x00000222L) +#define DOMAIN_ALIAS_RID_POWER_USERS (0x00000223L) + +#define DOMAIN_ALIAS_RID_ACCOUNT_OPS (0x00000224L) +#define DOMAIN_ALIAS_RID_SYSTEM_OPS (0x00000225L) +#define DOMAIN_ALIAS_RID_PRINT_OPS (0x00000226L) +#define DOMAIN_ALIAS_RID_BACKUP_OPS (0x00000227L) + +#define DOMAIN_ALIAS_RID_REPLICATOR (0x00000228L) + + + /* 32 bit time (sec) since 01jan1970 - cifs6.txt, section 3.5, page 30 */ typedef struct time_info { -- cgit From f20e6f6b261c3976b412845000b3f170f8ad6a9f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 22 Oct 1997 11:15:14 +0000 Subject: shared memory code cleanups (partly preparing for a possible sysV shared memory implementation) (This used to be commit 8d1993c71a5d5d32636f62ba9b9a9009ec74d730) --- source3/include/smb.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 0965b6b90b..c982e3e78d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -63,8 +63,7 @@ typedef int BOOL; /* offset in shared memory */ -typedef int smb_shm_offset_t; -#define NULL_OFFSET (smb_shm_offset_t)(0) +#define NULL_OFFSET (int)(0) /* limiting size of ipc replies */ #define REALLOC(ptr,size) Realloc(ptr,MAX((size),4*1024)) @@ -1273,6 +1272,22 @@ struct share_ops { void (*status)(FILE *); }; +/* each implementation of the shared memory code needs + to support the following operations */ +struct shmem_ops { + BOOL (*open)(char *, int ); + BOOL (*close)( void ); + int (*alloc)(int ); + BOOL (*free)(int ); + int (*get_userdef_off)(void); + void *(*offset2addr)(int ); + int (*addr2offset)(void *addr); + BOOL (*lock_hash_entry)(unsigned int); + BOOL (*unlock_hash_entry)( unsigned int ); + BOOL (*get_usage)(int *,int *,int *); +}; + + /* this is used for smbstatus */ struct connect_record { -- cgit From 2e8cedba6480d0c1f89d3490888cadac769d09ca Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 22 Oct 1997 11:31:37 +0000 Subject: loadparm.c : added "domain other sids" parameter pipenetlog.c : using "domain other sids" parameter in SAM Logon response. using new name_to_rid() function for r_uid and r_gid. pipentlsa.c : minor mods to do with new name_to_rid() function. pipesrvsvc.c : in the "net share enum" response, allocate some more space for the buffer. there can be only 32 share entries in the response anyway. this needs to be dealt with. pipeutil.c : modified name_to_rid() function to use new parameters "domain admin users" and "domain guest users", but will otherwise do unix uid + 1000. moved make_dom_gids() here. proto.h: the usual. smb.h smbparse.c : renamed sid_no to sid_rev_num in DOM_SID, and gid to r_gid in DOM_GID. util.c : moved make_dom_gids() from here. created char *unistrn2(uint16* uni_buffer, int max_len) (This used to be commit ec60e48d7982240b7755d246b2f1e8989467f66f) --- source3/include/smb.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index c982e3e78d..913f5607b7 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -341,15 +341,15 @@ typedef struct nttime_info } NTTIME; -#define MAXSUBAUTHS 10 /* max sub authorities in a SID */ +#define MAXSUBAUTHS 15 /* max sub authorities in a SID */ /* DOM_SID - security id */ typedef struct sid_info { - uint8 sid_no; /* SID revision number */ + uint8 sid_rev_num; /* SID revision number */ uint8 num_auths; /* number of sub-authorities */ uint8 id_auth[6]; /* Identifier Authority */ - uint16 sub_auths[MAXSUBAUTHS]; /* pointer to sub-authorities. */ + uint16 sub_auths[MAXSUBAUTHS]; /* pointer to sub-authorities. */ } DOM_SID; @@ -517,7 +517,7 @@ typedef struct sam_info /* DOM_GID - group id + user attributes */ typedef struct gid_info { - uint32 gid; /* group id */ + uint32 g_rid; /* a group RID */ uint32 attr; } DOM_GID; -- cgit From 5897f0493d0665ae53ea181e122c467faa0c7642 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 22 Oct 1997 14:28:19 +0000 Subject: Makefile client.c clientutil.c clitar.c nmbsync.c : redid the split that i did a year ago, taking the functions in client.c out into clientutil.c. guess what? we could now do encrypted password NetServerEnum2 calls in nmbd, if we wanted to. i can now use cli_call_api() to send to different pipes. i hope. pipenetlog.c: allow adding to users group _and_ to admin group. if adding to guest group, don't allow adding to users or admin as well. smb.h : added some pipe #defines (\PIPE\NETLOGON \PIPE\srvsvc ...) proto.h : usual. (This used to be commit 6ee065ce6e099acfc7e83ad399ef6e60b4c625c1) --- source3/include/smb.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 913f5607b7..d10b449e6f 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -260,6 +260,12 @@ typedef char fstring[128]; typedef fstring string; +/* pipe strings */ +#define PIPE_LANMAN "\\PIPE\\LANMAN" +#define PIPE_SRVSVC "\\PIPE\\srvsvc" +#define PIPE_NETLOGON "\\PIPE\\NETLOGON" +#define PIPE_NTLSA "\\PIPE\\ntlsa" + /* NETLOGON opcodes and data structures */ #define NET_QUERYFORPDC 7 /* Query for PDC */ -- cgit From a947dff4c001023d0f7c2f6f13c3a4b594c88139 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 22 Oct 1997 17:51:02 +0000 Subject: Makefile client.c : adding start of undocumented options to do NT domain logons, client-side. starting with LSA_REQCHAL. the code here happily crashes smbd: i'll investigate this further... :-) smbparse.c pipeutil.c lsaparse.c : moved some of the common make_xxxx() functions out of pipeutil.c so that the make_xxxx and (smb/lsa)_io_xxxx functions now sit together. makes sense, really... added a make_q_req_chal() function. restructured make_rpc_reply() and called it make_rpc_hdr(). created functions create_rpc_reply() and create_rpc_response(). pipenetlog.c pipentlsa.c pipesrvsvc.c calling new create_rpc_reply() function instead of old make_rpc_reply(). proto.h : usual. smb.h: added enum for RPC_PACKET_TYPE (This used to be commit b88ee3e16c6b671069f53ca2e9c5694ec8b1c030) --- source3/include/smb.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index d10b449e6f..83ed54c998 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -268,6 +268,14 @@ typedef fstring string; /* NETLOGON opcodes and data structures */ +enum RPC_PKT_TYPE +{ + RPC_REQUEST = 0x00, + RPC_RESPONSE = 0x02, + RPC_BIND = 0x0B, + RPC_BINDACK = 0x0C +}; + #define NET_QUERYFORPDC 7 /* Query for PDC */ #define NET_QUERYFORPDC_R 12 /* Response to Query for PDC */ #define NET_SAMLOGON 18 -- cgit From 390c1f3c4d3136b454fa5eb8681fa9ca34eaacc2 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 25 Oct 1997 10:58:18 +0000 Subject: Makefile : adding bits for new nt domain code byteorder.h : trying to get macros right, and not to crash on SUNOS5... client.c : added #ifdef NTDOMAIN, and created do_nt_login() function. don't want to have to recompile client.c unless absolutely necessary. credentials.c : moved deal_with_creds() [possibly inappropriately] into credentials.c ipc.c reply.c server.c uid.c : attempting to make (un)become_root() functions calleable from smbclient. this is a little tricky: smbclient might have to be another setuid root program, immediately setuid'ing to non-root, so that we can reset-uid to root to get at the smbpasswd file. or, have a secure pipe mechanism to smbd to grab smbpasswd entries. or the like. smbdes.c smbencrypt.c : created a function to generate lm and nt owf hashes. lsaparse.c ntclient.c smbparse.c : added nt client LSA_AUTH2 code. it works, too! pipenetlog.c pipentlsa.c pipesrvsvc.c : simplification. code-shuffling. getting that damn offset right for the opcode in RPC_HDR. smb.h : changed dcinfo xxx_creds to DOM_CRED structures instead of DOM_CHAL. we might need to store the server times as well. proto.h : the usual. (This used to be commit 82436a3d99d4bdce249ce9ff27fd2ca4b2447e07) --- source3/include/smb.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 83ed54c998..b6b9d177a1 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -550,7 +550,7 @@ typedef struct rpc_hdr_info uint32 alloc_hint; /* allocation hint - data size (bytes) minus header and tail. */ uint16 context_id; /* 0 - presentation context identifier */ uint8 cancel_count; /* 0 - cancel count */ - uint8 reserved; /* 0 - reserved */ + uint8 opnum; /* request: 0 - reserved. response: opnum */ } RPC_HDR; @@ -1185,8 +1185,8 @@ struct dcinfo { DOM_CHAL clnt_chal; /* Initial challenge received from client */ DOM_CHAL srv_chal; /* Initial server challenge */ - DOM_CHAL clnt_cred; /* Last client credential */ - DOM_CHAL srv_cred; /* Last server credential */ + DOM_CRED clnt_cred; /* Last client credential */ + DOM_CRED srv_cred; /* Last server credential */ uint32 sess_key[2]; /* Session key */ uchar md4pw[16]; /* md4(machine password) */ -- cgit From 54932934421e8a34d190604122bc22d676e4c7ea Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 25 Oct 1997 15:49:27 +0000 Subject: got the SAM logon request generated, and received a SAM logon response back. YEAH! need to add: - client-side credential calculation - client-side parsing of the SAM logon response. (This used to be commit 349677de3f06bb0892862de0e11172adeffda18a) --- source3/include/smb.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index b6b9d177a1..b19fbfb4ca 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -502,12 +502,12 @@ typedef struct id_info_1 uint32 param_ctrl; /* param control */ DOM_LOGON_ID logon_id; /* logon ID */ UNIHDR hdr_user_name; /* user name unicode header */ - UNIHDR hdr_workgroup_name; /* workgroup name unicode header */ + UNIHDR hdr_wksta_name; /* workgroup name unicode header */ ARC4_OWF arc4_lm_owf; /* arc4 LM OWF Password */ ARC4_OWF arc4_nt_owf; /* arc4 NT OWF Password */ UNISTR2 uni_domain_name; /* domain name unicode string */ UNISTR2 uni_user_name; /* user name unicode string */ - UNISTR2 uni_workgroup_name; /* workgroup name unicode string */ + UNISTR2 uni_wksta_name; /* workgroup name unicode string */ } DOM_ID_INFO_1; @@ -522,7 +522,7 @@ typedef struct sam_info union { - DOM_ID_INFO_1 id1; /* auth-level 1 */ + DOM_ID_INFO_1 *id1; /* auth-level 1 */ } auth; -- cgit From 7e56b5a173df10acfad9c99d59211a0432b2a28e Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 25 Oct 1997 17:38:37 +0000 Subject: added correct client-side credential generation / checking to the LSA SAM Logon query. i think i even got the client-side checking of the response credentials right! (This used to be commit f14c111835e18e361468cc6a1666a02654afe743) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index b19fbfb4ca..1869020c0d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -809,7 +809,7 @@ typedef struct lsa_q_user_info uint32 buffer_groups; /* undocumented buffer pointer to groups. */ uint32 user_flgs; /* user flags */ - char sess_key[16]; /* unused user session key */ + char user_sess_key[16]; /* unused user session key */ UNIHDR hdr_logon_srv; /* logon server unicode string header */ UNIHDR hdr_logon_dom; /* logon domain unicode string header */ -- cgit From 8047228db4d3545da13d87d7b370a38ed0b4c4bb Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 27 Oct 1997 12:02:34 +0000 Subject: Fixed 2 oplock bugs: 1) the oplock macros in smb.h used | where they should have used &. This means that smbd thought that all clients were always requesting oplocks. This would have _really_ confused smbclient and smbfs when they started receiving async oplock break requests when they don't even know what an oplock is! 2) an oplock break request from a client can be embedded in a normal lockingX request, and will be if the client has batched any lock requests internally. The smbd code assumed that all oplock break requests had num_locks==num_ulocks==0 which is not true. The only thing special about a oplock break request with num_locks==num_ulocks==0 is that no reply is sent. Otherwise it is processed as a normal locking request in addition to the oplock break processing. These two fixes get the MS mail system in Win98 working on a Samba 1.9.18 network drive. Andrew (This used to be commit ed71534df56d0296280dbde1859597fb42002088) --- source3/include/smb.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 1869020c0d..7019d41de0 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1804,14 +1804,12 @@ extern int unix_ERR_code; /* * Core protocol. */ -#define CORE_OPLOCK_REQUEST(inbuf) (((CVAL(inbuf,smb_flg)|(1<<5))>>5) | \ - ((CVAL(inbuf,smb_flg)|(1<<6))>>5)) +#define CORE_OPLOCK_REQUEST(inbuf) ((CVAL(inbuf,smb_flg)&((1<<5)|(1<<6)))>>5) /* * Extended protocol. */ -#define EXTENDED_OPLOCK_REQUEST(inbuf) (((SVAL(inbuf,smb_vwv2)|(1<<1))>>1) | \ - ((SVAL(inbuf,smb_vwv2)|(1<<2))>>1)) +#define EXTENDED_OPLOCK_REQUEST(inbuf) ((SVAL(inbuf,smb_vwv2)&((1<<1)|(1<<2)))>>1) /* Lock types. */ #define LOCKING_ANDX_SHARED_LOCK 0x1 -- cgit From 8586dda29b79f041cac2879ecff0afa3283dfca1 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 27 Oct 1997 15:09:23 +0000 Subject: added LSA Open Policy query and response processing to smbclient (This used to be commit 16cc27852bf54999db4b0a3665b0743d9fe0e74a) --- source3/include/smb.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 7019d41de0..e9734f379d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -265,6 +265,7 @@ typedef fstring string; #define PIPE_SRVSVC "\\PIPE\\srvsvc" #define PIPE_NETLOGON "\\PIPE\\NETLOGON" #define PIPE_NTLSA "\\PIPE\\ntlsa" +#define PIPE_LSARPC "\\PIPE\\lsarpc" /* NETLOGON opcodes and data structures */ @@ -579,6 +580,27 @@ typedef struct lsa_policy_info } LSA_POL_HND; +/* OBJ_ATTR (object attributes) */ +typedef struct object_attributes_info +{ + uint32 len; /* 0x18 - length (in bytes) inc. the length field. */ + uint32 ptr_root_dir; /* 0 - root directory (pointer) */ + uint32 ptr_obj_name; /* 0 - object name (pointer) */ + uint32 attributes; /* 0 - attributes (undocumented) */ + uint32 ptr_sec_desc; /* 0 - security descriptior (pointer) */ + uint32 sec_qos; /* 0 - security quality of service */ + +} LSA_OBJ_ATTR; + +/* LSA_Q_OPEN_POL - LSA Query Open Policy */ +typedef struct lsa_q_open_pol_info +{ + UNISTR2 uni_server_name; /* server name, starting with two '\'s */ + LSA_OBJ_ATTR attr ; /* object attributes */ + + uint32 des_access; /* desired access attributes */ + +} LSA_Q_OPEN_POL; /* LSA_R_OPEN_POL - response to LSA Open Policy */ typedef struct lsa_r_open_pol_info -- cgit From aee261e784915df4283e3bffaadac54ee36ec49e Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 27 Oct 1997 19:00:38 +0000 Subject: added LSA_Q_CLOSE and LSA_R_CLOSE (also to smb.h). implemented in smbclient. updated Query Info Policy to report domain name and domain sid for info levels 3 and 5. fixed bug in dom_sid_to_string (idauths decoded wrong). fixed bug in DOM_SID: subauths are 32 bit not 16. (This used to be commit 2f3cca23e2465ca6a3a31fda005af1fd74f6af92) --- source3/include/smb.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index e9734f379d..057a0b7550 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -364,7 +364,7 @@ typedef struct sid_info uint8 sid_rev_num; /* SID revision number */ uint8 num_auths; /* number of sub-authorities */ uint8 id_auth[6]; /* Identifier Authority */ - uint16 sub_auths[MAXSUBAUTHS]; /* pointer to sub-authorities. */ + uint32 sub_auths[MAXSUBAUTHS]; /* pointer to sub-authorities. */ } DOM_SID; @@ -632,10 +632,27 @@ typedef struct lsa_r_query_info } dom; - uint32 status; /* return code */ + uint32 status; /* return code */ } LSA_R_QUERY_INFO; +/* LSA_Q_CLOSE */ +typedef struct lsa_q_close_info +{ + LSA_POL_HND pol; /* policy handle */ + +} LSA_Q_CLOSE; + +/* LSA_R_CLOSE */ +typedef struct lsa_r_close_info +{ + LSA_POL_HND pol; /* policy handle. should be all zeros. */ + + uint32 status; /* return code */ + +} LSA_R_CLOSE; + + #define MAX_REF_DOMAINS 10 /* DOM_R_REF */ -- cgit From c9fa24b7a8809a7963f0970cf2dd21f6804e31a4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 28 Oct 1997 14:19:54 +0000 Subject: SYSV IPC implementation of fast share modes. It will try sysv IPC first, then if that fails it will try mmap(), then after that it will try share files. I have defined USE_SYSV_IPC for Linux, Solaris and HPUX at the moment. Probably a lot more could have it defined. In fact, the vast majority of systems support it. Need autoconf again :-) It should actually be faster than the mmap() version, and doesn't need any lock files. This means the problem of the share mem file being on a NFS drive will be gone. (This used to be commit cc8fe0f0629eea9acc39e30d8d76d5890a5b6978) --- source3/include/smb.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 057a0b7550..d7a576de85 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -46,8 +46,12 @@ /* Default number of hash buckets used in shared memory share mode */ #ifndef SHMEM_HASH_SIZE +#ifdef SEMMSL +#define SHMEM_HASH_SIZE (SEMMSL-1) +#else #define SHMEM_HASH_SIZE 113 #endif +#endif #define NMB_PORT 137 #define DGRAM_PORT 138 @@ -1328,7 +1332,6 @@ struct share_ops { /* each implementation of the shared memory code needs to support the following operations */ struct shmem_ops { - BOOL (*open)(char *, int ); BOOL (*close)( void ); int (*alloc)(int ); BOOL (*free)(int ); -- cgit From e75de8adc6918cc16ad84d2fa32cbc185d5b7fdb Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 28 Oct 1997 14:40:31 +0000 Subject: lower the default hash size if SEMMSL isn't defined (This used to be commit 9f0be847fdbcf0f8bbd69de6cdf277ae0440bcda) --- source3/include/smb.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index d7a576de85..cdd7bcac7a 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -49,7 +49,7 @@ #ifdef SEMMSL #define SHMEM_HASH_SIZE (SEMMSL-1) #else -#define SHMEM_HASH_SIZE 113 +#define SHMEM_HASH_SIZE 15 #endif #endif @@ -1312,9 +1312,6 @@ typedef struct } share_mode_entry; -/* Conversion to hash entry index from device and inode numbers. */ -#define HASH_ENTRY(dev,ino) ((( (uint32)(dev) )* ( (uint32)(ino) )) % lp_shmem_hash_size()) - /* each implementation of the share mode code needs to support the following operations */ struct share_ops { -- cgit From d8e79427c98fdd5eb5a8d57fc6d9b10464fd9882 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 28 Oct 1997 17:54:10 +0000 Subject: smb.h smbparse.c pipeutil.c : added bind and bind ack structures and parsing functions. restructured rpc header stuff. ntclient.c pipenetlog.c pipentlsa.c pipesrvsvc.c : having to deal with restructuring above. (This used to be commit 9f2c4f1fee7e411adba8f529b7666a7325584457) --- source3/include/smb.h | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index cdd7bcac7a..f0ab45fb37 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -552,12 +552,101 @@ typedef struct rpc_hdr_info uint16 frag_len; /* fragment length - data size (bytes) inc header and tail. */ uint16 auth_len; /* 0 - authentication length */ uint32 call_id; /* call identifier. matches 12th uint32 of incoming RPC data. */ + +} RPC_HDR; + +/* RPC_HDR_RR - ms request / response rpc header */ +typedef struct rpc_hdr_rr_info +{ + RPC_HDR hdr; + uint32 alloc_hint; /* allocation hint - data size (bytes) minus header and tail. */ uint16 context_id; /* 0 - presentation context identifier */ uint8 cancel_count; /* 0 - cancel count */ uint8 opnum; /* request: 0 - reserved. response: opnum */ -} RPC_HDR; +} RPC_HDR_RR; + +/* the interfaces are numbered. as yet I haven't seen more than one interface + * used on the same pipe name + * srvsvc + * abstract (0x4B324FC8, 0x01D31670, 0x475A7812, 0x88E16EBF, 0x00000003) + * transfer (0x8A885D04, 0x11C91CEB, 0x0008E89F, 0x6048102B, 0x00000002) + */ +/* RPC_IFACE */ +typedef struct rpc_iface_info +{ + uint8 data[16]; /* 16 bytes of number */ + uint32 version; /* the interface number */ + +} RPC_IFACE; + + +/* this seems to be the same string name depending on the name of the pipe, + * but is more likely to be linked to the interface name + * "srvsvc", "\\PIPE\\ntsvcs" + * "samr", "\\PIPE\\lsass" + * "wkssvc", "\\PIPE\\wksvcs" + * "NETLOGON", "\\PIPE\\NETLOGON" + */ +/* RPC_ADDR_STR */ +typedef struct rpc_addr_info +{ + uint16 len; /* length of the string including null terminator */ + fstring addr; /* the string above in single byte, null terminated form */ + +} RPC_ADDR_STR; + +/* RPC_HDR_BBA */ +typedef struct rpc_hdr_bba_info +{ + uint16 max_tsize; /* maximum transmission fragment size (0x1630) */ + uint16 max_rsize; /* max receive fragment size (0x1630) */ + uint32 assoc_gid; /* associated group id (0x0) */ + +} RPC_HDR_BBA; + +/* RPC_HDR_RB - ms req bind header */ +typedef struct rpc_hdr_rb_info +{ + RPC_HDR hdr; + RPC_HDR_BBA bba; + + uint32 num_elements; /* the number of elements (0x1) */ + uint16 context_id; /* presentation context identifier (0x0) */ + uint8 num_syntaxes; /* the number of syntaxes (has always been 1?)(0x1) */ + + RPC_IFACE abstract; /* num and vers. of interface client is using */ + RPC_IFACE transfer; /* num and vers. of interface to use for replies */ + +} RPC_HDR_RB; + +/* RPC_RESULTS - can only cope with one reason, right now... */ +typedef struct rpc_results_info +{ +/* uint8[] # 4-byte alignment padding, against SMB header */ + + uint8 num_results; /* the number of results (0x01) */ + +/* uint8[] # 4-byte alignment padding, against SMB header */ + + uint16 result; /* result (0x00 = accept) */ + uint16 reason; /* reason (0x00 = no reason specified) */ + +} RPC_RESULTS; + +/* RPC_HDR_BA */ +typedef struct rpc_hdr_ba_info +{ + RPC_HDR hdr; + RPC_HDR_BBA bba; + + RPC_ADDR_STR addr ; /* the secondary address string, as described earlier */ + RPC_RESULTS res ; /* results and reasons */ + RPC_IFACE transfer; /* the transfer syntax from the request */ + +} RPC_HDR_BA; + /* DOM_QUERY - info class 3 and 5 LSA Query response */ typedef struct dom_query_info -- cgit From fe0a702322bdf3c76a517e2fd7e92a05219c49dd Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 29 Oct 1997 00:04:14 +0000 Subject: byteorder.h : added mode for printing debug array data as chars not uint8/16/32s. only really useful for (uint8) strings or (uint16) unicode strings lsaparse.c smbparse.c smb.h : rpc bind and rpc bind ack structures and parsing and creation functions. ipc.c pipes.c pipenetlog.c pipentlsa.c pipesrvsvc.c : using rpc bind / bind ack parsing routines instead of incorrect use of api_LsarpcTNP1 function. ntclient.c : creation of do_rpc_bind() function. THAT'S IT, FOLKS! (This used to be commit 21c89e2f17c51939fd6b53dddbe3072419eb0db2) --- source3/include/smb.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index f0ab45fb37..24cb279f43 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -606,10 +606,9 @@ typedef struct rpc_hdr_bba_info } RPC_HDR_BBA; -/* RPC_HDR_RB - ms req bind header */ -typedef struct rpc_hdr_rb_info +/* RPC_BIND_REQ - ms req bind */ +typedef struct rpc_bind_req_info { - RPC_HDR hdr; RPC_HDR_BBA bba; uint32 num_elements; /* the number of elements (0x1) */ @@ -638,7 +637,6 @@ typedef struct rpc_results_info /* RPC_HDR_BA */ typedef struct rpc_hdr_ba_info { - RPC_HDR hdr; RPC_HDR_BBA bba; RPC_ADDR_STR addr ; /* the secondary address string, as described earlier */ -- cgit From 4fd96fddd2b13f60c4eb13263bac2a62a2795dcc Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 29 Oct 1997 01:59:54 +0000 Subject: clean up the hash entry code a bit. Got rid of lp_shmem_hash_size() and made it private to the 2 shmem implementations. Added new shmops->hash_size() function. Added code to handle the IPC system limits by looping decreasing the size of the resources (semaphores and shared memory) that we request until we get under the system limits, which can be quite low on some systems! Added checks that the creator of the IPC objects is root. Otherwise we would be open to a security hole where someone pre-creates the shared memory segment and attaches. (This used to be commit 6b6f624b63137d4750200e8cb4961b1402513632) --- source3/include/smb.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 24cb279f43..ab1ff0557f 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -44,15 +44,6 @@ #define SHMEM_SIZE 102400 #endif -/* Default number of hash buckets used in shared memory share mode */ -#ifndef SHMEM_HASH_SIZE -#ifdef SEMMSL -#define SHMEM_HASH_SIZE (SEMMSL-1) -#else -#define SHMEM_HASH_SIZE 15 -#endif -#endif - #define NMB_PORT 137 #define DGRAM_PORT 138 #define SMB_PORT 139 @@ -1425,6 +1416,7 @@ struct shmem_ops { BOOL (*lock_hash_entry)(unsigned int); BOOL (*unlock_hash_entry)( unsigned int ); BOOL (*get_usage)(int *,int *,int *); + unsigned (*hash_size)(void); }; -- cgit From a2cbf43a6d6166ac35513e2cc78b98736345181e Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 29 Oct 1997 13:24:42 +0000 Subject: split ntclient.c down into appropriate modules. (This used to be commit 50d7e4d6f6b5d770742ee83523d6146cf51f8259) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index ab1ff0557f..62c3fec19d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -584,7 +584,7 @@ typedef struct rpc_iface_info typedef struct rpc_addr_info { uint16 len; /* length of the string including null terminator */ - fstring addr; /* the string above in single byte, null terminated form */ + fstring str; /* the string above in single byte, null terminated form */ } RPC_ADDR_STR; -- cgit From 520878fd1f440a7313cedb4827bdc81454d94d20 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 29 Oct 1997 19:05:34 +0000 Subject: ipc.c ntclientpipe.c: response to Bind Acknowledgment needs a lookup table for the PIPE string (secondary address in RPC_HDR_BA structure). smbparse.c util.c : interesting problem, i think caused by us typecasting a uint16* buffer to char*. found on a SPARC. (This used to be commit 420408ee83902faa6cf871f26e93ad5efb483727) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 62c3fec19d..9b54385eee 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -260,6 +260,7 @@ typedef fstring string; #define PIPE_SRVSVC "\\PIPE\\srvsvc" #define PIPE_NETLOGON "\\PIPE\\NETLOGON" #define PIPE_NTLSA "\\PIPE\\ntlsa" +#define PIPE_LSASS "\\PIPE\\lsass" #define PIPE_LSARPC "\\PIPE\\lsarpc" /* NETLOGON opcodes and data structures */ -- cgit From a275e5d4e16142a9924f8b97980f364a80df3b64 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 30 Oct 1997 01:05:13 +0000 Subject: removed mechanism that created actual files NETLOGON, lsarpc and the like, which are pipes on the IPC$ connection. created mechanism to record pipe names in a separate pipes_struct. it is planned to expand this, to return sensible things like interface structures, and policy handles (RPC_IFACE and LSA_POL_HND). and the like. (This used to be commit 33cce5fac0e2f818a19a6c4e6a797ef44f3b5c75) --- source3/include/smb.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 9b54385eee..8f0bd31bf4 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -297,6 +297,7 @@ enum RPC_PKT_TYPE #define LSA_REQCHAL 0x04 #define LSA_SRVPWSET 0x06 #define LSA_SAMLOGON 0x02 +#define LSA_SAMLOGOFF 0x03 #define LSA_AUTH2 0x0f #define LSA_CLOSE 0x00 @@ -304,7 +305,6 @@ enum RPC_PKT_TYPE #define LSA_OPENSECRET 0xFF #define LSA_LOOKUPSIDS 0xFE #define LSA_LOOKUPNAMES 0xFD -#define LSA_SAMLOGOFF 0xFC /* srvsvc pipe */ #define NETSERVERGETINFO 0x15 @@ -678,6 +678,7 @@ typedef struct object_attributes_info /* LSA_Q_OPEN_POL - LSA Query Open Policy */ typedef struct lsa_q_open_pol_info { + uint32 ptr; /* undocumented buffer pointer */ UNISTR2 uni_server_name; /* server name, starting with two '\'s */ LSA_OBJ_ATTR attr ; /* object attributes */ -- cgit From 264b1e0e75ae63467b6fe51b339e1e5f3c4477bc Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 1 Nov 1997 07:33:55 +0000 Subject: some locking code cleanups (This used to be commit 6d77311d6cecabafb86c02e26b30724425ef6208) --- source3/include/smb.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 8f0bd31bf4..8bb1e993cd 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -57,9 +57,6 @@ typedef int BOOL; -/* offset in shared memory */ -#define NULL_OFFSET (int)(0) - /* limiting size of ipc replies */ #define REALLOC(ptr,size) Realloc(ptr,MAX((size),4*1024)) -- cgit From 4012c1cc8f47c7b3271a76a362ed2e4be4e8405c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 2 Nov 1997 04:01:57 +0000 Subject: convert the credentials code back to uchar[8] from uint32[2] This should fix the byte order problems (maybe!) (This used to be commit 21878e7d8628d05786c3c76f2943e31df1096577) --- source3/include/smb.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 8bb1e993cd..6a7f502286 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -443,8 +443,7 @@ typedef struct log_info /* DOM_CHAL - challenge info */ typedef struct chal_info { - uint32 data[2]; /* credentials */ - + uchar data[8]; /* credentials */ } DOM_CHAL; /* DOM_CREDs - timestamped client or server credentials */ @@ -1308,7 +1307,7 @@ struct dcinfo DOM_CRED clnt_cred; /* Last client credential */ DOM_CRED srv_cred; /* Last server credential */ - uint32 sess_key[2]; /* Session key */ + uchar sess_key[8]; /* Session key */ uchar md4pw[16]; /* md4(machine password) */ }; -- cgit From 028679f144d5321e0dfa4bc0840b54388b9d59d1 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 4 Nov 1997 20:27:08 +0000 Subject: smb.h : LSA_OPENSECRET and three other unknown #defines are commented as not being the real defines for these!!! rpc_pipes/pipenetlog.c : USE_ARCFOUR for Server Password Set. and then ignore the password (agh!) this will *fail* to do logins, by the way. i need to add a routine to update the smb password (next job). (This used to be commit b9d26344cc9b64ef3578931d099d52eab080fdd3) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 6a7f502286..892c31be97 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -298,7 +298,7 @@ enum RPC_PKT_TYPE #define LSA_AUTH2 0x0f #define LSA_CLOSE 0x00 -/* unknown .... */ +/* XXXX these are just here to get a compile!!! */ #define LSA_OPENSECRET 0xFF #define LSA_LOOKUPSIDS 0xFE #define LSA_LOOKUPNAMES 0xFD -- cgit From bd529d7a83c35be233baca09bc79aa911ad443ce Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 6 Nov 1997 23:03:58 +0000 Subject: following a cvs error, i am rewriting this monster-commit. with bad grace. Modified Files: --------------- Makefile: adding extra files ipc.c : send_trans_reply() - alignment issue. this makes the alignment the same as that in NT. this should be looked at by people who understand the SMB stuff better than i. api_fd_commands[] - added samr and wkssvc pipes. loadparm.c : lp_domain_controller() changed to mean "samba is a domain controller". it's a "yes/no" parameter, now. no, it isn't used _anywhere_. namedbwork.c nameelect.c : if "domain controller = yes" then add SV_TYPE_DOMAIN_CTRL to the host _and_ workgroup announcements. yes, you must do both: nt does. namelogon.c : important NETLOGON bug in SAMLOGON request parsing, which may be the source of some people's problems with logging on to the Samba PDC. password.c : get_smbpwnam() renamed to get_smbpwd_entry(). pipes.c : added samr and wkssvc pipes. proto.h : usual. can we actually _remove_ proto.h from the cvs tree, and have it as one of the Makefile dependencies, or something? reply.c : get_smbpwnam() renamed to get_smbpwd_entry() - also changed response error code when logging in from a WORKSTATION$ account. yes, paul is right: we need to know when to return the right error code, and why. server.c : added call to reset_chain_pnum(). #ifdef NTDOMAIN added call to init_lsa_policy_hnd() #endif. jeremy, you'd be proud: i did a compile without NTDOMAIN, and caught a link error for this function. smb.h : defines and structures for samr and wkssvc pipes. smbpass.c : modified get_smbpwnam() to get_smbpwd_entry() and it now takes two arguments. one for the name; if this is null, it looks up by smb_userid instead. oh, by the way, smb_userids are actually domain relative ids (RIDs). concatenate a RID with the domain SID, and you have an internet globally unique way of identifying a user. we're using RIDs in the wrong way.... added mod_smbpwnam() function. this was based on code in smbpasswd.c rpc_pipes/lsaparse.c : added enum trusted domain parsing. this is incomplete: i need a packet trace to write it properly. rpc_pipes/pipe_hnd.c : added reset_chain_pnum() function. rpc_pipes/pipenetlog.c : get_smbpwnam() function renamed to get_smbpwd_entry(). arcfour() issues. removed capability of get_md4pw() function to automatically add workstation accounts. this should either be done using smbpasswd -add MACHINE$, or by using \PIPE\samr. rpc_pipes/pipe_util.c : create_pol_hnd() - creates a unique LSA Policy Handle. overkill function: uses a 64 bit sequence number; current unix time and the smbd pid. rpc_pipes/smbparse.c : arcfour() issues. smb_io_unistr2() should advance by uni_str_len not uni_max_len. smb_io_smb_hdr_rb() - request bind uses uint16 for the context id, and uint8 for the num_syntaxes. oops, i put these both as uint32s. Added Files: ------------ rpc_pipes/lsa_hnd.c : on the samr pipe, allocate and associate an LSA Policy Handle with a SID. you receive queries with the LSA Policy Handle, and have to turn this back into a SID in order to answer the query... rpc_pipes/pipesamr.c rpc_pipes/samrparse.c \PIPE\samr processing. samr i presume is the SAM Replication pipe. rpc_pipes/pipewkssvc.c rpc_pipes/wksparse.c \PIPE\wkssvc processing. the Workstation Service pipe? holy cow. (This used to be commit 1bd084b3e690eb26a1006d616075e53d711ecd2f) --- source3/include/smb.h | 314 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 252 insertions(+), 62 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 892c31be97..83e1d9f85d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -255,8 +255,11 @@ typedef fstring string; /* pipe strings */ #define PIPE_LANMAN "\\PIPE\\LANMAN" #define PIPE_SRVSVC "\\PIPE\\srvsvc" +#define PIPE_SAMR "\\PIPE\\samr" +#define PIPE_WKSSVC "\\PIPE\\wkssvc" #define PIPE_NETLOGON "\\PIPE\\NETLOGON" #define PIPE_NTLSA "\\PIPE\\ntlsa" +#define PIPE_NTSVCS "\\PIPE\\ntsvcs" #define PIPE_LSASS "\\PIPE\\lsass" #define PIPE_LSARPC "\\PIPE\\lsarpc" @@ -288,6 +291,15 @@ enum RPC_PKT_TYPE #define ACB_PWNOEXP /* 1 = User password does not expire */ #define ACB_AUTOLOCK /* 1 = Account auto locked */ +#define SAMR_CLOSE 0x01 +#define SAMR_OPEN_SECRET 0x07 +#define SAMR_LOOKUPNAMES 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 LSA_OPENPOLICY 0x2c #define LSA_QUERYINFOPOLICY 0x07 #define LSA_ENUMTRUSTDOM 0x0d @@ -298,10 +310,12 @@ enum RPC_PKT_TYPE #define LSA_AUTH2 0x0f #define LSA_CLOSE 0x00 -/* XXXX these are just here to get a compile!!! */ +/* XXXX these are here to get a compile! */ + #define LSA_OPENSECRET 0xFF #define LSA_LOOKUPSIDS 0xFE -#define LSA_LOOKUPNAMES 0xFD +#define LSA_LOOKUPRIDS 0xFD +#define LSA_LOOKUPNAMES 0xFC /* srvsvc pipe */ #define NETSERVERGETINFO 0x15 @@ -716,6 +730,24 @@ typedef struct lsa_r_query_info } LSA_R_QUERY_INFO; +/* LSA_Q_ENUM_TRUST_DOM - LSA enumerate trusted domains */ +typedef struct lsa_enum_trust_dom_info +{ + LSA_POL_HND pol; /* policy handle */ + uint32 enum_context; /* enumeration context handle */ + uint32 preferred_len; /* preferred maximum length */ + +} LSA_Q_ENUM_TRUST_DOM; + +/* LSA_R_ENUM_TRUST_DOM - response to LSA enumerate trusted domains */ +typedef struct lsa_r_enum_trust_dom_info +{ + LSA_POL_HND pol; /* policy handle */ + + uint32 status; /* return code */ + +} LSA_R_ENUM_TRUST_DOM; + /* LSA_Q_CLOSE */ typedef struct lsa_q_close_info { @@ -1074,69 +1106,227 @@ typedef struct r_net_share_enum_info } SRV_R_NET_SHARE_ENUM; +/* SAMR_Q_CLOSE - probably a policy handle close */ +typedef struct q_samr_close_info +{ + LSA_POL_HND pol; /* policy handle */ + +} SAMR_Q_CLOSE; -/* -Yet to be turned into structures: - -6) \\MAILSLOT\NET\NTLOGON -------------------------- - -6.1) Query for PDC ------------------- - -Request: - - uint16 0x0007 - Query for PDC - STR machine name - STR response mailslot - uint8[] padding to 2-byte align with start of mailslot. - UNISTR machine name - uint32 NTversion - uint16 LMNTtoken - uint16 LM20token - -Response: - - uint16 0x000A - Respose to Query for PDC - STR machine name (in uppercase) - uint8[] padding to 2-byte align with start of mailslot. - UNISTR machine name - UNISTR domain name - uint32 NTversion (same as received in request) - uint16 LMNTtoken (same as received in request) - uint16 LM20token (same as received in request) - - -6.2) SAM Logon --------------- - -Request: - - uint16 0x0012 - SAM Logon - uint16 request count - UNISTR machine name - UNISTR user name - STR response mailslot - uint32 alloweable account - uint32 domain SID size - char[sid_size] domain SID, of sid_size bytes. - uint8[] ???? padding to 4? 2? -byte align with start of mailslot. - uint32 NTversion - uint16 LMNTtoken - uint16 LM20token - -Response: +/* SAMR_R_CLOSE - probably a policy handle close */ +typedef struct r_samr_close_info +{ + LSA_POL_HND pol; /* policy handle */ + uint32 status; /* return status */ - uint16 0x0013 - Response to SAM Logon - UNISTR machine name - UNISTR user name - workstation trust account - UNISTR domain name - uint32 NTversion - uint16 LMNTtoken - uint16 LM20token +} SAMR_R_CLOSE; -*/ + +/**************************************************************************** +SAMR_Q_OPEN_SECRET - unknown_0 values seen associated with SIDs: + +0x0000 0200 and a specific domain sid - S-1-5-21-44c01ca6-797e5c3d-33f83fd0 +0x0000 0280 and a well-known domain sid - S-1-5-20 +0x2000 0000 and a well-known domain sid - S-1-5-20 +0x2000 0000 and a specific domain sid - S-1-5-21-44c01ca6-797e5c3d-33f83fd0 +*****************************************************************************/ + +/* SAMR_Q_OPEN_SECRET - probably an open secret */ +typedef struct q_samr_open_secret_info +{ + LSA_POL_HND pol; /* policy handle */ + uint32 unknown_0; /* 0x2000 0000; 0x0000 0211; 0x0000 0280; 0x0000 0200 - unknown */ + DOM_SID dom_sid; /* domain SID */ + +} SAMR_Q_OPEN_SECRET; + + +/* SAMR_R_OPEN_SECRET - probably an open */ +typedef struct r_samr_open_secret_info +{ + LSA_POL_HND pol; /* policy handle associated with the SID */ + uint32 status; /* return status */ + +} SAMR_R_OPEN_SECRET; + + +/* SAMR_Q_UNKNOWN_11 - probably a "read SAM entry" */ +typedef struct q_samr_unknown_11_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? */ + + UNIHDR hdr_mach_acct; /* unicode machine account name header */ + UNISTR2 uni_mach_acct; /* unicode machine account name */ + +} SAMR_Q_UNKNOWN_11; + + +/* SAMR_R_UNKNOWN_11 - probably an open */ +typedef struct r_samr_unknown_11_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 status; /* return status - 0x99: user exists */ + +} SAMR_R_UNKNOWN_11; + + +/* SAMR_Q_UNKNOWN_22 - probably an open */ +typedef struct q_samr_unknown_22_info +{ + LSA_POL_HND pol; /* policy handle */ + uint32 unknown_id_0; /* 0x0000 03E8 - 32 bit unknown id */ + +} SAMR_Q_UNKNOWN_22; + + +/* SAMR_R_UNKNOWN_22 - probably an open */ +typedef struct r_samr_unknown_22_info +{ + LSA_POL_HND pol; /* policy handle associated with unknown id */ + uint32 status; /* return status */ + +} SAMR_R_UNKNOWN_22; + + +/* SAMR_Q_UNKNOWN_24 - probably a get sam info */ +typedef struct q_samr_unknown_24_info +{ + LSA_POL_HND pol; /* policy handle associated with unknown id */ + uint16 unknown_0; /* 0x0015 or 0x0011 - 16 bit unknown */ + +} SAMR_Q_UNKNOWN_24; + + +/* SAMR_R_UNKNOWN_24 - probably a get sam info */ +typedef struct r_samr_unknown_24_info +{ + uint32 ptr; /* pointer */ + uint16 unknown_0; /* 0x0015 or 0x0011 - 16 bit unknown (same as above) */ + uint16 unknown_1; /* 0x8b73 - 16 bit unknown */ + uint8 padding_0[16]; /* 0 - padding 16 bytes */ + NTTIME expiry; /* expiry time or something? */ + uint8 padding_1[24]; /* 0 - padding 24 bytes */ + + UNIHDR hdr_mach_acct; /* unicode header for machine account */ + uint32 padding_2; /* 0 - padding 4 bytes */ + + uint32 ptr_1; /* pointer */ + uint8 padding_3[32]; /* 0 - padding 32 bytes */ + uint32 padding_4; /* 0 - padding 4 bytes */ + + uint32 ptr_2; /* pointer */ + uint32 padding_5; /* 0 - padding 4 bytes */ + + uint32 ptr_3; /* pointer */ + uint8 padding_6[32]; /* 0 - padding 32 bytes */ + + uint32 unknown_id_0; /* unknown id associated with policy handle */ + uint16 unknown_2; /* 0x0201 - 16 bit unknown */ + uint32 unknown_3; /* 0x0000 0080 - 32 bit unknown */ + uint16 unknown_4; /* 0x003f - 16 bit unknown */ + uint16 unknown_5; /* 0x003c - 16 bit unknown */ + + uint8 padding_7[16]; /* 0 - padding 16 bytes */ + uint32 padding_8; /* 0 - padding 4 bytes */ + + UNISTR2 uni_mach_acct; /* unicode string for machine account */ + + uint8 padding_9[48]; /* 0 - padding 48 bytes */ + + uint32 status; /* return status */ + +} SAMR_R_UNKNOWN_24; + + +/* SAMR_Q_UNKNOWN_32 - probably a "create SAM entry" */ +typedef struct q_samr_unknown_32_info +{ + LSA_POL_HND pol; /* policy handle */ + + UNIHDR hdr_mach_acct; /* unicode machine account name header */ + UNISTR2 uni_mach_acct; /* unicode machine account name */ + + uint32 unknown_0; /* 32 bit unknown */ + uint16 unknown_1; /* 16 bit unknown */ + uint16 unknown_2; /* 16 bit unknown */ + +} SAMR_Q_UNKNOWN_32; + + +/* SAMR_R_UNKNOWN_32 - probably a "create SAM entry" */ +typedef struct r_samr_unknown_32_info +{ + LSA_POL_HND pol; /* policy handle */ + uint32 unknown_0; /* 0x0000 0030 - 32 bit unknown */ + uint32 padding; /* 0 - 4 byte padding */ + + uint32 status; /* return status - 0xC000 0099: user exists */ + +} SAMR_R_UNKNOWN_32; + + +/* SAMR_Q_UNKNOWN_39 - probably an open */ +typedef struct q_samr_unknown_39_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_R_UNKNOWN_39 - probably an open */ +typedef struct r_samr_unknown_39_info +{ + LSA_POL_HND pol; /* policy handle */ + uint32 status; /* return status */ + +} SAMR_R_UNKNOWN_39; + + +/* WKS_Q_UNKNOWN_0 - probably a capabilities request */ +typedef struct q_wks_unknown_0_info +{ + uint32 ptr_srv_name; /* pointer (to server name?) */ + UNISTR2 uni_srv_name; /* unicode server name starting with '\\' */ + + uint32 unknown_0; /* 0x64 - 32 bit unknown */ + uint16 unknown_1; /* 16 bit unknown */ + +} WKS_Q_UNKNOWN_0; + + +/* WKS_R_UNKNOWN_0 - probably a capabilities request */ +typedef struct r_wks_unknown_0_info +{ + uint32 unknown_0; /* 64 - unknown */ + uint32 ptr_1; /* pointer 1 */ + uint32 unknown_1; /* 0x0000 01f4 - unknown */ + uint32 ptr_srv_name; /* pointer to server name */ + uint32 ptr_dom_name; /* pointer to domain name */ + uint32 unknown_2; /* 4 - unknown */ + uint32 unknown_3; /* 0 - unknown */ + + UNISTR2 uni_srv_name; /* unicode server name */ + UNISTR2 uni_dom_name; /* unicode domainn name */ + uint32 status; /* return status */ + +} WKS_R_UNKNOWN_0; struct smb_passwd @@ -1148,7 +1338,6 @@ struct smb_passwd /* Other fields / flags may be added later */ }; - struct cli_state { int fd; int cnum; @@ -1175,6 +1364,7 @@ struct cli_state { int initialised; }; + struct current_user { int cnum, id; -- cgit From b9c6add64536e855156a00e32e5288486114e66e Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 7 Nov 1997 03:28:43 +0000 Subject: ipc.c : added a #define around the alignment thing: it's a way to stop NetMonitor from decoding your packets!!!! proto.h : usual. reply.c : added what i believe to be the correct error messages for getting correct domain joining. smb.h : some guesses at good names of the SAMR_XXXX functions. sorting out the SAMR_LOOKUP_RIDS function. this is *not* the same as the LSA_LOOKUP_RIDS function, unless paul accidentally put it on the ntlsa pipe by mistake, instead of the samr pipe :-) rpc_pipes/lsa_hnd.c rpc_pipes/pipe_hnd.c : moved creation and allocation of unique policy handles into this module. rpc_pipes/pipesamr.c rpc_pipes/samrparse.c rpc_pipes/smbparse.c : SAMR_LOOKUP_RIDS is beginning to look _suspiciously_ like the LSA_LOOKUP_RIDS function. but i know that there are subtle discrepancies. (This used to be commit 6bc07b0b4193e28b13a675fece8d9d6b365a7eb0) --- source3/include/smb.h | 76 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 30 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 83e1d9f85d..afa9e3d9b9 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -293,12 +293,12 @@ enum RPC_PKT_TYPE #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 @@ -423,16 +423,26 @@ typedef struct domsid2_info } 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 { @@ -841,7 +851,7 @@ typedef struct lsa_q_lookup_rids } 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 */ @@ -1151,37 +1161,43 @@ typedef struct r_samr_open_secret_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; + + uint32 status; /* return code */ -} SAMR_R_UNKNOWN_11; +} SAMR_R_LOOKUP_RIDS; /* SAMR_Q_UNKNOWN_22 - probably an open */ @@ -1279,24 +1295,24 @@ typedef struct r_samr_unknown_32_info } 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 */ -- cgit From e357d9106895b165bfa3f8331b9f186004c9a6cd Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 9 Nov 1997 17:30:10 +0000 Subject: attempting to mark up 32 bit error codes, needed for NT domains. separated out smb server-mode password validation into a separate file. added called and calling netbios names to client gen state: referenced section in rfc1002.txt. created workstation trust account checking code in ntclient.c there might be a bug in reply_session_setup_andX. i indented and added { } around single-line if statements: the lm password checking code now doesn't look right (around the GUEST_SESSSETUP bits). *no code semantics have been changed by the indentation process*. (This used to be commit f27966957fa7f16d337a4a58719239d036deab4c) --- source3/include/smb.h | 50 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 6 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index afa9e3d9b9..687f14b9ca 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1363,9 +1363,13 @@ struct cli_state { int protocol; int sec_mode; int error; - int privilages; + int privileges; fstring eff_name; - fstring desthost; + + fstring full_dest_host_name; + char called_netbios_name[16]; + char calling_netbios_name[16]; + char cryptkey[8]; uint32 sesskey; int serverzone; @@ -2020,6 +2024,15 @@ char *Strstr(char *s, char *p); #define BROWSER_CONSTANT 0xaa55 +/* NT Flags2 bits - cifs6.txt section 3.1.2 */ + +#define FLAGS2_LONG_PATH_COMPONENTS 0x0001 +#define FLAGS2_EXTENDED_ATTRIBUTES 0x0002 +#define FLAGS2_DFS_PATHNAMES 0x1000 +#define FLAGS2_READ_PERMIT_NO_EXECUTE 0x2000 +#define FLAGS2_32_BIT_ERROR_CODES 0x4000 +#define FLAGS2_UNICODE_STRINGS 0x8000 + /* Capabilities. see ftp.microsoft.com/developr/drg/cifs/cifs/cifs4.txt */ #define CAP_RAW_MODE 0x0001 @@ -2037,14 +2050,39 @@ char *Strstr(char *s, char *p); /* protocol types. It assumes that higher protocols include lower protocols as subsets */ -enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANMAN1,PROTOCOL_LANMAN2,PROTOCOL_NT1}; +enum protocol_types +{ + PROTOCOL_NONE, + PROTOCOL_CORE, + PROTOCOL_COREPLUS, + PROTOCOL_LANMAN1, + PROTOCOL_LANMAN2, + PROTOCOL_NT1 +}; /* security levels */ -enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER}; +enum security_types +{ + SEC_SHARE, + SEC_USER, + SEC_SERVER +}; + +/* bit-masks for security mode. see cifs6.txt Negprot 4.1.1 server response */ +#define USE_USER_LEVEL_SECURITY 1 +#define USE_CHALLENGE_RESPONSE 2 /* printing types */ -enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX, - PRINT_QNX,PRINT_PLP,PRINT_LPRNG}; +enum printing_types +{ + PRINT_BSD, + PRINT_SYSV, + PRINT_AIX, + PRINT_HPUX, + PRINT_QNX, + PRINT_PLP, + PRINT_LPRNG +}; /* Remote architectures we know about. */ enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_SAMBA}; -- cgit From 77aec4ae6307c0ad0b843bbf23d64ccb1aaf7476 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 10 Nov 1997 19:23:17 +0000 Subject: Rolled back tree state to 11:59pm 8th November 1997 EST to remove problems. Jeremy (This used to be commit 4a36ac236c2ad634f05efcd0179875d09988614a) --- source3/include/smb.h | 50 ++++++-------------------------------------------- 1 file changed, 6 insertions(+), 44 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 687f14b9ca..afa9e3d9b9 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1363,13 +1363,9 @@ struct cli_state { int protocol; int sec_mode; int error; - int privileges; + int privilages; fstring eff_name; - - fstring full_dest_host_name; - char called_netbios_name[16]; - char calling_netbios_name[16]; - + fstring desthost; char cryptkey[8]; uint32 sesskey; int serverzone; @@ -2024,15 +2020,6 @@ char *Strstr(char *s, char *p); #define BROWSER_CONSTANT 0xaa55 -/* NT Flags2 bits - cifs6.txt section 3.1.2 */ - -#define FLAGS2_LONG_PATH_COMPONENTS 0x0001 -#define FLAGS2_EXTENDED_ATTRIBUTES 0x0002 -#define FLAGS2_DFS_PATHNAMES 0x1000 -#define FLAGS2_READ_PERMIT_NO_EXECUTE 0x2000 -#define FLAGS2_32_BIT_ERROR_CODES 0x4000 -#define FLAGS2_UNICODE_STRINGS 0x8000 - /* Capabilities. see ftp.microsoft.com/developr/drg/cifs/cifs/cifs4.txt */ #define CAP_RAW_MODE 0x0001 @@ -2050,39 +2037,14 @@ char *Strstr(char *s, char *p); /* protocol types. It assumes that higher protocols include lower protocols as subsets */ -enum protocol_types -{ - PROTOCOL_NONE, - PROTOCOL_CORE, - PROTOCOL_COREPLUS, - PROTOCOL_LANMAN1, - PROTOCOL_LANMAN2, - PROTOCOL_NT1 -}; +enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANMAN1,PROTOCOL_LANMAN2,PROTOCOL_NT1}; /* security levels */ -enum security_types -{ - SEC_SHARE, - SEC_USER, - SEC_SERVER -}; - -/* bit-masks for security mode. see cifs6.txt Negprot 4.1.1 server response */ -#define USE_USER_LEVEL_SECURITY 1 -#define USE_CHALLENGE_RESPONSE 2 +enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER}; /* printing types */ -enum printing_types -{ - PRINT_BSD, - PRINT_SYSV, - PRINT_AIX, - PRINT_HPUX, - PRINT_QNX, - PRINT_PLP, - PRINT_LPRNG -}; +enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX, + PRINT_QNX,PRINT_PLP,PRINT_LPRNG}; /* Remote architectures we know about. */ enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_SAMBA}; -- cgit From 9f804556c4d0bb68f9b7acaf2b679bc0a02ea8f9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 17 Nov 1997 19:16:38 +0000 Subject: loadparm.c : Added "veto oplock files" parameter. make_printerdef.c: Fixed warning. quotas.c: Fixed irix root errors. server.c: Fixed oplock reference count bug. smb.h: Added IS_VETO_OPLOCK_PATH(). Jeremy. (This used to be commit c28487df63e29bc0f8d2ece876a07a2a076d4c73) --- source3/include/smb.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index afa9e3d9b9..6056ccd70f 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1502,6 +1502,7 @@ typedef 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; @@ -1680,6 +1681,7 @@ struct connect_record #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()) -- cgit From 7f2cd86196efd218b13b7d0d1f9a2b4fc0811760 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 28 Nov 1997 05:48:48 +0000 Subject: get_entries is an int not a bool (This used to be commit 84215c9b91f3c5130b172a3bbc83c7ddd66c5cb8) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 6056ccd70f..49854a2512 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1601,7 +1601,7 @@ struct share_ops { 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); -- cgit From cf9d07cc7d41627a59ea3bec5ba2b9eebb894ab5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 29 Nov 1997 02:40:31 +0000 Subject: added a sent_oplock_break element to Files[] as a paranoia check so we can't sent a oplock break twice on the same file. changed some debug levels in the oplock code to level 0 so we can track down a bug zero the returned Files[] entry in find_free_file() don't try to overcome client bugs in the handling of non-encrypted passwords if in server level security mode added paranoid null termination of password buffers slight change to my ajt_panic() routine (This used to be commit e360c79c9cec681c4609783019749773d3e79386) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 49854a2512..bd60c1077a 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1454,6 +1454,7 @@ typedef struct BOOL print_file; BOOL modified; BOOL granted_oplock; + BOOL sent_oplock_break; char *name; } files_struct; -- cgit From c65bcc26f7dbe608837eea200a99019aefa06a63 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 2 Dec 1997 23:26:42 +0000 Subject: get rid of some things out of smb.h that are already in local.h (This used to be commit d55df52487ca6786f1635276b2787857a772219a) --- source3/include/smb.h | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index bd60c1077a..e464809fa0 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -24,18 +24,6 @@ #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 -- cgit From 28f37efd349a3199954060700b3239aed4f3c9e2 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 4 Dec 1997 07:41:48 +0000 Subject: don't use free and alloc as structure elements (This used to be commit f7066355b00a169423b4f64f58567e19b52abc1b) --- source3/include/smb.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index e464809fa0..401459becc 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1601,9 +1601,9 @@ struct share_ops { /* 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); -- cgit From 8d50079a6e2d25e6a09d4830e140f83c6917acf2 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 5 Jan 1998 22:54:32 +0000 Subject: Added 3 commands: smbmount: This is a stripped down smbclient that communicates with the Linux 2.1.x kernel to supply authenticated smb connections for smbfs mount points. smbmnt/smbumount: setuid commands that do the actual smb mount system call after having done the appropriate security checks (This used to be commit ccbbc4e647ad900b215dae949d5bcd45671c68c8) --- source3/include/smb.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 401459becc..ebf0945855 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1628,6 +1628,25 @@ struct connect_record 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 */ -- cgit From 221fda2454396fa6c3d2b820d81c56b4cdc48f13 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 12 Jan 1998 00:20:10 +0000 Subject: *** empty log message *** (This used to be commit 7b031586ca33a381eb0e27f3557f43c2550df5f8) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index ebf0945855..e6c0565b05 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1443,6 +1443,7 @@ typedef struct BOOL modified; BOOL granted_oplock; BOOL sent_oplock_break; + BOOL reserved; char *name; } files_struct; -- cgit From 55f400bd84f26027f5ec9b7fa06b22895de7557c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 22 Jan 1998 13:27:43 +0000 Subject: This is *not* a big change (although it looks like one). This is merely updating the Copyright statements from 1997 to 1998. It's a once a year thing :-). NO OTHER CHANGES WERE MADE. Jeremy. (This used to be commit b9c16977231efb274e08856f7f3f4408dad6d96c) --- source3/include/smb.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index e6c0565b05..9c55e3f8be 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -2,10 +2,10 @@ 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 -- cgit From 89652787c3894c7a79345a2ea67a4de741a0f760 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 29 Jan 1998 08:25:46 +0000 Subject: Makefile: Fix for OSF1 typo. asyncdns.c: Fixes that went into 1.9.18p2 - allow unclocking of sigterm. chgpasswd.c: char -> unsigned char fixes. includes.h: AIX fix to get prototype for inet_ntoa. local.h: Tune size of shared memory based on MAX_OPEN_FILES. nmbd_mynames.c: Fix for nmbd repeated refresh bug. nmbd_responserecordsdb.c: Fix for nmbd repeated refresh bug. nmbd_winsserver.c: Fix for multi-homed registration optimisation. smb.h: Moved default shared memory size to local.h Jeremy. (This used to be commit fa5466805685d461564054d7d9947948fc56ae93) --- source3/include/smb.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 9c55e3f8be..9a7278069d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -27,11 +27,6 @@ #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 -- cgit From 99e11e171e40703271ad2a7934708cee66b0bb82 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 11 Feb 1998 11:07:14 +0000 Subject: Makefile: Added AIX 3.2.5. loadparm.c: Added "win95 bug compatibility" parameter. local.h: Replaced MAX_OPEN_FILES back to 100 from 10 (oops). reply.c: Fixed ulogoff check against uid - changed to vuid. server.c: Changed file struct save of uid - changed to vuid. smb.h: Changed id in struct current_user to vuid. Changed file struct uid to vuid. time.c: Added "win95 bug compatibility" atime -> mtime return. trans2.c: Added "win95 bug compatibility" fixes. uid.c: Changed id in struct current_user to vuid - added checks to set/reset it. util.c: Added code to expand environment variables. version.h : still at 1.9.18 (head branch doesn't matter too much at present). Jeremy. (This used to be commit adc903bcf59ad1664babd7f1d43675d3a75bfbc9) --- source3/include/smb.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 9a7278069d..77f4006c4a 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1366,7 +1366,7 @@ struct cli_state { struct current_user { - int cnum, id; + int cnum, vuid; int uid, gid; int ngroups; gid_t *groups; @@ -1424,7 +1424,7 @@ typedef struct int pos; uint32 size; int mode; - int uid; + int vuid; char *mmap_ptr; uint32 mmap_size; write_bmpx_struct *wbmpx_ptr; -- cgit From b7fb6c6b38784d25c9c85e9b27b08e30111dbd0c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 3 Mar 1998 20:19:14 +0000 Subject: Change the multibyte character set support so that Kanji support is one case of multibyte character support, rather than being a specific case in single byte character support. This allows us to add Big5 Chinese support (code page 950) and Korean Hangul support (code page 949) at very little cost. Also allows us to easily add future multibyte code pages. Makefile: Added codepages 949, 950 as we now support more multibyte codepages. asyncdns.c: Fixed problem with child being re-spawned when parent killed. charcnv.c charset.c client.c clitar.c kanji.c kanji.h smb.h util.c loadparm.c: Generic multibyte codepage support (adding Big5 Chinese and Korean Hangul). nmbd.c: Fixed problem with child being re-spawned when parent killed. mangle.c: Modified str_checksum so that first 15 characters have more effect on outcome. This helps with short name mangling as most 'long' names are still shorter than 15 chars (bug was foobar_mng and foobar_sum would hash to the same value, with the modified code they hash differently. Jeremy. (This used to be commit 299016338cfb47f0c585875ef9b468121fcee97d) --- source3/include/smb.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 77f4006c4a..f7a134d797 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -2099,7 +2099,10 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; #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 /* @@ -2110,7 +2113,7 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; /* * Default client code page - 850 - Western European */ -#define DEFAULT_CLIENT_CODE_PAGE 850 +#define DEFAULT_CLIENT_CODE_PAGE MSDOS_LATIN_1_CODEPAGE #endif /* KANJI */ /* -- cgit From 35d67dd80aa3ba72b75683cb1f35c81066e21223 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 8 Mar 1998 14:14:49 +0000 Subject: Jeremy is going to hate me ... These are some hacks on SWAT. Maybe users will actually be able to work out how to use it now. Unfortunately these changes required some editing in loadparm.c and smb.h which will make Jeremys merge job harder. Sorry! (This used to be commit 674c88a6bf4c8009769a482c53f105efdc54bbc8) --- source3/include/smb.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index f7a134d797..ccb3b0424a 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1643,6 +1643,39 @@ struct connection_options { uint16 serverzone; }; +/* the following are used by loadparm for option lists */ +typedef enum +{ + P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL, + P_STRING,P_USTRING,P_GSTRING,P_UGSTRING,P_ENUM +} parm_type; + +typedef enum +{ + P_LOCAL,P_GLOBAL,P_NONE +} parm_class; + +struct enum_list { + int value; + char *name; +}; + +struct parm_struct +{ + char *label; + parm_type type; + parm_class class; + void *ptr; + BOOL (*special)(); + struct enum_list *enum_list; + unsigned flags; +}; + + +#define FLAG_BASIC 1 +#define FLAG_HIDE 2 +#define FLAG_PRINT 4 + #ifndef LOCKING_VERSION #define LOCKING_VERSION 4 #endif /* LOCKING_VERSION */ -- cgit From fdeea341ed1bae670382e45eb731db1b5838ad21 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 11 Mar 1998 21:11:04 +0000 Subject: "For I have laboured mightily on Luke's code, and hath broken all I saw" - the book of Jeremy, chapter 1 :-). So here is the mega-merge of the NTDOM branch server code. It doesn't include the new client side pieces, we'll look at that later. This should give the same functionality, server wise, as the NTDOM branch does, only merged into the main branch. Any fixes to domain controler functionality should be added to the main branch, not the NTDOM branch. This code compiles without warnings on gcc2.8, but will need further testing before we are sure all the working functionality of the NTDOM server branch has been correctly carried over. I hereby declare the server side of the NTDOM branch dead (and all who sail in her :-). Jeremy. (This used to be commit 118ba4d77a33248e762a2cf843fb7cbc906ee6e7) --- source3/include/smb.h | 1114 ++----------------------------------------------- 1 file changed, 45 insertions(+), 1069 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index ccb3b0424a..a60b74a835 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -36,6 +36,11 @@ #define BOOLSTR(b) ((b) ? "Yes" : "No") #define BITSETB(ptr,bit) ((((char *)ptr)[0] & (1<<(bit)))!=0) #define BITSETW(ptr,bit) ((SVAL(ptr,0) & (1<<(bit)))!=0) + +#define IS_BITS_SET_ALL(var,bit) (((var)&(bit))==(bit)) +#define IS_BITS_SET_SOME(var,bit) (((var)&(bit))!=0) +#define IS_BITS_CLR_ALL(var,bit) (((var)&(~(bit)))==0) + #define PTR_DIFF(p1,p2) ((ptrdiff_t)(((char *)(p1)) - (char *)(p2))) typedef int BOOL; @@ -246,90 +251,6 @@ typedef fstring string; #define PIPE_LSASS "\\PIPE\\lsass" #define PIPE_LSARPC "\\PIPE\\lsarpc" -/* NETLOGON opcodes and data structures */ - -enum RPC_PKT_TYPE -{ - RPC_REQUEST = 0x00, - RPC_RESPONSE = 0x02, - RPC_BIND = 0x0B, - RPC_BINDACK = 0x0C -}; - -#define NET_QUERYFORPDC 7 /* Query for PDC */ -#define NET_QUERYFORPDC_R 12 /* Response to Query for PDC */ -#define NET_SAMLOGON 18 -#define NET_SAMLOGON_R 19 - -/* Allowable account control bits */ -#define ACB_DISABLED 1 /* 1 = User account disabled */ -#define ACB_HOMDIRREQ 2 /* 1 = Home directory required */ -#define ACB_PWNOTREQ 4 /* 1 = User password not required */ -#define ACB_TEMPDUP /* 1 = Temporary duplicate account */ -#define ACB_NORMAL /* 1 = Normal user account */ -#define ACB_MNS /* 1 = MNS logon user account */ -#define ACB_DOMTRUST /* 1 = Interdomain trust account */ -#define ACB_WSTRUST /* 1 = Workstation trust account */ -#define ACB_SVRTRUST /* 1 = Server trust account */ -#define ACB_PWNOEXP /* 1 = User password does not expire */ -#define ACB_AUTOLOCK /* 1 = Account auto locked */ - -#define SAMR_CLOSE 0x01 -#define SAMR_OPEN_SECRET 0x07 -#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_OPEN_POLICY 0x39 - -#define LSA_OPENPOLICY 0x2c -#define LSA_QUERYINFOPOLICY 0x07 -#define LSA_ENUMTRUSTDOM 0x0d -#define LSA_REQCHAL 0x04 -#define LSA_SRVPWSET 0x06 -#define LSA_SAMLOGON 0x02 -#define LSA_SAMLOGOFF 0x03 -#define LSA_AUTH2 0x0f -#define LSA_CLOSE 0x00 - -/* XXXX these are here to get a compile! */ - -#define LSA_OPENSECRET 0xFF -#define LSA_LOOKUPSIDS 0xFE -#define LSA_LOOKUPRIDS 0xFD -#define LSA_LOOKUPNAMES 0xFC - -/* srvsvc pipe */ -#define NETSERVERGETINFO 0x15 -#define NETSHAREENUM 0x0f - -/* well-known RIDs - Relative IDs */ - -/* RIDs - Well-known users ... */ -#define DOMAIN_USER_RID_ADMIN (0x000001F4L) -#define DOMAIN_USER_RID_GUEST (0x000001F5L) - -/* RIDs - well-known groups ... */ -#define DOMAIN_GROUP_RID_ADMINS (0x00000200L) -#define DOMAIN_GROUP_RID_USERS (0x00000201L) -#define DOMAIN_GROUP_RID_GUESTS (0x00000202L) - -/* RIDs - well-known aliases ... */ -#define DOMAIN_ALIAS_RID_ADMINS (0x00000220L) -#define DOMAIN_ALIAS_RID_USERS (0x00000221L) -#define DOMAIN_ALIAS_RID_GUESTS (0x00000222L) -#define DOMAIN_ALIAS_RID_POWER_USERS (0x00000223L) - -#define DOMAIN_ALIAS_RID_ACCOUNT_OPS (0x00000224L) -#define DOMAIN_ALIAS_RID_SYSTEM_OPS (0x00000225L) -#define DOMAIN_ALIAS_RID_PRINT_OPS (0x00000226L) -#define DOMAIN_ALIAS_RID_BACKUP_OPS (0x00000227L) - -#define DOMAIN_ALIAS_RID_REPLICATOR (0x00000228L) - - - /* 32 bit time (sec) since 01jan1970 - cifs6.txt, section 3.5, page 30 */ typedef struct time_info { @@ -344,990 +265,20 @@ typedef struct nttime_info uint32 high; } NTTIME; - - -#define MAXSUBAUTHS 15 /* max sub authorities in a SID */ - -/* DOM_SID - security id */ -typedef struct sid_info -{ - uint8 sid_rev_num; /* SID revision number */ - uint8 num_auths; /* number of sub-authorities */ - uint8 id_auth[6]; /* Identifier Authority */ - uint32 sub_auths[MAXSUBAUTHS]; /* pointer to sub-authorities. */ - -} DOM_SID; - -/* UNIHDR - unicode string header */ -typedef struct unihdr_info -{ - uint16 uni_max_len; - uint16 uni_str_len; - uint32 undoc; /* usually has a value of 4 */ - -} UNIHDR; - -/* UNIHDR2 - unicode string header and undocumented buffer */ -typedef struct unihdr2_info -{ - UNIHDR unihdr; - uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */ - -} UNIHDR2; - -/* clueless as to what maximum length should be */ -#define MAX_UNISTRLEN 1024 - -/* UNISTR - unicode string size and buffer */ -typedef struct unistr_info -{ - uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. ***MUST*** be null-terminated */ - -} UNISTR; - -/* UNISTR2 - unicode string size and buffer */ -typedef struct unistr2_info -{ - uint32 uni_max_len; - uint32 undoc; - uint32 uni_str_len; - uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. **NOT** necessarily null-terminated */ - -} UNISTR2; - -/* DOM_SID2 - domain SID structure - SIDs stored in unicode */ -typedef struct domsid2_info -{ - uint32 type; /* value is 5 */ - uint32 undoc; /* value is 0 */ - - UNIHDR2 hdr; /* XXXX conflict between hdr and str for length */ - UNISTR str; /* XXXX conflict between hdr and str for length */ - -} DOM_SID2; - -/* DOM_RID2 - domain RID structure for ntlsa pipe */ -typedef struct domrid2_info -{ - uint32 type; /* 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 -{ - uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */ - UNISTR2 uni_logon_srv; /* logon server name */ - uint32 undoc_buffer2; /* undocumented 32 bit buffer pointer */ - UNISTR2 uni_comp_name; /* client machine name */ - -} DOM_CLNT_SRV; - -/* DOM_LOG_INFO - login info */ -typedef struct log_info -{ - uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */ - UNISTR2 uni_logon_srv; /* logon server name */ - UNISTR2 uni_acct_name; /* account name */ - uint16 sec_chan; /* secure channel type */ - UNISTR2 uni_comp_name; /* client machine name */ - -} DOM_LOG_INFO; - -/* DOM_CHAL - challenge info */ -typedef struct chal_info -{ - uchar data[8]; /* credentials */ -} DOM_CHAL; - -/* DOM_CREDs - timestamped client or server credentials */ -typedef struct cred_info -{ - DOM_CHAL challenge; /* credentials */ - UTIME timestamp; /* credential time-stamp */ - -} DOM_CRED; - -/* DOM_CLNT_INFO - client info */ -typedef struct clnt_info -{ - DOM_LOG_INFO login; - DOM_CRED cred; - -} DOM_CLNT_INFO; - -/* DOM_CLNT_INFO2 - client info */ -typedef struct clnt_info2 -{ - DOM_CLNT_SRV login; - uint32 ptr_cred; - DOM_CRED cred; - -} DOM_CLNT_INFO2; - -/* DOM_LOGON_ID - logon id */ -typedef struct logon_info -{ - uint32 low; - uint32 high; - -} DOM_LOGON_ID; - -/* ARC4_OWF */ -typedef struct arc4_owf_info -{ - uint8 data[16]; - -} ARC4_OWF; - - -/* DOM_ID_INFO_1 */ -typedef struct id_info_1 -{ - uint32 ptr_id_info1; /* pointer to id_info_1 */ - UNIHDR hdr_domain_name; /* domain name unicode header */ - uint32 param_ctrl; /* param control */ - DOM_LOGON_ID logon_id; /* logon ID */ - UNIHDR hdr_user_name; /* user name unicode header */ - UNIHDR hdr_wksta_name; /* workgroup name unicode header */ - ARC4_OWF arc4_lm_owf; /* arc4 LM OWF Password */ - ARC4_OWF arc4_nt_owf; /* arc4 NT OWF Password */ - UNISTR2 uni_domain_name; /* domain name unicode string */ - UNISTR2 uni_user_name; /* user name unicode string */ - UNISTR2 uni_wksta_name; /* workgroup name unicode string */ - -} DOM_ID_INFO_1; - -/* SAM_INFO - sam logon/off id structure */ -typedef struct sam_info -{ - DOM_CLNT_INFO2 client; - uint32 ptr_rtn_cred; /* pointer to return credentials */ - DOM_CRED rtn_cred; /* return credentials */ - uint16 logon_level; - uint16 switch_value; - - union - { - DOM_ID_INFO_1 *id1; /* auth-level 1 */ - - } auth; - -} DOM_SAM_INFO; - -/* DOM_GID - group id + user attributes */ -typedef struct gid_info -{ - uint32 g_rid; /* a group RID */ - uint32 attr; - -} DOM_GID; - -/* RPC_HDR - ms rpc header */ -typedef struct rpc_hdr_info -{ - uint8 major; /* 5 - RPC major version */ - uint8 minor; /* 0 - RPC minor version */ - uint8 pkt_type; /* 2 - RPC response packet */ - uint8 frag; /* 3 - first frag + last frag */ - uint32 pack_type; /* 0x1000 0000 - packed data representation */ - uint16 frag_len; /* fragment length - data size (bytes) inc header and tail. */ - uint16 auth_len; /* 0 - authentication length */ - uint32 call_id; /* call identifier. matches 12th uint32 of incoming RPC data. */ - -} RPC_HDR; - -/* RPC_HDR_RR - ms request / response rpc header */ -typedef struct rpc_hdr_rr_info -{ - RPC_HDR hdr; - - uint32 alloc_hint; /* allocation hint - data size (bytes) minus header and tail. */ - uint16 context_id; /* 0 - presentation context identifier */ - uint8 cancel_count; /* 0 - cancel count */ - uint8 opnum; /* request: 0 - reserved. response: opnum */ - -} RPC_HDR_RR; - -/* the interfaces are numbered. as yet I haven't seen more than one interface - * used on the same pipe name - * srvsvc - * abstract (0x4B324FC8, 0x01D31670, 0x475A7812, 0x88E16EBF, 0x00000003) - * transfer (0x8A885D04, 0x11C91CEB, 0x0008E89F, 0x6048102B, 0x00000002) - */ -/* RPC_IFACE */ -typedef struct rpc_iface_info -{ - uint8 data[16]; /* 16 bytes of number */ - uint32 version; /* the interface number */ - -} RPC_IFACE; - - -/* this seems to be the same string name depending on the name of the pipe, - * but is more likely to be linked to the interface name - * "srvsvc", "\\PIPE\\ntsvcs" - * "samr", "\\PIPE\\lsass" - * "wkssvc", "\\PIPE\\wksvcs" - * "NETLOGON", "\\PIPE\\NETLOGON" - */ -/* RPC_ADDR_STR */ -typedef struct rpc_addr_info -{ - uint16 len; /* length of the string including null terminator */ - fstring str; /* the string above in single byte, null terminated form */ - -} RPC_ADDR_STR; - -/* RPC_HDR_BBA */ -typedef struct rpc_hdr_bba_info -{ - uint16 max_tsize; /* maximum transmission fragment size (0x1630) */ - uint16 max_rsize; /* max receive fragment size (0x1630) */ - uint32 assoc_gid; /* associated group id (0x0) */ - -} RPC_HDR_BBA; - -/* RPC_BIND_REQ - ms req bind */ -typedef struct rpc_bind_req_info -{ - RPC_HDR_BBA bba; - - uint32 num_elements; /* the number of elements (0x1) */ - uint16 context_id; /* presentation context identifier (0x0) */ - uint8 num_syntaxes; /* the number of syntaxes (has always been 1?)(0x1) */ - - RPC_IFACE abstract; /* num and vers. of interface client is using */ - RPC_IFACE transfer; /* num and vers. of interface to use for replies */ - -} RPC_HDR_RB; - -/* RPC_RESULTS - can only cope with one reason, right now... */ -typedef struct rpc_results_info -{ -/* uint8[] # 4-byte alignment padding, against SMB header */ - - uint8 num_results; /* the number of results (0x01) */ - -/* uint8[] # 4-byte alignment padding, against SMB header */ - - uint16 result; /* result (0x00 = accept) */ - uint16 reason; /* reason (0x00 = no reason specified) */ - -} RPC_RESULTS; - -/* RPC_HDR_BA */ -typedef struct rpc_hdr_ba_info -{ - RPC_HDR_BBA bba; - - RPC_ADDR_STR addr ; /* the secondary address string, as described earlier */ - RPC_RESULTS res ; /* results and reasons */ - RPC_IFACE transfer; /* the transfer syntax from the request */ - -} RPC_HDR_BA; - - -/* DOM_QUERY - info class 3 and 5 LSA Query response */ -typedef struct dom_query_info -{ - uint16 uni_dom_max_len; /* domain name string length * 2 */ - uint16 uni_dom_str_len; /* domain name string length * 2 */ - uint32 buffer_dom_name; /* undocumented domain name string buffer pointer */ - uint32 buffer_dom_sid; /* undocumented domain SID string buffer pointer */ - UNISTR2 uni_domain_name; /* domain name (unicode string) */ - DOM_SID dom_sid; /* domain SID */ - -} DOM_QUERY; - -/* level 5 is same as level 3. we hope. */ -typedef DOM_QUERY DOM_QUERY_3; -typedef DOM_QUERY DOM_QUERY_5; - -#define POL_HND_SIZE 20 - -/* LSA_POL_HND */ -typedef struct lsa_policy_info -{ - uint8 data[POL_HND_SIZE]; /* policy handle */ - -} LSA_POL_HND; - -/* OBJ_ATTR (object attributes) */ -typedef struct object_attributes_info -{ - uint32 len; /* 0x18 - length (in bytes) inc. the length field. */ - uint32 ptr_root_dir; /* 0 - root directory (pointer) */ - uint32 ptr_obj_name; /* 0 - object name (pointer) */ - uint32 attributes; /* 0 - attributes (undocumented) */ - uint32 ptr_sec_desc; /* 0 - security descriptior (pointer) */ - uint32 sec_qos; /* 0 - security quality of service */ - -} LSA_OBJ_ATTR; - -/* LSA_Q_OPEN_POL - LSA Query Open Policy */ -typedef struct lsa_q_open_pol_info -{ - uint32 ptr; /* undocumented buffer pointer */ - UNISTR2 uni_server_name; /* server name, starting with two '\'s */ - LSA_OBJ_ATTR attr ; /* object attributes */ - - uint32 des_access; /* desired access attributes */ - -} LSA_Q_OPEN_POL; - -/* LSA_R_OPEN_POL - response to LSA Open Policy */ -typedef struct lsa_r_open_pol_info -{ - LSA_POL_HND pol; /* policy handle */ - - uint32 status; /* return code */ - -} LSA_R_OPEN_POL; - -/* LSA_Q_QUERY_INFO - LSA query info policy */ -typedef struct lsa_query_info -{ - LSA_POL_HND pol; /* policy handle */ - uint16 info_class; /* info class */ - -} LSA_Q_QUERY_INFO; - -/* LSA_R_QUERY_INFO - response to LSA query info policy */ -typedef struct lsa_r_query_info -{ - uint32 undoc_buffer; /* undocumented buffer pointer */ - uint16 info_class; /* info class (same as info class in request) */ - - union - { - DOM_QUERY_3 id3; - DOM_QUERY_5 id5; - - } dom; - - uint32 status; /* return code */ - -} LSA_R_QUERY_INFO; - -/* LSA_Q_ENUM_TRUST_DOM - LSA enumerate trusted domains */ -typedef struct lsa_enum_trust_dom_info -{ - LSA_POL_HND pol; /* policy handle */ - uint32 enum_context; /* enumeration context handle */ - uint32 preferred_len; /* preferred maximum length */ - -} LSA_Q_ENUM_TRUST_DOM; - -/* LSA_R_ENUM_TRUST_DOM - response to LSA enumerate trusted domains */ -typedef struct lsa_r_enum_trust_dom_info -{ - LSA_POL_HND pol; /* policy handle */ - - uint32 status; /* return code */ - -} LSA_R_ENUM_TRUST_DOM; - -/* LSA_Q_CLOSE */ -typedef struct lsa_q_close_info -{ - LSA_POL_HND pol; /* policy handle */ - -} LSA_Q_CLOSE; - -/* LSA_R_CLOSE */ -typedef struct lsa_r_close_info -{ - LSA_POL_HND pol; /* policy handle. should be all zeros. */ - - uint32 status; /* return code */ - -} LSA_R_CLOSE; - - -#define MAX_REF_DOMAINS 10 - -/* DOM_R_REF */ -typedef struct dom_ref_info -{ - uint32 undoc_buffer; /* undocumented buffer pointer. */ - uint32 num_ref_doms_1; /* num referenced domains? */ - uint32 buffer_dom_name; /* undocumented domain name buffer pointer. */ - uint32 max_entries; /* 32 - max number of entries */ - uint32 num_ref_doms_2; /* 4 - num referenced domains? */ - - UNIHDR2 hdr_dom_name; /* domain name unicode string header */ - UNIHDR2 hdr_ref_dom[MAX_REF_DOMAINS]; /* referenced domain unicode string headers */ - - UNISTR uni_dom_name; /* domain name unicode string */ - DOM_SID ref_dom[MAX_REF_DOMAINS]; /* referenced domain SIDs */ - -} DOM_R_REF; - -#define MAX_LOOKUP_SIDS 10 - -/* LSA_Q_LOOKUP_SIDS - LSA Lookup SIDs */ -typedef struct lsa_q_lookup_sids -{ - LSA_POL_HND pol_hnd; /* policy handle */ - uint32 num_entries; - uint32 buffer_dom_sid; /* undocumented domain SID buffer pointer */ - uint32 buffer_dom_name; /* undocumented domain name buffer pointer */ - uint32 buffer_lookup_sids[MAX_LOOKUP_SIDS]; /* undocumented domain SID pointers to be looked up. */ - DOM_SID dom_sids[MAX_LOOKUP_SIDS]; /* domain SIDs to be looked up. */ - uint8 undoc[16]; /* completely undocumented 16 bytes */ - -} LSA_Q_LOOKUP_SIDS; - -/* LSA_R_LOOKUP_SIDS - response to LSA Lookup SIDs */ -typedef struct lsa_r_lookup_sids -{ - DOM_R_REF dom_ref; /* domain reference info */ - - uint32 num_entries; - uint32 undoc_buffer; /* undocumented buffer pointer */ - uint32 num_entries2; - - DOM_SID2 dom_sid[MAX_LOOKUP_SIDS]; /* domain SIDs being looked up */ - - uint32 num_entries3; - - uint32 status; /* return code */ - -} LSA_R_LOOKUP_SIDS; - -/* DOM_NAME - XXXX not sure about this structure */ -typedef struct dom_name_info -{ - uint32 uni_str_len; - UNISTR str; - -} DOM_NAME; - - -#define UNKNOWN_LEN 1 - -/* LSA_Q_LOOKUP_RIDS - LSA Lookup RIDs */ -typedef struct lsa_q_lookup_rids -{ - - LSA_POL_HND pol_hnd; /* policy handle */ - uint32 num_entries; - uint32 num_entries2; - uint32 buffer_dom_sid; /* undocumented domain SID buffer pointer */ - uint32 buffer_dom_name; /* undocumented domain name buffer pointer */ - DOM_NAME lookup_name[MAX_LOOKUP_SIDS]; /* names to be looked up */ - uint8 undoc[UNKNOWN_LEN]; /* completely undocumented bytes of unknown length */ - -} LSA_Q_LOOKUP_RIDS; - -/* 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 */ - - uint32 num_entries; - uint32 undoc_buffer; /* undocumented buffer pointer */ - - uint32 num_entries2; - DOM_RID2 dom_rid[MAX_LOOKUP_SIDS]; /* domain RIDs being looked up */ - - uint32 num_entries3; - - uint32 status; /* return code */ - -} LSA_R_LOOKUP_RIDS; - - - -/* NEG_FLAGS */ -typedef struct lsa_neg_flags_info -{ - uint32 neg_flags; /* negotiated flags */ - -} NEG_FLAGS; - - -/* LSA_Q_REQ_CHAL */ -typedef struct lsa_q_req_chal_info -{ - uint32 undoc_buffer; /* undocumented buffer pointer */ - UNISTR2 uni_logon_srv; /* logon server unicode string */ - UNISTR2 uni_logon_clnt; /* logon client unicode string */ - DOM_CHAL clnt_chal; /* client challenge */ - -} LSA_Q_REQ_CHAL; - - -/* LSA_R_REQ_CHAL */ -typedef struct lsa_r_req_chal_info -{ - DOM_CHAL srv_chal; /* server challenge */ - - uint32 status; /* return code */ - -} LSA_R_REQ_CHAL; - - - -/* LSA_Q_AUTH_2 */ -typedef struct lsa_q_auth2_info -{ - DOM_LOG_INFO clnt_id; /* client identification info */ - DOM_CHAL clnt_chal; /* client-calculated credentials */ - - NEG_FLAGS clnt_flgs; /* usually 0x0000 01ff */ - -} LSA_Q_AUTH_2; - - -/* LSA_R_AUTH_2 */ -typedef struct lsa_r_auth2_info -{ - DOM_CHAL srv_chal; /* server-calculated credentials */ - NEG_FLAGS srv_flgs; /* usually 0x0000 01ff */ - - uint32 status; /* return code */ - -} LSA_R_AUTH_2; - - -/* LSA_Q_SRV_PWSET */ -typedef struct lsa_q_srv_pwset_info -{ - DOM_CLNT_INFO clnt_id; /* client identification/authentication info */ - char pwd[16]; /* new password - undocumented. */ - -} LSA_Q_SRV_PWSET; - -/* LSA_R_SRV_PWSET */ -typedef struct lsa_r_srv_pwset_info -{ - DOM_CRED srv_cred; /* server-calculated credentials */ - - uint32 status; /* return code */ - -} LSA_R_SRV_PWSET; - -#define LSA_MAX_GROUPS 32 -#define LSA_MAX_SIDS 32 - -/* LSA_USER_INFO */ -typedef struct lsa_q_user_info -{ - uint32 ptr_user_info; - - NTTIME logon_time; /* logon time */ - NTTIME logoff_time; /* logoff time */ - NTTIME kickoff_time; /* kickoff time */ - NTTIME pass_last_set_time; /* password last set time */ - NTTIME pass_can_change_time; /* password can change time */ - NTTIME pass_must_change_time; /* password must change time */ - - UNIHDR hdr_user_name; /* username unicode string header */ - UNIHDR hdr_full_name; /* user's full name unicode string header */ - UNIHDR hdr_logon_script; /* logon script unicode string header */ - UNIHDR hdr_profile_path; /* profile path unicode string header */ - UNIHDR hdr_home_dir; /* home directory unicode string header */ - UNIHDR hdr_dir_drive; /* home directory drive unicode string header */ - - uint16 logon_count; /* logon count */ - uint16 bad_pw_count; /* bad password count */ - - uint32 user_id; /* User ID */ - uint32 group_id; /* Group ID */ - uint32 num_groups; /* num groups */ - uint32 buffer_groups; /* undocumented buffer pointer to groups. */ - uint32 user_flgs; /* user flags */ - - char user_sess_key[16]; /* unused user session key */ - - UNIHDR hdr_logon_srv; /* logon server unicode string header */ - UNIHDR hdr_logon_dom; /* logon domain unicode string header */ - - uint32 buffer_dom_id; /* undocumented logon domain id pointer */ - char padding[40]; /* unused padding bytes. expansion room */ - - uint32 num_other_sids; /* 0 - num_sids */ - uint32 buffer_other_sids; /* NULL - undocumented pointer to SIDs. */ - - UNISTR2 uni_user_name; /* username unicode string */ - UNISTR2 uni_full_name; /* user's full name unicode string */ - UNISTR2 uni_logon_script; /* logon script unicode string */ - UNISTR2 uni_profile_path; /* profile path unicode string */ - UNISTR2 uni_home_dir; /* home directory unicode string */ - UNISTR2 uni_dir_drive; /* home directory drive unicode string */ - - uint32 num_groups2; /* num groups */ - DOM_GID gids[LSA_MAX_GROUPS]; /* group info */ - - UNISTR2 uni_logon_srv; /* logon server unicode string */ - UNISTR2 uni_logon_dom; /* logon domain unicode string */ - - DOM_SID dom_sid; /* domain SID */ - DOM_SID other_sids[LSA_MAX_SIDS]; /* undocumented - domain SIDs */ - -} LSA_USER_INFO; - - -/* LSA_Q_SAM_LOGON */ -typedef struct lsa_q_sam_logon_info -{ - DOM_SAM_INFO sam_id; - -} LSA_Q_SAM_LOGON; - -/* LSA_R_SAM_LOGON */ -typedef struct lsa_r_sam_logon_info -{ - uint32 buffer_creds; /* undocumented buffer pointer */ - DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */ - - uint16 switch_value; /* 3 - indicates type of USER INFO */ - LSA_USER_INFO *user; - - uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */ - - uint32 status; /* return code */ - -} LSA_R_SAM_LOGON; - - -/* LSA_Q_SAM_LOGOFF */ -typedef struct lsa_q_sam_logoff_info -{ - DOM_SAM_INFO sam_id; - -} LSA_Q_SAM_LOGOFF; - -/* LSA_R_SAM_LOGOFF */ -typedef struct lsa_r_sam_logoff_info -{ - uint32 buffer_creds; /* undocumented buffer pointer */ - DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */ - - uint32 status; /* return code */ - -} LSA_R_SAM_LOGOFF; - - -/* SH_INFO_1 (pointers to level 1 share info strings) */ -typedef struct ptr_share_info1 -{ - uint32 ptr_netname; /* pointer to net name. */ - uint32 type; /* type of share. 0 - undocumented. */ - uint32 ptr_remark; /* pointer to comment. */ - -} SH_INFO_1; - -/* SH_INFO_1_STR (level 1 share info strings) */ -typedef struct str_share_info1 -{ - UNISTR2 uni_netname; /* unicode string of net name */ - UNISTR2 uni_remark; /* unicode string of comment. */ - -} SH_INFO_1_STR; - -/* oops - this is going to take up a *massive* amount of stack. */ -/* the UNISTR2s already have 1024 uint16 chars in them... */ -#define MAX_SHARE_ENTRIES 32 - -/* SHARE_INFO_1_CONTAINER */ -typedef struct share_info_ctr -{ - uint32 num_entries_read; /* EntriesRead */ - uint32 ptr_share_info; /* Buffer */ - uint32 num_entries_read2; /* EntriesRead */ - SH_INFO_1 info_1 [MAX_SHARE_ENTRIES]; /* share entry pointers */ - SH_INFO_1_STR info_1_str[MAX_SHARE_ENTRIES]; /* share entry strings */ - uint32 num_entries_read3; /* EntriesRead2 */ - uint32 padding; /* padding */ - -} SHARE_INFO_1_CTR; - - -/* SRV_Q_NET_SHARE_ENUM */ -typedef struct q_net_share_enum_info -{ - uint32 ptr_srv_name; /* pointer (to server name?) */ - UNISTR2 uni_srv_name; /* server name */ - - uint32 share_level; /* share level */ - uint32 switch_value; /* switch value */ - - uint32 ptr_share_info; /* pointer to SHARE_INFO_1_CTR */ - - union - { - SHARE_INFO_1_CTR info1; /* share info with 0 entries */ - - } share; - - uint32 preferred_len; /* preferred maximum length (0xffff ffff) */ - -} SRV_Q_NET_SHARE_ENUM; - - -/* SRV_R_NET_SHARE_ENUM */ -typedef struct r_net_share_enum_info -{ - uint32 share_level; /* share level */ - uint32 switch_value; /* switch value */ - - uint32 ptr_share_info; /* pointer to SHARE_INFO_1_CTR */ - union - { - SHARE_INFO_1_CTR info1; /* share info container */ - - } share; - - uint32 status; /* return status */ - -} SRV_R_NET_SHARE_ENUM; - - -/* SAMR_Q_CLOSE - probably a policy handle close */ -typedef struct q_samr_close_info -{ - LSA_POL_HND pol; /* policy handle */ - -} SAMR_Q_CLOSE; - - -/* SAMR_R_CLOSE - probably a policy handle close */ -typedef struct r_samr_close_info -{ - LSA_POL_HND pol; /* policy handle */ - uint32 status; /* return status */ - -} SAMR_R_CLOSE; - - -/**************************************************************************** -SAMR_Q_OPEN_SECRET - unknown_0 values seen associated with SIDs: - -0x0000 0200 and a specific domain sid - S-1-5-21-44c01ca6-797e5c3d-33f83fd0 -0x0000 0280 and a well-known domain sid - S-1-5-20 -0x2000 0000 and a well-known domain sid - S-1-5-20 -0x2000 0000 and a specific domain sid - S-1-5-21-44c01ca6-797e5c3d-33f83fd0 -*****************************************************************************/ - -/* SAMR_Q_OPEN_SECRET - probably an open secret */ -typedef struct q_samr_open_secret_info -{ - LSA_POL_HND pol; /* policy handle */ - uint32 unknown_0; /* 0x2000 0000; 0x0000 0211; 0x0000 0280; 0x0000 0200 - unknown */ - DOM_SID dom_sid; /* domain SID */ - -} SAMR_Q_OPEN_SECRET; - - -/* SAMR_R_OPEN_SECRET - probably an open */ -typedef struct r_samr_open_secret_info -{ - LSA_POL_HND pol; /* policy handle associated with the SID */ - uint32 status; /* return status */ - -} SAMR_R_OPEN_SECRET; - - -/**************************************************************************** -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 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_LOOKUP_RIDS; - - -/* SAMR_R_LOOKUP_RIDS - probably an open */ -typedef struct r_samr_lookup_names_info -{ - 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 num_entries3; - - uint32 status; /* return code */ - -} SAMR_R_LOOKUP_RIDS; - - -/* SAMR_Q_UNKNOWN_22 - probably an open */ -typedef struct q_samr_unknown_22_info -{ - LSA_POL_HND pol; /* policy handle */ - uint32 unknown_id_0; /* 0x0000 03E8 - 32 bit unknown id */ - -} SAMR_Q_UNKNOWN_22; - - -/* SAMR_R_UNKNOWN_22 - probably an open */ -typedef struct r_samr_unknown_22_info -{ - LSA_POL_HND pol; /* policy handle associated with unknown id */ - uint32 status; /* return status */ - -} SAMR_R_UNKNOWN_22; - - -/* SAMR_Q_UNKNOWN_24 - probably a get sam info */ -typedef struct q_samr_unknown_24_info -{ - LSA_POL_HND pol; /* policy handle associated with unknown id */ - uint16 unknown_0; /* 0x0015 or 0x0011 - 16 bit unknown */ - -} SAMR_Q_UNKNOWN_24; - - -/* SAMR_R_UNKNOWN_24 - probably a get sam info */ -typedef struct r_samr_unknown_24_info -{ - uint32 ptr; /* pointer */ - uint16 unknown_0; /* 0x0015 or 0x0011 - 16 bit unknown (same as above) */ - uint16 unknown_1; /* 0x8b73 - 16 bit unknown */ - uint8 padding_0[16]; /* 0 - padding 16 bytes */ - NTTIME expiry; /* expiry time or something? */ - uint8 padding_1[24]; /* 0 - padding 24 bytes */ - - UNIHDR hdr_mach_acct; /* unicode header for machine account */ - uint32 padding_2; /* 0 - padding 4 bytes */ - - uint32 ptr_1; /* pointer */ - uint8 padding_3[32]; /* 0 - padding 32 bytes */ - uint32 padding_4; /* 0 - padding 4 bytes */ - - uint32 ptr_2; /* pointer */ - uint32 padding_5; /* 0 - padding 4 bytes */ - - uint32 ptr_3; /* pointer */ - uint8 padding_6[32]; /* 0 - padding 32 bytes */ - - uint32 unknown_id_0; /* unknown id associated with policy handle */ - uint16 unknown_2; /* 0x0201 - 16 bit unknown */ - uint32 unknown_3; /* 0x0000 0080 - 32 bit unknown */ - uint16 unknown_4; /* 0x003f - 16 bit unknown */ - uint16 unknown_5; /* 0x003c - 16 bit unknown */ - - uint8 padding_7[16]; /* 0 - padding 16 bytes */ - uint32 padding_8; /* 0 - padding 4 bytes */ - - UNISTR2 uni_mach_acct; /* unicode string for machine account */ - - uint8 padding_9[48]; /* 0 - padding 48 bytes */ - - uint32 status; /* return status */ - -} SAMR_R_UNKNOWN_24; - - -/* SAMR_Q_UNKNOWN_32 - probably a "create SAM entry" */ -typedef struct q_samr_unknown_32_info -{ - LSA_POL_HND pol; /* policy handle */ - - UNIHDR hdr_mach_acct; /* unicode machine account name header */ - UNISTR2 uni_mach_acct; /* unicode machine account name */ - - uint32 unknown_0; /* 32 bit unknown */ - uint16 unknown_1; /* 16 bit unknown */ - uint16 unknown_2; /* 16 bit unknown */ - -} SAMR_Q_UNKNOWN_32; - - -/* SAMR_R_UNKNOWN_32 - probably a "create SAM entry" */ -typedef struct r_samr_unknown_32_info -{ - LSA_POL_HND pol; /* policy handle */ - uint32 unknown_0; /* 0x0000 0030 - 32 bit unknown */ - uint32 padding; /* 0 - 4 byte padding */ - - uint32 status; /* return status - 0xC000 0099: user exists */ - -} SAMR_R_UNKNOWN_32; - - -/* 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_OPEN_POLICY; - - -/* 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_OPEN_POLICY; - - -/* WKS_Q_UNKNOWN_0 - probably a capabilities request */ -typedef struct q_wks_unknown_0_info -{ - uint32 ptr_srv_name; /* pointer (to server name?) */ - UNISTR2 uni_srv_name; /* unicode server name starting with '\\' */ - - uint32 unknown_0; /* 0x64 - 32 bit unknown */ - uint16 unknown_1; /* 16 bit unknown */ - -} WKS_Q_UNKNOWN_0; - - -/* WKS_R_UNKNOWN_0 - probably a capabilities request */ -typedef struct r_wks_unknown_0_info -{ - uint32 unknown_0; /* 64 - unknown */ - uint32 ptr_1; /* pointer 1 */ - uint32 unknown_1; /* 0x0000 01f4 - unknown */ - uint32 ptr_srv_name; /* pointer to server name */ - uint32 ptr_dom_name; /* pointer to domain name */ - uint32 unknown_2; /* 4 - unknown */ - uint32 unknown_3; /* 0 - unknown */ - - UNISTR2 uni_srv_name; /* unicode server name */ - UNISTR2 uni_dom_name; /* unicode domainn name */ - uint32 status; /* return status */ - -} WKS_R_UNKNOWN_0; - +/* Allowable account control bits */ +#define ACB_DISABLED 0x0001 /* 1 = User account disabled */ +#define ACB_HOMDIRREQ 0x0002 /* 1 = Home directory required */ +#define ACB_PWNOTREQ 0x0004 /* 1 = User password not required */ +#define ACB_TEMPDUP 0x0008 /* 1 = Temporary duplicate account */ +#define ACB_NORMAL 0x0010 /* 1 = Normal user account */ +#define ACB_MNS 0x0020 /* 1 = MNS logon user account */ +#define ACB_DOMTRUST 0x0040 /* 1 = Interdomain trust account */ +#define ACB_WSTRUST 0x0080 /* 1 = Workstation trust account */ +#define ACB_SVRTRUST 0x0100 /* 1 = Server trust account */ +#define ACB_PWNOEXP 0x0200 /* 1 = User password does not expire */ +#define ACB_AUTOLOCK 0x0400 /* 1 = Account auto locked */ + struct smb_passwd { int smb_userid; @@ -1335,6 +286,7 @@ struct smb_passwd unsigned char *smb_passwd; /* Null if no password */ unsigned char *smb_nt_passwd; /* Null if no password */ /* Other fields / flags may be added later */ + uint16 acct_ctrl; }; struct cli_state { @@ -1491,6 +443,20 @@ typedef struct } connection_struct; +/* DOM_CHAL - challenge info */ +typedef struct chal_info +{ + uchar data[8]; /* credentials */ +} DOM_CHAL; + +/* DOM_CREDs - timestamped client or server credentials */ +typedef struct cred_info +{ + DOM_CHAL challenge; /* credentials */ + UTIME timestamp; /* credential time-stamp */ + +} DOM_CRED; + /* Domain controller authentication protocol info */ struct dcinfo { @@ -2058,6 +1024,14 @@ char *Strstr(char *s, char *p); #define BROWSER_ELECTION_VERSION 0x010f #define BROWSER_CONSTANT 0xaa55 +/* NT Flags2 bits - cifs6.txt section 3.1.2 */ + +#define FLAGS2_LONG_PATH_COMPONENTS 0x0001 +#define FLAGS2_EXTENDED_ATTRIBUTES 0x0002 +#define FLAGS2_DFS_PATHNAMES 0x1000 +#define FLAGS2_READ_PERMIT_NO_EXECUTE 0x2000 +#define FLAGS2_32_BIT_ERROR_CODES 0x4000 +#define FLAGS2_UNICODE_STRINGS 0x8000 /* Capabilities. see ftp.microsoft.com/developr/drg/cifs/cifs/cifs4.txt */ @@ -2129,8 +1103,6 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; #define UID_FIELD_INVALID 0 #define VUID_OFFSET 100 /* Amount to bias returned vuid numbers */ -#endif - /* Defines needed for multi-codepage support. */ #define MSDOS_LATIN_1_CODEPAGE 850 #define KANJI_CODEPAGE 932 @@ -2227,4 +1199,8 @@ extern int unix_ERR_code; #define CMD_REPLY 0x8000 +#endif /* _SMB_H */ + +#include "ntdomain.h" + /* _SMB_H */ -- cgit From b85346942e7d785af718b68d61b208cb457a2b27 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 14 Mar 1998 08:27:41 +0000 Subject: another makeover of loadparm to support new stuff in swat and testparm. In particular I added: - ability to optionally save default values of all parameters when calling lp_load(). This can then be used to save only non-default parameters in lp_dump(). This makes the saved smb.conf (and viewed parameters in testparm) much shorter - ability to not load ipc share in lp_load() - separators in parm_table[] so parameters can be grouped logically. - flag to mark parameters that are local but which should be also viewed as global as far as parameters editing is concerned (This used to be commit f9af35da26e58fb0b644b5f0169f1c212230047a) --- source3/include/smb.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index a60b74a835..48d9a8919d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -613,12 +613,12 @@ struct connection_options { typedef enum { P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL, - P_STRING,P_USTRING,P_GSTRING,P_UGSTRING,P_ENUM + P_STRING,P_USTRING,P_GSTRING,P_UGSTRING,P_ENUM,P_SEP } parm_type; typedef enum { - P_LOCAL,P_GLOBAL,P_NONE + P_LOCAL,P_GLOBAL,P_SEPARATOR,P_NONE, } parm_class; struct enum_list { @@ -635,12 +635,19 @@ struct parm_struct BOOL (*special)(); struct enum_list *enum_list; unsigned flags; + union { + BOOL bvalue; + int ivalue; + char *svalue; + char cvalue; + } def; }; -#define FLAG_BASIC 1 -#define FLAG_HIDE 2 -#define FLAG_PRINT 4 +#define FLAG_BASIC 1 /* fundamental options */ +#define FLAG_HIDE 2 /* options that should be hidden in SWAT */ +#define FLAG_PRINT 4 /* printing options */ +#define FLAG_GLOBAL 8 /* local options that should be globally settable in SWAT */ #ifndef LOCKING_VERSION #define LOCKING_VERSION 4 -- cgit From 14d6ee34de8935cb3ef59820fabf98d588dab11f Mon Sep 17 00:00:00 2001 From: "Christopher R. Hertel" Date: Mon, 16 Mar 1998 20:07:22 +0000 Subject: Lint was complaining about the following typedef in smb.h: typedef enum { P_LOCAL,P_GLOBAL,P_SEPARATOR,P_NONE, } parm_class; I removed the trailing comma. Chris -)----- (This used to be commit ac7cd9cacf2493b52d4db50d4fd4b8b08adfe837) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 48d9a8919d..0acc5cbfa3 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -618,7 +618,7 @@ typedef enum typedef enum { - P_LOCAL,P_GLOBAL,P_SEPARATOR,P_NONE, + P_LOCAL,P_GLOBAL,P_SEPARATOR,P_NONE } parm_class; struct enum_list { -- cgit From 1ab10eb365d8e2f5a337eea0b98956d5fd098c44 Mon Sep 17 00:00:00 2001 From: John Terpstra Date: Fri, 20 Mar 1998 13:37:46 +0000 Subject: Added MAXPRINTERLEN define in smb.h setting printer share name length to maximumof 15 characters. IF this needs to be limited to 8 characters again please do it in smb.h. (This used to be commit 3dfe0b135dd91864a81a5fadddc9151ac8812c6e) --- source3/include/smb.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 0acc5cbfa3..f0cdf9f356 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -24,6 +24,9 @@ #ifndef _SMB_H #define _SMB_H +/* Yves Gaige requested this */ +#define MAXPRINTERLEN 15 + #define BUFFER_SIZE (0xFFFF) #define SAFETY_MARGIN 1024 -- cgit From bee4067bd4771ee7883ab6365e91df86a1230618 Mon Sep 17 00:00:00 2001 From: John Terpstra Date: Sat, 21 Mar 1998 03:03:59 +0000 Subject: Getting ready for first Red Hat Linux RPMs for 1.9.19 pre-alpha release (This used to be commit 4e424d0ba652bf9c5dfd3c44216b6145538cf821) --- source3/include/smb.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index f0cdf9f356..0acc5cbfa3 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -24,9 +24,6 @@ #ifndef _SMB_H #define _SMB_H -/* Yves Gaige requested this */ -#define MAXPRINTERLEN 15 - #define BUFFER_SIZE (0xFFFF) #define SAFETY_MARGIN 1024 -- cgit From 612cbb6a6039c2cafb3de5e644f23a2a26d6c645 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 2 Apr 1998 01:01:24 +0000 Subject: Patch from Chris Maltby . His comments follow: + improvement to smbtar to allow exclusion/inclusion of system and hidden files, and to generate a listing of what has been archived in a format useful for automated backup systems. + add the "Softq" spooling system to samba's printing capabilities. + I have "fixed" the intrusion of US style dates into samba reporting as well. The format yyyy/mm/dd is not only uunambiguous, but also has the benefit of making lexicographic sorts work correctly. Jeremy. (This used to be commit f9dacd1d8b89fccad859c0c6bc7a492823eb4b06) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 0acc5cbfa3..88d9a9de09 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1064,7 +1064,7 @@ enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER}; /* printing types */ enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX, - PRINT_QNX,PRINT_PLP,PRINT_LPRNG}; + PRINT_QNX,PRINT_PLP,PRINT_LPRNG,PRINT_SOFTQ}; /* Remote architectures we know about. */ enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_SAMBA}; -- cgit From 3339f170c2d8a40c8941555b3ea0ad8b8b2f457f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 9 Apr 1998 00:07:17 +0000 Subject: Added codepage 936 (simplified Chineses). In doing so I realized that much code was being duplicated between Hangul, Big5 and Simplified Chinese - so I re-arranged kanji.[ch] to go through generic functions for all multibyte characters that can be identified by a single code range (not Kanji - but all the others). Jeremy. (This used to be commit b6c965c396eb3d4f0e6dfd863e70b28390c59f66) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 88d9a9de09..21bf346c62 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1115,6 +1115,7 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; #define KANJI_CODEPAGE 932 #define HANGUL_CODEPAGE 949 #define BIG5_CODEPAGE 950 +#define SIMPLIFIED_CHINESE_CODEPAGE 936 #ifdef KANJI /* -- cgit From af80d8e98f2f74939d680c6abc21e3f40b927f31 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 9 Apr 1998 20:48:48 +0000 Subject: Makefile, loadparm.c, server.c, smb.h, util.c: Patch from stn@techfak.uni-kiel.de (Stefan Nehlsen) to get homes from the NIS+ map. smbpasswd.c: Tidy up of cli_state structure. Jeremy. (This used to be commit fc2295e0f5729585fdb3ee47edb290851d4071c5) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 21bf346c62..33c483d54c 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -887,7 +887,7 @@ struct parm_struct #define smb_base(buf) (((char *)(buf))+4) -#define SUCCESS 0 /* The request was successful. */ +#define SMB_SUCCESS 0 /* The request was successful. */ #define ERRDOS 0x01 /* Error is from the core DOS operating system set. */ #define ERRSRV 0x02 /* Error is generated by the server network file manager.*/ #define ERRHRD 0x03 /* Error is an hardware error. */ -- cgit From cac6a060af598bf94e6414b06e7365ec51ca360e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 13 Apr 1998 19:24:06 +0000 Subject: Changes to allow Samba to be compiled with -Wstrict-prototypes with gcc. (Not a big change although it looks like it :-). Jeremy. (This used to be commit cd2613c57261456485fe4eeecfda209ada70de8e) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 33c483d54c..95521217e9 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -632,7 +632,7 @@ struct parm_struct parm_type type; parm_class class; void *ptr; - BOOL (*special)(); + BOOL (*special)(char *, char **); struct enum_list *enum_list; unsigned flags; union { -- cgit From 041a292c439189206f1c35de94893dd51a1fda33 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 15 Apr 1998 20:00:41 +0000 Subject: ipc.c: Fix for printer queue spinning with Win95. nmbd.c: Fix for always overwriting log despite append setting. smb.h: Addition of last time password changed entry to account info. smbpass.c: Changes to support last time changed field in smbpasswd file. smbpasswd.c: Changes to support last time changed field in smbpasswd file. util.c: Fix for always overwriting log despite append setting. Jeremy. (This used to be commit eb4fe9ecdf539209efab07dc992447ea7370cf93) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 95521217e9..46e282b2ba 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -287,6 +287,7 @@ struct smb_passwd unsigned char *smb_nt_passwd; /* Null if no password */ /* Other fields / flags may be added later */ uint16 acct_ctrl; + time_t last_change_time; }; struct cli_state { -- cgit From 8584c6bd6621eefb49aff69581caf28e38b4ceda Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 22 Apr 1998 00:56:38 +0000 Subject: genrand.c: Improved generation of random values, more secure. loadparm.c: Started add of 'security=domain' code. password.c: Fix for security=server NT bugs. reply.c: Started add of 'security=domain' code. server.c: Started add of 'security=domain' code. smb.h: Started add of 'security=domain' code. Jeremy. (This used to be commit e6bda112ebe0d41f54c4249b5c2e1f24011347e1) --- source3/include/smb.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 46e282b2ba..4438024dbd 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1061,7 +1061,11 @@ char *Strstr(char *s, char *p); enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANMAN1,PROTOCOL_LANMAN2,PROTOCOL_NT1}; /* security levels */ +#ifdef DOMAIN_CLIENT +enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER,SEC_DOMAIN}; +#else /* DOMAIN_CLIENT */ enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER}; +#endif /* DOMAIN_CLIENT */ /* printing types */ enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX, -- cgit From 30675f81f60bab24f47758baab8316d4467709ef Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 23 Apr 1998 22:59:19 +0000 Subject: Makefile: Added nterr.c into the mix. clientgen.c: Added nt_error as an entry in the struct client_state. password.c: Open the netlogon pipe. smb.h: Added nt_error as an entry in the struct client_state. lib/rpc/parse/parse_net.c: Added comments on net logon. lib/rpc/server/srv_netlog.c: Added comments on net logon. Jeremy. (This used to be commit 899a9f0dce50c73e03c8da2ebe920957491c8ad7) --- source3/include/smb.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 4438024dbd..8d5cc20582 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -298,7 +298,8 @@ struct cli_state { int uid; int protocol; int sec_mode; - int error; + int rap_error; + uint32 nt_error; int privilages; fstring eff_name; fstring desthost; -- cgit From e7ac86607c80912e55ac7179b100cea22749c16f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 25 Apr 1998 01:12:08 +0000 Subject: This looks like a big change but really isn't. It is changing the global variables "myname" and "myworkgroup" to "global_myname" and "global_myworkgroup" respectively. This is to make it very explicit when we are messing with a global (don't ask - it makes the domain client code much clearer :-). Jeremy. (This used to be commit 866406bfe399cf757c8275093dacd5ce4843afa0) --- source3/include/smb.h | 112 +++++++++++++++++++++++++++----------------------- 1 file changed, 60 insertions(+), 52 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 8d5cc20582..1bf5b318b3 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -251,13 +251,6 @@ typedef fstring string; #define PIPE_LSASS "\\PIPE\\lsass" #define PIPE_LSARPC "\\PIPE\\lsarpc" -/* 32 bit time (sec) since 01jan1970 - cifs6.txt, section 3.5, page 30 */ -typedef struct time_info -{ - uint32 time; - -} UTIME; - /* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */ typedef struct nttime_info { @@ -281,40 +274,69 @@ typedef struct nttime_info struct smb_passwd { - int smb_userid; - char *smb_name; - unsigned char *smb_passwd; /* Null if no password */ - unsigned char *smb_nt_passwd; /* Null if no password */ - /* Other fields / flags may be added later */ - uint16 acct_ctrl; - time_t last_change_time; + int smb_userid; + char *smb_name; + unsigned char *smb_passwd; /* Null if no password */ + unsigned char *smb_nt_passwd; /* Null if no password */ + /* Other fields / flags may be added later */ + uint16 acct_ctrl; + time_t last_change_time; }; +/* DOM_CHAL - challenge info */ +typedef struct chal_info +{ + uchar data[8]; /* credentials */ +} DOM_CHAL; + +/* 32 bit time (sec) since 01jan1970 - cifs6.txt, section 3.5, page 30 */ +typedef struct time_info +{ + uint32 time; + +} UTIME; + +/* DOM_CREDs - timestamped client or server credentials */ +typedef struct cred_info +{ + DOM_CHAL challenge; /* credentials */ + UTIME timestamp; /* credential time-stamp */ + +} DOM_CRED; + struct cli_state { - int fd; - int cnum; - int pid; - int mid; - int uid; - int protocol; - int sec_mode; - int rap_error; - uint32 nt_error; - int privilages; - fstring eff_name; - fstring desthost; - char cryptkey[8]; - uint32 sesskey; - int serverzone; - uint32 servertime; - int readbraw_supported; - int writebraw_supported; - int timeout; - int max_xmit; - char *outbuf; - char *inbuf; - int bufsize; - int initialised; + int fd; + int cnum; + int pid; + int mid; + int uid; + int protocol; + int sec_mode; + int rap_error; + int privilages; + fstring eff_name; + fstring desthost; + char cryptkey[8]; + uint32 sesskey; + int serverzone; + uint32 servertime; + int readbraw_supported; + int writebraw_supported; + int timeout; + int max_xmit; + char *outbuf; + char *inbuf; + int bufsize; + int initialised; + /* + * Only used in NT domain calls. + */ + uint32 nt_error; /* NT RPC error code. */ + uint16 nt_pipe_fnum; /* Pipe handle. */ + unsigned char sess_key[16]; /* Current session key. */ + DOM_CRED clnt_cred; /* Client credential. */ + fstring mach_acct; + fstring srv_name; }; @@ -445,20 +467,6 @@ typedef struct } connection_struct; -/* DOM_CHAL - challenge info */ -typedef struct chal_info -{ - uchar data[8]; /* credentials */ -} DOM_CHAL; - -/* DOM_CREDs - timestamped client or server credentials */ -typedef struct cred_info -{ - DOM_CHAL challenge; /* credentials */ - UTIME timestamp; /* credential time-stamp */ - -} DOM_CRED; - /* Domain controller authentication protocol info */ struct dcinfo { -- cgit From d3832506b2583130c4f4ba4b3edeabca987b7cbb Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 29 Apr 1998 00:02:57 +0000 Subject: This is the checkin that adds the security=domain functionality. WARNING - so far this has only been tested against a Samba PDC (still waiting for IS to add me the machine accounts :-). Still missing is the code in smbpasswd that will add a machine account password and change it on the domain controller, but this is not hard, and I will check it in soon. Jeremy. (This used to be commit 17b94a7084621b3f0106dd4d3386f05cdfc56d19) --- source3/include/smb.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 1bf5b318b3..33b38706df 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -335,8 +335,8 @@ struct cli_state { uint16 nt_pipe_fnum; /* Pipe handle. */ unsigned char sess_key[16]; /* Current session key. */ DOM_CRED clnt_cred; /* Client credential. */ - fstring mach_acct; - fstring srv_name; + fstring mach_acct; /* MYNAME$. */ + fstring srv_name_slash; /* \\remote server. */ }; @@ -1070,11 +1070,7 @@ char *Strstr(char *s, char *p); enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANMAN1,PROTOCOL_LANMAN2,PROTOCOL_NT1}; /* security levels */ -#ifdef DOMAIN_CLIENT enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER,SEC_DOMAIN}; -#else /* DOMAIN_CLIENT */ -enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER}; -#endif /* DOMAIN_CLIENT */ /* printing types */ enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX, -- cgit From e305c2c9e2e657974d34d1d58a8f9372921fdae2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 29 Apr 1998 19:22:01 +0000 Subject: clientgen.c: Fixed null session setup bug. password.c: Stopped cli_nt_logout call (we don't have it correct yet). Added Luke object-orientation fix :-). smb.h: Added clnt_name_slash to cli_state. lib/rpc/client/cli_login.c: Changed global_myname to clnt_name_slash where needed. lib/rpc/client/cli_netlogon.c: Fixed debug messages, don't check creds on error. lib/rpc/client/cli_pipe.c: Fixed debug messages, Added Luke object-orientation fix. lib/rpc/parse/parse_misc.c: Fixed STRING2 linearization bug that was adding 1. Jeremy. (This used to be commit c6c22df20196cb7f0ae84b1a1dd202a87adb8d4e) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 33b38706df..589a70879c 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -337,6 +337,7 @@ struct cli_state { DOM_CRED clnt_cred; /* Client credential. */ fstring mach_acct; /* MYNAME$. */ fstring srv_name_slash; /* \\remote server. */ + fstring clnt_name_slash; /* \\local client. */ }; -- cgit From a2bddb20ed078c3e1b9cb60a7420b3d107898f52 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 6 May 1998 01:34:51 +0000 Subject: Fixes for the %U and %G problems people have reported. Essentially, multiple session_setup_and_X's may be done to an smbd. As there is only one global variable containing the requested connection name (sessionsetup_user), then any subsequent sessionsetups overwrite this name (causing %U and %G to get the wrong name). This is particularly common when an NT client does a null session setup to get a browse list after the user has connected, but before a share has been mounted. These changes store the requested_name in the vuid structure (so this only really works for user level and above security) and copies this name back into the global variable before the standard_sub call. Jeremy. (This used to be commit b5187ad6a3b3af9fbbeee8bced0ab16b41e9825b) --- source3/include/smb.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 589a70879c..8b7ad6ea92 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -485,7 +485,8 @@ typedef struct int uid; /* uid of a validated user */ int gid; /* gid of a validated user */ - fstring name; /* name of a validated user */ + fstring requested_name; /* user name from the client */ + fstring name; /* unix user name of a validated user */ fstring real_name; /* to store real name from password file - simeon */ BOOL guest; -- cgit From 9273102ea54d010043e6fdfaf1c61116eb93562e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 8 May 1998 01:23:11 +0000 Subject: smb.h: Supporting defines for NT trans calls. trans2.c: Paranoia bugfixes added when studying nttrans.c. Jeremy. (This used to be commit 94e70edef91c71703a7ebcdaf2b5a2bdce940a69) --- source3/include/smb.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 8b7ad6ea92..429ce87f40 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -895,6 +895,31 @@ struct parm_struct #define smb_droff smb_vwv7 #define smb_drdisp smb_vwv8 +/* these are for the NT trans primary request. */ +#define smb_nt_MaxSetupCount smb_vwv0 +#define smb_nt_Flags (smb_vwv0 + 1) +#define smb_nt_TotalParameterCount (smb_vwv0 + 3) +#define smb_nt_TotalDataCount (smb_vwv0 + 7) +#define smb_nt_MaxParameterCount (smb_vwv0 + 11) +#define smb_nt_MaxDataCount (smb_vwv0 + 15) +#define smb_nt_ParameterCount (smb_vwv0 + 19) +#define smb_nt_ParameterOffset (smb_vwv0 + 23) +#define smb_nt_DataCount (smb_vwv0 + 27) +#define smb_nt_DataOffset (smb_vwv0 + 31) +#define smb_nt_SetupCount (smb_vwv0 + 35) +#define smb_nt_Function (smb_vwv0 + 36) +#define smb_nt_SetupStart (smb_vwv0 + 39) + +/* these are for the NT trans secondary request. */ +#define smb_nts_TotalParameterCount (smb_vwv0 + 3) +#define smb_nts_TotalDataCount (smb_vwv0 + 7) +#define smb_nts_ParameterCount (smb_vwv0 + 11) +#define smb_nts_ParameterOffset (smb_vwv0 + 15) +#define smb_nts_ParameterDisplacement (smb_vwv0 + 19) +#define smb_nts_DataCount (smb_vwv0 + 23) +#define smb_nts_DataOffset (smb_vwv0 + 27) +#define smb_nts_DataDisplacement (smb_vwv0 + 31) + /* where to find the base of the SMB packet proper */ #define smb_base(buf) (((char *)(buf))+4) -- cgit From 6b70e2c7fd55f6cd21c645ffd587c71ddc354374 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 8 May 1998 11:30:17 +0000 Subject: added extra fields to struct smb_passwd the smbpw functions are expected to fill in the blanks by reading the appropriate smb.conf parameters. the ldappw functions are expected to fill in the fields from the ldap database. a separate utility can be written to fill in the ldap database fields from the smb.conf parameters, at a later date. (This used to be commit 0b6394c83ec20afdd8065da6785e057c35f3951f) --- source3/include/smb.h | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 429ce87f40..11e7409a9a 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -272,17 +272,47 @@ typedef struct nttime_info #define ACB_PWNOEXP 0x0200 /* 1 = User password does not expire */ #define ACB_AUTOLOCK 0x0400 /* 1 = Account auto locked */ +#define MAX_HOURS_LEN 32 + struct smb_passwd { - int smb_userid; - char *smb_name; - unsigned char *smb_passwd; /* Null if no password */ - unsigned char *smb_nt_passwd; /* Null if no password */ - /* Other fields / flags may be added later */ - uint16 acct_ctrl; - time_t last_change_time; + time_t logon_time; /* logon time */ + time_t logoff_time; /* logoff time */ + time_t kickoff_time; /* kickoff time */ + time_t pass_last_set_time; /* password last set time */ + time_t pass_can_change_time; /* password can change time */ + time_t pass_must_change_time; /* password must change time */ + + char *smb_name; /* username unicode string */ + char *full_name; /* user's full name unicode string */ + char *home_dir; /* home directory unicode string */ + char *dir_drive; /* home directory drive unicode string */ + char *logon_script; /* logon script unicode string */ + char *profile_path; /* profile path unicode string */ + char *acct_desc ; /* user description unicode string */ + char *workstations; /* login from workstations unicode string */ + char *unknown_str ; /* don't know what this is, yet. */ + char *munged_dial ; /* munged path name and dial-back tel number */ + + int smb_userid; /* this is actually the unix uid_t */ + uint32 user_rid; /* Primary User ID */ + uint32 group_rid; /* Primary Group ID */ + + unsigned char *smb_passwd; /* Null if no password */ + unsigned char *smb_nt_passwd; /* Null if no password */ + + uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */ + uint32 unknown_3; /* 0x00ff ffff */ + + uint16 logon_divs; /* 168 - number of hours in a week */ + uint32 hours_len; /* normally 21 bytes */ + uint8 hours[MAX_HOURS_LEN]; + + uint32 unknown_5; /* 0x0002 0000 */ + uint32 unknown_6; /* 0x0000 04ec */ }; + /* DOM_CHAL - challenge info */ typedef struct chal_info { -- cgit From 45d32e53015d754dbdfe5dede2f1ff8b23a71c74 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 8 May 1998 14:09:13 +0000 Subject: added smb_grpid to smb_passwd struct (This used to be commit bcafdcda85581cee4b7b5ead4526c30851e461bf) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 11e7409a9a..542545147b 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -295,6 +295,7 @@ struct smb_passwd char *munged_dial ; /* munged path name and dial-back tel number */ int smb_userid; /* this is actually the unix uid_t */ + int smb_grpid; /* this is actually the unix gid_t */ uint32 user_rid; /* Primary User ID */ uint32 group_rid; /* Primary Group ID */ -- cgit From 9f57f01b144b030274cc5d116b864b3c27f251ef Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 8 May 1998 16:59:30 +0000 Subject: clitar.c: #ifdef'ed out all the bits that were giving 'defined but not used' messages. nttrans.c: More updates. smb.h: Removed stuff that didn't belong in the smb_passwd struct. Persuaded Luke to use a new structure. web/swat.c: Fixed gcc complaints about shadowing global 'string'. Jeremy. (This used to be commit 61c1dbb9785ed1e6fe40f93c7cc65024884df6f5) --- source3/include/smb.h | 45 ++++++--------------------------------------- 1 file changed, 6 insertions(+), 39 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 542545147b..23335e190a 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -272,45 +272,14 @@ typedef struct nttime_info #define ACB_PWNOEXP 0x0200 /* 1 = User password does not expire */ #define ACB_AUTOLOCK 0x0400 /* 1 = Account auto locked */ -#define MAX_HOURS_LEN 32 - struct smb_passwd { - time_t logon_time; /* logon time */ - time_t logoff_time; /* logoff time */ - time_t kickoff_time; /* kickoff time */ - time_t pass_last_set_time; /* password last set time */ - time_t pass_can_change_time; /* password can change time */ - time_t pass_must_change_time; /* password must change time */ - - char *smb_name; /* username unicode string */ - char *full_name; /* user's full name unicode string */ - char *home_dir; /* home directory unicode string */ - char *dir_drive; /* home directory drive unicode string */ - char *logon_script; /* logon script unicode string */ - char *profile_path; /* profile path unicode string */ - char *acct_desc ; /* user description unicode string */ - char *workstations; /* login from workstations unicode string */ - char *unknown_str ; /* don't know what this is, yet. */ - char *munged_dial ; /* munged path name and dial-back tel number */ - - int smb_userid; /* this is actually the unix uid_t */ - int smb_grpid; /* this is actually the unix gid_t */ - uint32 user_rid; /* Primary User ID */ - uint32 group_rid; /* Primary Group ID */ - - unsigned char *smb_passwd; /* Null if no password */ - unsigned char *smb_nt_passwd; /* Null if no password */ - - uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */ - uint32 unknown_3; /* 0x00ff ffff */ - - uint16 logon_divs; /* 168 - number of hours in a week */ - uint32 hours_len; /* normally 21 bytes */ - uint8 hours[MAX_HOURS_LEN]; - - uint32 unknown_5; /* 0x0002 0000 */ - uint32 unknown_6; /* 0x0000 04ec */ + char *smb_name; /* username */ + int smb_userid; /* this is actually the unix uid_t */ + unsigned char *smb_passwd; /* Null if no password */ + unsigned char *smb_nt_passwd; /* Null if no password */ + uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */ + time_t pass_last_set_time; /* password last set time */ }; @@ -324,7 +293,6 @@ typedef struct chal_info typedef struct time_info { uint32 time; - } UTIME; /* DOM_CREDs - timestamped client or server credentials */ @@ -332,7 +300,6 @@ typedef struct cred_info { DOM_CHAL challenge; /* credentials */ UTIME timestamp; /* credential time-stamp */ - } DOM_CRED; struct cli_state { -- cgit From 721814dd3e10a9f7ae3e6cd26bf5224f3fdcbd23 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 8 May 1998 17:53:17 +0000 Subject: added sam_passwd structure: don't want smb_passwd to be "polluted". (This used to be commit d42dd371fa2ab690bf4261a735f03a7380479ebe) --- source3/include/smb.h | 56 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 6 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 23335e190a..d8fe5a84f7 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -251,6 +251,7 @@ typedef fstring string; #define PIPE_LSASS "\\PIPE\\lsass" #define PIPE_LSARPC "\\PIPE\\lsarpc" + /* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */ typedef struct nttime_info { @@ -272,14 +273,57 @@ typedef struct nttime_info #define ACB_PWNOEXP 0x0200 /* 1 = User password does not expire */ #define ACB_AUTOLOCK 0x0400 /* 1 = Account auto locked */ +#define MAX_HOURS_LEN 32 + +struct sam_passwd +{ + time_t logon_time; /* logon time */ + time_t logoff_time; /* logoff time */ + time_t kickoff_time; /* kickoff time */ + time_t pass_last_set_time; /* password last set time */ + time_t pass_can_change_time; /* password can change time */ + time_t pass_must_change_time; /* password must change time */ + + char *smb_name; /* username string */ + char *full_name; /* user's full name string */ + char *home_dir; /* home directory string */ + char *dir_drive; /* home directory drive string */ + char *logon_script; /* logon script string */ + char *profile_path; /* profile path string */ + char *acct_desc ; /* user description string */ + char *workstations; /* login from workstations string */ + char *unknown_str ; /* don't know what this is, yet. */ + char *munged_dial ; /* munged path name and dial-back tel number */ + + int smb_userid; /* this is actually the unix uid_t */ + int smb_grpid; /* this is actually the unix gid_t */ + uint32 user_rid; /* Primary User ID */ + uint32 group_rid; /* Primary Group ID */ + + unsigned char *smb_passwd; /* Null if no password */ + unsigned char *smb_nt_passwd; /* Null if no password */ + + uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */ + uint32 unknown_3; /* 0x00ff ffff */ + + uint16 logon_divs; /* 168 - number of hours in a week */ + uint32 hours_len; /* normally 21 bytes */ + uint8 hours[MAX_HOURS_LEN]; + + uint32 unknown_5; /* 0x0002 0000 */ + uint32 unknown_6; /* 0x0000 04ec */ +}; + struct smb_passwd { - char *smb_name; /* username */ - int smb_userid; /* this is actually the unix uid_t */ - unsigned char *smb_passwd; /* Null if no password */ - unsigned char *smb_nt_passwd; /* Null if no password */ - uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */ - time_t pass_last_set_time; /* password last set time */ + int smb_userid; /* this is actually the unix uid_t */ + char *smb_name; /* username string */ + + unsigned char *smb_passwd; /* Null if no password */ + unsigned char *smb_nt_passwd; /* Null if no password */ + + uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */ + time_t pass_last_set_time; /* password last set time */ }; -- cgit From f888868f46a5418bac9ab528497136c152895305 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 12 May 1998 00:55:32 +0000 Subject: This is a security audit change of the main source. It removed all ocurrences of the following functions : sprintf strcpy strcat The replacements are slprintf, safe_strcpy and safe_strcat. It should not be possible to use code in Samba that uses sprintf, strcpy or strcat, only the safe_equivalents. Once Andrew has fixed the slprintf implementation then this code will be moved back to the 1.9.18 code stream. Jeremy. (This used to be commit 2d774454005f0b54e5684cf618da7060594dfcbb) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index d8fe5a84f7..714d3b2eb4 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -237,7 +237,7 @@ implemented */ typedef char pstring[1024]; typedef char fstring[128]; -typedef fstring string; +/* typedef fstring string; */ /* pipe strings */ -- cgit From ed4719b66c728b52240961897282d0bbc9c456c1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 13 May 1998 05:01:36 +0000 Subject: we don't need a typedef for string (This used to be commit 9907296225e35548dadd70e1be5a06517b27bb87) --- source3/include/smb.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 714d3b2eb4..3049b50362 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -237,8 +237,6 @@ implemented */ typedef char pstring[1024]; typedef char fstring[128]; -/* typedef fstring string; */ - /* pipe strings */ #define PIPE_LANMAN "\\PIPE\\LANMAN" -- cgit From 32954eb9e9eb1e3613ad55cb1afd5e19e81b5da8 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 18 May 1998 11:54:00 +0000 Subject: Makefile: - added nisppass.c and NISPLUS_FLAGS includes.h: - renamed USE_LDAP to USE_LDAP_DB. renamed NISPLUS to USE_NISPLUS_DB. added default define of USE_SMBPASS_DB. - removed ldap headers: they are local only to ldap.c ldap.c : - made all ldap-specific functions static. - added dummy sam21 functions loadparm.c : - renamed NISPLUS to NISPLUS_HOME mkproto.awk - commented out ldap-specific #ifdef generation code: it's not needed now that ldap-specific functions in ldap.c are static nisppass.c : - first attempt at an add function from (This used to be commit f215d375f0f1e12894c2a9e86bd28d4776d337c1) --- source3/include/smb.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 3049b50362..893d61fc79 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -325,6 +325,14 @@ struct smb_passwd }; +struct sam_disp_info +{ + uint32 user_rid; /* Primary User ID */ + char *smb_name; /* username string */ + char *full_name; /* user's full name string */ +}; + + /* DOM_CHAL - challenge info */ typedef struct chal_info { -- cgit From ffab54750f0eec202895670dd9293ee4aa3eb475 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 18 May 1998 21:30:57 +0000 Subject: chgpasswd.c: Changed back to getsmb... from getsam... ldap.c: Stoped dummy_function being prototyped. loadparm.c: Fixed slprintf sizes. nisppass.c: Fixed safe_strcpy sizes. nmbd_processlogon.c: Changed back to getsmb... from getsam... nttrans.c: Just a dump of new code. passdb.c: Moved stuff around a lot - stopped any lookups by rid. This needs to be indirected through a function table (soon). password.c: Changed back to getsmb... from getsam... reply.c: Changed back to getsmb... from getsam... slprintf.c: Fixed prototype problems. smb.h: Fixed prototype problems. smbpass.c: Changed to getsmbfile.... smbpasswd.c: Changed back to getsmb... from getsam... lib/rpc/server/srv_netlog.c: Changed back to getsmb... from getsam... lib/rpc/server/srv_samr.c: Fixed rid lookup - use uid or gid lookup. lib/rpc/server/srv_util.c: Changed back to getsmb... from getsam... Jeremy. (This used to be commit 7d332b2493d2089d09521250fc9b72d8953307c0) --- source3/include/smb.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 893d61fc79..c90f77a593 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -979,9 +979,11 @@ struct parm_struct #define ERRCMD 0xFF /* Command was not in the "SMB" format. */ #ifdef __STDC__ -int Debug1(char *, ...); +int Debug1(char *, ...); +int slprintf(char *str, int n, char *format, ...); #else -int Debug1(); +int Debug1(); +int slprintf(); #endif #ifdef DFS_AUTH -- cgit From 118827376f8ccedb455e81b7d2b3bff029cde457 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 18 May 1998 23:57:28 +0000 Subject: Abstracted all the crappy password interfaces through an indirect function table, selectable at compile time. This should make the code that implements all the password functions much cleaner, as it's now very clear exactly what a particular password database needs to provide to Samba. Jeremy. (This used to be commit 27ca536ad974242524c12f7100e419d9e7f9647f) --- source3/include/smb.h | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index c90f77a593..fff44f179d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -332,7 +332,6 @@ struct sam_disp_info char *full_name; /* user's full name string */ }; - /* DOM_CHAL - challenge info */ typedef struct chal_info { @@ -635,8 +634,45 @@ struct shmem_ops { unsigned (*hash_size)(void); }; +/* + * Each implementation of the password database code needs + * to support the following operations. + */ + +struct passdb_ops { + /* + * Password database ops. + */ + void *(*startsmbpwent)(BOOL); + void (*endsmbpwent)(void *); + unsigned long (*getsmbpwpos)(void *); + BOOL (*setsmbpwpos)(void *, unsigned long); + /* + * smb password database query functions. + */ + struct smb_passwd *(*getsmbpwnam)(char *); + struct smb_passwd *(*getsmbpwuid)(uid_t); + struct smb_passwd *(*getsmbpwent)(void *); + /* + * smb password database modification functions. + */ + BOOL (*add_smbpwd_entry)(struct smb_passwd *); + BOOL (*mod_smbpwd_entry)(struct smb_passwd *, BOOL); + + /* + * Functions that manupulate a struct sam_passwd. + */ + struct sam_passwd *(*getsam21pwent)(void *); + + struct sam_passwd *(*getsam21pwnam)(char *); + struct sam_passwd *(*getsam21pwuid)(uint32); + + BOOL (*add_sam21pwd_entry)(struct sam_passwd *); + BOOL (*mod_sam21pwd_entry)(struct sam_passwd *, BOOL); +}; /* this is used for smbstatus */ + struct connect_record { int magic; -- cgit From 0a36b8d8a959c18c670a7e41e3f5a728f3ea88c3 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 19 May 1998 17:48:40 +0000 Subject: ldap.c : - added support for some of the new passdb_ops functions. - removed functions that are supported "indirectly" through passdb.c nisppass.c : - modified make_nisname_from_xxx() functions to take a "file" arg. - turned getnisp21pwuid() into getnisp21pwrid(). getnisp21pwuid() functionality is available through "indirect" support in passdb.c - removed functions that are supported "indirectly" through passdb.c - added support for some of the new passdb_ops functions. passdb.c : - created getsam21pwrid() function to go alongside getsam21pwuid. it is not expected that getsam21pwuid ever be used, certainly not from the lib/rpc code. - created getsamdisprid() and getsamdispent(). these are primarily for support of SamrQueryDisplayInfo, however given that they [struct sam_disp_info] return username, rid and fullname, there may be further instances where these functions will be useful. - added support where either the get/add/mod-smb or get/add/mod-sam21 functions are optional. this can be done very easily by checking whether the struct passdb_ops table functions are NULL or not. documented this capability in the notes at the top of the module. - where unix uid was referenced, use uid_t. - where unix gid was referenced, use gid_t. smb.h : - added sam_disp_info functions to passdb_ops. - added getsam21pwrid() function. smbpass.c : - added reference to iterate_getsam21pwrid(). lib/rpc/server/srv_samr.c : - removed group rid code added to get_user_info_21() code: this had been added in the wrong place. the client / server should already know whether it wants to do a lookup by user rid or by group rid. the test of whether the rid is a user or group rid has been left in because this may become useful consistency-check code. - converted back to getsam21pwrid() not getsam21pwuid(pdb_user_rid_to_uid()). this is because the unix uid to user rid mapping can be non-monotonic in some password database systems, and monotonic in others. imposing the restriction by converting immediately from rid to uid at this point is inadviseable, and will place this potential restriction on _all_ password database systems, not just some which, for whatever reason, do not support user rids. it should be up to the individual password database writer to convert from user rid to unix uid, should that module not support rids. lib/rpc/server/srv_util.c : - got lookup_user_name() to call getsamdisprid() not getsmbpwuid(). a bug was introduced (or at least the bug already there was not fixed) whereby the nt user rid was converted to a unix uid, and then not used. (This used to be commit 0193dd21c3c44e0611add742c6f92b92474de6b8) --- source3/include/smb.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index fff44f179d..8687f618e4 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -637,6 +637,17 @@ struct shmem_ops { /* * Each implementation of the password database code needs * to support the following operations. + * + * either the get/mod/add-smbXXX or the get/mod/add-sam21XXX functions + * are optional, but not both. conversion routines will be called + * if only one of each is supported. the preference is to provide + * full getsam21pwXXX functionality. + * + * e.g: provide a getsam21pwnam() function but set getsmbpwnam() to NULL: + * passdb.c will automatically call getsam21pwnam() and then call the + * sam21-to-smb conversion routine if the passdb.c::getsmbpwnam() function + * is called. + * */ struct passdb_ops { @@ -647,12 +658,14 @@ struct passdb_ops { void (*endsmbpwent)(void *); unsigned long (*getsmbpwpos)(void *); BOOL (*setsmbpwpos)(void *, unsigned long); + /* * smb password database query functions. */ struct smb_passwd *(*getsmbpwnam)(char *); struct smb_passwd *(*getsmbpwuid)(uid_t); struct smb_passwd *(*getsmbpwent)(void *); + /* * smb password database modification functions. */ @@ -664,11 +677,24 @@ struct passdb_ops { */ struct sam_passwd *(*getsam21pwent)(void *); + /* + * sam password database query functions. + */ struct sam_passwd *(*getsam21pwnam)(char *); - struct sam_passwd *(*getsam21pwuid)(uint32); + struct sam_passwd *(*getsam21pwuid)(uid_t); + struct sam_passwd *(*getsam21pwrid)(uint32); + /* + * sam password database modification functions. + */ BOOL (*add_sam21pwd_entry)(struct sam_passwd *); BOOL (*mod_sam21pwd_entry)(struct sam_passwd *, BOOL); + + /* + * sam query display info functions. + */ + struct sam_disp_info *(*getsamdisprid)(uint32); + struct sam_disp_info *(*getsamdispent)(void *); }; /* this is used for smbstatus */ -- cgit From 48c7034c92452982167adc2c34049dea353c272c Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 19 May 1998 19:17:35 +0000 Subject: removed "default" system for password database api: all functions must be supported. there are some stub routines in passdb.c which can be copied into a password database api which do conversion. the module writer can choose which of these to provide full support for instead of using the conversion routines. (This used to be commit d906ac5941fa22f93a38d65906b89a80f971b83c) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 8687f618e4..cc0ce07495 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -693,6 +693,7 @@ struct passdb_ops { /* * sam query display info functions. */ + struct sam_disp_info *(*getsamdispnam)(char *); struct sam_disp_info *(*getsamdisprid)(uint32); struct sam_disp_info *(*getsamdispent)(void *); }; -- cgit From 1b412a501e22602ac5edcd875e09bd3814b6e841 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 19 May 1998 20:08:37 +0000 Subject: passdb.c: Fixed typo in coment. smb.h: Removed comments no longer valid. smbpass.c: Stopped dummy function from being prototyped. util.c: Fix for multibyte char problems with strlower, strupper and string_replace. Jeremy. (This used to be commit cd244b45a5d35fceee2a4034b0c6aabdb58871aa) --- source3/include/smb.h | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index cc0ce07495..092cf349e5 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -637,17 +637,6 @@ struct shmem_ops { /* * Each implementation of the password database code needs * to support the following operations. - * - * either the get/mod/add-smbXXX or the get/mod/add-sam21XXX functions - * are optional, but not both. conversion routines will be called - * if only one of each is supported. the preference is to provide - * full getsam21pwXXX functionality. - * - * e.g: provide a getsam21pwnam() function but set getsmbpwnam() to NULL: - * passdb.c will automatically call getsam21pwnam() and then call the - * sam21-to-smb conversion routine if the passdb.c::getsmbpwnam() function - * is called. - * */ struct passdb_ops { -- cgit From 0f9d24f083acb5bb17d220ac6bcac833625e1f74 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 23 May 1998 02:00:21 +0000 Subject: Added more NT definitions, getting ready for nttrans code. Jeremy. (This used to be commit 26c0176e104f7345f16f7fdb1115f32e6b0cfcdb) --- source3/include/smb.h | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 092cf349e5..31935b636d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1020,6 +1020,63 @@ struct parm_struct #define smb_nts_DataOffset (smb_vwv0 + 27) #define smb_nts_DataDisplacement (smb_vwv0 + 31) +/* these are for the NT create_and_X */ +#define smb_ntcreate_NameLength (smb_vwv0 + 5) +#define smb_ntcreate_Flags (smb_vwv0 + 7) +#define smb_ntcreate_RootDirectoryFid (smb_wvw0 + 11) +#define smb_ntcreate_DesiredAccess (smb_vwv0 + 15) +#define smb_ntcreate_AllocationSize (smb_vwv0 + 19) +#define smb_ntcreate_FileAttributes (smb_vwv0 + 27) +#define smb_ntcreate_ShareAccess (smb_vwv0 + 31) +#define smb_ntcreate_CreateDisposition (smb_vwv0 + 35) +#define smb_ntcreate_CreateOptions (smb_vwv0 + 39) +#define smb_ntcreate_ImpersonationLevel (smb_vwv0 + 43) +#define smb_ntcreate_SecurityFlags (smb_vwv0 + 47) + +/* these are the constants used in the above call. */ +/* DesiredAccess */ +#if 0 +/* TODO.... JRA */ +#define GENERIC_READ xxx? +#define GENERIC_WRITE xxx? +#endif + +/* Flags field. */ +#define REQUEST_OPLOCK 2 +#define REQUEST_BATCH_OPLOCK 4 +#define OPEN_DIRECTORY 8 + +/* ShareAccess field. */ +#define FILE_SHARE_NONE 0 /* Cannot be used in bitmask. */ +#define FILE_SHARE_READ 1 +#define FILE_SHARE_WRITE 2 +#define FILE_SHARE_DELETE 4 + +/* FileAttributesField */ +#define FILE_ATTRIBUTE_READONLY aRONLY +#define FILE_ATTRIBUTE_HIDDEN aHIDDEN +#define FILE_ATTRIBUTE_SYSTEM aSYSTEM +#define FILE_ATTRIBUTE_DIRECTORY aDIR +#define FILE_ATTRIBUTE_ARCHIVE aARCH +#define FILE_ATTRIBUTE_NORMAL 0x80L +#define FILE_ATTRIBUTE_TEMPORARY 0x100L +#define FILE_ATTRIBUTE_COMPRESSED 0x800L +/* Flags - combined with attributes. */ +#define FILE_FLAG_WRITE_THROUGH 0x80000000L +#define FILE_FLAG_NO_BUFFERING 0x20000000L +#define FILE_FLAG_RANDOM_ACCESS 0x10000000L +#define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000L +#define FILE_FLAG_DELETE_ON_CLOSE 0x04000000L +#define FILE_FLAG_BACKUP_SEMANTICS 0x02000000L +#define FILE_FLAG_POSIX_SEMANTICS 0x01000000L + +/* CreateDisposition field. */ +#define CREATE_NEW 1 +#define CREATE_ALWAYS 2 +#define OPEN_EXISTING 3 +#define OPEN_ALWAYS 4 +#define TRUNCATE_EXISTING 5 + /* where to find the base of the SMB packet proper */ #define smb_base(buf) (((char *)(buf))+4) -- cgit From 1d16f750515bcf49e0dc87394479dc56e7192538 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 26 May 1998 19:37:31 +0000 Subject: smb.h: More NT SMB stuff (just defines). smbpass.c: Do *NOT* make this function static. It breaks the compile on gcc util.c: Getting closer to MS wildcard semantics. A trailing '*' matches any trailing dot-separated components. trans2.c: Removed hacks that change multiple '?' -> '*' as this breaks things now. trans2.h: Removed NT_FILE_ATTRIBUTE_NORMAL - now FILE_ATTRIBUTE_NORMAL is defined in smb.h. Jeremy. (This used to be commit 42a65511068cd9006350c80bbed2f346f3f01cb0) --- source3/include/smb.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 31935b636d..0382cf2c71 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1037,6 +1037,15 @@ struct parm_struct /* DesiredAccess */ #if 0 /* TODO.... JRA */ +#define SPECIFIC_RIGHTS_MASK 0x00FFFFL +#define STANDARD_RIGHTS_MASK 0xFF0000L +#define DELETE_ACCESS (1L<<16) +#define READ_CONTROL_ACCESS (1L<<17) +#define WRITE_DAC_ACCESS (1L<<18) +#define WRITE_OWNER_ACCESS (1L<<19) +#define SYNCHRONIZE_ACCESS (1L<<20) +#define SYSTEM_SECURITY_ACCESS (1L<<24) + #define GENERIC_READ xxx? #define GENERIC_WRITE xxx? #endif -- cgit From c435955b02c7fc227b9475ff73c62e080d34a1af Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 3 Jun 1998 01:04:45 +0000 Subject: ipc.c: Fix bug where we don't return the correct error code when client gives a too-small buffer for share info. Fix from Gil Kloepfer smb.h: server.c: Fix for a nastly little security problem with multi-user Windows NT servers and Samba where the contents of the open-file cache can end up being served out to users who shouldn't have access. This is some *seriously* ugly code. Jeremy. (This used to be commit 05c85df3c7da982085615e5a1db6c71e164db4f5) --- source3/include/smb.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 0382cf2c71..cdac9cb720 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -433,6 +433,8 @@ typedef struct typedef struct { uint16 ref_count; + uint16 uid_cache_count; + uid_t uid_users_cache[10]; uint32 dev; uint32 inode; int fd; -- cgit From 59e2992139774762456826f6667e73f2b39828d8 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 4 Jun 1998 15:24:20 +0000 Subject: added "domain admin group" and "domain guest group" parameters. this is because "domain admin users" and "domain guest users" was overloaded. incorrectly. (This used to be commit 04b824007263ac4879c7282a2d230deaac7d2c7b) --- source3/include/smb.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index cdac9cb720..214b36e704 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -687,6 +687,15 @@ struct passdb_ops { struct sam_disp_info *(*getsamdispnam)(char *); struct sam_disp_info *(*getsamdisprid)(uint32); struct sam_disp_info *(*getsamdispent)(void *); + +#if 0 + /* + * password checking functions + */ + struct smb_passwd *(*smb_password_chal )(char *username, char lm_pass[24], char nt_pass[24], char chal[8]); + struct smb_passwd *(*smb_password_check )(char *username, char lm_hash[16], char nt_hash[16], + struct passwd *(*unix_password_check)(char *username, char *pass, int pass_len); +#endif }; /* this is used for smbstatus */ -- cgit From 1b85da9a1cd91c4d658ea50f1ed6545e85a0199a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 4 Jun 1998 17:48:21 +0000 Subject: had what would be a compile error if it wasn't #if 0'd out in passdb_ops (This used to be commit 2cb94eec59bdcc1272063637bbc8b7a5449fdc62) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 214b36e704..dfbe213e57 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -693,7 +693,7 @@ struct passdb_ops { * password checking functions */ struct smb_passwd *(*smb_password_chal )(char *username, char lm_pass[24], char nt_pass[24], char chal[8]); - struct smb_passwd *(*smb_password_check )(char *username, char lm_hash[16], char nt_hash[16], + struct smb_passwd *(*smb_password_check )(char *username, char lm_hash[16], char nt_hash[16]); struct passwd *(*unix_password_check)(char *username, char *pass, int pass_len); #endif }; -- cgit From 860f674c0deefca62f3c918cf657a902f4b73dd8 Mon Sep 17 00:00:00 2001 From: "Christopher R. Hertel" Date: Fri, 12 Jun 1998 03:11:33 +0000 Subject: This is the first, small step toward some tweaks that Jeremy and I have been discussing regarding the debug mechanism. With this, I've added a macro that allows syntax like: if( DEBUGLVL( 3 ) ) { Debug1( "message" ); Debug2( "message" ); } The next step is to incorporate timestamps. Chris -)----- (This used to be commit 0b35065d0c5a33a9eebee683ecb08e9aef4c1830) --- source3/include/smb.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index dfbe213e57..085c06769b 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -100,10 +100,12 @@ typedef unsigned int uint32; /* debugging code */ #ifndef SYSLOG #define DEBUG(level,body) ((DEBUGLEVEL>=(level))?(Debug1 body):0) +#define DEBUGLVL(level) (DEBUGLEVEL>=(level)) #else extern int syslog_level; #define DEBUG(level,body) ((DEBUGLEVEL>=(level))? (syslog_level = (level), Debug1 body):0) +#define DEBUGLVL(level) ( DEBUGLEVEL >= (syslog_level=(level)) ) #endif /* this defines the error codes that receive_smb can put in smb_read_error */ -- cgit From cb757820f5452d192ce3b1eeb4f19a17ee93c3fe Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 16 Jun 1998 01:35:52 +0000 Subject: Added SSL support from Christian Starkjohann This patch may not yet compile with -DUSE_SSL enabled, further Makefile changes may be needed. But it was important to get this code in place before I go off to USENIX. Jeremy. (This used to be commit 31e768369fdc61e07c59630c86c62239f3d3f3f7) --- source3/include/smb.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 085c06769b..a5571d3645 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1290,6 +1290,10 @@ enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_SAMB /* case handling */ enum case_handling {CASE_LOWER,CASE_UPPER}; +#ifdef USE_SSL +/* SSL version options */ +enum ssl_version_enum {SMB_SSL_V2,SMB_SSL_V3,SMB_SSL_V23,SMB_SSL_TLS1}; +#endif /* USE_SSL */ /* Macros to get at offsets within smb_lkrng and smb_unlkrng structures. We cannot define these as actual structures -- cgit From 8afebcdd7e055cd6c6f9eb69f9ba652b4e1ab591 Mon Sep 17 00:00:00 2001 From: Richard Sharpe Date: Sun, 21 Jun 1998 12:44:34 +0000 Subject: Remove the copyright to Canon Information Systems Australia, as we don't want them to have the copyright. Added a new DOSERR response code that Win95 returns, unimp, unimplemented. Added code to ignore errors on setting remote time, as Win 95 does not like the time being changed on a directory. Win NT and Samba are OK at this. This is the next to last clean-ups here. Next is to properly handle restore times on directories (except for Win95--see above). Now have Jay's changes in and have fixed a bug reported by Tim Lee. (This used to be commit dc9436bae4493b71ba92970d6cc49dbb33cd55cd) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index a5571d3645..821bf12d94 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -164,6 +164,7 @@ implemented */ #define ERRnofiles 18 /* no more files found in file search */ #define ERRbadshare 32 /* Share mode on file conflict with open mode */ #define ERRlock 33 /* Lock request conflicts with existing lock */ +#define ERRunsup 50 /* Request unsupported, returned by Win 95, RJS 20Jun98 */ #define ERRfilexists 80 /* File in operation already exists */ #define ERRcannotopen 110 /* Cannot open the file specified */ #define ERRunknownlevel 124 -- cgit From 1829528d1fb2b87c726341aaf8d69d1190f83d6b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 30 Jun 1998 21:19:40 +0000 Subject: nttrans.c: More code towards NT protocol. smb.h: More code towards NT protocol. time.c: Fix for sco bug. Jeremy. (This used to be commit e53f4396ead540bcf9ecd18f3253e49216404a1b) --- source3/include/smb.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 821bf12d94..734dddff14 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1049,8 +1049,18 @@ struct parm_struct /* these are the constants used in the above call. */ /* DesiredAccess */ -#if 0 -/* TODO.... JRA */ +/* File Specific access rights. */ +#define FILE_READ_DATA 0x001 +#define FILE_WRITE_DATA 0x002 +#define FILE_APPEND_DATA 0x004 +#define FILE_READ_EA 0x008 +#define FILE_WRITE_EA 0x010 +#define FILE_EXECUTE 0x020 +#define FILE_DELETE_CHILD 0x040 +#define FILE_READ_ATTRIBUTES 0x080 +#define FILE_WRITE_ATTRIBUTES 0x100 + +/* Generic access masks & rights. */ #define SPECIFIC_RIGHTS_MASK 0x00FFFFL #define STANDARD_RIGHTS_MASK 0xFF0000L #define DELETE_ACCESS (1L<<16) @@ -1060,10 +1070,6 @@ struct parm_struct #define SYNCHRONIZE_ACCESS (1L<<20) #define SYSTEM_SECURITY_ACCESS (1L<<24) -#define GENERIC_READ xxx? -#define GENERIC_WRITE xxx? -#endif - /* Flags field. */ #define REQUEST_OPLOCK 2 #define REQUEST_BATCH_OPLOCK 4 -- cgit From 139a34157eba50f70c86f2dd07fb384a7cbaf9cc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 1 Jul 1998 21:49:49 +0000 Subject: includes.h: AIX fix. nttrans.c: More NT SMB work. smb.h: More NT SMB defines. trans2.c: Change call response as I now have docs on what the flags mean. #ifdef it with JRATEST until I'm sure it's ok though. Jeremy. (This used to be commit ce2503fddd7ef9eed89e1a63fd834f13432a9cd6) --- source3/include/smb.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 734dddff14..9cedc890b8 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1090,6 +1090,8 @@ struct parm_struct #define FILE_ATTRIBUTE_NORMAL 0x80L #define FILE_ATTRIBUTE_TEMPORARY 0x100L #define FILE_ATTRIBUTE_COMPRESSED 0x800L +#define SAMBA_ATTRIBUTES_MASK 0x7F + /* Flags - combined with attributes. */ #define FILE_FLAG_WRITE_THROUGH 0x80000000L #define FILE_FLAG_NO_BUFFERING 0x20000000L @@ -1106,6 +1108,12 @@ struct parm_struct #define OPEN_ALWAYS 4 #define TRUNCATE_EXISTING 5 +/* Filesystem Attributes. */ +#define FILE_CASE_SENSITIVE_SEARCH 0x1 +#define FILE_CASE_PRESERVED_NAMES 0x2 +#define FILE_UNICODE_ON_DISK 0x4 +#define FILE_PERISITANT_ACLS 0x8 + /* where to find the base of the SMB packet proper */ #define smb_base(buf) (((char *)(buf))+4) -- cgit From ddf62bbbdb12e45d0fec5dab3dcd8030d2aa4680 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 9 Jul 1998 00:41:32 +0000 Subject: NT SMB trans reply code. Jeremy. (This used to be commit 556254d72517c8a5bf70cafaf443df1675fe64d9) --- source3/include/smb.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 9cedc890b8..697caa349d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1034,6 +1034,16 @@ struct parm_struct #define smb_nts_DataOffset (smb_vwv0 + 27) #define smb_nts_DataDisplacement (smb_vwv0 + 31) +/* these are for the NT trans reply. */ +#define smb_ntr_TotalParameterCount (smb_vwv0 + 3) +#define smb_ntr_TotalDataCount (smb_vwv0 + 7) +#define smb_ntr_ParameterCount (smb_vwv0 + 11) +#define smb_ntr_ParameterOffset (smb_vwv0 + 15) +#define smb_ntr_ParameterDisplacement (smb_vwv0 + 19) +#define smb_ntr_DataCount (smb_vwv0 + 23) +#define smb_ntr_DataOffset (smb_vwv0 + 27) +#define smb_ntr_DataDisplacement (smb_vwv0 + 31) + /* these are for the NT create_and_X */ #define smb_ntcreate_NameLength (smb_vwv0 + 5) #define smb_ntcreate_Flags (smb_vwv0 + 7) -- cgit From ebad4278b72289f10ce7afa72a137f5e3e998b01 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 11 Jul 1998 01:25:02 +0000 Subject: nntrans.c: Fully implemented transact rename. reply.c: Added NT specific rename if exists flag to rename_internals(). smb.h: Added NT rename flag. Jeremy. (This used to be commit b398f7daf58459db6e8d3496502abeb634ac2183) --- source3/include/smb.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 697caa349d..e58fcc034d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1118,6 +1118,9 @@ struct parm_struct #define OPEN_ALWAYS 4 #define TRUNCATE_EXISTING 5 +/* Flag for NT transact rename call. */ +#define RENAME_REPLACE_IF_EXISTS 1 + /* Filesystem Attributes. */ #define FILE_CASE_SENSITIVE_SEARCH 0x1 #define FILE_CASE_PRESERVED_NAMES 0x2 -- cgit From dc44d77c7fd3427b1313e8ee2d7929fb7778148f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 16 Jul 1998 22:46:06 +0000 Subject: Makefile: Added nttrans.o includes.h: Added termios.h for AIX. nttrans.c: Working NT SMB calls ! pipes.c: Use strequal instead of strcmp. server.c: Use #defines rather than numbers. smb.h: Updated NT SMB #defines. Jeremy. (This used to be commit 3e5cada9885059e9926eb6a56d350c4b1b53d245) --- source3/include/smb.h | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index e58fcc034d..ca295f3b42 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1112,11 +1112,25 @@ struct parm_struct #define FILE_FLAG_POSIX_SEMANTICS 0x01000000L /* CreateDisposition field. */ -#define CREATE_NEW 1 -#define CREATE_ALWAYS 2 -#define OPEN_EXISTING 3 -#define OPEN_ALWAYS 4 -#define TRUNCATE_EXISTING 5 +#define FILE_SUPERSEDE 0 +#define FILE_OPEN 1 +#define FILE_CREATE 2 +#define FILE_OPEN_IF 3 +#define FILE_OVERWRITE 4 +#define FILE_OVERWRITE_IF 5 + +/* Responses when opening a file. */ +#define FILE_WAS_OPENED 1 +#define FILE_WAS_CREATED 2 +#define FILE_WAS_OVERWRITTEN 3 + +/* File type flags */ +#define FILE_TYPE_DISK 0 +#define FILE_TYPE_BYTE_MODE_PIPE 1 +#define FILE_TYPE_MESSAGE_MODE_PIPE 2 +#define FILE_TYPE_PRINTER 3 +#define FILE_TYPE_COMM_DEVICE 4 +#define FILE_TYPE_UNKNOWN 0xFFFF /* Flag for NT transact rename call. */ #define RENAME_REPLACE_IF_EXISTS 1 -- cgit From 471087c9d28a4058efc16f98784cb179ffc1e4c4 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 17 Jul 1998 22:21:24 +0000 Subject: Code added to fix the renaming of a directory under NT SMB calls. local.h: Changed MAXDIR to MAX_OPEN_DIRECTORIES - shmem size also tuned by this. dir.c: Use MAX_OPEN_DIRECTORIES. nttrans.c: Allow opening of a directory to succeed. Doesn't actually open a file descriptor but takes a files_struct slot marked as an fd. reply.c: Changed to close any outstanding is_directory files. reply_close changed to understand directory files. server.c: Added open_directory(), close_directory() calls. smb.h: Added is_directory to files_struct. Changed OPEN_FNUM to check that target is !is_directory (this prevents the normal file calls from processing a directory files_struct. Jeremy. (This used to be commit e01ce693f47e75e277f3440d46e32b0bd866b550) --- source3/include/smb.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index ca295f3b42..921cb4284d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -418,14 +418,14 @@ typedef struct /* Structure used when SMBwritebmpx is active */ typedef struct - { - int wr_total_written; /* So we know when to discard this */ - int32 wr_timeout; - int32 wr_errclass; - int32 wr_error; /* Cached errors */ - BOOL wr_mode; /* write through mode) */ - BOOL wr_discard; /* discard all further data */ - } write_bmpx_struct; +{ + int wr_total_written; /* So we know when to discard this */ + int32 wr_timeout; + int32 wr_errclass; + int32 wr_error; /* Cached errors */ + BOOL wr_mode; /* write through mode) */ + BOOL wr_discard; /* discard all further data */ +} write_bmpx_struct; /* * Structure used to indirect fd's from the files_struct. @@ -467,6 +467,7 @@ typedef struct BOOL modified; BOOL granted_oplock; BOOL sent_oplock_break; + BOOL is_directory; BOOL reserved; char *name; } files_struct; @@ -781,7 +782,7 @@ struct parm_struct /* these are useful macros for checking validity of handles */ #define VALID_FNUM(fnum) (((fnum) >= 0) && ((fnum) < MAX_OPEN_FILES)) -#define OPEN_FNUM(fnum) (VALID_FNUM(fnum) && Files[fnum].open) +#define OPEN_FNUM(fnum) (VALID_FNUM(fnum) && Files[fnum].open && !Files[fnum].is_directory) #define VALID_CNUM(cnum) (((cnum) >= 0) && ((cnum) < MAX_CONNECTIONS)) #define OPEN_CNUM(cnum) (VALID_CNUM(cnum) && Connections[cnum].open) #define IS_IPC(cnum) (VALID_CNUM(cnum) && Connections[cnum].ipc) -- cgit From f5866fd4ba8da9acde87c7f9da8f1a242540e287 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 22 Jul 1998 13:59:19 +0000 Subject: Fixed bug found by Richard Sharpe. After increasing files_struct size by MAX_OPEN_DIRECTORIES for nttrans I forgot to update the code that enumerates the array. Created new MAX_FNUMS in local.h, changed all code that iterates through the files_struct array to use this. (sorry Richard). Jeremy. (This used to be commit 339b10222269d71c7a493cc08b7b1bfd35fd55fc) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 921cb4284d..7079198a40 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -781,7 +781,7 @@ struct parm_struct #endif /* LOCKING_VERSION */ /* these are useful macros for checking validity of handles */ -#define VALID_FNUM(fnum) (((fnum) >= 0) && ((fnum) < MAX_OPEN_FILES)) +#define VALID_FNUM(fnum) (((fnum) >= 0) && ((fnum) < MAX_FNUMS)) #define OPEN_FNUM(fnum) (VALID_FNUM(fnum) && Files[fnum].open && !Files[fnum].is_directory) #define VALID_CNUM(cnum) (((cnum) >= 0) && ((cnum) < MAX_CONNECTIONS)) #define OPEN_CNUM(cnum) (VALID_CNUM(cnum) && Connections[cnum].open) -- cgit From 1aa138922e5c0e4925ff5cbfcdb4e7cad367b31b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 27 Jul 1998 18:50:45 +0000 Subject: chgpasswd.c: Fixed up debug calls to stop crashes if ptsname failed. local.h: Kept FSTYPE_STRING as Samba for now. nmbd_browsesync.c: Added bugfix from Matt Chapman mattyc@cyberdude.com - lmb_browserlist is now a struct ubi_dlList not a struct browse_cache_record *. server.c: smb.h: uid.c: password.c: Removed attrs code - it is not used anywhere. Jeremy (This used to be commit ef1af7fe6d5c58ae57b8e4efff0729e1a315da43) --- source3/include/smb.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 7079198a40..3b1796f76b 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -398,7 +398,6 @@ struct current_user int ngroups; gid_t *groups; int *igroups; - int *attrs; }; typedef struct @@ -510,7 +509,6 @@ typedef struct int ngroups; gid_t *groups; int *igroups; /* an integer version - some OSes are broken :-( */ - int *attrs; time_t lastused; BOOL used; @@ -548,7 +546,6 @@ typedef struct int n_groups; gid_t *groups; int *igroups; /* an integer version - some OSes are broken :-( */ - int *attrs; /* attributes associated with each gid */ int n_sids; int *sids; -- cgit From 64578c0589a3a741f81fb55c16eeb882128da00b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 29 Jul 1998 03:08:05 +0000 Subject: merge from the autoconf2 branch to the main branch (This used to be commit 3bda7ac417107a7b01d91805ca71c4330657ed21) --- source3/include/smb.h | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 3b1796f76b..1c37aab7e2 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -57,12 +57,6 @@ typedef int BOOL; as signed and unsigned int will work. */ -/* afs/stds.h defines int16 and int32 */ -#ifndef AFS_AUTH -typedef short int16; -typedef int int32; -#endif - #ifndef uint8 typedef unsigned char uint8; #endif @@ -71,22 +65,17 @@ typedef unsigned char uint8; typedef unsigned short uint16; #endif -#ifndef uint32 -typedef unsigned int uint32; -#endif - #ifndef uchar #define uchar unsigned char #endif + #ifndef int16 #define int16 short #endif + #ifndef uint16 #define uint16 unsigned short #endif -#ifndef uint32 -#define uint32 unsigned int -#endif #define SIZEOFWORD 2 @@ -94,11 +83,15 @@ typedef unsigned int uint32; #define DEF_CREATE_MASK (0755) #endif +#ifndef PRINTCAP_NAME +#define PRINTCAP_NAME "/etc/printcap" +#endif + /* how long to wait for secondary SMB packets (milli-seconds) */ #define SMB_SECONDARY_WAIT (60*1000) /* debugging code */ -#ifndef SYSLOG +#if !defined(WITH_SYSLOG) || defined(NO_SYSLOG) #define DEBUG(level,body) ((DEBUGLEVEL>=(level))?(Debug1 body):0) #define DEBUGLVL(level) (DEBUGLEVEL>=(level)) #else @@ -1149,7 +1142,7 @@ struct parm_struct #define ERRHRD 0x03 /* Error is an hardware error. */ #define ERRCMD 0xFF /* Command was not in the "SMB" format. */ -#ifdef __STDC__ +#ifdef HAVE_STDARG_H int Debug1(char *, ...); int slprintf(char *str, int n, char *format, ...); #else @@ -1157,7 +1150,7 @@ int Debug1(); int slprintf(); #endif -#ifdef DFS_AUTH +#ifdef WITH_DFS void dfs_unlogin(void); extern int dcelogin_atmost_once; #endif @@ -1170,14 +1163,6 @@ void ajt_panic(void); char *strdup(char *s); #endif -#ifdef REPLACE_STRLEN -int Strlen(char *); -#endif - -#ifdef REPLACE_STRSTR -char *Strstr(char *s, char *p); -#endif - #ifndef MIN #define MIN(a,b) ((a)<(b)?(a):(b)) #endif @@ -1190,7 +1175,7 @@ char *Strstr(char *s, char *p); #endif #ifndef SIGNAL_CAST -#define SIGNAL_CAST +#define SIGNAL_CAST (RETSIGTYPE (*)()) #endif #ifndef SELECT_CAST @@ -1330,10 +1315,10 @@ enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_SAMB /* case handling */ enum case_handling {CASE_LOWER,CASE_UPPER}; -#ifdef USE_SSL +#ifdef WITH_SSL /* SSL version options */ enum ssl_version_enum {SMB_SSL_V2,SMB_SSL_V3,SMB_SSL_V23,SMB_SSL_TLS1}; -#endif /* USE_SSL */ +#endif /* WITH_SSL */ /* Macros to get at offsets within smb_lkrng and smb_unlkrng structures. We cannot define these as actual structures -- cgit From fb08c34cf3950f994701a9c98c89670f6346f7ab Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 29 Jul 1998 05:05:36 +0000 Subject: get rid of the runtime test for broken getgroups() and add a compile time test instead. This also allows us to get rid of the igroups element of a couple of structures. (This used to be commit 8b25fe734166b76ceebf8d9543c706ebe0fddc96) --- source3/include/smb.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 1c37aab7e2..8d846d4531 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -386,11 +386,10 @@ struct cli_state { struct current_user { - int cnum, vuid; - int uid, gid; - int ngroups; - gid_t *groups; - int *igroups; + int cnum, vuid; + int uid, gid; + int ngroups; + GID_T *groups; }; typedef struct @@ -500,8 +499,7 @@ typedef struct /* This groups info is valid for the user that *opened* the connection */ int ngroups; - gid_t *groups; - int *igroups; /* an integer version - some OSes are broken :-( */ + GID_T *groups; time_t lastused; BOOL used; @@ -537,8 +535,7 @@ typedef struct /* following groups stuff added by ih */ /* This groups info is needed for when we become_user() for this uid */ int n_groups; - gid_t *groups; - int *igroups; /* an integer version - some OSes are broken :-( */ + GID_T *groups; int n_sids; int *sids; -- cgit From 7284bb5ca049a682097bb25afcf25d40f1ac5479 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 30 Jul 1998 21:18:57 +0000 Subject: Makefile.in: Moved UBIQX stuff into UTILOBJ. loadparm.c: Added "ole locking compatibility" option (default "true"). locking.c: Changes to implement union in files_struct. locking_shm.c: Changes to implement union in files_struct. nttrans.c: Made opening a directory explicit (we have to). Added create directory code for nttrans. reply.c: Changes to implement union in files_struct. server.c: Changes to implement union in files_struct. Added create directory code. trans2.c: Changes to implement union in files_struct. smb.h: Changes to implement union in files_struct. util.c: Changed linked list code to UNIQX linked list. This will make the other lists I need to implement for ChangeNotify and blocking locks easier. Jeremy. (This used to be commit 3a5eea850bb256b39cff8ace1e4fb4e0c1f5472b) --- source3/include/smb.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 8d846d4531..115d8ce31b 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -169,6 +169,7 @@ implemented */ #define ERRbaddirectory 267 /* Invalid directory name in a path. */ #define ERROR_EAS_DIDNT_FIT 275 /* Extended attributes didn't fit */ #define ERROR_EAS_NOT_SUPPORTED 282 /* Extended attributes not supported */ +#define ERROR_NOTIFY_ENUM_DIR 1022 /* Buffer too small to return change notify. */ #define ERRunknownipc 2142 @@ -437,10 +438,24 @@ typedef struct int real_open_flags; } file_fd_struct; +/* + * Structure used to keep directory state information around. + * Used in NT change-notify code. + */ + +typedef struct +{ + time_t modify_time; + time_t status_time; +} dir_status_struct; + typedef struct { int cnum; - file_fd_struct *fd_ptr; + union { + file_fd_struct *fd_ptr; + dir_status_struct *dir_ptr; + } f_u; int pos; uint32 size; int mode; @@ -463,7 +478,6 @@ typedef struct char *name; } files_struct; - struct uid_cache { int entries; int list[UID_CACHE_SIZE]; -- cgit From ebd415c03f7e76a024182748d2cafebbfd5238b1 Mon Sep 17 00:00:00 2001 From: "Christopher R. Hertel" Date: Fri, 31 Jul 1998 20:16:35 +0000 Subject: This is the checkin of the debug changes. Makefile.in: I've added debug.o. proto.h : Rebuilt, as is standard for these sorts of things. smb.h : New macros, etc. util.c : Debug code removed. I'll check in debug.c in the next step. Chris -)----- (This used to be commit 653c17c1b8e34bfbd05ea35ada9436a50d5a7ba4) --- source3/include/smb.h | 68 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 59 insertions(+), 9 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 115d8ce31b..60e214d73e 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -90,17 +90,69 @@ typedef unsigned short uint16; /* how long to wait for secondary SMB packets (milli-seconds) */ #define SMB_SECONDARY_WAIT (60*1000) -/* debugging code */ -#if !defined(WITH_SYSLOG) || defined(NO_SYSLOG) -#define DEBUG(level,body) ((DEBUGLEVEL>=(level))?(Debug1 body):0) -#define DEBUGLVL(level) (DEBUGLEVEL>=(level)) +/* -------------------------------------------------------------------------- ** + * Debugging code. See also debug.c + */ + +/* mkproto.awk has trouble with ifdef'd function definitions (it ignores + * the #ifdef directive and will read both definitions, thus creating two + * diffferent prototype declarations), so we must do these by hand. + */ +#ifdef HAVE_STDARG_H +int Debug1( char *, ... ); +BOOL dbgtext( char *, ... ); #else -extern int syslog_level; +int Debug1(); +BOOL dbgtext(); +#endif -#define DEBUG(level,body) ((DEBUGLEVEL>=(level))? (syslog_level = (level), Debug1 body):0) -#define DEBUGLVL(level) ( DEBUGLEVEL >= (syslog_level=(level)) ) +/* If we have these macros, we can add additional info to the header. */ +#ifdef HAVE_FILE_MACRO +#define FILE_MACRO (__FILE__) +#else +#define FILE_MACRO ("") #endif +#ifdef HAVE_FUNCTION_MACRO +#define FUNCTION_MACRO (__FUNCTION__) +#else +#define FUNCTION_MACRO ("") +#endif + +/* Debugging macros. + * DEBUGLVL() - If level is <= the system-wide DEBUGLEVEL then generate a + * header using the default macros for file, line, and + * function name. + * Returns True if the debug level was <= DEBUGLEVEL. + * Example usage: + * if( DEBUGLVL( 2 ) ) + * dbgtext( "Some text.\n" ); + * DEGUG() - Good old DEBUG(). Each call to DEBUG() will generate a new + * header *unless* the previous debug output was unterminated + * (i.e., no '\n'). See debug.c:dbghdr() for more info. + * Example usage: + * DEBUG( 2, ("Some text.\n") ); + * DEBUGADD() - If level <= DEBUGLEVEL, then the text is appended to the + * current message (i.e., no header). + * Usage: + * DEBUGADD( 2, ("Some additional text.\n") ); + */ +#define DEBUGLVL( level ) \ + ( (DEBUGLEVEL>=(level)) \ + && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) + +#define DEBUG( level, body ) \ + if( (DEBUGLEVEL>=(level)) \ + && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) \ + (void)dbgtext body + +#define DEBUGADD( level, body ) \ + if( DEBUGLEVEL>=(level) ) (void)dbgtext body + +/* End Debugging code section. + * -------------------------------------------------------------------------- ** + */ + /* this defines the error codes that receive_smb can put in smb_read_error */ #define READ_TIMEOUT 1 #define READ_EOF 2 @@ -1154,10 +1206,8 @@ struct parm_struct #define ERRCMD 0xFF /* Command was not in the "SMB" format. */ #ifdef HAVE_STDARG_H -int Debug1(char *, ...); int slprintf(char *str, int n, char *format, ...); #else -int Debug1(); int slprintf(); #endif -- cgit From 7448091da6ee11709b8e5117ff6810515567f88a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 3 Aug 1998 19:07:55 +0000 Subject: First implementation of ChangeNotify - this version only checks for changes in the directory modify timestamps. A better version will look at the requested client flags, and create a hash that represents the current state of the directory, and check against this instead. debug.c: Added lp_timestamp_logs() function. loadparm.c: Added "change notify timeout" in seconds (default 60) - this is the scan rate for a directory. Added ""timestamp logs" boolean - default True. Turns off log timestamps (so I can read them :-). nttrans.c: ChangeNotify implementation. server.c: ChangeNotify implementation. shmem_sysv.c: Added exits on shmem errors (without them smbd can core dump if some calls fail). smb.h: Added ChangeNotify flags for future use. util.c: Tidied up typedef. Jeremy. (This used to be commit a0748c3f53974483680ebe2ea4f556ece8d7fa43) --- source3/include/smb.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 60e214d73e..b33db0ce66 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -190,7 +190,7 @@ implemented */ #define STYPE_IPC 3 /* Interprocess communication (IPC) */ #define STYPE_HIDDEN 0x80000000 /* share is a hidden one (ends with $) */ -/* SMB X/Open error codes for the ERRdos error class */ +/* SMB X/Open error codes for the ERRDOS error class */ #define ERRbadfunc 1 /* Invalid function (or system call) */ #define ERRbadfile 2 /* File not found (pathname error) */ #define ERRbadpath 3 /* Directory not found */ @@ -1076,7 +1076,7 @@ struct parm_struct #define smb_nt_DataOffset (smb_vwv0 + 31) #define smb_nt_SetupCount (smb_vwv0 + 35) #define smb_nt_Function (smb_vwv0 + 36) -#define smb_nt_SetupStart (smb_vwv0 + 39) +#define smb_nt_SetupStart (smb_vwv0 + 38) /* these are for the NT trans secondary request. */ #define smb_nts_TotalParameterCount (smb_vwv0 + 3) @@ -1195,6 +1195,17 @@ struct parm_struct #define FILE_UNICODE_ON_DISK 0x4 #define FILE_PERISITANT_ACLS 0x8 +/* ChangeNotify flags. */ +#define FILE_NOTIFY_CHANGE_FILE_NAME 0x001 +#define FILE_NOTIFY_CHANGE_DIR_NAME 0x002 +#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x004 +#define FILE_NOTIFY_CHANGE_SIZE 0x008 +#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x010 +#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x020 +#define FILE_NOTIFY_CHANGE_CREATION 0x040 +#define FILE_NOTIFY_CHANGE_EA 0x080 +#define FILE_NOTIFY_CHANGE_SECURITY 0x100 + /* where to find the base of the SMB packet proper */ #define smb_base(buf) (((char *)(buf))+4) -- cgit From 5a5049cd77c608134c87a2332b8a070c01731680 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 9 Aug 1998 13:12:09 +0000 Subject: removed the if statements from the DEBUG() macro definitions. Chris, you should never put if statements in macros, use the ugly (a?b:c) form instead, otherwise you can produce incorrect code when you have things like: if (foo) DEBUG((blah)); else DEBUG((blooh)); (This used to be commit ab912448c1ff2487b6a313574d72f389baa65e6d) --- source3/include/smb.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index b33db0ce66..f8a055ad48 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -142,12 +142,12 @@ BOOL dbgtext(); && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) #define DEBUG( level, body ) \ - if( (DEBUGLEVEL>=(level)) \ - && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) \ - (void)dbgtext body + ((DEBUGLEVEL>=(level) && \ + dbghdr(level, FILE_MACRO, FUNCTION_MACRO, (__LINE__)))? \ + (void)dbgtext body:0) #define DEBUGADD( level, body ) \ - if( DEBUGLEVEL>=(level) ) (void)dbgtext body + (DEBUGLEVEL>=(level)?(void)dbgtext body:0); /* End Debugging code section. * -------------------------------------------------------------------------- ** -- cgit From 17fb3a2304d3f9eaa314c90b476d153b5f333f31 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 10 Aug 1998 20:12:53 +0000 Subject: Makefile.in: Fixed make clean bug with CVS directory in bin/. include/smb.h: Fixed bugs in Debug macro's with SGI compiler. smbd/trans2.c: Fixed bug reported by Zoltan Palmai PR#8903 where get_lanman2_dir_entry() could return a mangled name as a resume key and call_trans2findnext() wasn't doing the same. Jeremy. (This used to be commit 9d010e721c27af1d9498fd1e147993ba8ac8b41e) --- source3/include/smb.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index f8a055ad48..bc44fbdd2b 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -144,10 +144,10 @@ BOOL dbgtext(); #define DEBUG( level, body ) \ ((DEBUGLEVEL>=(level) && \ dbghdr(level, FILE_MACRO, FUNCTION_MACRO, (__LINE__)))? \ - (void)dbgtext body:0) + (void)(dbgtext body) : (void)0) #define DEBUGADD( level, body ) \ - (DEBUGLEVEL>=(level)?(void)dbgtext body:0); + (DEBUGLEVEL>=(level)?(void)(dbgtext body) : (void)0); /* End Debugging code section. * -------------------------------------------------------------------------- ** -- cgit From 7938e492bad71dc9a1d7618cf31c02d663a3fab0 Mon Sep 17 00:00:00 2001 From: "Christopher R. Hertel" Date: Tue, 11 Aug 1998 15:54:15 +0000 Subject: Removed a stray semicolon in the DEBUGADD() macro. (This used to be commit efa67d6b2b6d4a1e007dba5f2f5da5aff723fe59) --- source3/include/smb.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index bc44fbdd2b..5d408719ae 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -138,16 +138,16 @@ BOOL dbgtext(); * DEBUGADD( 2, ("Some additional text.\n") ); */ #define DEBUGLVL( level ) \ - ( (DEBUGLEVEL>=(level)) \ + ( (DEBUGLEVEL >= (level)) \ && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) #define DEBUG( level, body ) \ - ((DEBUGLEVEL>=(level) && \ - dbghdr(level, FILE_MACRO, FUNCTION_MACRO, (__LINE__)))? \ - (void)(dbgtext body) : (void)0) + ( ( DEBUGLEVEL >= (level) \ + && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) \ + ? (void)(dbgtext body) : (void)0 ) #define DEBUGADD( level, body ) \ - (DEBUGLEVEL>=(level)?(void)(dbgtext body) : (void)0); + ( (DEBUGLEVEL >= (level)) ? (void)(dbgtext body) : (void)0 ) /* End Debugging code section. * -------------------------------------------------------------------------- ** -- cgit From a0082c340a2c577e8ecec8c1e0fefc2765af90dc Mon Sep 17 00:00:00 2001 From: "Christopher R. Hertel" Date: Tue, 11 Aug 1998 18:56:03 +0000 Subject: I've come up with a different scheme for doing the DEBUG() and DEBUGADD() macros that meets the RVALUE requirement and doesn't use the (a?b:c) format that Andrew called "ugly". I've added the new macros but kept the old macros within a #if 0..#else..#endif block in case I've missed somthing. Basically, I've used (void)( (a) && (b) ) or (void)( (a) && (b) && (c) ) instead of ( (a) ? (void)(b) : (void)(c) ) or similar. I have this compiled and running now. Here's the diff: $ cvs diff smb.h Enter passphrase for RSA key 'crh@Ruby': Index: smb.h =================================================================== RCS file: /data/cvs/samba/source/include/smb.h,v retrieving revision 1.172 diff -r1.172 smb.h 143a144,145 > #if 0 > 150a153,164 > > #else > > #define DEBUG( level, body ) \ > (void)( (DEBUGLEVEL >= (level)) \ > && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \ > && (dbgtext body) ) > > #define DEBUGADD( level, body ) \ > (void)( (DEBUGLEVEL >= (level)) && (dbgtext body) ) > > #endif Chris -)----- (This used to be commit 53b433e6ab9fd69a02016ee4f2a3f756640ea565) --- source3/include/smb.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 5d408719ae..69f98dfdee 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -141,6 +141,8 @@ BOOL dbgtext(); ( (DEBUGLEVEL >= (level)) \ && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) +#if 0 + #define DEBUG( level, body ) \ ( ( DEBUGLEVEL >= (level) \ && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) \ @@ -149,6 +151,18 @@ BOOL dbgtext(); #define DEBUGADD( level, body ) \ ( (DEBUGLEVEL >= (level)) ? (void)(dbgtext body) : (void)0 ) +#else + +#define DEBUG( level, body ) \ + (void)( (DEBUGLEVEL >= (level)) \ + && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \ + && (dbgtext body) ) + +#define DEBUGADD( level, body ) \ + (void)( (DEBUGLEVEL >= (level)) && (dbgtext body) ) + +#endif + /* End Debugging code section. * -------------------------------------------------------------------------- ** */ -- cgit From b1778b6b57401d78fb4352992fde54706af6b75f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 11 Aug 1998 23:28:35 +0000 Subject: include/smb.h: Removed dir_ptr. Not needed. locking/locking.c: First cut a blocking lock code. #ifdef'ed out for now. locking/locking_shm.c: Removed dir_ptr. Not needed. smbd/nttrans.c: More work on ChangeNotify - return is not an error and needs to be handled as a nttrans with zero params. Removed dir_ptr. Not needed. smbd/reply.c: smbd/server.c: smbd/trans2.c: Removed dir_ptr. Not needed. Hmmm. At the moment smbclient is broken - doesn't issue prompt correctly. This needs looking at. Jeremy. (This used to be commit ddfbcc05815621d3c463f92faed047f126412342) --- source3/include/smb.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 69f98dfdee..bbd404b217 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -518,10 +518,7 @@ typedef struct typedef struct { int cnum; - union { - file_fd_struct *fd_ptr; - dir_status_struct *dir_ptr; - } f_u; + file_fd_struct *fd_ptr; int pos; uint32 size; int mode; -- cgit From b9623ab59e813131b1ed3f51616a46e719d59c21 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 14 Aug 1998 17:38:29 +0000 Subject: this is the bug change to using connection_struct* instead of cnum. Connections[] is now a local array in server.c I might have broken something with this change. In particular the oplock code is suspect and some .dll files aren't being oplocked when I expected them to be. I'll look at it after I've got some sleep. (This used to be commit c7ee025ead4a85b6fa44a832047b878451845fb6) --- source3/include/smb.h | 184 +++++++++++++++++++++++++++----------------------- 1 file changed, 100 insertions(+), 84 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index bbd404b217..b060134d8e 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -98,9 +98,20 @@ typedef unsigned short uint16; * the #ifdef directive and will read both definitions, thus creating two * diffferent prototype declarations), so we must do these by hand. */ +/* I know the __attribute__ stuff is ugly, but it does ensure we get the + arguemnts to DEBUG() right. We have got them wrong too often in the + past */ #ifdef HAVE_STDARG_H -int Debug1( char *, ... ); -BOOL dbgtext( char *, ... ); +int Debug1( char *, ... ) +#ifdef __GNUC__ + __attribute__ ((format (printf, 1, 2))) +#endif +; +BOOL dbgtext( char *, ... ) +#ifdef __GNUC__ + __attribute__ ((format (printf, 1, 2))) +#endif +; #else int Debug1(); BOOL dbgtext(); @@ -451,14 +462,6 @@ struct cli_state { }; -struct current_user -{ - int cnum, vuid; - int uid, gid; - int ngroups; - GID_T *groups; -}; - typedef struct { int size; @@ -515,32 +518,6 @@ typedef struct time_t status_time; } dir_status_struct; -typedef struct -{ - int cnum; - file_fd_struct *fd_ptr; - int pos; - uint32 size; - int mode; - int vuid; - char *mmap_ptr; - uint32 mmap_size; - write_bmpx_struct *wbmpx_ptr; - struct timeval open_time; - BOOL open; - BOOL can_lock; - BOOL can_read; - BOOL can_write; - BOOL share_mode; - BOOL print_file; - BOOL modified; - BOOL granted_oplock; - BOOL sent_oplock_break; - BOOL is_directory; - BOOL reserved; - char *name; -} files_struct; - struct uid_cache { int entries; int list[UID_CACHE_SIZE]; @@ -554,38 +531,74 @@ typedef struct typedef struct { - int service; - BOOL force_user; - struct uid_cache uid_cache; - void *dirptr; - BOOL open; - BOOL printer; - BOOL ipc; - BOOL read_only; - BOOL admin_user; - char *dirpath; - char *connectpath; - char *origpath; - char *user; /* name of user who *opened* this connection */ - int uid; /* uid of user who *opened* this connection */ - int gid; /* gid of user who *opened* this connection */ - - uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */ - - /* following groups stuff added by ih */ + unsigned cnum; /* an index passed over the wire */ + int service; + BOOL force_user; + struct uid_cache uid_cache; + void *dirptr; + BOOL open; + BOOL printer; + BOOL ipc; + BOOL read_only; + BOOL admin_user; + char *dirpath; + char *connectpath; + char *origpath; + char *user; /* name of user who *opened* this connection */ + int uid; /* uid of user who *opened* this connection */ + int gid; /* gid of user who *opened* this connection */ + + uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */ + + /* following groups stuff added by ih */ + + /* This groups info is valid for the user that *opened* the connection */ + int ngroups; + GID_T *groups; + + time_t lastused; + BOOL used; + 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; - /* This groups info is valid for the user that *opened* the connection */ - int ngroups; - GID_T *groups; +struct current_user +{ + connection_struct *conn; + int vuid; + int uid, gid; + int ngroups; + GID_T *groups; +}; - time_t lastused; - BOOL used; - 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. */ +typedef struct +{ + connection_struct *conn; + file_fd_struct *fd_ptr; + int pos; + uint32 size; + int mode; + int vuid; + char *mmap_ptr; + uint32 mmap_size; + write_bmpx_struct *wbmpx_ptr; + struct timeval open_time; + BOOL open; + BOOL can_lock; + BOOL can_read; + BOOL can_write; + BOOL share_mode; + BOOL print_file; + BOOL modified; + BOOL granted_oplock; + BOOL sent_oplock_break; + BOOL is_directory; + BOOL reserved; + char *fsp_name; +} files_struct; -} connection_struct; /* Domain controller authentication protocol info */ struct dcinfo @@ -679,9 +692,9 @@ typedef struct to support the following operations */ struct share_ops { BOOL (*stop_mgmt)(void); - BOOL (*lock_entry)(int , uint32 , uint32 , int *); - BOOL (*unlock_entry)(int , uint32 , uint32 , int ); - int (*get_entries)(int , int , uint32 , uint32 , share_mode_entry **); + BOOL (*lock_entry)(connection_struct *, uint32 , uint32 , int *); + BOOL (*unlock_entry)(connection_struct *, uint32 , uint32 , int ); + int (*get_entries)(connection_struct *, int , uint32 , uint32 , share_mode_entry **); void (*del_entry)(int , int ); BOOL (*set_entry)(int , int , uint16 , uint16 ); BOOL (*remove_oplock)(int , int); @@ -848,12 +861,12 @@ struct parm_struct #define VALID_FNUM(fnum) (((fnum) >= 0) && ((fnum) < MAX_FNUMS)) #define OPEN_FNUM(fnum) (VALID_FNUM(fnum) && Files[fnum].open && !Files[fnum].is_directory) #define VALID_CNUM(cnum) (((cnum) >= 0) && ((cnum) < MAX_CONNECTIONS)) -#define OPEN_CNUM(cnum) (VALID_CNUM(cnum) && Connections[cnum].open) -#define IS_IPC(cnum) (VALID_CNUM(cnum) && Connections[cnum].ipc) -#define IS_PRINT(cnum) (VALID_CNUM(cnum) && Connections[cnum].printer) -#define FNUM_OK(fnum,c) (OPEN_FNUM(fnum) && (c)==Files[fnum].cnum) +#define OPEN_CNUM(conn) ((conn) && (conn)->open) +#define IS_IPC(conn) ((conn) && (conn)->ipc) +#define IS_PRINT(conn) ((conn) && (conn)->printer) +#define FNUM_OK(fnum,c) (OPEN_FNUM(fnum) && (c)==Files[fnum].conn) -#define CHECK_FNUM(fnum,c) if (!FNUM_OK(fnum,c)) \ +#define CHECK_FNUM(fnum,conn) if (!FNUM_OK(fnum,conn)) \ return(ERROR(ERRDOS,ERRbadfid)) #define CHECK_READ(fnum) if (!Files[fnum].can_read) \ return(ERROR(ERRDOS,ERRbadaccess)) @@ -863,26 +876,25 @@ struct parm_struct return(CACHED_ERROR(fnum)) /* translates a connection number into a service number */ -#define SNUM(cnum) (Connections[cnum].service) +#define SNUM(conn) ((conn)?(conn)->service:-1) /* access various service details */ #define SERVICE(snum) (lp_servicename(snum)) #define PRINTCAP (lp_printcapname()) #define PRINTCOMMAND(snum) (lp_printcommand(snum)) #define PRINTERNAME(snum) (lp_printername(snum)) -#define CAN_WRITE(cnum) (OPEN_CNUM(cnum) && !Connections[cnum].read_only) +#define CAN_WRITE(conn) (OPEN_CNUM(conn) && !conn->read_only) #define VALID_SNUM(snum) (lp_snum_ok(snum)) #define GUEST_OK(snum) (VALID_SNUM(snum) && lp_guest_ok(snum)) #define GUEST_ONLY(snum) (VALID_SNUM(snum) && lp_guest_only(snum)) #define CAN_SETDIR(snum) (!lp_no_set_dir(snum)) -#define CAN_PRINT(cnum) (OPEN_CNUM(cnum) && lp_print_ok(SNUM(cnum))) -#define POSTSCRIPT(cnum) (OPEN_CNUM(cnum) && lp_postscript(SNUM(cnum))) -#define MAP_HIDDEN(cnum) (OPEN_CNUM(cnum) && lp_map_hidden(SNUM(cnum))) -#define MAP_SYSTEM(cnum) (OPEN_CNUM(cnum) && lp_map_system(SNUM(cnum))) -#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 CAN_PRINT(conn) ((conn) && lp_print_ok((conn)->service)) +#define MAP_HIDDEN(conn) ((conn) && lp_map_hidden((conn)->service)) +#define MAP_SYSTEM(conn) ((conn) && lp_map_system((conn)->service)) +#define MAP_ARCHIVE(conn) ((conn) && lp_map_archive((conn)->service)) +#define IS_HIDDEN_PATH(conn,path) ((conn) && is_in_path((path),(conn)->hide_list)) +#define IS_VETO_PATH(conn,path) ((conn) && is_in_path((path),(conn)->veto_list)) +#define IS_VETO_OPLOCK_PATH(conn,path) ((conn) && is_in_path((path),(conn)->veto_oplock_list)) #define SMBENCRYPT() (lp_encrypted_passwords()) @@ -1228,7 +1240,11 @@ struct parm_struct #define ERRCMD 0xFF /* Command was not in the "SMB" format. */ #ifdef HAVE_STDARG_H -int slprintf(char *str, int n, char *format, ...); +int slprintf(char *str, int n, char *format, ...) +#ifdef __GNUC__ + __attribute__ ((format (printf, 3, 4))) +#endif +; #else int slprintf(); #endif -- cgit From e13aeea928dd89373cfaf3916c96f853c1227884 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 15 Aug 1998 01:19:26 +0000 Subject: configure: Changes for extra headers. configure.in: Source for header changes. client/clitar.c: Fixed isXXX macros & debugs for gcc pedantic compile. include/config.h.in: Added MEMSET, BZERO, MEMORY, RPCSVC_YPCLNT, STRINGS headers. include/includes.h: Headers for the above. include/smb.h: Made SIGNAL_CAST POSIX by default void (*)(int). lib/access.c: Fixed isXXX macros & debugs for gcc pedantic compile. lib/charset.c: Fixed isXXX macros & debugs for gcc pedantic compile. lib/debug.c: Fixed signal functs. lib/kanji.c: Fixed isXXX macros & debugs for gcc pedantic compile. lib/smbrun.c: Fixed isXXX macros & debugs for gcc pedantic compile. lib/util.c: Fixed isXXX macros & debugs for gcc pedantic compile. libsmb/namequery.c: Fixed isXXX macros & debugs for gcc pedantic compile. locking/shmem.c: Fixed isXXX macros & debugs for gcc pedantic compile. locking/shmem_sysv.c: Fixed error messages in sysV stuff. nmbd/asyncdns.c: Fixed signal functs. nmbd/nmbd.c: Fixed isXXX macros & debugs for gcc pedantic compile. passdb/passdb.c: Fixed isXXX macros & debugs for gcc pedantic compile. passdb/smbpassfile.c: Fixed isXXX macros & debugs for gcc pedantic compile. smbd/chgpasswd.c: Fixed isXXX macros & debugs for gcc pedantic compile. smbd/ipc.c: Fixed isXXX macros & debugs for gcc pedantic compile. smbd/nttrans.c: Fixed fsp code path. smbd/password.c: fixed HAVE_YP_GET_DEFAULT_DOMAIN problem. smbd/printing.c: Fixed isXXX macros & debugs for gcc pedantic compile. smbd/reply.c: Fixed isXXX macros & debugs for gcc pedantic compile. smbd/server.c: Fixed isXXX macros & debugs for gcc pedantic compile. smbd/trans2.c: Fixed core dump bug. smbd/uid.c: Fixed isXXX macros & debugs for gcc pedantic compile. Jeremy. (This used to be commit 1b9cbcd02e575dc0a95fa589f720df30a4acc46b) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index b060134d8e..fa5d496ceb 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1274,7 +1274,7 @@ char *strdup(char *s); #endif #ifndef SIGNAL_CAST -#define SIGNAL_CAST (RETSIGTYPE (*)()) +#define SIGNAL_CAST (RETSIGTYPE (*)(int)) #endif #ifndef SELECT_CAST -- cgit From 127655cc888ac40332d4e8e5b94aab03f5120aae Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 15 Aug 1998 07:27:34 +0000 Subject: this checkin gets rid of the global Files[] array and makes it local in files.c it should now be faily easy to expand the default MAX_OPEN_FILES to many thousands. (This used to be commit b088c804f98908eb02f05ab2f2e8a61691a0a582) --- source3/include/smb.h | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index fa5d496ceb..801e134435 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -575,6 +575,7 @@ struct current_user typedef struct { + int fnum; connection_struct *conn; file_fd_struct *fd_ptr; int pos; @@ -599,6 +600,10 @@ typedef struct char *fsp_name; } files_struct; +/* this macro should always be used to extract an fnum (smb_fid) from + a packet to ensure chaining works correctly */ +#define GETFSP(buf,where) (chain_fsp?chain_fsp:file_fsp(SVAL(buf,where))) + /* Domain controller authentication protocol info */ struct dcinfo @@ -695,9 +700,9 @@ struct share_ops { BOOL (*lock_entry)(connection_struct *, uint32 , uint32 , int *); BOOL (*unlock_entry)(connection_struct *, uint32 , uint32 , int ); int (*get_entries)(connection_struct *, int , uint32 , uint32 , share_mode_entry **); - void (*del_entry)(int , int ); - BOOL (*set_entry)(int , int , uint16 , uint16 ); - BOOL (*remove_oplock)(int , int); + void (*del_entry)(int , files_struct *); + BOOL (*set_entry)(int, files_struct *, uint16 , uint16 ); + BOOL (*remove_oplock)(files_struct *, int); int (*forall)(void (*)(share_mode_entry *, char *)); void (*status)(FILE *); }; @@ -858,22 +863,21 @@ struct parm_struct #endif /* LOCKING_VERSION */ /* these are useful macros for checking validity of handles */ -#define VALID_FNUM(fnum) (((fnum) >= 0) && ((fnum) < MAX_FNUMS)) -#define OPEN_FNUM(fnum) (VALID_FNUM(fnum) && Files[fnum].open && !Files[fnum].is_directory) +#define OPEN_FSP(fsp) ((fsp) && (fsp)->open && !(fsp)->is_directory) #define VALID_CNUM(cnum) (((cnum) >= 0) && ((cnum) < MAX_CONNECTIONS)) -#define OPEN_CNUM(conn) ((conn) && (conn)->open) +#define OPEN_CONN(conn) ((conn) && (conn)->open) #define IS_IPC(conn) ((conn) && (conn)->ipc) #define IS_PRINT(conn) ((conn) && (conn)->printer) -#define FNUM_OK(fnum,c) (OPEN_FNUM(fnum) && (c)==Files[fnum].conn) +#define FNUM_OK(fsp,c) (OPEN_FSP(fsp) && (c)==(fsp)->conn) -#define CHECK_FNUM(fnum,conn) if (!FNUM_OK(fnum,conn)) \ +#define CHECK_FSP(fsp,conn) if (!FNUM_OK(fsp,conn)) \ return(ERROR(ERRDOS,ERRbadfid)) -#define CHECK_READ(fnum) if (!Files[fnum].can_read) \ +#define CHECK_READ(fsp) if (!(fsp)->can_read) \ return(ERROR(ERRDOS,ERRbadaccess)) -#define CHECK_WRITE(fnum) if (!Files[fnum].can_write) \ +#define CHECK_WRITE(fsp) if (!(fsp)->can_write) \ return(ERROR(ERRDOS,ERRbadaccess)) -#define CHECK_ERROR(fnum) if (HAS_CACHED_ERROR(fnum)) \ - return(CACHED_ERROR(fnum)) +#define CHECK_ERROR(fsp) if (HAS_CACHED_ERROR(fsp)) \ + return(CACHED_ERROR(fsp)) /* translates a connection number into a service number */ #define SNUM(conn) ((conn)?(conn)->service:-1) @@ -883,7 +887,7 @@ struct parm_struct #define PRINTCAP (lp_printcapname()) #define PRINTCOMMAND(snum) (lp_printcommand(snum)) #define PRINTERNAME(snum) (lp_printername(snum)) -#define CAN_WRITE(conn) (OPEN_CNUM(conn) && !conn->read_only) +#define CAN_WRITE(conn) (OPEN_CONN(conn) && !conn->read_only) #define VALID_SNUM(snum) (lp_snum_ok(snum)) #define GUEST_OK(snum) (VALID_SNUM(snum) && lp_guest_ok(snum)) #define GUEST_ONLY(snum) (VALID_SNUM(snum) && lp_guest_only(snum)) @@ -1432,11 +1436,10 @@ enum ssl_version_enum {SMB_SSL_V2,SMB_SSL_V3,SMB_SSL_V23,SMB_SSL_TLS1}; #define CACHE_ERROR(w,c,e) ((w)->wr_errclass = (c), (w)->wr_error = (e), \ w->wr_discard = True, -1) /* Macro to test if an error has been cached for this fnum */ -#define HAS_CACHED_ERROR(fnum) (Files[(fnum)].open && \ - Files[(fnum)].wbmpx_ptr && \ - Files[(fnum)].wbmpx_ptr->wr_discard) +#define HAS_CACHED_ERROR(fsp) ((fsp)->open && (fsp)->wbmpx_ptr && \ + (fsp)->wbmpx_ptr->wr_discard) /* Macro to turn the cached error into an error packet */ -#define CACHED_ERROR(fnum) cached_error_packet(inbuf,outbuf,fnum,__LINE__) +#define CACHED_ERROR(fsp) cached_error_packet(inbuf,outbuf,fsp,__LINE__) /* these are the datagram types */ #define DGRAM_DIRECT_UNIQUE 0x10 -- cgit From a7acf10566af549eb71e7a421397c8073d55e0f6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 16 Aug 1998 03:04:06 +0000 Subject: server.c: fixed a bug in close_file() with the new files.c handling code bitmap.c: added bitmap hanlding code in preparation for increasing the default max open files to several thousand (This used to be commit f573a65b67e7a57586fec57845598e49b157ee0a) --- source3/include/smb.h | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 801e134435..3b562b9d13 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -494,17 +494,19 @@ typedef struct * file descriptor and process. */ -typedef struct +typedef struct file_fd_struct { - uint16 ref_count; - uint16 uid_cache_count; - uid_t uid_users_cache[10]; - uint32 dev; - uint32 inode; - int fd; - int fd_readonly; - int fd_writeonly; - int real_open_flags; + struct file_fd_struct *next, *prev; + uint16 ref_count; + uint16 uid_cache_count; + uid_t uid_users_cache[10]; + uint32 dev; + uint32 inode; + int fd; + int fdnum; + int fd_readonly; + int fd_writeonly; + int real_open_flags; } file_fd_struct; /* @@ -573,8 +575,9 @@ struct current_user GID_T *groups; }; -typedef struct +typedef struct files_struct { + struct files_struct *next, *prev; int fnum; connection_struct *conn; file_fd_struct *fd_ptr; @@ -852,6 +855,10 @@ struct parm_struct } def; }; +struct bitmap { + uint32 *b; + int n; +}; #define FLAG_BASIC 1 /* fundamental options */ #define FLAG_HIDE 2 /* options that should be hidden in SWAT */ -- cgit From 739d0b1ddc58bbb792c3eebe8c545602a4fae438 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 16 Aug 1998 04:08:47 +0000 Subject: got rid of the Files[] array completely (previously I'd just made it private to files.c) It now is a doubly linked list with a bitmap for allocated file numbers. Similarly for the fd_ptr code. I also changed the default maximum number of open files to 4096. The static cost is 1 bit per file. It all seems to work, and it passes the "does Sue scream" test, but if you see weird behaviour then please investigate. With the volume of new code that has gone in there are bound to be one or two bugs lurking. note that you must do a "make clean" before building this as many data structures have changed in size. (This used to be commit 79755ce97004b787d7e83a8d18fc4c7c003b7231) --- source3/include/smb.h | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 3b562b9d13..e99eb30023 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -599,7 +599,6 @@ typedef struct files_struct BOOL granted_oplock; BOOL sent_oplock_break; BOOL is_directory; - BOOL reserved; char *fsp_name; } files_struct; -- cgit From 8978aae69699ccab76fdf95037948b1cc7e7c286 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 17 Aug 1998 03:52:05 +0000 Subject: much cleaner chain pointer handling for both files and pipes. the chain pointer is now stored as a static and is set whenever a handle is created or extracted. This also makes the code less error prone. (This used to be commit 068a862982bea726e8d7b1b4065d510b9840a272) --- source3/include/smb.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index e99eb30023..2f2363ba71 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -602,11 +602,6 @@ typedef struct files_struct char *fsp_name; } files_struct; -/* this macro should always be used to extract an fnum (smb_fid) from - a packet to ensure chaining works correctly */ -#define GETFSP(buf,where) (chain_fsp?chain_fsp:file_fsp(SVAL(buf,where))) - - /* Domain controller authentication protocol info */ struct dcinfo { -- cgit From 983dc71c9844675ad364f3ea59ddd04b87857b55 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 17 Aug 1998 06:13:32 +0000 Subject: moved connection_struct handling code into smbd/conn.c and changed it to a linked list with bitmap format. (This used to be commit b7aaab1b6b2d2f72b2bb7c11f5c7bf081a6093d9) --- source3/include/smb.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 2f2363ba71..c68f88cbdd 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -531,14 +531,14 @@ typedef struct BOOL is_wild; } name_compare_entry; -typedef struct +typedef struct connection_struct { + struct connection_struct *next, *prev; unsigned cnum; /* an index passed over the wire */ int service; BOOL force_user; struct uid_cache uid_cache; void *dirptr; - BOOL open; BOOL printer; BOOL ipc; BOOL read_only; @@ -865,7 +865,6 @@ struct bitmap { /* these are useful macros for checking validity of handles */ #define OPEN_FSP(fsp) ((fsp) && (fsp)->open && !(fsp)->is_directory) -#define VALID_CNUM(cnum) (((cnum) >= 0) && ((cnum) < MAX_CONNECTIONS)) #define OPEN_CONN(conn) ((conn) && (conn)->open) #define IS_IPC(conn) ((conn) && (conn)->ipc) #define IS_PRINT(conn) ((conn) && (conn)->printer) @@ -888,7 +887,7 @@ struct bitmap { #define PRINTCAP (lp_printcapname()) #define PRINTCOMMAND(snum) (lp_printcommand(snum)) #define PRINTERNAME(snum) (lp_printername(snum)) -#define CAN_WRITE(conn) (OPEN_CONN(conn) && !conn->read_only) +#define CAN_WRITE(conn) (!conn->read_only) #define VALID_SNUM(snum) (lp_snum_ok(snum)) #define GUEST_OK(snum) (VALID_SNUM(snum) && lp_guest_ok(snum)) #define GUEST_ONLY(snum) (VALID_SNUM(snum) && lp_guest_only(snum)) -- cgit From 4c5c26b1ef4be862fc2037dd5fcc120cb35bacca Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 17 Aug 1998 07:15:54 +0000 Subject: now that we have no global arrays we can start to split up the monster server.c without breaking things. this splits off netprot.c and fileio.c for negprot and read/write/seek handling respectively. (This used to be commit b3d7014643ec9f2eef6e6f598f5b9db1fe2f930d) --- source3/include/smb.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index c68f88cbdd..e88737f046 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -200,6 +200,13 @@ implemented */ #define aDIR (1L<<4) #define aARCH (1L<<5) +/* for readability... */ +#define IS_DOS_READONLY(test_mode) (((test_mode) & aRONLY) != 0) +#define IS_DOS_DIR(test_mode) (((test_mode) & aDIR) != 0) +#define IS_DOS_ARCHIVE(test_mode) (((test_mode) & aARCH) != 0) +#define IS_DOS_SYSTEM(test_mode) (((test_mode) & aSYSTEM) != 0) +#define IS_DOS_HIDDEN(test_mode) (((test_mode) & aHIDDEN) != 0) + /* deny modes */ #define DENY_DOS 0 #define DENY_ALL 1 -- cgit From 7d657984bbdf867319e96dee6fbf5ed5b835ad14 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 21 Aug 1998 09:43:21 +0000 Subject: added a macro ZERO_STRUCT() which is useful for initialising structures declared on the stack. (This used to be commit f323af8fce54cd5d51c848aa7ea7be4dd3538f2e) --- source3/include/smb.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index e88737f046..9d6c8d7e29 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1563,6 +1563,9 @@ extern int unix_ERR_code; #define CMD_REPLY 0x8000 +/* useful macros */ +#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x)) + #endif /* _SMB_H */ #include "ntdomain.h" -- cgit From 038e3433d39337f736b7b69ac1e6212e9f8e5406 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 21 Aug 1998 11:37:40 +0000 Subject: added new smb.conf option "panic action". see my samba-technical explanation. (This used to be commit c6899df44c34088a4d2bf1edc840320b0ba7e32e) --- source3/include/smb.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 9d6c8d7e29..a11a3ac61f 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1265,10 +1265,6 @@ void dfs_unlogin(void); extern int dcelogin_atmost_once; #endif -#if AJT -void ajt_panic(void); -#endif - #ifdef NOSTRDUP char *strdup(char *s); #endif -- cgit From 3f3f47b0bd8d089120d267cfad1976db95cd8ebe Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 22 Aug 1998 02:54:21 +0000 Subject: added ASSERT() and ASSERT_ARRAY() macros and sprinkled them liberally in the rpc code. (This used to be commit e6ce1c5b5a9f29d8fcbbd23019186ff5c600e795) --- source3/include/smb.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index a11a3ac61f..9dc1ff5f38 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1561,6 +1561,10 @@ extern int unix_ERR_code; /* useful macros */ #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x)) +#define ASSERT(b) ((b)?0: \ + (DEBUG(0,("PANIC: assert failed at %s(%d)\n", \ + __FILE__, __LINE__)), smb_panic("assert failed"))) +#define ASSERT_ARRAY(a,n) ASSERT((sizeof(a)/sizeof((a)[0])) >= (n)) #endif /* _SMB_H */ -- cgit From 8afc9c80ac11649f06e5517d819dbf201c941acb Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 24 Aug 1998 21:49:10 +0000 Subject: Changed ASSERT macros to SMB_ASSERT macros as some systems already have an ASSERT macro defined. Jeremy. (This used to be commit dbe6ad014a8b5dcbf17d7cd9865650c2e040d666) --- source3/include/smb.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 9dc1ff5f38..0a49b72a27 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1561,10 +1561,10 @@ extern int unix_ERR_code; /* useful macros */ #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x)) -#define ASSERT(b) ((b)?0: \ +#define SMB_ASSERT(b) ((b)?(void)0: \ (DEBUG(0,("PANIC: assert failed at %s(%d)\n", \ __FILE__, __LINE__)), smb_panic("assert failed"))) -#define ASSERT_ARRAY(a,n) ASSERT((sizeof(a)/sizeof((a)[0])) >= (n)) +#define SMB_ASSERT_ARRAY(a,n) SMB_ASSERT((sizeof(a)/sizeof((a)[0])) >= (n)) #endif /* _SMB_H */ -- cgit From 2c065107b149797e2a42a6c119f883d30be411eb Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 25 Aug 1998 06:40:42 +0000 Subject: changed the default permissions code to do this: if ((sbuf->st_mode & S_IWUSR) == 0) result |= aRONLY; rather than the very complex user/group permissions checks we do currently. This is equivalent ot setting "alternate permissions = yes" in the old code. The change is motivated by three main reasons: 1) it's basically impossible to second guess whether a file is writeable without trying to open it for writing. ACLs, root squash etc just make it too hard. 2) setting it not RONLY if the owner can write is closer to what NT does (eg. look at a cdrom - files are not marked read only). 3) it prevents the silly problem of copying files from a read only share to a writeable share and then finding you can't write to them as windows preserves the RONLY flag. Lots of people get bitten by this when they drag a folder from a Samba drive. It also hurts some install programs. I have also added a new flag type for loadparm.c called FLAG_DEPRECATED which I've set for "alternate permissions". I'll soon add code to testparm to give a warning about deprecated options. (This used to be commit c4363a12fdc0be329ca2bfeb1d7b89bfe90031dc) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 0a49b72a27..00c5464251 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -865,6 +865,7 @@ struct bitmap { #define FLAG_HIDE 2 /* options that should be hidden in SWAT */ #define FLAG_PRINT 4 /* printing options */ #define FLAG_GLOBAL 8 /* local options that should be globally settable in SWAT */ +#define FLAG_DEPRECATED 16 /* options that should no longer be used */ #ifndef LOCKING_VERSION #define LOCKING_VERSION 4 -- cgit From 520d24c191941289ae1e86bc372cde4908a9fa35 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 26 Aug 1998 03:06:48 +0000 Subject: use a separate ZERO_ARRAY() macro instead of ZERO_STRUCT() for arrays. This prevents (harmless) warnings from some compilers (This used to be commit c2da46d1d0820a86e7f77506563cfe7f67b08fee) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 00c5464251..31e3b645b1 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1562,6 +1562,7 @@ extern int unix_ERR_code; /* useful macros */ #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x)) +#define ZERO_ARRAY(x) memset((char *)(x), 0, sizeof(x)) #define SMB_ASSERT(b) ((b)?(void)0: \ (DEBUG(0,("PANIC: assert failed at %s(%d)\n", \ __FILE__, __LINE__)), smb_panic("assert failed"))) -- cgit From 5e5e320d361afcb4d9503354b3912b4c7a672197 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 27 Aug 1998 20:38:53 +0000 Subject: This is the stat cache code - seems to work fine (needs heavy NetBench testing though.... :-). Attempts to efficiently reduce the number of stat() calls Samba does. Jeremy. (This used to be commit d0e48a2d8072c3e77a57ac6a2fb5044c05f03b41) --- source3/include/smb.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 31e3b645b1..b615d09708 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -908,6 +908,14 @@ struct bitmap { #define IS_VETO_PATH(conn,path) ((conn) && is_in_path((path),(conn)->veto_list)) #define IS_VETO_OPLOCK_PATH(conn,path) ((conn) && is_in_path((path),(conn)->veto_oplock_list)) +/* + * Used by the stat cache code to check if a returned + * stat structure is valid. + */ + +#define VALID_STAT(st) (st.st_nlink != 0) +#define VALID_STAT_OF_DIR(st) (VALID_STAT(st) && S_ISDIR(st.st_mode)) + #define SMBENCRYPT() (lp_encrypted_passwords()) /* the basic packet size, assuming no words or bytes */ -- cgit From c021867feea2a7a1bc29ec89d7625754220f0431 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 30 Aug 1998 04:30:57 +0000 Subject: changed the size of a char array in the userdata_struct from 1 to 16 to account for padding/alignment issues. Eventually I'd like to find a way to get rid of this construct altogether as it is a bit error prone and hard to debug. also added a new macro: ZERO_STRUCTP() that takes a pointer to a structure and zeros the structure. Used in nmbd to zero allocated structures before freeing them to try to catch bugs a bit faster. (This used to be commit d3dda65d5177154e2128f50ca3dd34e8e13b6b08) --- source3/include/smb.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index b615d09708..90435b208e 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1569,8 +1569,17 @@ extern int unix_ERR_code; #define CMD_REPLY 0x8000 /* useful macros */ + +/* zero a structure */ #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x)) + +/* zero a structure given a pointer to the structure */ +#define ZERO_STRUCTP(x) memset((char *)(x), 0, sizeof(*(x))) + +/* zero an array - note that sizeof(array) must work - ie. it must not be a + pointer */ #define ZERO_ARRAY(x) memset((char *)(x), 0, sizeof(x)) + #define SMB_ASSERT(b) ((b)?(void)0: \ (DEBUG(0,("PANIC: assert failed at %s(%d)\n", \ __FILE__, __LINE__)), smb_panic("assert failed"))) -- cgit From 693480af8bb2d3e83566af9463ca427f47a879da Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 31 Aug 1998 20:20:54 +0000 Subject: configure.in, configure: include/config.h.in: Added stropts and poll. include/smb.h: Moved old typedefs of uint8 etc. into include/includes.h where all the other defines live (changed them from typedefs to defines). Other changes : changed from using uint32 to SMB_DEV_T and SMB_INO_T in preparation for moving to size independed (ie. 64 bit clean) device and inode access. Stat call wrapper comes next :-). Jeremy. (This used to be commit 3d9ec96de5e04e83abafe9c5d980bd39eee856ea) --- source3/include/smb.h | 53 ++++++++++++--------------------------------------- 1 file changed, 12 insertions(+), 41 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 90435b208e..b27c531937 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -48,35 +48,6 @@ typedef int BOOL; /* limiting size of ipc replies */ #define REALLOC(ptr,size) Realloc(ptr,MAX((size),4*1024)) -/* - Samba needs type definitions for int16, int32, uint16 and uint32. - - Normally these are signed and unsigned 16 and 32 bit integers, but - they actually only need to be at least 16 and 32 bits - respectively. Thus if your word size is 8 bytes just defining them - as signed and unsigned int will work. -*/ - -#ifndef uint8 -typedef unsigned char uint8; -#endif - -#ifndef uint16 -typedef unsigned short uint16; -#endif - -#ifndef uchar -#define uchar unsigned char -#endif - -#ifndef int16 -#define int16 short -#endif - -#ifndef uint16 -#define uint16 unsigned short -#endif - #define SIZEOFWORD 2 #ifndef DEF_CREATE_MASK @@ -507,8 +478,8 @@ typedef struct file_fd_struct uint16 ref_count; uint16 uid_cache_count; uid_t uid_users_cache[10]; - uint32 dev; - uint32 inode; + SMB_DEV_T dev; + SMB_INO_T inode; int fd; int fdnum; int fd_readonly; @@ -701,9 +672,9 @@ typedef struct to support the following operations */ struct share_ops { BOOL (*stop_mgmt)(void); - BOOL (*lock_entry)(connection_struct *, uint32 , uint32 , int *); - BOOL (*unlock_entry)(connection_struct *, uint32 , uint32 , int ); - int (*get_entries)(connection_struct *, int , uint32 , uint32 , share_mode_entry **); + BOOL (*lock_entry)(connection_struct *, SMB_DEV_T , SMB_INO_T , int *); + BOOL (*unlock_entry)(connection_struct *, SMB_DEV_T , SMB_INO_T , int ); + int (*get_entries)(connection_struct *, int , SMB_DEV_T , SMB_INO_T , share_mode_entry **); void (*del_entry)(int , files_struct *); BOOL (*set_entry)(int, files_struct *, uint16 , uint16 ); BOOL (*remove_oplock)(files_struct *, int); @@ -1551,19 +1522,19 @@ extern int unix_ERR_code; * * Form of this is : * - * 0 2 6 10 14 18 22 + * 0 2 6 10 14 14+devsize 14+devsize+inodesize * +----+--------+--------+--------+-------+--------+ - * | cmd| pid | dev | inode | sec | usec | + * | cmd| pid | sec | usec | dev | inode | * +----+--------+--------+--------+-------+--------+ */ #define OPLOCK_BREAK_CMD 0x1 #define OPLOCK_BREAK_PID_OFFSET 2 -#define OPLOCK_BREAK_DEV_OFFSET 6 -#define OPLOCK_BREAK_INODE_OFFSET 10 -#define OPLOCK_BREAK_SEC_OFFSET 14 -#define OPLOCK_BREAK_USEC_OFFSET 18 -#define OPLOCK_BREAK_MSG_LEN 22 +#define OPLOCK_BREAK_SEC_OFFSET 6 +#define OPLOCK_BREAK_USEC_OFFSET 10 +#define OPLOCK_BREAK_DEV_OFFSET 14 +#define OPLOCK_BREAK_INODE_OFFSET (OPLOCK_BREAK_DEV_OFFSET + sizeof(SMB_DEV_T)) +#define OPLOCK_BREAK_MSG_LEN (OPLOCK_BREAK_INODE_OFFSET + sizeof(SMB_INO_T)) #define CMD_REPLY 0x8000 -- cgit From 7bb86c1b132bce31a006ea9768a54db7a45fe1a5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 3 Sep 1998 18:40:31 +0000 Subject: Ok - this is the 64 bit widening check in. It changes the configure to check for stat64 and friends, and then changes much of Samba to use the data type SMB_OFF_T for file size information. stat/fstat/lstat/lseek/ftruncate have now become sys_stat etc. to hide the 64 bit calls if needed. Note that this still does not expose 64 bit functionality to the client, as the changes to the reply_xxx smb's are not yet done. This code change should make these changes possible. Still to do before full 64 bit-ness to the client: fcntl lock code. statfs code widening of dev_t and ino_t (now possible due to SMB_DEV_T and SMB_OFF_T types being in place). Let me know if wierd things happen after this check-in and I'll fix them :-). Jeremy. (This used to be commit 14500936c321d15995c963766aac67bf1f4e3824) --- source3/include/smb.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index b27c531937..8600bcc120 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -442,10 +442,10 @@ struct cli_state { typedef struct { - int size; + SMB_OFF_T size; int mode; - int uid; - int gid; + uid_t uid; + gid_t gid; /* these times are normally kept in GMT */ time_t mtime; time_t atime; @@ -559,12 +559,12 @@ typedef struct files_struct int fnum; connection_struct *conn; file_fd_struct *fd_ptr; - int pos; - uint32 size; + SMB_OFF_T pos; + SMB_OFF_T size; int mode; int vuid; char *mmap_ptr; - uint32 mmap_size; + SMB_OFF_T mmap_size; write_bmpx_struct *wbmpx_ptr; struct timeval open_time; BOOL open; -- cgit From ede44ebdf089a835ea1f3141dd00b50b7bbc54e1 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 10 Sep 1998 18:57:06 +0000 Subject: smb.h: Removed fdnum from file_fd_struct. Not needed. files.c: Removed fd bitmap - not needed. Added code to do use arrays rather than linked list - disabled by default but can be enabled to check performance. Jeremy. (This used to be commit 069efc04545d5fdfc5c40467b8b7554ed5226a2e) --- source3/include/smb.h | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 8600bcc120..dae3e275d5 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -481,7 +481,6 @@ typedef struct file_fd_struct SMB_DEV_T dev; SMB_INO_T inode; int fd; - int fdnum; int fd_readonly; int fd_writeonly; int real_open_flags; -- cgit From 06cc91f9a631a23dcd4902d710b89e4b7584c459 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 11 Sep 1998 01:24:30 +0000 Subject: Added ssize_t to configure code. Got 'religion' about using size_t and ssize_t for read/write stuff as part of the code to expose 64 bits to the client. This checkin does all the 'easy' stuff - such as all the read/write/lock calls - but now comes the harder parts (open & friends) and all the file enquiry functions..... Jeremy. (This used to be commit 36544fe5476f7770bd5748574fc54be7b3ee4d4a) --- source3/include/smb.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index dae3e275d5..3e68f1c4ca 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -458,7 +458,7 @@ typedef struct /* Structure used when SMBwritebmpx is active */ typedef struct { - int wr_total_written; /* So we know when to discard this */ + size_t wr_total_written; /* So we know when to discard this */ int32 wr_timeout; int32 wr_errclass; int32 wr_error; /* Cached errors */ @@ -1413,6 +1413,10 @@ enum ssl_version_enum {SMB_SSL_V2,SMB_SSL_V3,SMB_SSL_V23,SMB_SSL_TLS1}; #define SMB_LPID_OFFSET(indx) (10 * (indx)) #define SMB_LKOFF_OFFSET(indx) ( 2 + (10 * (indx))) #define SMB_LKLEN_OFFSET(indx) ( 6 + (10 * (indx))) +#define SMB_LARGE_LKOFF_OFFSET_HIGH(indx) (4 + (20 * (indx))) +#define SMB_LARGE_LKOFF_OFFSET_LOW(indx) (8 + (20 * (indx))) +#define SMB_LARGE_LKLEN_OFFSET_HIGH(indx) (12 + (20 * (indx))) +#define SMB_LARGE_LKLEN_OFFSET_LOW(indx) (16 + (20 * (indx))) /* Macro to cache an error in a write_bmpx_struct */ #define CACHE_ERROR(w,c,e) ((w)->wr_errclass = (c), (w)->wr_error = (e), \ -- cgit From 27d0bef143fbc4d7547c022046c094bbdbd0bfc1 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 11 Sep 1998 19:14:27 +0000 Subject: Ok - this is the 'expose 64 bit to the clients' checkin. I have tested it by creating a 'holey' 20GB file - checking that it shows up correctl in the NT file view (it does) and am busily copying it to NULL: on the NT box. All good so far.... :-). Also implemented NT 'delete on close' semantics. Jeremy. (This used to be commit 1654faee80648583e6a47ab7eda990fefdf85124) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 3e68f1c4ca..5a90f08258 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -576,6 +576,7 @@ typedef struct files_struct BOOL granted_oplock; BOOL sent_oplock_break; BOOL is_directory; + BOOL delete_on_close; char *fsp_name; } files_struct; -- cgit From cd5d4d5c12395fc55cca5048ff368d52717ab9cc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 14 Sep 1998 19:49:55 +0000 Subject: Fixed problems people were having with creating profile directories (NTTrans/Create with Security Descriptor for a directory). It turns out the CIFS spec is bogus (what a suprise) and the 'is a directory' flag is actually embedded in the create_options field. Jeremy. (This used to be commit 68750d8153f01bd0802bb86e93c3ca5d11acb199) --- source3/include/smb.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 5a90f08258..412b1f3383 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1187,6 +1187,16 @@ struct bitmap { #define FILE_OVERWRITE 4 #define FILE_OVERWRITE_IF 5 +/* CreateOptions field. */ +#define FILE_DIRECTORY_FILE 0x0001 +#define FILE_WRITE_THROUGH 0x0002 +#define FILE_SEQUENTIAL_ONLY 0x0004 +#define FILE_NON_DIRECTORY_FILE 0x0040 +#define FILE_NO_EA_KNOWLEDGE 0x0200 +#define FILE_EIGHT_DOT_THREE_ONLY 0x0400 +#define FILE_RANDOM_ACCESS 0x0800 +#define FILE_DELETE_ON_CLOSE 0x1000 + /* Responses when opening a file. */ #define FILE_WAS_OPENED 1 #define FILE_WAS_CREATED 2 -- cgit From ac9b687cc2496409e1c8d86393812faf94ec7550 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 17 Sep 1998 19:16:12 +0000 Subject: configure configure.in: Added tests for fseek64 and ftell64. config.h.in: Added fseek64 and ftell64. includes.h: Added definition of SMB_BIG_INTEGER. smb.h: Changed (*getsmbpwpos) and (*setsmbpwpos) to use SMB_BIG_INTEGER. access.c: Tidyup of dbug statement. system.c: Added sys_fseek and sys_ftell. Changed mode calls to use mode_t. asyncdns.c: Tidyup of comment. loadparm.c: Tidyup of set_default_server_announce_type() function definition. ldap.c: Changed (*getsmbpwpos) and (*setsmbpwpos) to use SMB_BIG_INTEGER. nispass.c: Changed (*getsmbpwpos) and (*setsmbpwpos) to use SMB_BIG_INTEGER. smbpass.c: Changed (*getsmbpwpos) and (*setsmbpwpos) to use SMB_BIG_INTEGER. smbpassfile.c: Use sys_fseek(). chgpasswd.c: Tidyup of debug statement. dosmode.c: Changed mode calls to use mode_t. ipc.c: Removal of dead code. nttrans.c: Changed mode calls to use mode_t. open.c: Changed mode calls to use mode_t. pipes.c: Removal of dead code. reply.c: Removal of dead code. trans2.c: Removal of dead code. Changed mode calls to use mode_t. Jeremy. (This used to be commit c381d32e3dc23fe887408016cae821aceb30da2c) --- source3/include/smb.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 412b1f3383..aa963f9163 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -708,8 +708,8 @@ struct passdb_ops { */ void *(*startsmbpwent)(BOOL); void (*endsmbpwent)(void *); - unsigned long (*getsmbpwpos)(void *); - BOOL (*setsmbpwpos)(void *, unsigned long); + SMB_BIG_INTEGER (*getsmbpwpos)(void *); + BOOL (*setsmbpwpos)(void *, SMB_BIG_INTEGER); /* * smb password database query functions. -- cgit From b8b67f4fab4a6fd686c5796c2701882197a7bd9d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 17 Sep 1998 23:06:57 +0000 Subject: configure configure.in: Added checks for statvfs64. Last bit of 64 bit widening (I hope :-). include/config.h.in: Added #undef STAT_STATVFS64. include/includes.h: Added SMB_STRUCT_STATVFS type, Changed SMB_BIG_INTEGER to SMB_BIG_UINT and SMB_BIG_INT types. include/smb.h: Added flag defines from CIFS spec. lib/debug.c: Fixed one more mode_t issue. lib/system.c: Added sys_statvfs wrapper. lib/util.c: Changed trim_string to use size_t. param/loadparm.c: Moved "blocking locks" into locking section. Alphabetised locking options. Question - shuld we do this for all options ? passdb/ldap.c: Changed SMB_BIG_INTEGER to SMB_BIG_UINT. passdb/nispass.c: Changed SMB_BIG_INTEGER to SMB_BIG_UINT. passdb/smbpass.c: Changed SMB_BIG_INTEGER to SMB_BIG_UINT. smbd/dfree.c: Changed to use 64 bit types if available. Moved to use unsigned types. smbd/dosmode.c: Fixed one more mode_t issue. smbd/negprot.c: Changed literals to be FLAG_ #defines. smbd/nttrans.c: Removed dead code. smbd/open.c: Changed disk_free call. smbd/process.c: Changed literals to be FLAG_ #defines. smbd/reply.c: Changed disk_free call. smbd/trans2.c: Fixed but in SMB_QUERY_FS_VOLUME_INFO call. Was using UNICODE - should use ascii. tests/summary.c: Added STAT_STATVFS64 check. Jeremy. (This used to be commit c512b1b91fb7f2a7a93b9033a33e06d966daadb4) --- source3/include/smb.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index aa963f9163..de482de6d6 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -708,8 +708,8 @@ struct passdb_ops { */ void *(*startsmbpwent)(BOOL); void (*endsmbpwent)(void *); - SMB_BIG_INTEGER (*getsmbpwpos)(void *); - BOOL (*setsmbpwpos)(void *, SMB_BIG_INTEGER); + SMB_BIG_UINT (*getsmbpwpos)(void *); + BOOL (*setsmbpwpos)(void *, SMB_BIG_UINT); /* * smb password database query functions. @@ -925,6 +925,15 @@ struct bitmap { #define smb_vwv16 69 #define smb_vwv17 71 +/* flag defines. CIFS spec 3.1.1 */ +#define FLAG_SUPPORT_LOCKREAD 0x01 +#define FLAG_CLIENT_BUF_AVAIL 0x02 +#define FLAG_RESERVED 0x04 +#define FLAG_CASELESS_PATHNAMES 0x08 +#define FLAG_CANONICAL_PATHNAMES 0x10 +#define FLAG_REQUEST_OPLOCK 0x20 +#define FLAG_REQUEST_BATCH_OPLOCK 0x40 +#define FLAG_REPLY 0x80 /* the complete */ #define SMBmkdir 0x00 /* create directory */ @@ -1115,7 +1124,7 @@ struct bitmap { /* these are for the NT create_and_X */ #define smb_ntcreate_NameLength (smb_vwv0 + 5) #define smb_ntcreate_Flags (smb_vwv0 + 7) -#define smb_ntcreate_RootDirectoryFid (smb_wvw0 + 11) +#define smb_ntcreate_RootDirectoryFid (smb_vwv0 + 11) #define smb_ntcreate_DesiredAccess (smb_vwv0 + 15) #define smb_ntcreate_AllocationSize (smb_vwv0 + 19) #define smb_ntcreate_FileAttributes (smb_vwv0 + 27) @@ -1494,7 +1503,8 @@ extern int unix_ERR_code; /* * Core protocol. */ -#define CORE_OPLOCK_REQUEST(inbuf) ((CVAL(inbuf,smb_flg)&((1<<5)|(1<<6)))>>5) +#define CORE_OPLOCK_REQUEST(inbuf) \ + ((CVAL(inbuf,smb_flg)&(FLAG_REQUEST_OPLOCK|FLAG_REQUEST_BATCH_OPLOCK))>>5) /* * Extended protocol. -- cgit From bc97ab2b7ca6849696b391412333a96ff0ad682f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 20 Sep 1998 15:39:12 +0000 Subject: add a define for SMB_SEARCH_BITS and change comment on FSTYPE_STRING (This used to be commit 9c275bcd98cbbd9367d9b7a2204889fcefd74638) --- source3/include/smb.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index de482de6d6..2af7b7ced4 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1134,6 +1134,9 @@ struct bitmap { #define smb_ntcreate_ImpersonationLevel (smb_vwv0 + 43) #define smb_ntcreate_SecurityFlags (smb_vwv0 + 47) +/* this is used on a TConX. I'm not sure the name is very helpful though */ +#define SMB_SUPPORT_SEARCH_BITS 0x0001 + /* these are the constants used in the above call. */ /* DesiredAccess */ /* File Specific access rights. */ -- cgit From aab2fe021643417854451c65e564932f4ac25f10 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 23 Sep 1998 01:48:45 +0000 Subject: First cut at kernel oplocks. This should have no effect unless runnin on a machine that supports them in autoconf. Move various functions out of lib/util.c into smbd/process.c and smbd/oplock.c where they belong. Jeremy. (This used to be commit c3c5e13f85c97939746070132dad941e79c546fb) --- source3/include/smb.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 2af7b7ced4..842aeb57be 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1538,11 +1538,11 @@ extern int unix_ERR_code; * Loopback command offsets. */ -#define UDP_CMD_LEN_OFFSET 0 -#define UDP_CMD_PORT_OFFSET 4 -#define UDP_CMD_HEADER_LEN 6 +#define OPBRK_CMD_LEN_OFFSET 0 +#define OPBRK_CMD_PORT_OFFSET 4 +#define OPBRK_CMD_HEADER_LEN 6 -#define UDP_MESSAGE_CMD_OFFSET 0 +#define OPBRK_MESSAGE_CMD_OFFSET 0 /* * Oplock break command code to send over the udp socket. @@ -1563,6 +1563,24 @@ extern int unix_ERR_code; #define OPLOCK_BREAK_INODE_OFFSET (OPLOCK_BREAK_DEV_OFFSET + sizeof(SMB_DEV_T)) #define OPLOCK_BREAK_MSG_LEN (OPLOCK_BREAK_INODE_OFFSET + sizeof(SMB_INO_T)) +#if defined(HAVE_KERNEL_OPLOCKS) +/* + * Oplock break command code sent via the kernel interface. + * + * Form of this is : + * + * 0 2 2+devsize 2+devsize+inodesize + * +----+--------+--------+ + * | cmd| dev | inode | + * +----+--------+--------+ + */ + +#define KERNEL_OPLOCK_BREAK_CMD 0x2 +#define KERNEL_OPLOCK_BREAK_DEV_OFFSET 2 +#define KERNEL_OPLOCK_BREAK_INODE_OFFSET (KERNEL_OPLOCK_BREAK_DEV_OFFSET + sizeof(SMB_DEV_T)) +#define KERNEL_OPLOCK_BREAK_MSG_LEN (KERNEL_OPLOCK_BREAK_INODE_OFFSET + sizeof(SMB_INO_T)) + +#endif /* HAVE_KERNEL_OPLOCKS */ #define CMD_REPLY 0x8000 -- cgit From dc36d8768aa13000c48b520f09f6678ea9ffbf28 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 24 Sep 1998 22:33:13 +0000 Subject: Integration of Anders Blomdell 's smbpasswd changes. Not exactly the same as his code - several changes. Jeremy. (This used to be commit e96747a8e3b9ea5a79c4258e55d7e8f3bf0bf193) --- source3/include/smb.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 842aeb57be..bec14ddd13 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1601,6 +1601,12 @@ extern int unix_ERR_code; __FILE__, __LINE__)), smb_panic("assert failed"))) #define SMB_ASSERT_ARRAY(a,n) SMB_ASSERT((sizeof(a)/sizeof((a)[0])) >= (n)) +/* + * Size of new password account encoding string. DO NOT CHANGE. + */ + +#define NEW_PW_FORMAT_SPACE_PADDED_LEN 14 + #endif /* _SMB_H */ #include "ntdomain.h" -- cgit From 66d5d73a5d75e88a77970f7b27687b8354ab2e80 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 25 Sep 1998 21:01:52 +0000 Subject: added rpcclient program (This used to be commit aa38f39d67fade4dfd7badb7a9b39c833a1dd1ca) --- source3/include/smb.h | 205 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 168 insertions(+), 37 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index bec14ddd13..59a7a07e76 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -403,42 +403,20 @@ typedef struct cred_info UTIME timestamp; /* credential time-stamp */ } DOM_CRED; -struct cli_state { - int fd; - int cnum; - int pid; - int mid; - int uid; - int protocol; - int sec_mode; - int rap_error; - int privilages; - fstring eff_name; - fstring desthost; - char cryptkey[8]; - uint32 sesskey; - int serverzone; - uint32 servertime; - int readbraw_supported; - int writebraw_supported; - int timeout; - int max_xmit; - char *outbuf; - char *inbuf; - int bufsize; - int initialised; - /* - * Only used in NT domain calls. - */ - uint32 nt_error; /* NT RPC error code. */ - uint16 nt_pipe_fnum; /* Pipe handle. */ - unsigned char sess_key[16]; /* Current session key. */ - DOM_CRED clnt_cred; /* Client credential. */ - fstring mach_acct; /* MYNAME$. */ - fstring srv_name_slash; /* \\remote server. */ - fstring clnt_name_slash; /* \\local client. */ -}; +struct pwd_info +{ + BOOL null_pwd; + BOOL cleartext; + BOOL crypted; + fstring password; + + uchar smb_lm_pwd[16]; + uchar smb_nt_pwd[16]; + + uchar smb_lm_owf[24]; + uchar smb_nt_owf[24]; +}; typedef struct { @@ -1601,6 +1579,161 @@ extern int unix_ERR_code; __FILE__, __LINE__)), smb_panic("assert failed"))) #define SMB_ASSERT_ARRAY(a,n) SMB_ASSERT((sizeof(a)/sizeof((a)[0])) >= (n)) +#include "ntdomain.h" + +/* A netbios name structure. */ +struct nmb_name { + char name[17]; + char scope[64]; + unsigned int name_type; +}; + +struct cli_state { + int fd; + int cnum; + int pid; + int mid; + int uid; + int protocol; + int sec_mode; + int rap_error; + int privilages; + + fstring eff_name; + fstring desthost; + fstring user_name; + fstring domain; + + fstring share; + fstring dev; + struct nmb_name called; + struct nmb_name calling; + fstring full_dest_host_name; + struct in_addr dest_ip; + + struct pwd_info pwd; + char cryptkey[8]; + uint32 sesskey; + int serverzone; + uint32 servertime; + int readbraw_supported; + int writebraw_supported; + int timeout; + int max_xmit; + char *outbuf; + char *inbuf; + int bufsize; + int initialised; + /* + * Only used in NT domain calls. + */ + uint32 nt_error; /* NT RPC error code. */ + uint16 nt_pipe_fnum; /* Pipe handle. */ + unsigned char sess_key[16]; /* Current session key. */ + DOM_CRED clnt_cred; /* Client credential. */ + fstring mach_acct; /* MYNAME$. */ + fstring srv_name_slash; /* \\remote server. */ + fstring clnt_name_slash; /* \\local client. */ +}; + +struct acct_info +{ + fstring acct_name; /* account name */ + uint32 smb_userid; /* domain-relative RID */ +}; + +struct nt_client_info +{ + /************* \PIPE\NETLOGON stuff ******************/ + + fstring mach_acct; + + uint8 sess_key[16]; + DOM_CRED clnt_cred; + DOM_CRED rtn_cred; + + NET_ID_INFO_CTR ctr; + NET_USER_INFO_3 user_info3; + + /************** \PIPE\lsarpc stuff ********************/ + + POLICY_HND lsa_info_pol; + + /* domain member */ + fstring level3_dom; + fstring level3_sid; + + /* domain controller */ + fstring level5_dom; + fstring level5_sid; + + /************** \PIPE\samr stuff ********************/ + + POLICY_HND samr_pol_connect; + POLICY_HND samr_pol_open_domain; + POLICY_HND samr_pol_open_user; + + struct acct_info *sam; + int num_sam_entries; +}; + + +struct tar_client_info +{ + int blocksize; + BOOL inc; + BOOL reset; + BOOL excl; + char type; + int attrib; + char **cliplist; + int clipn; + int tp; + int num_files; + int buf_size; + int bytes_written; + char *buf; + int handle; + int print_mode; + char *file_mode; +}; + +struct client_info +{ + struct in_addr dest_ip; + fstring dest_host; + fstring query_host; + uint8 name_type; + + fstring myhostname; + fstring mach_acct; + + pstring cur_dir; + pstring base_dir; + pstring file_sel; + + fstring service; + fstring share; + fstring svc_type; + + time_t newer_than; + int archive_level; + int dir_total; + int put_total_time_ms; + int put_total_size; + int get_total_time_ms; + int get_total_size; + int print_mode; + BOOL translation; + BOOL recurse_dir; + BOOL prompt; + BOOL lowercase; + BOOL abort_mget; + + struct tar_client_info tar; + struct nt_client_info dom; +}; + /* * Size of new password account encoding string. DO NOT CHANGE. */ @@ -1609,6 +1742,4 @@ extern int unix_ERR_code; #endif /* _SMB_H */ -#include "ntdomain.h" - /* _SMB_H */ -- cgit From 6fb5804b28adffbbcb45b84e485e09d9d2ddddea Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 25 Sep 1998 22:20:05 +0000 Subject: added in samr commands. assistance in returning the missing functions, automatically removed because they were "unused", would be appreciated. (This used to be commit d0f7b0d915973ccb85409af3d6d951a716cd66d2) --- source3/include/smb.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 59a7a07e76..cc62234268 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1401,6 +1401,9 @@ enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_SAMB /* case handling */ enum case_handling {CASE_LOWER,CASE_UPPER}; +/* display info */ +enum action_type { ACTION_HEADER, ACTION_ENUMERATE, ACTION_FOOTER }; + #ifdef WITH_SSL /* SSL version options */ enum ssl_version_enum {SMB_SSL_V2,SMB_SSL_V3,SMB_SSL_V23,SMB_SSL_TLS1}; -- cgit From 5f7ee360567a6b4e1a6f43ff01da057d2998fef8 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 25 Sep 1998 23:40:49 +0000 Subject: Makefile.in: Fixed bug with continuation line causing proto to fail. Added $(PROGS) $(SPROGS) as targets for make clean. acconfig.h: Added HAVE_IRIX_SPECIFIC_CAPABILITIES. configure.in: Added sys/capability.h header check. Added function checks for srandom random srand rand. Added HAVE_IRIX_SPECIFIC_CAPABILITIES test. includes.h: Added #include . ntdomain.h: Moved struct acct_info into here from smb.h smb.h: Added KERNEL_OPLOCK_CAPABILITY define. Moved enum action_type into rpcclient.h Moved struct cli_state into client.h Moved struct nt_client_info, struct tar_client_info, struct client_info into rpcclient.h lib/genrand.c: Changed to use sys_random() & friends. lib/smbrun.c: Lose capabilities after fork. lib/system.c: Added set_process_capability(), set_inherited_process_capability() sys_random(), sys_srandom(). lib/util.c: Added Ander's EFBIG lock check to fcntl_lock for 64 bit access to an 32 bit mounted NFS filesystem. nmbd/nmbd.c: Changed to use sys_random() & friends. nmbd/nmbd_browsesync.c: Changed to use sys_random() & friends. passdb/ldap.c: Missed one pdb_encode_acct_ctrl call. passdb/passdb.c: Changed to Ander's code for ' ' characters. passdb/smbpass.c: Added Ander's code to reset ACB_PWNOTREQ. script/mkproto.awk: Added 'long' to prototypes. smbd/chgpasswd.c: Lose capabilities after fork. smbd/open.c: Do the mmap *after* the kernel oplock. smbd/oplock.c: Removed stub code from kernel oplock path. Added set_process_capability(), set_inherited_process_capability() calls. smbd/reply.c: Initialize count = 0, offset = 0. smbd/server.c: Added set_process_capability(), set_inherited_process_capability() calls. tests/summary.c: Ensure we have RANDOM or RAND. utils/smbpasswd.c: Added Ander's code to reset ACB_PWNOTREQ. utils/torture.c: Changed to use sys_random() & friends. Jeremy. (This used to be commit e8be306f23963ac00b1a383ebe0cc1421529fb02) --- source3/include/smb.h | 156 +++----------------------------------------------- 1 file changed, 8 insertions(+), 148 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index cc62234268..e1baac8f6f 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1401,9 +1401,6 @@ enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_SAMB /* case handling */ enum case_handling {CASE_LOWER,CASE_UPPER}; -/* display info */ -enum action_type { ACTION_HEADER, ACTION_ENUMERATE, ACTION_FOOTER }; - #ifdef WITH_SSL /* SSL version options */ enum ssl_version_enum {SMB_SSL_V2,SMB_SSL_V3,SMB_SSL_V23,SMB_SSL_TLS1}; @@ -1544,6 +1541,12 @@ extern int unix_ERR_code; #define OPLOCK_BREAK_INODE_OFFSET (OPLOCK_BREAK_DEV_OFFSET + sizeof(SMB_DEV_T)) #define OPLOCK_BREAK_MSG_LEN (OPLOCK_BREAK_INODE_OFFSET + sizeof(SMB_INO_T)) +/* + * Capabilities abstracted for different systems. + */ + +#define KERNEL_OPLOCK_CAPABILITY 0x1 + #if defined(HAVE_KERNEL_OPLOCKS) /* * Oplock break command code sent via the kernel interface. @@ -1591,151 +1594,8 @@ struct nmb_name { unsigned int name_type; }; -struct cli_state { - int fd; - int cnum; - int pid; - int mid; - int uid; - int protocol; - int sec_mode; - int rap_error; - int privilages; - - fstring eff_name; - fstring desthost; - fstring user_name; - fstring domain; - - fstring share; - fstring dev; - struct nmb_name called; - struct nmb_name calling; - fstring full_dest_host_name; - struct in_addr dest_ip; - - struct pwd_info pwd; - char cryptkey[8]; - uint32 sesskey; - int serverzone; - uint32 servertime; - int readbraw_supported; - int writebraw_supported; - int timeout; - int max_xmit; - char *outbuf; - char *inbuf; - int bufsize; - int initialised; - /* - * Only used in NT domain calls. - */ - uint32 nt_error; /* NT RPC error code. */ - uint16 nt_pipe_fnum; /* Pipe handle. */ - unsigned char sess_key[16]; /* Current session key. */ - DOM_CRED clnt_cred; /* Client credential. */ - fstring mach_acct; /* MYNAME$. */ - fstring srv_name_slash; /* \\remote server. */ - fstring clnt_name_slash; /* \\local client. */ -}; - -struct acct_info -{ - fstring acct_name; /* account name */ - uint32 smb_userid; /* domain-relative RID */ -}; - -struct nt_client_info -{ - /************* \PIPE\NETLOGON stuff ******************/ - - fstring mach_acct; - - uint8 sess_key[16]; - DOM_CRED clnt_cred; - DOM_CRED rtn_cred; - - NET_ID_INFO_CTR ctr; - NET_USER_INFO_3 user_info3; - - /************** \PIPE\lsarpc stuff ********************/ - - POLICY_HND lsa_info_pol; - - /* domain member */ - fstring level3_dom; - fstring level3_sid; - - /* domain controller */ - fstring level5_dom; - fstring level5_sid; - - /************** \PIPE\samr stuff ********************/ - - POLICY_HND samr_pol_connect; - POLICY_HND samr_pol_open_domain; - POLICY_HND samr_pol_open_user; - - struct acct_info *sam; - int num_sam_entries; -}; - - -struct tar_client_info -{ - int blocksize; - BOOL inc; - BOOL reset; - BOOL excl; - char type; - int attrib; - char **cliplist; - int clipn; - int tp; - int num_files; - int buf_size; - int bytes_written; - char *buf; - int handle; - int print_mode; - char *file_mode; -}; - -struct client_info -{ - struct in_addr dest_ip; - fstring dest_host; - fstring query_host; - uint8 name_type; - - fstring myhostname; - fstring mach_acct; - - pstring cur_dir; - pstring base_dir; - pstring file_sel; - - fstring service; - fstring share; - fstring svc_type; - - time_t newer_than; - int archive_level; - int dir_total; - int put_total_time_ms; - int put_total_size; - int get_total_time_ms; - int get_total_size; - int print_mode; - BOOL translation; - BOOL recurse_dir; - BOOL prompt; - BOOL lowercase; - BOOL abort_mget; - - struct tar_client_info tar; - struct nt_client_info dom; -}; +#include "client.h" +#include "rpcclient.h" /* * Size of new password account encoding string. DO NOT CHANGE. -- cgit From cf3a9741dc7427efb97eff09a3c197a906ce6767 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 28 Sep 1998 21:43:48 +0000 Subject: Changes to test in configure if capabilities are enabled on a system. Changes to get Samba to compile cleanly with the IRIX compiler with the options : -fullwarn -woff 1209,1174 (the -woff options are to turn off warnings about unused function parameters and controlling loop expressions being constants). Split prototype generation as we hit a limit in IRIX nawk. Removed "." code in smbd/filename.c (yet again :-). Jeremy. (This used to be commit e0567433bd72aec17bf5a54cc292701095d25f09) --- source3/include/smb.h | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index e1baac8f6f..f42951ec59 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -403,36 +403,6 @@ typedef struct cred_info UTIME timestamp; /* credential time-stamp */ } DOM_CRED; -struct pwd_info -{ - BOOL null_pwd; - BOOL cleartext; - BOOL crypted; - - fstring password; - - uchar smb_lm_pwd[16]; - uchar smb_nt_pwd[16]; - - uchar smb_lm_owf[24]; - uchar smb_nt_owf[24]; -}; - -typedef struct -{ - SMB_OFF_T size; - int mode; - uid_t uid; - gid_t gid; - /* these times are normally kept in GMT */ - time_t mtime; - time_t atime; - time_t ctime; - pstring name; - -} file_info; - - /* Structure used when SMBwritebmpx is active */ typedef struct { @@ -538,7 +508,7 @@ typedef struct files_struct file_fd_struct *fd_ptr; SMB_OFF_T pos; SMB_OFF_T size; - int mode; + mode_t mode; int vuid; char *mmap_ptr; SMB_OFF_T mmap_size; -- cgit From 9066025a8a4afe1f7f559c455d86fc023792ed17 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 29 Sep 1998 20:24:17 +0000 Subject: Got very strict about the differences and uses of uid_t, gid_t and vuid. Added sys_getgroups() to get around the int * return problem. Set correct datatypes for all uid, gid and vuid variables. Jeremy. (This used to be commit e570db46fc3a78e499523fd342e9a34cebb18998) --- source3/include/smb.h | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index f42951ec59..56b0e3bc24 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -345,8 +345,8 @@ struct sam_passwd char *unknown_str ; /* don't know what this is, yet. */ char *munged_dial ; /* munged path name and dial-back tel number */ - int smb_userid; /* this is actually the unix uid_t */ - int smb_grpid; /* this is actually the unix gid_t */ + uid_t smb_userid; /* this is actually the unix uid_t */ + gid_t smb_grpid; /* this is actually the unix gid_t */ uint32 user_rid; /* Primary User ID */ uint32 group_rid; /* Primary Group ID */ @@ -366,7 +366,7 @@ struct sam_passwd struct smb_passwd { - int smb_userid; /* this is actually the unix uid_t */ + uid_t smb_userid; /* this is actually the unix uid_t */ char *smb_name; /* username string */ unsigned char *smb_passwd; /* Null if no password */ @@ -447,7 +447,7 @@ typedef struct struct uid_cache { int entries; - int list[UID_CACHE_SIZE]; + uid_t list[UID_CACHE_SIZE]; }; typedef struct @@ -472,8 +472,8 @@ typedef struct connection_struct char *connectpath; char *origpath; char *user; /* name of user who *opened* this connection */ - int uid; /* uid of user who *opened* this connection */ - int gid; /* gid of user who *opened* this connection */ + uid_t uid; /* uid of user who *opened* this connection */ + gid_t gid; /* gid of user who *opened* this connection */ uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */ @@ -481,7 +481,7 @@ typedef struct connection_struct /* This groups info is valid for the user that *opened* the connection */ int ngroups; - GID_T *groups; + gid_t *groups; time_t lastused; BOOL used; @@ -494,10 +494,11 @@ typedef struct connection_struct struct current_user { connection_struct *conn; - int vuid; - int uid, gid; + uint16 vuid; + uid_t uid; + gid_t gid; int ngroups; - GID_T *groups; + gid_t *groups; }; typedef struct files_struct @@ -509,7 +510,7 @@ typedef struct files_struct SMB_OFF_T pos; SMB_OFF_T size; mode_t mode; - int vuid; + uint16 vuid; char *mmap_ptr; SMB_OFF_T mmap_size; write_bmpx_struct *wbmpx_ptr; @@ -542,8 +543,8 @@ struct dcinfo typedef struct { - int uid; /* uid of a validated user */ - int gid; /* gid of a validated user */ + uid_t uid; /* uid of a validated user */ + gid_t gid; /* gid of a validated user */ fstring requested_name; /* user name from the client */ fstring name; /* unix user name of a validated user */ @@ -553,7 +554,7 @@ typedef struct /* following groups stuff added by ih */ /* This groups info is needed for when we become_user() for this uid */ int n_groups; - GID_T *groups; + gid_t *groups; int n_sids; int *sids; @@ -714,8 +715,8 @@ struct connect_record int magic; int pid; int cnum; - int uid; - int gid; + uid_t uid; + gid_t gid; char name[24]; char addr[24]; char machine[128]; @@ -727,7 +728,7 @@ struct connection_options { int protocol; /* Connection-Options */ uint32 max_xmit; - uint16 server_uid; + uint16 server_vuid; uint16 tid; /* The following are LANMAN 1.0 options */ uint16 sec_mode; -- cgit From 404f14fb36577ee182fd8a928e6cb7b374e4ecb9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 6 Oct 1998 13:10:06 +0000 Subject: implemented unix semantics for rename in smbwrapper (This used to be commit a5c18f9c82f5f76b00ff29c5668b4f0d3e8d6bd0) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 56b0e3bc24..05ea1bf7c7 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -216,6 +216,7 @@ implemented */ #define ERRfilexists 80 /* File in operation already exists */ #define ERRcannotopen 110 /* Cannot open the file specified */ #define ERRunknownlevel 124 +#define ERRrename 183 #define ERRbadpipe 230 /* Named pipe invalid */ #define ERRpipebusy 231 /* All instances of pipe are busy */ #define ERRpipeclosing 232 /* named pipe close in progress */ -- cgit From a785f8d2c90f3db579c781ca5f722cb5b695fcb4 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 16 Oct 1998 23:40:59 +0000 Subject: dce/rpc (This used to be commit 29434f496c18e816d864060d68f357aea6ef5de8) --- source3/include/smb.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 05ea1bf7c7..4cc5599f44 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -490,6 +490,7 @@ typedef struct connection_struct 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; struct current_user @@ -497,7 +498,7 @@ struct current_user connection_struct *conn; uint16 vuid; uid_t uid; - gid_t gid; + gid_t gid; int ngroups; gid_t *groups; }; -- cgit From 21e107fd42eb953affac28239588458c6c0ee323 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 21 Oct 1998 21:11:16 +0000 Subject: the next dialog: user-groups. it's not very sensible what appears, but hey: it appears! (This used to be commit 399035098f212e976cc0000a215e0705ebe78c05) --- source3/include/smb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index 4cc5599f44..f755b81b92 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -667,6 +667,7 @@ struct passdb_ops { */ struct smb_passwd *(*getsmbpwnam)(char *); struct smb_passwd *(*getsmbpwuid)(uid_t); + struct smb_passwd *(*getsmbpwrid)(uint32); struct smb_passwd *(*getsmbpwent)(void *); /* -- cgit From 5d6ed11ef3c860c95ae7b3a855b0ddb123bd9737 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 23 Oct 1998 00:58:28 +0000 Subject: include/smb.h: Added #defines for lots of things - makes our code a *lot* easier to read. lib/util.c: Fixed Luke's set_first_token() function - should return void. smbd/close.c: Move delete_on_close into file_fd_struct structure. smbd/ipc.c: Changed local_machine back to fstring. smbd/nttrans.c: Use defines for mapping share modes. smbd/open.c: Move delete_on_close into file_fd_struct structure, added code for ALLOW_SHARE_DELETE. smbd/reply.c: Use defines for mapping share modes. smbd/trans2.c: Move delete_on_close into file_fd_struct structure. Jeremy. (This used to be commit 8e1ce307bd6a9056b4a95fe6f52ff42dc6e03a08) --- source3/include/smb.h | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'source3/include/smb.h') diff --git a/source3/include/smb.h b/source3/include/smb.h index f755b81b92..d71d1cd1eb 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -186,6 +186,47 @@ implemented */ #define DENY_NONE 4 #define DENY_FCB 7 +/* open modes */ +#define DOS_OPEN_RDONLY 0 +#define DOS_OPEN_WRONLY 1 +#define DOS_OPEN_RDWR 2 +#define DOS_OPEN_FCB 0xF + +/* define shifts and masks for share and open modes. */ +#define OPEN_MODE_MASK 0xF +#define SHARE_MODE_SHIFT 4 +#define SHARE_MODE_MASK 0x7 +#define GET_OPEN_MODE(x) ((x) & OPEN_MODE_MASK) +#define SET_OPEN_MODE(x) ((x) & OPEN_MODE_MASK) +#define GET_DENY_MODE(x) (((x)>>SHARE_MODE_SHIFT) & SHARE_MODE_MASK) +#define SET_DENY_MODE(x) ((x)<