~ubuntu-branches/ubuntu/karmic/openvas-server/karmic

« back to all changes in this revision

Viewing changes to openvasd/preferences.c

  • Committer: Bazaar Package Importer
  • Author(s): Javier Fernandez-Sanguino Pen~a
  • Date: 2009-01-02 01:38:47 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090102013847-74xy2uo1e3hovqjo
Tags: 2.0.0-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* OpenVAS
2
 
* $Id: preferences.c 865 2008-05-13 14:51:21Z jan $
 
2
* $Id: preferences.c 1318 2008-09-10 09:15:36Z mwiegand $
3
3
* Description: Loads the preferences set in openvasd.conf into the memory. 
4
4
*
5
5
* Authors: - Renaud Deraison <deraison@nessus.org> (Original pre-fork develoment)
454
454
 
455
455
 
456
456
int
457
 
preferences_plugin_timeout(preferences, id)
 
457
preferences_plugin_timeout(preferences, oid)
458
458
 struct arglist * preferences;
459
 
 int id;
 
459
 char * oid;
460
460
{
461
461
 int ret = 0;
462
 
 char * pref_name = emalloc(strlen("timeout.") + 40);
 
462
 char * pref_name = emalloc(strlen("timeout.") + 100);
463
463
 
464
 
 sprintf(pref_name, "timeout.%d", id);
 
464
 sprintf(pref_name, "timeout.%s", oid);
465
465
 if(arg_get_type(preferences, pref_name) == ARG_STRING)
466
466
 {
467
467
  int to = atoi(arg_get_value(preferences, pref_name));
658
658
}
659
659
 
660
660
int
661
 
preferences_detached_scan(preferences)
662
 
 struct arglist * preferences;
663
 
{
664
 
 static int yes = -1;
665
 
 char * pref;
666
 
 
667
 
 if(!preferences)
668
 
  {
669
 
   yes = -1;
670
 
   return -1;
671
 
  }
672
 
  
673
 
  
674
 
 if(yes >= 0)
675
 
  return yes;
676
 
  
677
 
  
678
 
 pref = arg_get_value(preferences, "detached_scan");
679
 
 if(pref && !strcmp(pref, "yes"))
680
 
   yes = 1;
681
 
 else
682
 
   yes = 0;
683
 
 
684
 
 return yes;
685
 
}
686
 
 
687
 
 
688
 
int
689
 
preferences_continuous_scan(preferences)
690
 
 struct arglist * preferences;
691
 
692
 
 static int yes = -1;
693
 
 char * pref;
694
 
 
695
 
 if(!preferences)
696
 
  {
697
 
   yes = -1;
698
 
   return -1;
699
 
  }
700
 
  
701
 
  
702
 
 if(yes >= 0)
703
 
  return yes;
704
 
 
705
 
 pref = arg_get_value(preferences, "continuous_scan");
706
 
 if(pref && !strcmp(pref, "yes"))
707
 
   yes = 1;
708
 
 else
709
 
   yes = 0;
710
 
 
711
 
 return yes;
712
 
}
713
 
 
714
 
 
715
 
int
716
661
preferences_report_killed_plugins(preferences)
717
662
 struct arglist * preferences;
718
663
739
684
}
740
685
 
741
686
int
742
 
preferences_delay_between_scans(preferences)
743
 
 struct arglist * preferences;
744
 
{
745
 
 static int delay = -1;
746
 
 char * pref;
747
 
 
748
 
 if(!preferences)
749
 
  {
750
 
   delay = -1;
751
 
   return -1;
752
 
  }
753
 
  
754
 
  
755
 
 if(delay >= 0)
756
 
  return delay;
757
 
  
758
 
 pref = arg_get_value(preferences, "delay_between_scan_loops"); 
759
 
 if(pref)
760
 
 {
761
 
  if(atoi(pref)){
762
 
        delay = atoi(pref);
763
 
        return delay;
764
 
        }
765
 
  else
766
 
   if(!strcmp(pref, "0")){
767
 
        delay = 0;
768
 
        return delay;
769
 
        }
770
 
 }
771
 
 delay = 3600;
772
 
 return delay;
773
 
}
774
 
 
775
 
char *
776
 
preferences_detached_scan_email(preferences)
777
 
 struct arglist * preferences;
778
 
{
779
 
 char * pref = arg_get_value(preferences, "detached_scan_email_address");
780
 
 
781
 
 if(pref && pref[0] != '\0' && strcmp(pref, "no"))
782
 
  return pref;
783
 
 else
784
 
  return NULL;
785
 
}
786
 
 
787
 
 
788
 
int
789
687
preferences_silent_dependencies(preferences)
790
688
 struct arglist * preferences;
791
689
{
844
742
 preferences_use_mac_addr(NULL);
845
743
 preferences_save_session(NULL);
846
744
 preferences_save_empty_sessions(NULL);
847
 
 preferences_continuous_scan(NULL);
848
 
 preferences_delay_between_scans(NULL);
849
 
 preferences_detached_scan(NULL);
850
 
 preferences_detached_scan_email(NULL);
851
745
 preferences_silent_dependencies(NULL);
852
746
}