Forráskód Böngészése

Client: Bugfix: The tree connection to the named pipe share that was created in the ListShares method was not being terminated

Tal Aloni 7 éve
szülő
commit
38fa17acce
2 módosított fájl, 6 hozzáadás és 3 törlés
  1. 3 2
      SMBLibrary/Client/SMB1Client.cs
  2. 3 1
      SMBLibrary/Client/SMB2Client.cs

+ 3 - 2
SMBLibrary/Client/SMB1Client.cs

@@ -255,14 +255,15 @@ namespace SMBLibrary.Client
                 throw new InvalidOperationException("A login session must be successfully established before retrieving share list");
             }
 
-
             SMB1FileStore namedPipeShare = TreeConnect("IPC$", ServiceName.NamedPipe, out status);
             if (namedPipeShare == null)
             {
                 return null;
             }
 
-            return ServerServiceHelper.ListShares(namedPipeShare, ShareType.DiskDrive, out status);
+            List<string> shares = ServerServiceHelper.ListShares(namedPipeShare, ShareType.DiskDrive, out status);
+            namedPipeShare.Disconnect();
+            return shares;
         }
 
         public SMB1FileStore TreeConnect(string shareName, ServiceName serviceName, out NTStatus status)

+ 3 - 1
SMBLibrary/Client/SMB2Client.cs

@@ -187,7 +187,9 @@ namespace SMBLibrary.Client
                 return null;
             }
 
-            return ServerServiceHelper.ListShares(namedPipeShare, SMBLibrary.Services.ShareType.DiskDrive, out status);
+            List<string> shares = ServerServiceHelper.ListShares(namedPipeShare, SMBLibrary.Services.ShareType.DiskDrive, out status);
+            namedPipeShare.Disconnect();
+            return shares;
         }
 
         public SMB2FileStore TreeConnect(string shareName, out NTStatus status)