diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/smb.h | 1 | ||||
-rw-r--r-- | source3/locking/locking.c | 4 | ||||
-rw-r--r-- | source3/torture/torture.c | 10 |
3 files changed, 12 insertions, 3 deletions
diff --git a/source3/include/smb.h b/source3/include/smb.h index 7a7c2bcede..1cceb88983 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -177,6 +177,7 @@ implemented */ #define ERRfilexists 80 /* File in operation already exists */ #define ERRcannotopen 110 /* Cannot open the file specified */ #define ERRunknownlevel 124 +#define ERRnotlocked 158 /* This region is not locked by this locking context. */ #define ERRrename 183 #define ERRbadpipe 230 /* Named pipe invalid */ #define ERRpipebusy 231 /* All instances of pipe are busy */ diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 68c3c5b653..a75388081e 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -168,7 +168,7 @@ BOOL do_unlock(files_struct *fsp,connection_struct *conn, if (!OPEN_FSP(fsp) || !fsp->can_lock || (fsp->conn != conn)) { *eclass = ERRDOS; - *ecode = ERRlock; + *ecode = ERRbadfid; return False; } @@ -187,7 +187,7 @@ BOOL do_unlock(files_struct *fsp,connection_struct *conn, if (!ok) { DEBUG(10,("do_unlock: returning ERRlock.\n" )); *eclass = ERRDOS; - *ecode = ERRlock; + *ecode = ERRnotlocked; return False; } diff --git a/source3/torture/torture.c b/source3/torture/torture.c index a50c44b296..d7e169bdcc 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -909,8 +909,16 @@ static void run_locktest2(int dummy) cli_setpid(&cli, 2); - if (cli_unlock(&cli, fnum1, 0, 8)) { + if (cli_unlock(&cli, fnum1, 0, 4)) { printf("unlock1 succeeded! This is a locking bug\n"); + } else { + if (!check_error(&cli, ERRDOS, ERRnotlocked, 0)) return; + } + + if (cli_unlock(&cli, fnum1, 0, 8)) { + printf("unlock2 succeeded! This is a locking bug\n"); + } else { + if (!check_error(&cli, ERRDOS, ERRnotlocked, 0)) return; } if (cli_lock(&cli, fnum3, 0, 4, 0, WRITE_LOCK)) { |