ZERO_STRUCTP(ul_new);
ul_new->start = lock->start + lock->size;
ul_new->size = ul_curr->start + ul_curr->size - ul_new->start;
+ ul_new->smbpid = ul_curr->smbpid;
/* Add into the dlink list after the ul_curr point - NOT at ulhead. */
DLIST_ADD(ul_curr, ul_new);
ZERO_STRUCTP(ul_new);
ul_new->start = lock->start;
ul_new->size = lock->size;
+ ul_new->smbpid = lock->context.smbpid;
DLIST_ADD(ulist, ul_new);
}
#include "includes.h"
extern int DEBUGLEVEL;
+int global_smbpid;
/* the locking database handle */
static TDB_CONTEXT *tdb;
return(False);
ret = !brl_locktest(fsp->dev, fsp->inode,
- fsp->smbpid, getpid(), conn->cnum,
+ global_smbpid, getpid(), conn->cnum,
offset, count, lock_type);
/*
if (OPEN_FSP(fsp) && fsp->can_lock && (fsp->conn == conn)) {
ok = brl_lock(fsp->dev, fsp->inode, fsp->fnum,
- fsp->smbpid, getpid(), conn->cnum,
+ global_smbpid, getpid(), conn->cnum,
offset, count,
lock_type);
* lock entry.
*/
(void)brl_unlock(fsp->dev, fsp->inode, fsp->fnum,
- fsp->smbpid, getpid(), conn->cnum,
+ global_smbpid, getpid(), conn->cnum,
offset, count);
}
}
pid = getpid();
ok = brl_unlock(fsp->dev, fsp->inode, fsp->fnum,
- fsp->smbpid, pid, conn->cnum, offset, count);
+ global_smbpid, pid, conn->cnum, offset, count);
if (!ok) {
DEBUG(10,("do_unlock: returning ERRlock.\n" ));
ZERO_STRUCTP(ul);
ul->start = offset;
ul->size = count;
+ ul->smbpid = global_smbpid;
DLIST_ADD(ulist, ul);
/*
* Now unlock all of them. This will remove the brl entry also
- * for each lock.
+ * for each lock. Note we need to make sure the global_smbpid matches
+ * the one associated with each lock in case the client plays games
+ * with smbpids (like smbtorture does :-).
*/
- for(; ul; ul = ul->next)
+ for(; ul; ul = ul->next) {
+ global_smbpid = ul->smbpid;
do_unlock(fsp,fsp->conn,ul->size,ul->start,&eclass,&ecode);
-
+ }
+
talloc_destroy(ul_ctx);
} else {
extern pstring sesssetup_user;
extern uint16 global_oplock_port;
extern BOOL global_client_failed_oplock_break;
-extern int global_smbpid;
/****************************************************************************
fd support routines - attempt to do a dos_open.
fsp->dev = sbuf.st_dev;
GetTimeOfDay(&fsp->open_time);
fsp->vuid = current_user.vuid;
- fsp->smbpid = global_smbpid;
fsp->size = 0;
fsp->pos = -1;
fsp->can_lock = True;
fsp->mode = 0;
GetTimeOfDay(&fsp->open_time);
fsp->vuid = current_user.vuid;
- fsp->smbpid = global_smbpid;
fsp->size = 0;
fsp->pos = -1;
fsp->can_lock = False;
fsp->mode = 0;
GetTimeOfDay(&fsp->open_time);
fsp->vuid = current_user.vuid;
- fsp->smbpid = global_smbpid;
fsp->size = 0;
fsp->pos = -1;
fsp->can_lock = True;