*** /usr/local/sbin/ocs_mac_agent.php.orig 2007-12-20 14:17:37.000000000 -0500 --- /usr/local/sbin/ocs_mac_agent.php 2009-04-03 19:47:59.000000000 -0400 *************** *** 323,329 **** } if (empty($this->_hostname)) { ! if ($this->_getName == 'scutil' || (isset($a_vals[$a_index['GETNAME'][0]]['value']) && $a_vals[$a_index['GETNAME'][0]]['value'] == 'scutil')) { $this->_hostname = exec('/usr/sbin/scutil --get ComputerName'); --- 323,329 ---- } if (empty($this->_hostname)) { ! if ( ( !isset($this->_getName)) || ($this->_getName == 'scutil') || (isset($a_vals[$a_index['GETNAME'][0]]['value']) && $a_vals[$a_index['GETNAME'][0]]['value'] == 'scutil')) { $this->_hostname = exec('/usr/sbin/scutil --get ComputerName'); *************** *** 391,396 **** --- 391,397 ---- $this->_request->setBody(gzcompress(utf8_decode($this->_inventory()))); if (PEAR::isError($this->_request->sendRequest()) || $this->_request->getResponseCode() != 200) { $this->message('Cannot transmit inventory. Response Code: ' . $this->_request->getResponseCode(), 'error'); + // print $this->_inventory(); die(); } else { *************** *** 754,760 **** // big that it's useless. Now, if we had domxml... exec('/usr/sbin/system_profiler -xml SPNetworkDataType SPPCIDataType SPModemDataType SPMemoryDataType SPUSBDataType SPSCSIDataType SPParallelSCSIDataType SPIDEDataType SPParallelATADataType SPSerialATADataType SPFireWireDataType SPHardwareDataType SPSoftwareDataType SPNetworkDataType SPApplicationsDataType SPDisplaysDataType SPPrintersDataType', $a_output, $s_error); $this->_profileData = implode("\n", $a_output); ! print $this->_profileData; } else { $this->message('Using Input file for XML data: ' . $this->_xmlinputfile); --- 755,761 ---- // big that it's useless. Now, if we had domxml... exec('/usr/sbin/system_profiler -xml SPNetworkDataType SPPCIDataType SPModemDataType SPMemoryDataType SPUSBDataType SPSCSIDataType SPParallelSCSIDataType SPIDEDataType SPParallelATADataType SPSerialATADataType SPFireWireDataType SPHardwareDataType SPSoftwareDataType SPNetworkDataType SPApplicationsDataType SPDisplaysDataType SPPrintersDataType', $a_output, $s_error); $this->_profileData = implode("\n", $a_output); ! // print $this->_profileData; } else { $this->message('Using Input file for XML data: ' . $this->_xmlinputfile); *************** *** 831,837 **** $this->_data['CONTENT']['HARDWARE']['OSCOMMENTS'] = $s_kernel; $this->_data['CONTENT']['HARDWARE']['PROCESSORT'] = $this->_getValByKey('cpu_type', $s_node); $this->_data['CONTENT']['HARDWARE']['PROCESSORS'] = $this->_toMHz($this->_getValByKey('current_processor_speed', $s_node)); ! $this->_data['CONTENT']['HARDWARE']['PROCESSORN'] = $this->_getValByKey('number_processors', $s_node, 'integer'); $this->_data['CONTENT']['HARDWARE']['MEMORY'] = $this->_toMB($this->_getValByKey('physical_memory', $s_node)); $this->_data['CONTENT']['HARDWARE']['SWAP'] = 0; $this->_data['CONTENT']['HARDWARE']['IPADDR'] = $s_ipaddr; --- 832,841 ---- $this->_data['CONTENT']['HARDWARE']['OSCOMMENTS'] = $s_kernel; $this->_data['CONTENT']['HARDWARE']['PROCESSORT'] = $this->_getValByKey('cpu_type', $s_node); $this->_data['CONTENT']['HARDWARE']['PROCESSORS'] = $this->_toMHz($this->_getValByKey('current_processor_speed', $s_node)); ! $this->_data['CONTENT']['HARDWARE']['PROCESSORN'] = $this->_getValByKey('number_processors', $s_node, 'integer'); ! if($this->_data['CONTENT']['HARDWARE']['PROCESSORN'] == "N/A") { ! $this->_data['CONTENT']['HARDWARE']['PROCESSORN'] = $this->_getValByKey('number_cpus', $s_node, 'integer'); ! } $this->_data['CONTENT']['HARDWARE']['MEMORY'] = $this->_toMB($this->_getValByKey('physical_memory', $s_node)); $this->_data['CONTENT']['HARDWARE']['SWAP'] = 0; $this->_data['CONTENT']['HARDWARE']['IPADDR'] = $s_ipaddr; *************** *** 903,908 **** --- 907,913 ---- $this->_data['CONTENT']['MEMORIES'][$i]['CAPACITY'] = $this->_toKB($this->_getValByKey('dimm_size', $s_node)); $this->_data['CONTENT']['MEMORIES'][$i]['SPEED'] = $this->_getValByKey('dimm_speed', $s_node); $this->_data['CONTENT']['MEMORIES'][$i]['TYPE'] = $this->_getValByKey('dimm_type', $s_node); + $this->_data['CONTENT']['MEMORIES'][$i]['SERIALNUMBER'] = $this->_getValByKey('dimm_serial_number', $s_node); $this->_data['CONTENT']['MEMORIES'][$i]['NUMSLOTS'] = $i + 1; } } *************** *** 976,981 **** --- 981,988 ---- $s_manufacturer = $this->_getValByKey('device_manufacturer', $s_node); $this->_data['CONTENT']['STORAGES'][$s_index4]['MANUFACTURER'] = $s_manufacturer; $this->_data['CONTENT']['STORAGES'][$s_index4]['MODEL'] = $this->_getValByKey('device_model', $s_node); + $this->_data['CONTENT']['STORAGES'][$s_index4]['SERIALNUMBER'] = $this->_getValByKey('device_serial', $s_node); + $this->_data['CONTENT']['STORAGES'][$s_index4]['FIRMWARE'] = $this->_getValByKey('device_revision', $s_node); $this->_data['CONTENT']['STORAGES'][$s_index4]['DESCRIPTION'] = $this->_getValByKey('_name', $s_node); $this->_data['CONTENT']['STORAGES'][$s_index4]['DISKSIZE'] = $this->_toMB($this->_getValByKey('size', $s_node)); $s_node = preg_replace('/^\t{4}.*?^\t{4}<\/array>/sm', '', $s_node); *************** *** 1008,1014 **** $i = 0; foreach ($a_nodes as $s_type => $s_nodeName) { ! $s_node = $this->_getDataNode($s_nodeName); // checks if it is present if ($s_node != '') { // remove its items so we can get to name --- 1015,1021 ---- $i = 0; foreach ($a_nodes as $s_type => $s_nodeName) { ! $s_node = $this->_getDataNode($s_nodeName, false); // checks if it is present if ($s_node != '') { // remove its items so we can get to name *************** *** 1366,1372 **** } else { // Remove control characters -- breaks XML ! $value = preg_replace('/[[:cntrl:]]/', '', $value); if (trim($value) == '') { $s_xml .= str_repeat("\t", $in_level) . "<$key />\n"; } --- 1373,1379 ---- } else { // Remove control characters -- breaks XML ! $value = preg_replace('/[^ a-z0-9.,\:\-\/\(\)\\\]/i', '', $value); if (trim($value) == '') { $s_xml .= str_repeat("\t", $in_level) . "<$key />\n"; }