Example #1
0
 public function testFstatVFS()
 {
     $state = smbclient_state_new();
     smbclient_state_init($state, null, SMB_USER, SMB_PASS);
     $file = smbclient_open($state, $this->testuri, 'r');
     $vfs = smbclient_fstatvfs($state, $file);
     smbclient_close($state, $file);
     smbclient_state_free($state);
     $this->assertTrue(is_array($vfs));
     $this->hasParts($vfs);
 }
 /**
  * @expectedException PHPUnit_Framework_Error_Warning
  */
 public function testStateFreeDouble()
 {
     $state = smbclient_state_new();
     $this->assertTrue(smbclient_state_free($state));
     $this->assertFalse(smbclient_state_free($state));
 }
 public function testOptionNTHash()
 {
     $state = smbclient_state_new();
     if (smbclient_option_get($state, SMBCLIENT_OPT_USE_NT_HASH) === null) {
         smbclient_state_free($state);
         return;
     }
     smbclient_option_set($state, SMBCLIENT_OPT_USE_NT_HASH, true);
     // NTLM hash of 'password' generated at http://www.tobtu.com/lmntlm.php
     smbclient_state_init($state, null, SMB_USER, SMB_HASH);
     $dir = smbclient_opendir($state, 'smb://' . SMB_HOST . '/' . SMB_SHARE);
     while (($out = smbclient_readdir($state, $dir)) !== false) {
     }
     $this->assertTrue(is_resource($dir));
     smbclient_closedir($state, $dir);
     smbclient_state_free($state);
 }
Example #4
0
 public function __destruct()
 {
     if ($this->connected) {
         smbclient_state_free($this->state);
     }
 }