comparison src/context.cpp @ 170:bd33eaccfed8

fix pre/post scripts in rpm spec file
author carl
date Thu, 30 Aug 2007 14:07:09 -0700
parents 6bac960af6b4
children 83fe0be032c1
comparison
equal deleted inserted replaced
169:44021d570958 170:bd33eaccfed8
695 for (dnsblp_map::iterator i=dnsbl_names.begin(); i!=dnsbl_names.end(); i++) { 695 for (dnsblp_map::iterator i=dnsbl_names.begin(); i!=dnsbl_names.end(); i++) {
696 DNSBLP d = (*i).second; 696 DNSBLP d = (*i).second;
697 // delete the underlying DNSBL objects. 697 // delete the underlying DNSBL objects.
698 delete d; 698 delete d;
699 } 699 }
700 if (generic_regx && strlen(generic_regx)) regfree(&generic_pattern); 700 if (generic_regx) regfree(&generic_pattern);
701 } 701 }
702 702
703 703
704 bool CONTEXT::is_parent(CONTEXTP p) { 704 bool CONTEXT::is_parent(CONTEXTP p) {
705 if (p == parent) return true; 705 if (p == parent) return true;
717 717
718 718
719 bool CONTEXT::set_generic(char *regx, char *msg) 719 bool CONTEXT::set_generic(char *regx, char *msg)
720 { 720 {
721 int rc = 0; 721 int rc = 0;
722 if (generic_regx && strlen(generic_regx)) regfree(&generic_pattern); 722 if (generic_regx) regfree(&generic_pattern);
723 generic_regx = regx; 723 generic_regx = regx;
724 generic_message = msg; 724 generic_message = msg;
725 if (generic_regx && strlen(generic_regx)) { 725 if (generic_regx) {
726 rc = regcomp(&generic_pattern, regx, REG_NOSUB | REG_ICASE | REG_EXTENDED); 726 rc = regcomp(&generic_pattern, regx, REG_NOSUB | REG_ICASE | REG_EXTENDED);
727 } 727 }
728 return rc; // true iff bad pattern 728 return rc; // true iff bad pattern
729 } 729 }
730 730
731 731
732 char *CONTEXT::generic_match(char *client) 732 char *CONTEXT::generic_match(char *client)
733 { 733 {
734 if (parent && !generic_regx) return parent->generic_match(client); 734 if (parent && !generic_regx) return parent->generic_match(client);
735 if (!strlen(generic_regx)) return NULL; 735 if (!generic_regx) return NULL;
736 if (0 == regexec(&generic_pattern, client, 0, NULL, 0)) { 736 if (0 == regexec(&generic_pattern, client, 0, NULL, 0)) {
737 return generic_message; 737 return generic_message;
738 } 738 }
739 return NULL; 739 return NULL;
740 } 740 }