~ocsinventory-dev/ocsinventory-server/stable-2.0

« back to all changes in this revision

Viewing changes to Apache/Ocsinventory/Server/Useragent.pm

  • Committer: mortheres
  • Date: 2011-09-28 08:02:45 UTC
  • Revision ID: guillaume.protet@mortheres.info-20110928080245-1xhcbnf0g8ot7zog
Add availibilty to allow external useragents using a text file

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
     }
79
79
  }
80
80
 
 
81
  #If external references file exists
 
82
  if ($ENV{'OCS_OPT_EXT_USERAGENTS_FILE_PATH'} && -f $ENV{'OCS_OPT_EXT_USERAGENTS_FILE_PATH'}) {
 
83
    open(FILE, $ENV{'OCS_OPT_EXT_USERAGENTS_FILE_PATH'}) or die "Cannot open $ENV{'OCS_OPT_EXT_USERAGENTS_FILE_PATH'} file !!"; 
 
84
    my @ext_useragents = <FILE>; chomp @ext_useragents;
 
85
    close FILE;
 
86
 
 
87
    $stop = 0 if (grep(/^$Apache::Ocsinventory::CURRENT_CONTEXT{'USER_AGENT'}$/, @ext_useragents)); 
 
88
  }
 
89
 
81
90
  #Does we have to stop PROLOG ?
82
91
  if ($stop) {
83
92
    &_log(400,'useragent','Bad agent or agent version too recent for server !!') if $ENV{'OCS_OPT_LOGLEVEL'};