private_data, priv_len);
}
-struct idle_event {
- struct timed_event *te;
- struct timeval interval;
- char *name;
- bool (*handler)(const struct timeval *now, void *private_data);
- void *private_data;
-};
-
-static void smbd_idle_event_handler(struct event_context *ctx,
- struct timed_event *te,
- struct timeval now,
- void *private_data)
-{
- struct idle_event *event =
- talloc_get_type_abort(private_data, struct idle_event);
-
- TALLOC_FREE(event->te);
-
- DEBUG(10,("smbd_idle_event_handler: %s %p called\n",
- event->name, event->te));
-
- if (!event->handler(&now, event->private_data)) {
- DEBUG(10,("smbd_idle_event_handler: %s %p stopped\n",
- event->name, event->te));
- /* Don't repeat, delete ourselves */
- TALLOC_FREE(event);
- return;
- }
-
- DEBUG(10,("smbd_idle_event_handler: %s %p rescheduled\n",
- event->name, event->te));
-
- event->te = event_add_timed(ctx, event,
- timeval_sum(&now, &event->interval),
- smbd_idle_event_handler, event);
-
- /* We can't do much but fail here. */
- SMB_ASSERT(event->te != NULL);
-}
-
-struct idle_event *event_add_idle(struct event_context *event_ctx,
- TALLOC_CTX *mem_ctx,
- struct timeval interval,
- const char *name,
- bool (*handler)(const struct timeval *now,
- void *private_data),
- void *private_data)
-{
- struct idle_event *result;
- struct timeval now = timeval_current();
-
- result = talloc(mem_ctx, struct idle_event);
- if (result == NULL) {
- DEBUG(0, ("talloc failed\n"));
- return NULL;
- }
-
- result->interval = interval;
- result->handler = handler;
- result->private_data = private_data;
-
- if (!(result->name = talloc_asprintf(result, "idle_evt(%s)", name))) {
- DEBUG(0, ("talloc failed\n"));
- TALLOC_FREE(result);
- return NULL;
- }
-
- result->te = event_add_timed(event_ctx, result,
- timeval_sum(&now, &interval),
- smbd_idle_event_handler, result);
- if (result->te == NULL) {
- DEBUG(0, ("event_add_timed failed\n"));
- TALLOC_FREE(result);
- return NULL;
- }
-
- DEBUG(10,("event_add_idle: %s %p\n", result->name, result->te));
- return result;
-}
-
static void smbd_sig_term_handler(struct tevent_context *ev,
struct tevent_signal *se,
int signum,
DEBUG(3, ("Transaction %d of length %d (%u toread)\n",
sconn->trans_num, (int)nread, (unsigned int)unread_bytes));
- if (msg_type != 0) {
+ if (msg_type != NBSSmessage) {
/*
* NetBIOS session request, keepalive, etc.
*/
sconn->trans_num++;
done:
- sconn->smb1.num_requests++;
+ sconn->num_requests++;
/* The timeout_processing function isn't run nearly
often enough to implement 'max log size' without
level 10. Checking every 50 SMBs is a nice
tradeoff of performance vs log file size overrun. */
- if ((sconn->smb1.num_requests % 50) == 0 &&
+ if ((sconn->num_requests % 50) == 0 &&
need_to_check_log_size()) {
change_to_root_user();
check_log_size();
char *outbuf;
bool ok;
- if ((inbuf_len == 4) && (CVAL(inbuf, 0) == SMBkeepalive)) {
+ if ((inbuf_len == 4) && (CVAL(inbuf, 0) == NBSSkeepalive)) {
DEBUG(10, ("Got netbios keepalive\n"));
/*
* Just swallow it
char *rhost;
int ret;
- if (lp_maxprotocol() == PROTOCOL_SMB2) {
+ if (lp_maxprotocol() >= PROTOCOL_SMB2_02) {
/*
* We're not making the decision here,
* we're just allowing the client
sconn->remote_address,
talloc_tos());
if (remaddr == NULL) {
-
+ DEBUG(0,("%s: tsocket_address_inet_addr_string remote failed - %s\n",
+ __location__, strerror(errno)));
+ exit_server_cleanly("tsocket_address_inet_addr_string remote failed.\n");
}
} else {
remaddr = "0.0.0.0";