summaryrefslogtreecommitdiff
path: root/source3/nmbd/nmbd_packets.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-12-17 21:41:28 +0000
committerJeremy Allison <jra@samba.org>1998-12-17 21:41:28 +0000
commit3e7039349fa79cc16cd3a2ece79b63b0fffbb616 (patch)
tree604dd3f79eb5ad7378662e977e5df4b9ea5d51c5 /source3/nmbd/nmbd_packets.c
parentd973a107a2edac5ee2874eb6fdc005b9d32be379 (diff)
downloadsamba-3e7039349fa79cc16cd3a2ece79b63b0fffbb616.tar.gz
samba-3e7039349fa79cc16cd3a2ece79b63b0fffbb616.tar.bz2
samba-3e7039349fa79cc16cd3a2ece79b63b0fffbb616.zip
Fix bug with nmbd running wild due to recursion in retransmit_or_expire_response_records().
Jeremy. (This used to be commit d5f05b4faef50e7cfc0ed05a87d92e14102106c6)
Diffstat (limited to 'source3/nmbd/nmbd_packets.c')
-rw-r--r--source3/nmbd/nmbd_packets.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index ce785b40a4..7f27753352 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -1633,16 +1633,31 @@ to IP %s on subnet %s\n", rrec->response_id, inet_ntoa(rrec->packet->ip),
on subnet %s\n", rrec->response_id, inet_ntoa(rrec->packet->ip),
subrec->subnet_name));
- /* Call the timeout function. This will deal with removing the
- timed out packet. */
- if(rrec->timeout_fn)
- (*rrec->timeout_fn)(subrec, rrec);
- else
+ /*
+ * Check the flag in this record to prevent recursion if we end
+ * up in this function again via the timeout function call.
+ */
+
+ if(!rrec->in_expiration_processing)
{
- /* We must remove the record ourself if there is
- no timeout function. */
- remove_response_record(subrec, rrec);
- }
+
+ /*
+ * Set the recursion protection flag in this record.
+ */
+
+ rrec->in_expiration_processing = True;
+
+ /* Call the timeout function. This will deal with removing the
+ timed out packet. */
+ if(rrec->timeout_fn)
+ (*rrec->timeout_fn)(subrec, rrec);
+ else
+ {
+ /* We must remove the record ourself if there is
+ no timeout function. */
+ remove_response_record(subrec, rrec);
+ }
+ } /* !rrec->in_expitation_processing */
} /* rrec->repeat_count > 0 */
} /* rrec->repeat_time <= t */
} /* end for rrec */