Exemple #1
0
 public function test($isPersonal = true)
 {
     if ($isPersonal) {
         if ($this->stat('')) {
             return true;
         }
         return false;
     } else {
         $smb = new \smb();
         $pu = $smb->parse_url($this->constructUrl(''));
         // Attempt to connect anonymously
         $pu['user'] = '';
         $pu['pass'] = '';
         // Share cannot be checked if dynamic
         if ($this->username_as_share) {
             if ($smb->look($pu)) {
                 return true;
             } else {
                 return false;
             }
         }
         if (!$pu['share']) {
             return false;
         }
         // The following error messages are expected due to anonymous login
         $regexp = array('(NT_STATUS_ACCESS_DENIED)' => 'skip') + $smb->getRegexp();
         if ($smb->client("-d 0 " . escapeshellarg('//' . $pu['host'] . '/' . $pu['share']) . " -c exit", $pu, $regexp)) {
             return true;
         } else {
             return false;
         }
     }
 }
Exemple #2
0
 function execute($command, $purl, $regexp = NULL)
 {
     if (strpos($command, ';') !== false) {
         trigger_error('Semicolon not supported in commands');
         exit;
     }
     return smb::client('-d 0 ' . escapeshellarg('//' . $purl['host'] . '/' . $purl['share']) . ' -c ' . escapeshellarg($command), $purl, $regexp);
 }
Exemple #3
0
 function execute($command, $purl)
 {
     return smb::client('-d 0 ' . escapeshellarg('//' . $purl['host'] . '/' . $purl['share']) . ' -c ' . escapeshellarg($command), $purl);
 }