/[anubis]/anubis/src/rc.c
ViewVC logotype

Diff of /anubis/src/rc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.23 by gray, Sun Jul 6 09:24:02 2003 UTC revision 1.24 by gray, Tue Jul 15 10:15:22 2003 UTC
# Line 81  anubis_find_section(char *name) Line 81  anubis_find_section(char *name)
81  }  }
82    
83  void  void
84    anubis_section_set_prio(char *name, enum section_prio prio)
85    {
86            struct rc_secdef *p = anubis_find_section(name);
87            if (p)
88                    p->prio = prio;
89    }
90    
91    void
92  open_rcfile(int method)  open_rcfile(int method)
93  {  {
94          char homedir[MAXPATHLEN+1];          char homedir[MAXPATHLEN+1];
95          char *rcfile = 0;          char *rcfile = 0;
96          RC_SECTION *sec;          RC_SECTION *sec;
   
         rc_section_list_destroy(parse_tree);  
         parse_tree = NULL;  
97                    
98          switch (method) {          switch (method) {
99          case CF_SUPERVISOR:          case CF_SUPERVISOR:
# Line 168  process_rcfile(int method) Line 173  process_rcfile(int method)
173  #define KW_SOCKS_AUTH         11  #define KW_SOCKS_AUTH         11
174  #define KW_READ_ENTIRE_BODY   12  #define KW_READ_ENTIRE_BODY   12
175  #define KW_DROP_UNKNOWN_USER  13  #define KW_DROP_UNKNOWN_USER  13
176    #define KW_RULE_PRIORITY      14
177    
178  char **  char **
179  list_to_argv(LIST *list)  list_to_argv(LIST *list)
# Line 198  control_parser(int method, int key, LIST Line 204  control_parser(int method, int key, LIST
204                  if (strlen(session.tunnel) != 0)                  if (strlen(session.tunnel) != 0)
205                          topt |= T_NAMES;                          topt |= T_NAMES;
206                  break;                  break;
207    
208            case KW_RULE_PRIORITY:
209                    if (strcasecmp(arg, "user") == 0)
210                            anubis_section_set_prio("RULE", prio_user);
211                    else if (strcasecmp(arg, "system") == 0)
212                            anubis_section_set_prio("RULE", prio_system);
213                    else if (strcasecmp(arg, "override") == 0)
214                            anubis_section_set_prio("RULE", prio_override);
215                    else
216                            return RC_KW_ERROR;
217                    break;
218                                    
219          case KW_TERMLEVEL:                    case KW_TERMLEVEL:          
220                  if (strcmp("silent", arg) == 0)                  if (strcmp("silent", arg) == 0)
# Line 301  control_parser(int method, int key, LIST Line 318  control_parser(int method, int key, LIST
318    
319  static struct rc_kwdef init_kw[] = {  static struct rc_kwdef init_kw[] = {
320          { "bind", KW_BIND },          { "bind", KW_BIND },
321            { "rule-priority", KW_RULE_PRIORITY },
322          { NULL },          { NULL },
323  };  };
324    
# Line 507  rule_section_init(void) Line 525  rule_section_init(void)
525  {  {
526          struct rc_secdef *sp = anubis_add_section("RULE");          struct rc_secdef *sp = anubis_add_section("RULE");
527          sp->allow_prog = 1;          sp->allow_prog = 1;
528            sp->prio = prio_system;
529          rc_secdef_add_child(sp, &rule_sect_child);          rc_secdef_add_child(sp, &rule_sect_child);
530  }  }
531    
# Line 524  rc_system_init(void) Line 543  rc_system_init(void)
543  #endif /* HAVE_GPG */  #endif /* HAVE_GPG */
544  }  }
545    
 /* Placeholders */  
   
546  void  void
547  rcfile_process_section(int method, char *name, void *data, MESSAGE *msg)  rcfile_process_section(int method, char *name, void *data, MESSAGE *msg)
548  {  {
549          RC_SECTION *sec = rc_section_lookup(parse_tree, name);          RC_SECTION *sec;
550          rc_run_section(method, sec, anubis_rc_sections, data, msg);  
551            for (sec = rc_section_lookup(parse_tree, name);
552                 sec;
553                 sec = rc_section_lookup(sec->next, name))
554                    rc_run_section(method, sec, anubis_rc_sections, data, msg);
555  }  }
556    
557  void  void
# Line 538  rcfile_call_section(int method, char *na Line 559  rcfile_call_section(int method, char *na
559  {  {
560          RC_SECTION *sec = rc_section_lookup(parse_tree, name);          RC_SECTION *sec = rc_section_lookup(parse_tree, name);
561          if (!sec)          if (!sec)
562                  anubis_error(SOFT,                  anubis_error(SOFT, _("No such section: %s"), name);
                              _("No such section: %s"), name);  
563          rc_call_section(method, sec, anubis_rc_sections, data, msg);          rc_call_section(method, sec, anubis_rc_sections, data, msg);
564  }  }
565    

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26