From 754096ef989c5c3ff61fc121d2e620936181b86e Mon Sep 17 00:00:00 2001 From: cajus Date: Fri, 29 Jun 2007 10:24:16 +0000 Subject: [PATCH] Added new (not yet used) function git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6744 594d385d-05f5-0310-b6e9-bd551577e9d8 --- Changelog | 3 +++ FAQ | 6 ++++++ include/functions.inc | 29 +++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/Changelog b/Changelog index 4d8b4e3e7..5f28b5bbe 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,9 @@ GOsa2 changelog =============== +* gosa 2.5.12 + - Fixed problems with automatic reverse zones + * gosa 2.5.11a - Added chinese translation - Fixed language detection and removed line wraps in tab headers diff --git a/FAQ b/FAQ index e7a6740f2..3da4ce0c3 100644 --- a/FAQ +++ b/FAQ @@ -367,3 +367,9 @@ Q: I'd like to use rfc2307bis compliant groups. Is this possible? A: Yes - place the rfc2307bis="true" inside of the location section of your gosa.conf. Remember, that you can't create empty groups in this mode. + +Q: Can GOsa show some vendor information for given MAC addresses? + +A: Yes. Download http://standards.ieee.org/regauth/oui/oui.txt and place + it in /etc/gosa/oui.txt. + diff --git a/include/functions.inc b/include/functions.inc index 001d152ff..1fa5e5dba 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -2490,5 +2490,34 @@ function prepare4mailbody($string) } +function mac2company($mac) +{ + $vendor= ""; + + /* Generate a normailzed mac... */ + $mac= substr(preg_replace('/[:-]/', '', $mac), 0, 6); + + /* Check for existance of the oui file */ + if (!is_readable(CONFIG_DIR."/oui.txt")){ + return (""); + } + + /* Open file and look for mac addresses... */ + $handle = @fopen(CONFIG_DIR."/oui.txt", "r"); + if ($handle) { + while (!feof($handle)) { + $line = fgets($handle, 4096); + + if (preg_match("/^$mac/", $line)){ + echo "$line
"; + } + } + fclose($handle); + } + + return ($vendor); +} + + // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> -- 2.30.2