SMB_ASSERT(plock->lock_type != UNLOCK_LOCK);
for (i=0; i < br_lck->num_locks; i++) {
+ if (locks[i].start + locks[i].size < locks[i].start) {
+ /* 64-bit wrap. Error. */
+ return NT_STATUS_INVALID_LOCK_RANGE;
+ }
+
/* Do any Windows or POSIX locks conflict ? */
if (brl_conflict(&locks[i], plock)) {
/* Remember who blocked us. */
if (type & LOCKING_ANDX_CANCEL_LOCK) {
struct blocking_lock_record *blr = NULL;
+ if (num_locks > 1) {
+ /*
+ * MS-CIFS (2.2.4.32.1) states that a cancel is honored if and only
+ * if the lock vector contains one entry. When given mutliple cancel
+ * requests in a single PDU we expect the server to return an
+ * error. Windows servers seem to accept the request but only
+ * cancel the first lock.
+ * JRA - Do what Windows does (tm) :-).
+ */
+
+#if 0
+ /* MS-CIFS (2.2.4.32.1) behavior. */
+ return NT_STATUS_DOS(ERRDOS,
+ ERRcancelviolation);
+#else
+ /* Windows behavior. */
+ if (i != 0) {
+ DEBUG(10,("smbd_do_locking: ignoring subsequent "
+ "cancel request\n"));
+ continue;
+ }
+#endif
+ }
+
if (lp_blocking_locks(SNUM(conn))) {
/* Schedule a message to ourselves to