summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-07-29 00:27:23 +0000
committerJeremy Allison <jra@samba.org>1998-07-29 00:27:23 +0000
commitc48b3fce6be6d5d952cbcda0ddae223dda5a576f (patch)
tree7159458adde4cc2a2f9991727de74340e4829b8d /source3
parent83951dd37685ac8c5e45f44270d932250f785be5 (diff)
downloadsamba-c48b3fce6be6d5d952cbcda0ddae223dda5a576f.tar.gz
samba-c48b3fce6be6d5d952cbcda0ddae223dda5a576f.tar.bz2
samba-c48b3fce6be6d5d952cbcda0ddae223dda5a576f.zip
locking.c: Print messages when we downgrade a lock.
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. (This used to be commit 7b3a9d6285cc0d1967155a68845e28c6296ecc67)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/locking/locking.c2
-rw-r--r--source3/smbd/reply.c3
-rw-r--r--source3/smbd/trans2.c48
4 files changed, 35 insertions, 19 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 92008b46e1..97ee483f55 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -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);
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index f443482544..e4ca6bbb04 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -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;
}
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index c9daf14b4b..f05ba2eee6 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -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++)
{
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index a0aa65601f..2fcab32afb 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -574,6 +574,33 @@ static int get_lanman2_dir_entry(int cnum,char *path_mask,int dirtype,int info_l
}
/****************************************************************************
+ 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
****************************************************************************/
static int call_trans2findfirst(char *inbuf, char *outbuf, int bufsize, int cnum,
@@ -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 */
/*