locking.c: Print messages when we downgrade a lock.
authorJeremy Allison <jra@samba.org>
Wed, 29 Jul 1998 00:27:23 +0000 (00:27 +0000)
committerJeremy Allison <jra@samba.org>
Wed, 29 Jul 1998 00:27:23 +0000 (00:27 +0000)
reply.c: Do the same mask expansion we do in trans2.c - needed for Win98.
trans2.c: Make the mask expansion into a function call now we have to
          do it twice.
Jeremy.

source/include/proto.h
source/locking/locking.c
source/smbd/reply.c
source/smbd/trans2.c

index 92008b46e12102d499b2bd4a8cb5129dec93e0ab..97ee483f55e850c5d1355ca62c28e12e7f1f89b5 100644 (file)
@@ -1949,6 +1949,7 @@ time_t get_create_time(struct stat *st,BOOL fake_dirs);
 
 /*The following definitions come from  trans2.c  */
 
+void mask_convert( char *mask);
 int reply_findclose(char *inbuf,char *outbuf,int length,int bufsize);
 int reply_findnclose(char *inbuf,char *outbuf,int length,int bufsize);
 int reply_transs2(char *inbuf,char *outbuf,int length,int bufsize);
index f443482544cef0b726954b6251298cdccc418d91..e4ca6bbb04945cf01348ad17232a888d0dccba4a 100644 (file)
@@ -51,11 +51,13 @@ static int map_lock_type( files_struct *fsp, int lock_type)
      * Win32 locking semantics allow this.
      * Do the best we can and attempt a read-only lock.
      */
+    DEBUG(10,("map_lock_type: Downgrading write lock to read due to read-only file.\n"));
     return F_RDLCK;
   } else if( (lock_type == F_RDLCK) && (fsp->fd_ptr->real_open_flags == O_WRONLY)) {
     /*
      * Ditto for read locks on write only files.
      */
+    DEBUG(10,("map_lock_type: Changing read lock to write due to write-only file.\n"));
     return F_WRLCK;
   }
 
index c9daf14b4b017e20a920f583bec015385451c104..f05ba2eee66145556d0e93f028a0ead6a7e2348b 100644 (file)
@@ -1081,6 +1081,9 @@ int reply_search(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
       }
   }
 
+  /* Convert the formatted mask. (This code lives in trans2.c) */
+  mask_convert(mask);
+
   {
     for (p=mask; *p; p++)
       {
index a0aa65601ffdf2dd23d4de058a952317ea7112cf..2fcab32afba8195b588d751a8bb1a1790c1d5459 100644 (file)
@@ -573,6 +573,33 @@ static int get_lanman2_dir_entry(int cnum,char *path_mask,int dirtype,int info_l
   return(found);
 }
   
+/****************************************************************************
+ Convert the directory masks formated for the wire.
+****************************************************************************/
+
+void mask_convert( char *mask)
+{
+  /*
+   * We know mask is a pstring.
+   */
+  char *p = mask;
+  while (*p) {
+    if (*p == '<') {
+      pstring expnd;
+      if(p[1] != '"' && p[1] != '.') {
+        pstrcpy( expnd, p+1 );
+        *p++ = '*';
+        *p = '.';
+        safe_strcpy( p+1, expnd, sizeof(pstring) - (p - mask) - 2);
+      } else
+        *p = '*';
+    }
+    if (*p == '>') *p = '?';
+    if (*p == '"') *p = '.';
+    p++;
+  }
+}
+
 /****************************************************************************
   reply to a TRANS2_FINDFIRST
 ****************************************************************************/
@@ -678,25 +705,8 @@ static int call_trans2findfirst(char *inbuf, char *outbuf, int bufsize, int cnum
   if (dptr_num < 0)
     return(ERROR(ERRDOS,ERRbadfile));
 
-  /* convert the formatted masks */
-  {
-    p = mask;
-    while (*p) {
-      if (*p == '<') {
-        pstring expnd;
-        if(p[1] != '"' && p[1] != '.') {
-          pstrcpy( expnd, p+1 );
-          *p++ = '*';
-          *p = '.';
-          safe_strcpy( p+1, expnd, sizeof(mask) - (p - mask) - 2);
-        } else
-          *p = '*';
-      }
-      if (*p == '>') *p = '?';
-      if (*p == '"') *p = '.';
-      p++;
-    }
-  }
+  /* Convert the formatted mask. */
+  mask_convert(mask);
 
 #if 0 /* JRA */
   /*