summaryrefslogtreecommitdiffstats
path: root/source3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1996-05-05 11:23:23 +0000
committerAndrew Tridgell <tridge@samba.org>1996-05-05 11:23:23 +0000
commit341a401b4802b2759092819ab5e50fe237a406d9 (patch)
tree83420ae68ca7358d5c114955d2b442a49fcb7e70 /source3
parent3ae4d22406602f618081b51db7430d249cc16e17 (diff)
downloadsamba-341a401b4802b2759092819ab5e50fe237a406d9.tar.gz
samba-341a401b4802b2759092819ab5e50fe237a406d9.tar.xz
samba-341a401b4802b2759092819ab5e50fe237a406d9.zip
handle being passed a dptr of -1 to mean "close all open dir handles".
Looks like OS/2 does this. It caused a core dump. (This used to be commit 4b2579daae0a9d78780476694fd395d97445e197)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/dir.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index ac6f918b9d..214b28dad0 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -186,6 +186,19 @@ close a dptr
****************************************************************************/
void dptr_close(int key)
{
+ /* OS/2 seems to use -1 to indicate "close all directories" */
+ if (key == -1) {
+ int i;
+ for (i=0;i<NUMDIRPTRS;i++)
+ dptr_close(i);
+ return;
+ }
+
+ if (key < 0 || key >= NUMDIRPTRS) {
+ DEBUG(3,("Invalid key %d given to dptr_close\n",key));
+ return;
+ }
+
if (dirptrs[key].valid) {
DEBUG(4,("closing dptr key %d\n",key));
if (dirptrs[key].ptr) {