*/
#include "includes.h"
+#include "smbd/smbd.h"
#include "smbd/globals.h"
-#include "librpc/gen_ndr/messaging.h"
+#include "messages.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_LOCKING
(int)from_now.tv_sec, (int)from_now.tv_usec));
}
- sconn->smb1.locks.brl_timeout = event_add_timed(smbd_event_context(),
- NULL, next_timeout,
- brl_timeout_fn, sconn);
+ sconn->smb1.locks.brl_timeout = tevent_add_timer(sconn->ev_ctx,
+ NULL, next_timeout,
+ brl_timeout_fn, sconn);
if (sconn->smb1.locks.brl_timeout == NULL) {
return False;
}
blr->expire_time.tv_sec = 0;
blr->expire_time.tv_usec = 0; /* Never expire. */
} else {
- blr->expire_time = timeval_current_ofs(lock_timeout/1000,
- (lock_timeout % 1000) * 1000);
+ blr->expire_time = timeval_current_ofs_msec(lock_timeout);
}
blr->lock_num = lock_num;
blr->smblctx = smblctx;
/* Ensure we'll receive messages when this is unlocked. */
if (!sconn->smb1.locks.blocking_lock_unlock_state) {
- messaging_register(sconn->msg_ctx, NULL,
+ messaging_register(sconn->msg_ctx, sconn,
MSG_SMB_UNLOCK, received_unlock_msg);
sconn->smb1.locks.blocking_lock_unlock_state = true;
}
uint8_t *data;
int i;
- data = (uint8_t *)blr->req->buf
+ data = discard_const_p(uint8_t, blr->req->buf)
+ ((large_file_format ? 20 : 10)*num_ulocks);
/*
uint8_t *data;
NTSTATUS status = NT_STATUS_OK;
- data = (uint8_t *)blr->req->buf
+ data = discard_const_p(uint8_t, blr->req->buf)
+ ((large_file_format ? 20 : 10)*num_ulocks);
/*
Called when a file is closed.
*****************************************************************************/
-void cancel_pending_lock_requests_by_fid(files_struct *fsp,
- struct byte_range_lock *br_lck,
- enum file_close_type close_type)
+void smbd_cancel_pending_lock_requests_by_fid(files_struct *fsp,
+ struct byte_range_lock *br_lck,
+ enum file_close_type close_type)
{
struct smbd_server_connection *sconn = fsp->conn->sconn;
struct blocking_lock_record *blr, *blr_cancelled, *next = NULL;
struct server_id server_id,
DATA_BLOB *data)
{
- struct smbd_server_connection *sconn;
+ struct smbd_server_connection *sconn =
+ talloc_get_type(private_data,
+ struct smbd_server_connection);
- sconn = msg_ctx_to_sconn(msg);
if (sconn == NULL) {
- DEBUG(1, ("could not find sconn\n"));
return;
}
struct server_id server_id,
DATA_BLOB *data)
{
- struct smbd_server_connection *sconn;
NTSTATUS err;
const char *msg = (const char *)data->data;
struct blocking_lock_record *blr;
+ struct smbd_server_connection *sconn =
+ talloc_get_type(private_data,
+ struct smbd_server_connection);
+
+ if (sconn == NULL) {
+ return;
+ }
if (data->data == NULL) {
smb_panic("process_blocking_lock_cancel_message: null msg");
smb_panic("process_blocking_lock_cancel_message: bad msg");
}
- sconn = msg_ctx_to_sconn(ctx);
- if (sconn == NULL) {
- DEBUG(1, ("could not find sconn\n"));
- return;
- }
-
memcpy(&blr, msg, sizeof(blr));
memcpy(&err, &msg[sizeof(blr)], sizeof(NTSTATUS));
if (!sconn->smb1.locks.blocking_lock_cancel_state) {
/* Register our message. */
- messaging_register(sconn->msg_ctx, NULL,
+ messaging_register(sconn->msg_ctx, sconn,
MSG_SMB_BLOCKING_LOCK_CANCEL,
process_blocking_lock_cancel_message);