chgpasswd.c: Fix from Peter Debus <pdebus@turing.une.edu.au> for Digital UNIX
authorJeremy Allison <jra@samba.org>
Thu, 2 Jul 1998 18:49:08 +0000 (18:49 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 2 Jul 1998 18:49:08 +0000 (18:49 +0000)
             password change core dump bug.
nmbd_subnetdb.c: Make namelist_entry_compare() static.
nttrans.c: More NT SMB stuff.
Jeremy.
(This used to be commit 1925a29c6b355b8358ee99e5b876b6376aa7d628)

source3/include/proto.h
source3/nmbd/nmbd_subnetdb.c
source3/smbd/chgpasswd.c
source3/smbd/nttrans.c

index edf6e60915a4f19a41e1c1bdcaa34a8f01db36e7..888f26e90649d3215f9acbf730bd66755580b3e9 100644 (file)
@@ -1533,7 +1533,6 @@ void write_browse_list(time_t t, BOOL force_write);
 
 /*The following definitions come from  nmbd_subnetdb.c  */
 
-int namelist_entry_compare( ubi_trItemPtr Item, ubi_trNodePtr Node );
 BOOL create_subnets(void);
 BOOL we_are_a_wins_client(void);
 struct subnet_record *get_next_subnet_maybe_unicast(struct subnet_record *subrec);
index 36a3ee9a27c33195b8fbaf3d6450199ed1867280..20d924910dd5ccb1d555a67754658eb880a73161 100644 (file)
@@ -79,7 +79,7 @@ static void add_subnet(struct subnet_record *subrec)
   Note that we cannot use memcmp here as we have no control
   over how the struct nmb_name structures are packed in memory. JRA.
  * ************************************************************************** ** */
-int namelist_entry_compare( ubi_trItemPtr Item, ubi_trNodePtr Node )
+static int namelist_entry_compare( ubi_trItemPtr Item, ubi_trNodePtr Node )
   {
   struct name_record *NR = (struct name_record *)Node;
   struct nmb_name *nmbname = (struct nmb_name *)Item;
@@ -103,7 +103,7 @@ int namelist_entry_compare( ubi_trItemPtr Item, ubi_trNodePtr Node )
  * This will go away when we move to a "real" database back-end.
  * ************************************************************************** **
  */
-int namelist_entry_compare( ubi_trItemPtr Item, ubi_trNodePtr Node )
+static int namelist_entry_compare( ubi_trItemPtr Item, ubi_trNodePtr Node )
   {
   struct name_record *NR = (struct name_record *)Node;
 
index e8f3abc4f1779aedbfde909ae84402cc13c8450c..204a4480e931ff3bab37aad9696d5243734049f7 100644 (file)
@@ -77,7 +77,7 @@ static int findpty(char **slave)
 #else /* defined(SVR4) || defined(SUNOS5) */
   fstrcpy( line, "/dev/ptyXX" );
 
-  dirp = OpenDir(-1, "/dev", True);
+  dirp = OpenDir(-1, "/dev", False);
   if (!dirp) return(-1);
   while ((dpname = ReadDirName(dirp)) != NULL) {
     if (strncmp(dpname, "pty", 3) == 0 && strlen(dpname) == 5) {
index 1cde27a9ff2ea4228137a81ecf14fb9123d29032..f6b5704681560d54981d8eb368ee9213dd133187 100644 (file)
@@ -23,6 +23,7 @@
 
 extern int DEBUGLEVEL;
 extern int Protocol;
+extern int chain_fnum;
 extern connection_struct Connections[];
 extern files_struct Files[];
 extern int Client;  
@@ -46,6 +47,10 @@ static char *known_nt_pipes[] = {
   NULL
 };
 
+/****************************************************************************
+ Save case statics.
+****************************************************************************/
+
 static BOOL saved_case_sensitive;
 static BOOL saved_case_preserve;
 static BOOL saved_short_case_preserve;
@@ -106,7 +111,8 @@ int reply_ntcreate_and_X(char *inbuf,char *outbuf,int length,int bufsize)
      reply bits separately. */
   int oplock_request = flags & (REQUEST_OPLOCK|REQUEST_BATCH_OPLOCK);
   int unixmode;
-  int size=0,fmode=0,mtime=0,rmode=0;
+  int fmode=0,mtime=0,rmode=0;
+  off_t file_size = 0;
   struct stat sbuf;
   int smb_action = 0;
   BOOL bad_path = False;
@@ -206,16 +212,13 @@ int reply_ntcreate_and_X(char *inbuf,char *outbuf,int length,int bufsize)
   unix_convert(fname,cnum,0,&bad_path);
     
   fnum = find_free_file();
-  if (fnum < 0)
-  {
+  if (fnum < 0) {
     restore_case_semantics(file_attributes);
     return(ERROR(ERRSRV,ERRnofids));
   }
 
-  if (!check_name(fname,cnum))
-  { 
-    if((errno == ENOENT) && bad_path)
-    {
+  if (!check_name(fname,cnum)) { 
+    if((errno == ENOENT) && bad_path) {
       unix_ERR_class = ERRDOS;
       unix_ERR_code = ERRbadpath;
     }
@@ -229,14 +232,12 @@ int reply_ntcreate_and_X(char *inbuf,char *outbuf,int length,int bufsize)
   unixmode = unix_mode(cnum,smb_attr | aARCH);
     
   open_file_shared(fnum,cnum,fname,smb_open_mode,smb_ofun,unixmode,
-           oplock_request, &rmode,&smb_action);
+                   oplock_request,&rmode,&smb_action);
 
   fsp = &Files[fnum];
     
-  if (!fsp->open)
-  { 
-    if((errno == ENOENT) && bad_path)
-    {
+  if (!fsp->open) { 
+    if((errno == ENOENT) && bad_path) {
       unix_ERR_class = ERRDOS;
       unix_ERR_code = ERRbadpath;
     }
@@ -283,42 +284,32 @@ int reply_ntcreate_and_X(char *inbuf,char *outbuf,int length,int bufsize)
 
   p = outbuf + smb_vwv2;
 
-  SCVAL(p,0, (smb_action & EXTENDED_OPLOCK_GRANTED ? );
+  /*
+   * Currently as we don't support level II oplocks we just report
+   * exclusive & batch here.
+   */
+
+  SCVAL(p,0, (smb_action & EXTENDED_OPLOCK_GRANTED ? 3 : 0));
   p++;
   SSVAL(p,0,fnum);
   p += 2;
   SIVAL(p,0,smb_action);
   p += 4;
-  
-  CreationTime
-  p += 8;
-  LastAccessTime;
-  p += 8;
-  LastWriteTime;
+
+  /* Create time. */  
+  put_long_date(p,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(cnum))));
   p += 8;
-  ChangeTime;
+  put_long_date(p,sbuf.st_atime); /* access time */
   p += 8;
-  FileAttributes;
-  p += 4;
-  AllocationSize;
+  put_long_date(p,sbuf.st_mtime); /* write time */
   p += 8;
-  EndOfFile;
+  put_long_date(p,sbuf.st_mtime); /* change time */
   p += 8;
-  SSVAL(p,0,0); /* File Type */
-  p += 2;
-  SSVAL(p,0,0); /* Device State */
-  p += 1;
-  SCVAL(p,0,0); /* Not Directory. */
-
-  SSVAL(outbuf,smb_vwv3,fmode);
-  if(lp_dos_filetime_resolution(SNUM(cnum)) )
-    put_dos_date3(outbuf,smb_vwv4,mtime & ~1);
-  else
-    put_dos_date3(outbuf,smb_vwv4,mtime);
-  SIVAL(outbuf,smb_vwv6,size);
-  SSVAL(outbuf,smb_vwv8,rmode);
-  SSVAL(outbuf,smb_vwv11,smb_action);
-    
+  SIVAL(p,0,fmode); /* File Attributes. */
+  p += 12;
+  SIVAL(p,0, size & 0xFFFFFFFF);
+  SIVAL(p,4, (size >> 32));
+
   chain_fnum = fnum;
     
   restore_case_semantics(file_attributes);
@@ -326,6 +317,26 @@ int reply_ntcreate_and_X(char *inbuf,char *outbuf,int length,int bufsize)
   return chain_reply(inbuf,outbuf,length,bufsize);
 }
 
+/****************************************************************************
+ reply to a NT_TRANSACT_CREATE call (needs to process SD's).
+****************************************************************************/
+
+static int call_nt_transact_create(char *inbuf, char *outbuf, int bufsize, int cnum,
+                                   char **setup, char **params, char **data)
+{
+  char *params = *pparams;
+  uint32 flags = SIVAL(params,0);
+  uint32 desired_access = 
+  uint32 file_attributes = SIVAL(inbuf,smb_ntcreate_FileAttributes);
+  uint32 share_access = SIVAL(inbuf,smb_ntcreate_ShareAccess);
+  uint32 create_disposition = SIVAL(inbuf,smb_ntcreate_CreateDisposition);
+  uint32 fname_len = MIN(((uint32)SSVAL(inbuf,smb_ntcreate_NameLength)),
+                         ((uint32)sizeof(fname)-1));
+  int smb_ofun;
+  int smb_open_mode;
+  int smb_attr = file_attributes & SAMBA_ATTRIBUTES_MASK;
+}
+
 /****************************************************************************
   reply to an unsolicited SMBNTtranss - just ignore it!
 ****************************************************************************/
@@ -344,11 +355,11 @@ int reply_nttrans(char *inbuf,char *outbuf,int length,int bufsize)
 {
   int outsize = 0;
   int cnum = SVAL(inbuf,smb_tid);
-#if 0
+#if 0 /* Not used. */
   uint16 max_setup_count = CVAL(inbuf, smb_nt_MaxSetupCount);
   uint32 max_parameter_count = IVAL(inbuf, smb_nt_MaxParameterCount);
   uint32 max_data_count = IVAL(inbuf,smb_nt_MaxDataCount);
-#endif
+#endif /* Not used. */
   uint32 total_parameter_count = IVAL(inbuf, smb_nt_TotalParameterCount);
   uint32 total_data_count = IVAL(inbuf, smb_nt_TotalDataCount);
   uint32 parameter_count = IVAL(inbuf,smb_nt_ParameterCount);