… | |
… | |
3 | * Rights to this code are documented in doc/pod/license.pod. |
3 | * Rights to this code are documented in doc/pod/license.pod. |
4 | * |
4 | * |
5 | * Copyright © 2005-2007 Atheme Project (http://www.atheme.org) |
5 | * Copyright © 2005-2007 Atheme Project (http://www.atheme.org) |
6 | */ |
6 | */ |
7 | |
7 | |
8 | static char const rcsid[] = "$Id: conf.C,v 1.4 2007/08/28 17:08:12 pippijn Exp $"; |
8 | static char const rcsid[] = "$Id: conf.C,v 1.5 2007/08/28 22:18:31 pippijn Exp $"; |
9 | |
9 | |
10 | #include "atheme.h" |
10 | #include "atheme.h" |
11 | #include <ermyth/crypto.h> |
11 | #include <ermyth/crypto.h> |
12 | #include <ermyth/database.h> |
12 | #include <ermyth/database.h> |
13 | #include <ermyth/module.h> |
13 | #include <ermyth/module.h> |
… | |
… | |
18 | #include "pmodule.h" |
18 | #include "pmodule.h" |
19 | #include "privs.h" |
19 | #include "privs.h" |
20 | |
20 | |
21 | ConfTable::callbacks ConfTable::callback; |
21 | ConfTable::callbacks ConfTable::callback; |
22 | |
22 | |
23 | #define PARAM_ERROR(ce) \ |
23 | namespace config |
24 | { \ |
24 | { |
|
|
25 | enum error |
|
|
26 | { |
|
|
27 | no_param, |
|
|
28 | wrong_param |
|
|
29 | }; |
|
|
30 | } |
|
|
31 | |
|
|
32 | template<config::error e> |
|
|
33 | int param_error (config_entry_t *ce, char const * const msg = NULL); |
|
|
34 | |
|
|
35 | template<> |
|
|
36 | int param_error<config::no_param> (config_entry_t *ce, char const * const msg) |
|
|
37 | { |
25 | slog(LG_INFO, "%s:%i: no parameter for " \ |
38 | slog (LG_INFO, "%s:%i: no parameter for " |
26 | "configuration option: %s", \ |
39 | "configuration option: %s %s", |
27 | (ce)->ce_fileptr->cf_filename, \ |
40 | ce->ce_fileptr->cf_filename, |
28 | (ce)->ce_varlinenum, (ce)->ce_varname); \ |
41 | ce->ce_varlinenum, ce->ce_varname, |
29 | return 1; \ |
42 | msg ? msg : ""); |
|
|
43 | return 1; |
|
|
44 | } |
|
|
45 | |
|
|
46 | template<> |
|
|
47 | int param_error<config::wrong_param> (config_entry_t *ce, char const * const msg) |
|
|
48 | { |
|
|
49 | slog (LG_INFO, "%s:%i: wrong parameter for " |
|
|
50 | "configuration option: %s %s", |
|
|
51 | ce->ce_fileptr->cf_filename, |
|
|
52 | ce->ce_varlinenum, ce->ce_varname, msg ? msg : ""); |
|
|
53 | return 1; |
30 | } |
54 | } |
31 | |
55 | |
32 | static int c_serverinfo (config_entry_t *); |
56 | static int c_serverinfo (config_entry_t *); |
33 | static int c_general (config_entry_t *); |
57 | static int c_general (config_entry_t *); |
34 | static int c_database (config_entry_t *); |
58 | static int c_database (config_entry_t *); |
… | |
… | |
683 | char *name; |
707 | char *name; |
684 | |
708 | |
685 | if (cold_start == false) |
709 | if (cold_start == false) |
686 | return 0; |
710 | return 0; |
687 | |
711 | |
688 | if (ce->ce_vardata == NULL) |
712 | if (ce->vardata<char *> () == NULL) |
689 | PARAM_ERROR (ce); |
713 | return param_error<config::no_param> (ce); |
690 | |
714 | |
691 | name = ce->ce_vardata; |
715 | name = ce->vardata<char *> (); |
692 | |
716 | |
693 | typedef factory::factory_mgr<protocol::handler> protocol_factory; |
717 | typedef factory::factory_mgr<protocol::handler> protocol_factory; |
694 | protocol_factory &f = protocol_factory::instance (); |
718 | protocol_factory &f = protocol_factory::instance (); |
695 | |
719 | |
696 | if (!f.provides (name)) |
720 | if (!f.provides (name)) |
697 | PARAM_ERROR (ce); |
721 | return param_error<config::wrong_param> (ce, "(no such protocol handler)"); |
698 | |
722 | |
699 | phandler = f.create (name); |
723 | phandler = f.create (name); |
700 | |
724 | |
701 | return 0; |
725 | return 0; |
702 | } |
726 | } |
… | |
… | |
707 | char *name; |
731 | char *name; |
708 | |
732 | |
709 | if (cold_start == false) |
733 | if (cold_start == false) |
710 | return 0; |
734 | return 0; |
711 | |
735 | |
712 | if (ce->ce_vardata == NULL) |
736 | if (ce->vardata<char *> () == NULL) |
713 | PARAM_ERROR (ce); |
737 | return param_error<config::no_param> (ce); |
714 | |
738 | |
715 | name = ce->ce_vardata; |
739 | name = ce->vardata<char *> (); |
716 | |
740 | |
717 | if (!modules::provides (name)) |
741 | if (!modules::provides (name)) |
718 | { |
742 | return param_error<config::wrong_param> (ce, "(no such module)"); |
719 | dbg << "No such module\n"; |
|
|
720 | PARAM_ERROR (ce); |
|
|
721 | } |
|
|
722 | |
743 | |
723 | modules::enable (name); |
744 | modules::enable (name); |
724 | |
745 | |
725 | return 0; |
746 | return 0; |
726 | } |
747 | } |
… | |
… | |
731 | char *name; |
752 | char *name; |
732 | |
753 | |
733 | if (cold_start == false) |
754 | if (cold_start == false) |
734 | return 0; |
755 | return 0; |
735 | |
756 | |
736 | if (ce->ce_vardata == NULL) |
757 | if (ce->vardata<char *> () == NULL) |
737 | PARAM_ERROR (ce); |
758 | return param_error<config::no_param> (ce); |
738 | |
759 | |
739 | name = ce->ce_vardata; |
760 | name = ce->vardata<char *> (); |
740 | |
761 | |
741 | typedef factory::factory_mgr<crypto::handler> crypto_factory; |
762 | typedef factory::factory_mgr<crypto::handler> crypto_factory; |
742 | crypto_factory &f = crypto_factory::instance (); |
763 | crypto_factory &f = crypto_factory::instance (); |
743 | |
764 | |
744 | if (!f.provides (name)) |
765 | if (!f.provides (name)) |
745 | PARAM_ERROR (ce); |
766 | return param_error<config::wrong_param> (ce, "(no such crypto handler)"); |
746 | |
767 | |
747 | crypter = f.create (name); |
768 | crypter = f.create (name); |
748 | |
769 | |
749 | return 0; |
770 | return 0; |
750 | } |
771 | } |
… | |
… | |
755 | char *name; |
776 | char *name; |
756 | |
777 | |
757 | if (cold_start == false) |
778 | if (cold_start == false) |
758 | return 0; |
779 | return 0; |
759 | |
780 | |
760 | if (ce->ce_vardata == NULL) |
781 | if (ce->vardata<char *> () == NULL) |
761 | PARAM_ERROR (ce); |
782 | return param_error<config::no_param> (ce); |
762 | |
783 | |
763 | name = ce->ce_vardata; |
784 | name = ce->vardata<char *> (); |
764 | |
785 | |
765 | typedef factory::factory_mgr<database::handler> backend_factory; |
786 | typedef factory::factory_mgr<database::handler> backend_factory; |
766 | backend_factory &f = backend_factory::instance (); |
787 | backend_factory &f = backend_factory::instance (); |
767 | |
788 | |
768 | if (!f.provides (name)) |
789 | if (!f.provides (name)) |
769 | PARAM_ERROR (ce); |
790 | return param_error<config::wrong_param> (ce, "(no such database backend)"); |
770 | |
791 | |
771 | backend = f.create (name); |
792 | backend = f.create (name); |
772 | |
793 | |
773 | return 0; |
794 | return 0; |
774 | } |
795 | } |
… | |
… | |
778 | { |
799 | { |
779 | char *name; |
800 | char *name; |
780 | char *host = NULL, *vhost = NULL, *password = NULL; |
801 | char *host = NULL, *vhost = NULL, *password = NULL; |
781 | unsigned int port = 0; |
802 | unsigned int port = 0; |
782 | |
803 | |
783 | if (ce->ce_vardata == NULL) |
804 | if (ce->vardata<char *> () == NULL) |
784 | PARAM_ERROR (ce); |
805 | return param_error<config::no_param> (ce); |
785 | |
806 | |
786 | if (me.name != NULL && !irccasecmp (ce->ce_vardata, me.name)) |
807 | if (me.name != NULL && !irccasecmp (ce->vardata<char *> (), me.name)) |
787 | slog (LG_ERROR, "%s:%d: uplink's server name %s should not be the same as our server name, continuing anyway", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata); |
808 | slog (LG_ERROR, "%s:%d: uplink's server name %s should not be the same as our server name, continuing anyway", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->vardata<char *> ()); |
788 | else if (!strchr (ce->ce_vardata, '.')) |
809 | else if (!strchr (ce->vardata<char *> (), '.')) |
789 | slog (LG_ERROR, "%s:%d: uplink's server name %s is invalid, continuing anyway", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata); |
810 | slog (LG_ERROR, "%s:%d: uplink's server name %s is invalid, continuing anyway", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->vardata<char *> ()); |
790 | else if (isdigit (ce->ce_vardata[0])) |
811 | else if (isdigit (ce->vardata<char *> ()[0])) |
791 | slog (LG_ERROR, "%s:%d: uplink's server name %s starts with a digit, probably invalid (continuing anyway)", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata); |
812 | slog (LG_ERROR, "%s:%d: uplink's server name %s starts with a digit, probably invalid (continuing anyway)", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->vardata<char *> ()); |
792 | |
813 | |
793 | name = sstrdup (ce->ce_vardata); |
814 | name = sstrdup (ce->vardata<char *> ()); |
794 | |
815 | |
795 | for (ce = ce->ce_entries; ce; ce = ce->ce_next) |
816 | for (ce = ce->ce_entries; ce; ce = ce->ce_next) |
796 | { |
817 | { |
797 | if (!strcasecmp ("HOST", ce->ce_varname)) |
818 | if (!strcasecmp ("HOST", ce->ce_varname)) |
798 | { |
819 | { |
799 | if (ce->ce_vardata == NULL) |
820 | if (ce->vardata<char *> () == NULL) |
800 | PARAM_ERROR (ce); |
821 | return param_error<config::no_param> (ce); |
801 | |
822 | |
802 | host = sstrdup (ce->ce_vardata); |
823 | host = sstrdup (ce->vardata<char *> ()); |
803 | } |
824 | } |
804 | else if (!strcasecmp ("VHOST", ce->ce_varname)) |
825 | else if (!strcasecmp ("VHOST", ce->ce_varname)) |
805 | { |
826 | { |
806 | if (ce->ce_vardata == NULL) |
827 | if (ce->vardata<char *> () == NULL) |
807 | PARAM_ERROR (ce); |
828 | return param_error<config::no_param> (ce); |
808 | |
829 | |
809 | vhost = sstrdup (ce->ce_vardata); |
830 | vhost = sstrdup (ce->vardata<char *> ()); |
810 | } |
831 | } |
811 | else if (!strcasecmp ("PASSWORD", ce->ce_varname)) |
832 | else if (!strcasecmp ("PASSWORD", ce->ce_varname)) |
812 | { |
833 | { |
813 | if (ce->ce_vardata == NULL) |
834 | if (ce->vardata<char *> () == NULL) |
814 | PARAM_ERROR (ce); |
835 | return param_error<config::no_param> (ce); |
815 | |
836 | |
816 | password = sstrdup (ce->ce_vardata); |
837 | password = sstrdup (ce->vardata<char *> ()); |
817 | } |
838 | } |
818 | else if (!strcasecmp ("PORT", ce->ce_varname)) |
839 | else if (!strcasecmp ("PORT", ce->ce_varname)) |
819 | { |
840 | { |
820 | if (ce->ce_vardata == NULL) |
841 | if (ce->vardata<char *> () == NULL) |
821 | PARAM_ERROR (ce); |
842 | return param_error<config::no_param> (ce); |
822 | |
843 | |
823 | port = ce->ce_vardatanum; |
844 | port = ce->vardata<int> (); |
824 | } |
845 | } |
825 | else |
846 | else |
826 | { |
847 | { |
827 | slog (LG_ERROR, "%s:%d: Invalid configuration option uplink::%s", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_varname); |
848 | slog (LG_ERROR, "%s:%d: Invalid configuration option uplink::%s", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_varname); |
828 | continue; |
849 | continue; |
… | |
… | |
845 | operclass_t *operclass; |
866 | operclass_t *operclass; |
846 | char *name; |
867 | char *name; |
847 | char *privs = NULL, *newprivs; |
868 | char *privs = NULL, *newprivs; |
848 | int flags = 0; |
869 | int flags = 0; |
849 | |
870 | |
850 | if (ce->ce_vardata == NULL) |
871 | if (ce->vardata<char *> () == NULL) |
851 | PARAM_ERROR (ce); |
872 | return param_error<config::no_param> (ce); |
852 | |
873 | |
853 | name = ce->ce_vardata; |
874 | name = ce->vardata<char *> (); |
854 | |
875 | |
855 | for (ce = ce->ce_entries; ce; ce = ce->ce_next) |
876 | for (ce = ce->ce_entries; ce; ce = ce->ce_next) |
856 | { |
877 | { |
857 | if (!strcasecmp ("PRIVS", ce->ce_varname)) |
878 | if (!strcasecmp ("PRIVS", ce->ce_varname)) |
858 | { |
879 | { |
859 | if (ce->ce_vardata == NULL && ce->ce_entries == NULL) |
880 | if (ce->vardata<char *> () == NULL && ce->ce_entries == NULL) |
860 | PARAM_ERROR (ce); |
881 | return param_error<config::no_param> (ce); |
861 | |
882 | |
862 | if (ce->ce_entries == NULL) |
883 | if (ce->ce_entries == NULL) |
863 | { |
884 | { |
864 | if (privs == NULL) |
885 | if (privs == NULL) |
865 | privs = sstrdup (ce->ce_vardata); |
886 | privs = sstrdup (ce->vardata<char *> ()); |
866 | else |
887 | else |
867 | { |
888 | { |
868 | newprivs = alloc<char> (strlen (privs) + 1 + strlen (ce->ce_vardata) + 1); |
889 | newprivs = alloc<char> (strlen (privs) + 1 + strlen (ce->vardata<char *> ()) + 1); |
869 | strcpy (newprivs, privs); |
890 | strcpy (newprivs, privs); |
870 | strcat (newprivs, " "); |
891 | strcat (newprivs, " "); |
871 | strcat (newprivs, ce->ce_vardata); |
892 | strcat (newprivs, ce->vardata<char *> ()); |
872 | sfree (privs); |
893 | sfree (privs); |
873 | privs = newprivs; |
894 | privs = newprivs; |
874 | } |
895 | } |
875 | } |
896 | } |
876 | else |
897 | else |
… | |
… | |
924 | { |
945 | { |
925 | char *name; |
946 | char *name; |
926 | operclass_t *operclass = NULL; |
947 | operclass_t *operclass = NULL; |
927 | config_entry_t *topce; |
948 | config_entry_t *topce; |
928 | |
949 | |
929 | if (ce->ce_vardata == NULL) |
950 | if (ce->vardata<char *> () == NULL) |
930 | PARAM_ERROR (ce); |
951 | return param_error<config::no_param> (ce); |
931 | |
952 | |
932 | topce = ce; |
953 | topce = ce; |
933 | name = ce->ce_vardata; |
954 | name = ce->vardata<char *> (); |
934 | |
955 | |
935 | for (ce = ce->ce_entries; ce; ce = ce->ce_next) |
956 | for (ce = ce->ce_entries; ce; ce = ce->ce_next) |
936 | { |
957 | { |
937 | if (!strcasecmp ("OPERCLASS", ce->ce_varname)) |
958 | if (!strcasecmp ("OPERCLASS", ce->ce_varname)) |
938 | { |
959 | { |
939 | if (ce->ce_vardata == NULL) |
960 | if (ce->vardata<char *> () == NULL) |
940 | PARAM_ERROR (ce); |
961 | return param_error<config::no_param> (ce); |
941 | |
962 | |
942 | operclass = operclass_find (ce->ce_vardata); |
963 | operclass = operclass_find (ce->vardata<char *> ()); |
943 | if (operclass == NULL) |
964 | if (operclass == NULL) |
944 | slog (LG_ERROR, "%s:%d: invalid operclass %s for operator %s", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata, name); |
965 | slog (LG_ERROR, "%s:%d: invalid operclass %s for operator %s", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->vardata<char *> (), name); |
945 | } |
966 | } |
946 | else |
967 | else |
947 | { |
968 | { |
948 | slog (LG_ERROR, "%s:%d: Invalid configuration option operator::%s", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_varname); |
969 | slog (LG_ERROR, "%s:%d: Invalid configuration option operator::%s", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_varname); |
949 | continue; |
970 | continue; |
… | |
… | |
964 | } |
985 | } |
965 | |
986 | |
966 | static int |
987 | static int |
967 | c_si_name (config_entry_t *ce) |
988 | c_si_name (config_entry_t *ce) |
968 | { |
989 | { |
969 | if (ce->ce_vardata == NULL) |
990 | if (ce->vardata<char *> () == NULL) |
970 | PARAM_ERROR (ce); |
991 | return param_error<config::no_param> (ce); |
971 | |
992 | |
972 | if (!(runflags & RF_REHASHING)) |
993 | if (!(runflags & RF_REHASHING)) |
973 | me.name = sstrdup (ce->ce_vardata); |
994 | me.name = sstrdup (ce->vardata<char *> ()); |
974 | |
995 | |
975 | return 0; |
996 | return 0; |
976 | } |
997 | } |
977 | |
998 | |
978 | static int |
999 | static int |
979 | c_si_desc (config_entry_t *ce) |
1000 | c_si_desc (config_entry_t *ce) |
980 | { |
1001 | { |
981 | if (ce->ce_vardata == NULL) |
1002 | if (ce->vardata<char *> () == NULL) |
982 | PARAM_ERROR (ce); |
1003 | return param_error<config::no_param> (ce); |
983 | |
1004 | |
984 | if (me.desc != NULL) |
1005 | if (me.desc != NULL) |
985 | sfree (me.desc); |
1006 | sfree (me.desc); |
986 | me.desc = sstrdup (ce->ce_vardata); |
1007 | me.desc = sstrdup (ce->vardata<char *> ()); |
987 | |
1008 | |
988 | return 0; |
1009 | return 0; |
989 | } |
1010 | } |
990 | |
1011 | |
991 | static int |
1012 | static int |
992 | c_si_numeric (config_entry_t *ce) |
1013 | c_si_numeric (config_entry_t *ce) |
993 | { |
1014 | { |
994 | if (ce->ce_vardata == NULL) |
1015 | if (ce->vardata<char *> () == NULL) |
995 | PARAM_ERROR (ce); |
1016 | return param_error<config::no_param> (ce); |
996 | |
1017 | |
997 | if (!(runflags & RF_REHASHING)) |
1018 | if (!(runflags & RF_REHASHING)) |
998 | me.numeric = sstrdup (ce->ce_vardata); |
1019 | me.numeric = sstrdup (ce->vardata<char *> ()); |
999 | |
1020 | |
1000 | return 0; |
1021 | return 0; |
1001 | } |
1022 | } |
1002 | |
1023 | |
1003 | static int |
1024 | static int |
1004 | c_si_mdlimit (config_entry_t *ce) |
1025 | c_si_mdlimit (config_entry_t *ce) |
1005 | { |
1026 | { |
1006 | if (ce->ce_vardata == NULL) |
1027 | if (ce->vardata<char *> () == NULL) |
1007 | PARAM_ERROR (ce); |
1028 | return param_error<config::no_param> (ce); |
1008 | |
1029 | |
1009 | me.mdlimit = ce->ce_vardatanum; |
1030 | me.mdlimit = ce->vardata<int> (); |
1010 | |
1031 | |
1011 | return 0; |
1032 | return 0; |
1012 | } |
1033 | } |
1013 | |
1034 | |
1014 | static int |
1035 | static int |
1015 | c_si_vhost (config_entry_t *ce) |
1036 | c_si_vhost (config_entry_t *ce) |
1016 | { |
1037 | { |
1017 | if (ce->ce_vardata == NULL) |
1038 | if (ce->vardata<char *> () == NULL) |
1018 | PARAM_ERROR (ce); |
1039 | return param_error<config::no_param> (ce); |
1019 | |
1040 | |
1020 | me.vhost = sstrdup (ce->ce_vardata); |
1041 | me.vhost = sstrdup (ce->vardata<char *> ()); |
1021 | |
1042 | |
1022 | return 0; |
1043 | return 0; |
1023 | } |
1044 | } |
1024 | |
1045 | |
1025 | static int |
1046 | static int |
1026 | c_si_recontime (config_entry_t *ce) |
1047 | c_si_recontime (config_entry_t *ce) |
1027 | { |
1048 | { |
1028 | if (ce->ce_vardata == NULL) |
1049 | if (ce->vardata<char *> () == NULL) |
1029 | PARAM_ERROR (ce); |
1050 | return param_error<config::no_param> (ce); |
1030 | |
1051 | |
1031 | me.recontime = ce->ce_vardatanum; |
1052 | me.recontime = ce->vardata<int> (); |
1032 | |
1053 | |
1033 | return 0; |
1054 | return 0; |
1034 | } |
1055 | } |
1035 | |
1056 | |
1036 | static int |
1057 | static int |
1037 | c_si_restarttime (config_entry_t *ce) |
1058 | c_si_restarttime (config_entry_t *ce) |
1038 | { |
1059 | { |
1039 | if (ce->ce_vardata == NULL) |
1060 | if (ce->vardata<char *> () == NULL) |
1040 | PARAM_ERROR (ce); |
1061 | return param_error<config::no_param> (ce); |
1041 | |
1062 | |
1042 | me.restarttime = ce->ce_vardatanum; |
1063 | me.restarttime = ce->vardata<int> (); |
1043 | |
1064 | |
1044 | return 0; |
1065 | return 0; |
1045 | } |
1066 | } |
1046 | |
1067 | |
1047 | static int |
1068 | static int |
1048 | c_si_netname (config_entry_t *ce) |
1069 | c_si_netname (config_entry_t *ce) |
1049 | { |
1070 | { |
1050 | if (ce->ce_vardata == NULL) |
1071 | if (ce->vardata<char *> () == NULL) |
1051 | PARAM_ERROR (ce); |
1072 | return param_error<config::no_param> (ce); |
1052 | |
1073 | |
1053 | me.netname = sstrdup (ce->ce_vardata); |
1074 | me.netname = sstrdup (ce->vardata<char *> ()); |
1054 | |
1075 | |
1055 | return 0; |
1076 | return 0; |
1056 | } |
1077 | } |
1057 | |
1078 | |
1058 | static int |
1079 | static int |
1059 | c_si_hidehostsuffix (config_entry_t *ce) |
1080 | c_si_hidehostsuffix (config_entry_t *ce) |
1060 | { |
1081 | { |
1061 | if (ce->ce_vardata == NULL) |
1082 | if (ce->vardata<char *> () == NULL) |
1062 | PARAM_ERROR (ce); |
1083 | return param_error<config::no_param> (ce); |
1063 | |
1084 | |
1064 | me.hidehostsuffix = sstrdup (ce->ce_vardata); |
1085 | me.hidehostsuffix = sstrdup (ce->vardata<char *> ()); |
1065 | |
1086 | |
1066 | return 0; |
1087 | return 0; |
1067 | } |
1088 | } |
1068 | |
1089 | |
1069 | static int |
1090 | static int |
1070 | c_si_adminname (config_entry_t *ce) |
1091 | c_si_adminname (config_entry_t *ce) |
1071 | { |
1092 | { |
1072 | if (ce->ce_vardata == NULL) |
1093 | if (ce->vardata<char *> () == NULL) |
1073 | PARAM_ERROR (ce); |
1094 | return param_error<config::no_param> (ce); |
1074 | |
1095 | |
1075 | me.adminname = sstrdup (ce->ce_vardata); |
1096 | me.adminname = sstrdup (ce->vardata<char *> ()); |
1076 | |
1097 | |
1077 | return 0; |
1098 | return 0; |
1078 | } |
1099 | } |
1079 | |
1100 | |
1080 | static int |
1101 | static int |
1081 | c_si_adminemail (config_entry_t *ce) |
1102 | c_si_adminemail (config_entry_t *ce) |
1082 | { |
1103 | { |
1083 | if (ce->ce_vardata == NULL) |
1104 | if (ce->vardata<char *> () == NULL) |
1084 | PARAM_ERROR (ce); |
1105 | return param_error<config::no_param> (ce); |
1085 | |
1106 | |
1086 | me.adminemail = sstrdup (ce->ce_vardata); |
1107 | me.adminemail = sstrdup (ce->vardata<char *> ()); |
1087 | |
1108 | |
1088 | return 0; |
1109 | return 0; |
1089 | } |
1110 | } |
1090 | |
1111 | |
1091 | static int |
1112 | static int |
1092 | c_si_mta (config_entry_t *ce) |
1113 | c_si_mta (config_entry_t *ce) |
1093 | { |
1114 | { |
1094 | if (ce->ce_vardata == NULL) |
1115 | if (ce->vardata<char *> () == NULL) |
1095 | PARAM_ERROR (ce); |
1116 | return param_error<config::no_param> (ce); |
1096 | |
1117 | |
1097 | me.mta = sstrdup (ce->ce_vardata); |
1118 | me.mta = sstrdup (ce->vardata<char *> ()); |
1098 | |
1119 | |
1099 | return 0; |
1120 | return 0; |
1100 | } |
1121 | } |
1101 | |
1122 | |
1102 | static int |
1123 | static int |
… | |
… | |
1104 | { |
1125 | { |
1105 | config_entry_t *flce; |
1126 | config_entry_t *flce; |
1106 | int val; |
1127 | int val; |
1107 | int mask = 0; |
1128 | int mask = 0; |
1108 | |
1129 | |
1109 | if (ce->ce_vardata != NULL) |
1130 | if (ce->vardata<char *> () != NULL) |
1110 | { |
1131 | { |
1111 | val = token_to_value (logflags, ce->ce_vardata); |
1132 | val = token_to_value (logflags, ce->vardata<char *> ()); |
1112 | |
1133 | |
1113 | if ((val != TOKEN_UNMATCHED) && (val != TOKEN_ERROR)) |
1134 | if ((val != TOKEN_UNMATCHED) && (val != TOKEN_ERROR)) |
1114 | mask |= val; |
1135 | mask |= val; |
1115 | else |
1136 | else |
1116 | { |
1137 | { |
1117 | slog (LG_INFO, "%s:%d: unknown flag: %s", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata); |
1138 | slog (LG_INFO, "%s:%d: unknown flag: %s", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->vardata<char *> ()); |
1118 | } |
1139 | } |
1119 | } |
1140 | } |
1120 | for (flce = ce->ce_entries; flce; flce = flce->ce_next) |
1141 | for (flce = ce->ce_entries; flce; flce = flce->ce_next) |
1121 | { |
1142 | { |
1122 | val = token_to_value (logflags, flce->ce_varname); |
1143 | val = token_to_value (logflags, flce->ce_varname); |
… | |
… | |
1134 | } |
1155 | } |
1135 | |
1156 | |
1136 | static int |
1157 | static int |
1137 | c_si_maxlogins (config_entry_t *ce) |
1158 | c_si_maxlogins (config_entry_t *ce) |
1138 | { |
1159 | { |
1139 | if (ce->ce_vardata == NULL) |
1160 | if (ce->vardata<char *> () == NULL) |
1140 | PARAM_ERROR (ce); |
1161 | return param_error<config::no_param> (ce); |
1141 | |
1162 | |
1142 | me.maxlogins = ce->ce_vardatanum; |
1163 | me.maxlogins = ce->vardata<int> (); |
1143 | |
1164 | |
1144 | return 0; |
1165 | return 0; |
1145 | |
1166 | |
1146 | } |
1167 | } |
1147 | |
1168 | |
1148 | static int |
1169 | static int |
1149 | c_si_maxusers (config_entry_t *ce) |
1170 | c_si_maxusers (config_entry_t *ce) |
1150 | { |
1171 | { |
1151 | if (ce->ce_vardata == NULL) |
1172 | if (ce->vardata<char *> () == NULL) |
1152 | PARAM_ERROR (ce); |
1173 | return param_error<config::no_param> (ce); |
1153 | |
1174 | |
1154 | me.maxusers = ce->ce_vardatanum; |
1175 | me.maxusers = ce->vardata<int> (); |
1155 | |
1176 | |
1156 | return 0; |
1177 | return 0; |
1157 | |
1178 | |
1158 | } |
1179 | } |
1159 | |
1180 | |
1160 | static int |
1181 | static int |
1161 | c_si_maxnicks (config_entry_t *ce) |
1182 | c_si_maxnicks (config_entry_t *ce) |
1162 | { |
1183 | { |
1163 | if (ce->ce_vardata == NULL) |
1184 | if (ce->vardata<char *> () == NULL) |
1164 | PARAM_ERROR (ce); |
1185 | return param_error<config::no_param> (ce); |
1165 | |
1186 | |
1166 | me.maxnicks = ce->ce_vardatanum; |
1187 | me.maxnicks = ce->vardata<int> (); |
1167 | |
1188 | |
1168 | return 0; |
1189 | return 0; |
1169 | } |
1190 | } |
1170 | |
1191 | |
1171 | static int |
1192 | static int |
1172 | c_si_maxchans (config_entry_t *ce) |
1193 | c_si_maxchans (config_entry_t *ce) |
1173 | { |
1194 | { |
1174 | if (ce->ce_vardata == NULL) |
1195 | if (ce->vardata<char *> () == NULL) |
1175 | PARAM_ERROR (ce); |
1196 | return param_error<config::no_param> (ce); |
1176 | |
1197 | |
1177 | me.maxchans = ce->ce_vardatanum; |
1198 | me.maxchans = ce->vardata<int> (); |
1178 | |
1199 | |
1179 | return 0; |
1200 | return 0; |
1180 | } |
1201 | } |
1181 | |
1202 | |
1182 | static int |
1203 | static int |
1183 | c_si_emaillimit (config_entry_t *ce) |
1204 | c_si_emaillimit (config_entry_t *ce) |
1184 | { |
1205 | { |
1185 | if (ce->ce_vardata == NULL) |
1206 | if (ce->vardata<char *> () == NULL) |
1186 | PARAM_ERROR (ce); |
1207 | return param_error<config::no_param> (ce); |
1187 | |
1208 | |
1188 | me.emaillimit = ce->ce_vardatanum; |
1209 | me.emaillimit = ce->vardata<int> (); |
1189 | |
1210 | |
1190 | return 0; |
1211 | return 0; |
1191 | } |
1212 | } |
1192 | |
1213 | |
1193 | static int |
1214 | static int |
1194 | c_si_emailtime (config_entry_t *ce) |
1215 | c_si_emailtime (config_entry_t *ce) |
1195 | { |
1216 | { |
1196 | if (ce->ce_vardata == NULL) |
1217 | if (ce->vardata<char *> () == NULL) |
1197 | PARAM_ERROR (ce); |
1218 | return param_error<config::no_param> (ce); |
1198 | |
1219 | |
1199 | me.emailtime = ce->ce_vardatanum; |
1220 | me.emailtime = ce->vardata<int> (); |
1200 | |
1221 | |
1201 | return 0; |
1222 | return 0; |
1202 | } |
1223 | } |
1203 | |
1224 | |
1204 | static int |
1225 | static int |
1205 | c_si_auth (config_entry_t *ce) |
1226 | c_si_auth (config_entry_t *ce) |
1206 | { |
1227 | { |
1207 | if (ce->ce_vardata == NULL) |
1228 | if (ce->vardata<char *> () == NULL) |
1208 | PARAM_ERROR (ce); |
1229 | return param_error<config::no_param> (ce); |
1209 | |
1230 | |
1210 | if (!strcasecmp ("EMAIL", ce->ce_vardata)) |
1231 | if (!strcasecmp ("EMAIL", ce->vardata<char *> ())) |
1211 | me.auth = AUTH_EMAIL; |
1232 | me.auth = AUTH_EMAIL; |
1212 | |
1233 | |
1213 | else |
1234 | else |
1214 | me.auth = AUTH_NONE; |
1235 | me.auth = AUTH_NONE; |
1215 | |
1236 | |
… | |
… | |
1217 | } |
1238 | } |
1218 | |
1239 | |
1219 | static int |
1240 | static int |
1220 | c_si_casemapping (config_entry_t *ce) |
1241 | c_si_casemapping (config_entry_t *ce) |
1221 | { |
1242 | { |
1222 | if (ce->ce_vardata == NULL) |
1243 | if (ce->vardata<char *> () == NULL) |
1223 | PARAM_ERROR (ce); |
1244 | return param_error<config::no_param> (ce); |
1224 | |
1245 | |
1225 | if (!strcasecmp ("ASCII", ce->ce_vardata)) |
1246 | if (!strcasecmp ("ASCII", ce->vardata<char *> ())) |
1226 | set_match_mapping (MATCH_ASCII); |
1247 | set_match_mapping (MATCH_ASCII); |
1227 | |
1248 | |
1228 | else |
1249 | else |
1229 | set_match_mapping (MATCH_RFC1459); |
1250 | set_match_mapping (MATCH_RFC1459); |
1230 | |
1251 | |
… | |
… | |
1232 | } |
1253 | } |
1233 | |
1254 | |
1234 | static int |
1255 | static int |
1235 | c_ci_nick (config_entry_t *ce) |
1256 | c_ci_nick (config_entry_t *ce) |
1236 | { |
1257 | { |
1237 | if (ce->ce_vardata == NULL) |
1258 | if (ce->vardata<char *> () == NULL) |
1238 | PARAM_ERROR (ce); |
1259 | return param_error<config::no_param> (ce); |
1239 | |
1260 | |
1240 | if (chansvs.nick != NULL) |
1261 | if (chansvs.nick != NULL) |
1241 | sfree (chansvs.nick); |
1262 | sfree (chansvs.nick); |
1242 | chansvs.nick = sstrdup (ce->ce_vardata); |
1263 | chansvs.nick = sstrdup (ce->vardata<char *> ()); |
1243 | |
1264 | |
1244 | return 0; |
1265 | return 0; |
1245 | } |
1266 | } |
1246 | |
1267 | |
1247 | static int |
1268 | static int |
1248 | c_ci_user (config_entry_t *ce) |
1269 | c_ci_user (config_entry_t *ce) |
1249 | { |
1270 | { |
1250 | if (ce->ce_vardata == NULL) |
1271 | if (ce->vardata<char *> () == NULL) |
1251 | PARAM_ERROR (ce); |
1272 | return param_error<config::no_param> (ce); |
1252 | |
1273 | |
1253 | if (chansvs.user != NULL) |
1274 | if (chansvs.user != NULL) |
1254 | sfree (chansvs.user); |
1275 | sfree (chansvs.user); |
1255 | chansvs.user = sstrdup (ce->ce_vardata); |
1276 | chansvs.user = sstrdup (ce->vardata<char *> ()); |
1256 | |
1277 | |
1257 | return 0; |
1278 | return 0; |
1258 | } |
1279 | } |
1259 | |
1280 | |
1260 | static int |
1281 | static int |
1261 | c_ci_host (config_entry_t *ce) |
1282 | c_ci_host (config_entry_t *ce) |
1262 | { |
1283 | { |
1263 | if (ce->ce_vardata == NULL) |
1284 | if (ce->vardata<char *> () == NULL) |
1264 | PARAM_ERROR (ce); |
1285 | return param_error<config::no_param> (ce); |
1265 | |
1286 | |
1266 | if (chansvs.host != NULL) |
1287 | if (chansvs.host != NULL) |
1267 | sfree (chansvs.host); |
1288 | sfree (chansvs.host); |
1268 | chansvs.host = sstrdup (ce->ce_vardata); |
1289 | chansvs.host = sstrdup (ce->vardata<char *> ()); |
1269 | |
1290 | |
1270 | return 0; |
1291 | return 0; |
1271 | } |
1292 | } |
1272 | |
1293 | |
1273 | static int |
1294 | static int |
1274 | c_ci_real (config_entry_t *ce) |
1295 | c_ci_real (config_entry_t *ce) |
1275 | { |
1296 | { |
1276 | if (ce->ce_vardata == NULL) |
1297 | if (ce->vardata<char *> () == NULL) |
1277 | PARAM_ERROR (ce); |
1298 | return param_error<config::no_param> (ce); |
1278 | |
1299 | |
1279 | if (chansvs.real != NULL) |
1300 | if (chansvs.real != NULL) |
1280 | sfree (chansvs.real); |
1301 | sfree (chansvs.real); |
1281 | chansvs.real = sstrdup (ce->ce_vardata); |
1302 | chansvs.real = sstrdup (ce->vardata<char *> ()); |
1282 | |
1303 | |
1283 | return 0; |
1304 | return 0; |
1284 | } |
1305 | } |
1285 | |
1306 | |
1286 | static int |
1307 | static int |
… | |
… | |
1295 | } |
1316 | } |
1296 | |
1317 | |
1297 | static int |
1318 | static int |
1298 | c_ci_vop (config_entry_t *ce) |
1319 | c_ci_vop (config_entry_t *ce) |
1299 | { |
1320 | { |
1300 | if (ce->ce_vardata == NULL) |
1321 | if (ce->vardata<char *> () == NULL) |
1301 | PARAM_ERROR (ce); |
1322 | return param_error<config::no_param> (ce); |
1302 | |
1323 | |
1303 | chansvs.ca_vop = flags_to_bitmask (ce->ce_vardata, chanacs_flags, 0); |
1324 | chansvs.ca_vop = flags_to_bitmask (ce->vardata<char *> (), chanacs_flags, 0); |
1304 | |
1325 | |
1305 | return 0; |
1326 | return 0; |
1306 | } |
1327 | } |
1307 | |
1328 | |
1308 | static int |
1329 | static int |
1309 | c_ci_hop (config_entry_t *ce) |
1330 | c_ci_hop (config_entry_t *ce) |
1310 | { |
1331 | { |
1311 | if (ce->ce_vardata == NULL) |
1332 | if (ce->vardata<char *> () == NULL) |
1312 | PARAM_ERROR (ce); |
1333 | return param_error<config::no_param> (ce); |
1313 | |
1334 | |
1314 | chansvs.ca_hop = flags_to_bitmask (ce->ce_vardata, chanacs_flags, 0); |
1335 | chansvs.ca_hop = flags_to_bitmask (ce->vardata<char *> (), chanacs_flags, 0); |
1315 | |
1336 | |
1316 | return 0; |
1337 | return 0; |
1317 | } |
1338 | } |
1318 | |
1339 | |
1319 | static int |
1340 | static int |
1320 | c_ci_aop (config_entry_t *ce) |
1341 | c_ci_aop (config_entry_t *ce) |
1321 | { |
1342 | { |
1322 | if (ce->ce_vardata == NULL) |
1343 | if (ce->vardata<char *> () == NULL) |
1323 | PARAM_ERROR (ce); |
1344 | return param_error<config::no_param> (ce); |
1324 | |
1345 | |
1325 | chansvs.ca_aop = flags_to_bitmask (ce->ce_vardata, chanacs_flags, 0); |
1346 | chansvs.ca_aop = flags_to_bitmask (ce->vardata<char *> (), chanacs_flags, 0); |
1326 | |
1347 | |
1327 | return 0; |
1348 | return 0; |
1328 | } |
1349 | } |
1329 | |
1350 | |
1330 | static int |
1351 | static int |
1331 | c_ci_sop (config_entry_t *ce) |
1352 | c_ci_sop (config_entry_t *ce) |
1332 | { |
1353 | { |
1333 | if (ce->ce_vardata == NULL) |
1354 | if (ce->vardata<char *> () == NULL) |
1334 | PARAM_ERROR (ce); |
1355 | return param_error<config::no_param> (ce); |
1335 | |
1356 | |
1336 | chansvs.ca_sop = flags_to_bitmask (ce->ce_vardata, chanacs_flags, 0); |
1357 | chansvs.ca_sop = flags_to_bitmask (ce->vardata<char *> (), chanacs_flags, 0); |
1337 | |
1358 | |
1338 | return 0; |
1359 | return 0; |
1339 | } |
1360 | } |
1340 | |
1361 | |
1341 | static int |
1362 | static int |
… | |
… | |
1346 | } |
1367 | } |
1347 | |
1368 | |
1348 | static int |
1369 | static int |
1349 | c_ci_trigger (config_entry_t *ce) |
1370 | c_ci_trigger (config_entry_t *ce) |
1350 | { |
1371 | { |
1351 | if (ce->ce_vardata == NULL) |
1372 | if (ce->vardata<char *> () == NULL) |
1352 | PARAM_ERROR (ce); |
1373 | return param_error<config::no_param> (ce); |
1353 | |
1374 | |
1354 | if (chansvs.trigger != NULL) |
1375 | if (chansvs.trigger != NULL) |
1355 | sfree (chansvs.trigger); |
1376 | sfree (chansvs.trigger); |
1356 | chansvs.trigger = sstrdup (ce->ce_vardata); |
1377 | chansvs.trigger = sstrdup (ce->vardata<char *> ()); |
1357 | |
1378 | |
1358 | return 0; |
1379 | return 0; |
1359 | } |
1380 | } |
1360 | |
1381 | |
1361 | static int |
1382 | static int |
1362 | c_ci_expire (config_entry_t *ce) |
1383 | c_ci_expire (config_entry_t *ce) |
1363 | { |
1384 | { |
1364 | if (ce->ce_vardata == NULL) |
1385 | if (ce->vardata<char *> () == NULL) |
1365 | PARAM_ERROR (ce); |
1386 | return param_error<config::no_param> (ce); |
1366 | |
1387 | |
1367 | chansvs.expiry = (ce->ce_vardatanum * 60 * 60 * 24); |
1388 | chansvs.expiry = (ce->vardata<int> () * 60 * 60 * 24); |
1368 | |
1389 | |
1369 | return 0; |
1390 | return 0; |
1370 | } |
1391 | } |
1371 | |
1392 | |
1372 | static int |
1393 | static int |
1373 | c_ci_maxchanacs (config_entry_t *ce) |
1394 | c_ci_maxchanacs (config_entry_t *ce) |
1374 | { |
1395 | { |
1375 | if (ce->ce_vardata == NULL) |
1396 | if (ce->vardata<char *> () == NULL) |
1376 | PARAM_ERROR (ce); |
1397 | return param_error<config::no_param> (ce); |
1377 | |
1398 | |
1378 | chansvs.maxchanacs = ce->ce_vardatanum; |
1399 | chansvs.maxchanacs = ce->vardata<int> (); |
1379 | |
1400 | |
1380 | return 0; |
1401 | return 0; |
1381 | } |
1402 | } |
1382 | |
1403 | |
1383 | static int |
1404 | static int |
1384 | c_ci_maxfounders (config_entry_t *ce) |
1405 | c_ci_maxfounders (config_entry_t *ce) |
1385 | { |
1406 | { |
1386 | if (ce->ce_vardata == NULL) |
1407 | if (ce->vardata<char *> () == NULL) |
1387 | PARAM_ERROR (ce); |
1408 | return param_error<config::no_param> (ce); |
1388 | |
1409 | |
1389 | chansvs.maxfounders = ce->ce_vardatanum; |
1410 | chansvs.maxfounders = ce->vardata<int> (); |
1390 | |
1411 | |
1391 | return 0; |
1412 | return 0; |
1392 | } |
1413 | } |
1393 | |
1414 | |
1394 | static int |
1415 | static int |
1395 | c_gi_chan (config_entry_t *ce) |
1416 | c_gi_chan (config_entry_t *ce) |
1396 | { |
1417 | { |
1397 | if (ce->ce_vardata == NULL) |
1418 | if (ce->vardata<char *> () == NULL) |
1398 | PARAM_ERROR (ce); |
1419 | return param_error<config::no_param> (ce); |
1399 | |
1420 | |
1400 | config_options.chan = sstrdup (ce->ce_vardata); |
1421 | config_options.chan = sstrdup (ce->vardata<char *> ()); |
1401 | |
1422 | |
1402 | return 0; |
1423 | return 0; |
1403 | } |
1424 | } |
1404 | |
1425 | |
1405 | static int |
1426 | static int |
… | |
… | |
1501 | } |
1522 | } |
1502 | |
1523 | |
1503 | static int |
1524 | static int |
1504 | c_gi_flood_msgs (config_entry_t *ce) |
1525 | c_gi_flood_msgs (config_entry_t *ce) |
1505 | { |
1526 | { |
1506 | if (ce->ce_vardata == NULL) |
1527 | if (ce->vardata<char *> () == NULL) |
1507 | PARAM_ERROR (ce); |
1528 | return param_error<config::no_param> (ce); |
1508 | |
1529 | |
1509 | config_options.flood_msgs = ce->ce_vardatanum; |
1530 | config_options.flood_msgs = ce->vardata<int> (); |
1510 | |
1531 | |
1511 | return 0; |
1532 | return 0; |
1512 | } |
1533 | } |
1513 | |
1534 | |
1514 | static int |
1535 | static int |
1515 | c_gi_flood_time (config_entry_t *ce) |
1536 | c_gi_flood_time (config_entry_t *ce) |
1516 | { |
1537 | { |
1517 | if (ce->ce_vardata == NULL) |
1538 | if (ce->vardata<char *> () == NULL) |
1518 | PARAM_ERROR (ce); |
1539 | return param_error<config::no_param> (ce); |
1519 | |
1540 | |
1520 | config_options.flood_time = ce->ce_vardatanum; |
1541 | config_options.flood_time = ce->vardata<int> (); |
1521 | |
1542 | |
1522 | return 0; |
1543 | return 0; |
1523 | } |
1544 | } |
1524 | |
1545 | |
1525 | static int |
1546 | static int |
1526 | c_gi_kline_time (config_entry_t *ce) |
1547 | c_gi_kline_time (config_entry_t *ce) |
1527 | { |
1548 | { |
1528 | if (ce->ce_vardata == NULL) |
1549 | if (ce->vardata<char *> () == NULL) |
1529 | PARAM_ERROR (ce); |
1550 | return param_error<config::no_param> (ce); |
1530 | |
1551 | |
1531 | config_options.kline_time = (ce->ce_vardatanum * 60 * 60 * 24); |
1552 | config_options.kline_time = (ce->vardata<int> () * 60 * 60 * 24); |
1532 | |
1553 | |
1533 | return 0; |
1554 | return 0; |
1534 | } |
1555 | } |
1535 | |
1556 | |
1536 | static int |
1557 | static int |
1537 | c_gi_commit_interval (config_entry_t *ce) |
1558 | c_gi_commit_interval (config_entry_t *ce) |
1538 | { |
1559 | { |
1539 | if (ce->ce_vardata == NULL) |
1560 | if (ce->vardata<char *> () == NULL) |
1540 | PARAM_ERROR (ce); |
1561 | return param_error<config::no_param> (ce); |
1541 | |
1562 | |
1542 | config_options.commit_interval = (ce->ce_vardatanum * 60); |
1563 | config_options.commit_interval = (ce->vardata<int> () * 60); |
1543 | |
1564 | |
1544 | return 0; |
1565 | return 0; |
1545 | } |
1566 | } |
1546 | |
1567 | |
1547 | static int |
1568 | static int |
1548 | c_gi_expire (config_entry_t *ce) |
1569 | c_gi_expire (config_entry_t *ce) |
1549 | { |
1570 | { |
1550 | if (ce->ce_vardata == NULL) |
1571 | if (ce->vardata<char *> () == NULL) |
1551 | PARAM_ERROR (ce); |
1572 | return param_error<config::no_param> (ce); |
1552 | |
1573 | |
1553 | slog (LG_INFO, "warning: general::expire has been deprecated. please use nickserv::expire and chanserv::expire respectively."); |
1574 | slog (LG_INFO, "warning: general::expire has been deprecated. please use nickserv::expire and chanserv::expire respectively."); |
1554 | |
1575 | |
1555 | nicksvs.expiry = (ce->ce_vardatanum * 60 * 60 * 24); |
1576 | nicksvs.expiry = (ce->vardata<int> () * 60 * 60 * 24); |
1556 | chansvs.expiry = (ce->ce_vardatanum * 60 * 60 * 24); |
1577 | chansvs.expiry = (ce->vardata<int> () * 60 * 60 * 24); |
1557 | |
1578 | |
1558 | return 0; |
1579 | return 0; |
1559 | } |
1580 | } |
1560 | |
1581 | |
1561 | static int |
1582 | static int |
1562 | c_gi_default_clone_limit (config_entry_t *ce) |
1583 | c_gi_default_clone_limit (config_entry_t *ce) |
1563 | { |
1584 | { |
1564 | if (ce->ce_vardata == NULL) |
1585 | if (ce->vardata<char *> () == NULL) |
1565 | PARAM_ERROR (ce); |
1586 | return param_error<config::no_param> (ce); |
1566 | |
1587 | |
1567 | config_options.default_clone_limit = ce->ce_vardatanum; |
1588 | config_options.default_clone_limit = ce->vardata<int> (); |
1568 | |
1589 | |
1569 | return 0; |
1590 | return 0; |
1570 | } |
1591 | } |
1571 | |
1592 | |
1572 | static int |
1593 | static int |
1573 | c_oi_nick (config_entry_t *ce) |
1594 | c_oi_nick (config_entry_t *ce) |
1574 | { |
1595 | { |
1575 | if (ce->ce_vardata == NULL) |
1596 | if (ce->vardata<char *> () == NULL) |
1576 | PARAM_ERROR (ce); |
1597 | return param_error<config::no_param> (ce); |
1577 | |
1598 | |
1578 | if (opersvs.nick != NULL) |
1599 | if (opersvs.nick != NULL) |
1579 | sfree (opersvs.nick); |
1600 | sfree (opersvs.nick); |
1580 | opersvs.nick = sstrdup (ce->ce_vardata); |
1601 | opersvs.nick = sstrdup (ce->vardata<char *> ()); |
1581 | |
1602 | |
1582 | return 0; |
1603 | return 0; |
1583 | } |
1604 | } |
1584 | |
1605 | |
1585 | static int |
1606 | static int |
1586 | c_oi_user (config_entry_t *ce) |
1607 | c_oi_user (config_entry_t *ce) |
1587 | { |
1608 | { |
1588 | if (ce->ce_vardata == NULL) |
1609 | if (ce->vardata<char *> () == NULL) |
1589 | PARAM_ERROR (ce); |
1610 | return param_error<config::no_param> (ce); |
1590 | |
1611 | |
1591 | if (opersvs.user != NULL) |
1612 | if (opersvs.user != NULL) |
1592 | sfree (opersvs.user); |
1613 | sfree (opersvs.user); |
1593 | opersvs.user = sstrdup (ce->ce_vardata); |
1614 | opersvs.user = sstrdup (ce->vardata<char *> ()); |
1594 | |
1615 | |
1595 | return 0; |
1616 | return 0; |
1596 | } |
1617 | } |
1597 | |
1618 | |
1598 | static int |
1619 | static int |
1599 | c_oi_host (config_entry_t *ce) |
1620 | c_oi_host (config_entry_t *ce) |
1600 | { |
1621 | { |
1601 | if (ce->ce_vardata == NULL) |
1622 | if (ce->vardata<char *> () == NULL) |
1602 | PARAM_ERROR (ce); |
1623 | return param_error<config::no_param> (ce); |
1603 | |
1624 | |
1604 | if (opersvs.host != NULL) |
1625 | if (opersvs.host != NULL) |
1605 | sfree (opersvs.host); |
1626 | sfree (opersvs.host); |
1606 | opersvs.host = sstrdup (ce->ce_vardata); |
1627 | opersvs.host = sstrdup (ce->vardata<char *> ()); |
1607 | |
1628 | |
1608 | return 0; |
1629 | return 0; |
1609 | } |
1630 | } |
1610 | |
1631 | |
1611 | static int |
1632 | static int |
1612 | c_oi_real (config_entry_t *ce) |
1633 | c_oi_real (config_entry_t *ce) |
1613 | { |
1634 | { |
1614 | if (ce->ce_vardata == NULL) |
1635 | if (ce->vardata<char *> () == NULL) |
1615 | PARAM_ERROR (ce); |
1636 | return param_error<config::no_param> (ce); |
1616 | |
1637 | |
1617 | if (opersvs.real != NULL) |
1638 | if (opersvs.real != NULL) |
1618 | sfree (opersvs.real); |
1639 | sfree (opersvs.real); |
1619 | opersvs.real = sstrdup (ce->ce_vardata); |
1640 | opersvs.real = sstrdup (ce->vardata<char *> ()); |
1620 | |
1641 | |
1621 | return 0; |
1642 | return 0; |
1622 | } |
1643 | } |
1623 | |
1644 | |
1624 | static int |
1645 | static int |
1625 | c_ni_nick (config_entry_t *ce) |
1646 | c_ni_nick (config_entry_t *ce) |
1626 | { |
1647 | { |
1627 | if (ce->ce_vardata == NULL) |
1648 | if (ce->vardata<char *> () == NULL) |
1628 | PARAM_ERROR (ce); |
1649 | return param_error<config::no_param> (ce); |
1629 | |
1650 | |
1630 | if (nicksvs.nick != NULL) |
1651 | if (nicksvs.nick != NULL) |
1631 | sfree (nicksvs.nick); |
1652 | sfree (nicksvs.nick); |
1632 | nicksvs.nick = sstrdup (ce->ce_vardata); |
1653 | nicksvs.nick = sstrdup (ce->vardata<char *> ()); |
1633 | |
1654 | |
1634 | return 0; |
1655 | return 0; |
1635 | } |
1656 | } |
1636 | |
1657 | |
1637 | static int |
1658 | static int |
1638 | c_ni_user (config_entry_t *ce) |
1659 | c_ni_user (config_entry_t *ce) |
1639 | { |
1660 | { |
1640 | if (ce->ce_vardata == NULL) |
1661 | if (ce->vardata<char *> () == NULL) |
1641 | PARAM_ERROR (ce); |
1662 | return param_error<config::no_param> (ce); |
1642 | |
1663 | |
1643 | if (nicksvs.user != NULL) |
1664 | if (nicksvs.user != NULL) |
1644 | sfree (nicksvs.user); |
1665 | sfree (nicksvs.user); |
1645 | nicksvs.user = sstrdup (ce->ce_vardata); |
1666 | nicksvs.user = sstrdup (ce->vardata<char *> ()); |
1646 | |
1667 | |
1647 | return 0; |
1668 | return 0; |
1648 | } |
1669 | } |
1649 | |
1670 | |
1650 | static int |
1671 | static int |
1651 | c_ni_host (config_entry_t *ce) |
1672 | c_ni_host (config_entry_t *ce) |
1652 | { |
1673 | { |
1653 | if (ce->ce_vardata == NULL) |
1674 | if (ce->vardata<char *> () == NULL) |
1654 | PARAM_ERROR (ce); |
1675 | return param_error<config::no_param> (ce); |
1655 | |
1676 | |
1656 | if (nicksvs.host != NULL) |
1677 | if (nicksvs.host != NULL) |
1657 | sfree (nicksvs.host); |
1678 | sfree (nicksvs.host); |
1658 | nicksvs.host = sstrdup (ce->ce_vardata); |
1679 | nicksvs.host = sstrdup (ce->vardata<char *> ()); |
1659 | |
1680 | |
1660 | return 0; |
1681 | return 0; |
1661 | } |
1682 | } |
1662 | |
1683 | |
1663 | static int |
1684 | static int |
1664 | c_ni_real (config_entry_t *ce) |
1685 | c_ni_real (config_entry_t *ce) |
1665 | { |
1686 | { |
1666 | if (ce->ce_vardata == NULL) |
1687 | if (ce->vardata<char *> () == NULL) |
1667 | PARAM_ERROR (ce); |
1688 | return param_error<config::no_param> (ce); |
1668 | |
1689 | |
1669 | if (nicksvs.real != NULL) |
1690 | if (nicksvs.real != NULL) |
1670 | sfree (nicksvs.real); |
1691 | sfree (nicksvs.real); |
1671 | nicksvs.real = sstrdup (ce->ce_vardata); |
1692 | nicksvs.real = sstrdup (ce->vardata<char *> ()); |
1672 | |
1693 | |
1673 | return 0; |
1694 | return 0; |
1674 | } |
1695 | } |
1675 | |
1696 | |
1676 | static int |
1697 | static int |
… | |
… | |
1688 | } |
1709 | } |
1689 | |
1710 | |
1690 | static int |
1711 | static int |
1691 | c_ni_expire (config_entry_t *ce) |
1712 | c_ni_expire (config_entry_t *ce) |
1692 | { |
1713 | { |
1693 | if (ce->ce_vardata == NULL) |
1714 | if (ce->vardata<char *> () == NULL) |
1694 | PARAM_ERROR (ce); |
1715 | return param_error<config::no_param> (ce); |
1695 | |
1716 | |
1696 | nicksvs.expiry = (ce->ce_vardatanum * 60 * 60 * 24); |
1717 | nicksvs.expiry = (ce->vardata<int> () * 60 * 60 * 24); |
1697 | |
1718 | |
1698 | return 0; |
1719 | return 0; |
1699 | } |
1720 | } |
1700 | |
1721 | |
1701 | static int |
1722 | static int |
1702 | c_ss_nick (config_entry_t *ce) |
1723 | c_ss_nick (config_entry_t *ce) |
1703 | { |
1724 | { |
1704 | if (ce->ce_vardata == NULL) |
1725 | if (ce->vardata<char *> () == NULL) |
1705 | PARAM_ERROR (ce); |
1726 | return param_error<config::no_param> (ce); |
1706 | |
1727 | |
1707 | if (saslsvs.nick != NULL) |
1728 | if (saslsvs.nick != NULL) |
1708 | sfree (saslsvs.nick); |
1729 | sfree (saslsvs.nick); |
1709 | saslsvs.nick = sstrdup (ce->ce_vardata); |
1730 | saslsvs.nick = sstrdup (ce->vardata<char *> ()); |
1710 | |
1731 | |
1711 | return 0; |
1732 | return 0; |
1712 | } |
1733 | } |
1713 | |
1734 | |
1714 | static int |
1735 | static int |
1715 | c_ss_user (config_entry_t *ce) |
1736 | c_ss_user (config_entry_t *ce) |
1716 | { |
1737 | { |
1717 | if (ce->ce_vardata == NULL) |
1738 | if (ce->vardata<char *> () == NULL) |
1718 | PARAM_ERROR (ce); |
1739 | return param_error<config::no_param> (ce); |
1719 | |
1740 | |
1720 | if (saslsvs.user != NULL) |
1741 | if (saslsvs.user != NULL) |
1721 | sfree (saslsvs.user); |
1742 | sfree (saslsvs.user); |
1722 | saslsvs.user = sstrdup (ce->ce_vardata); |
1743 | saslsvs.user = sstrdup (ce->vardata<char *> ()); |
1723 | |
1744 | |
1724 | return 0; |
1745 | return 0; |
1725 | } |
1746 | } |
1726 | |
1747 | |
1727 | static int |
1748 | static int |
1728 | c_ss_host (config_entry_t *ce) |
1749 | c_ss_host (config_entry_t *ce) |
1729 | { |
1750 | { |
1730 | if (ce->ce_vardata == NULL) |
1751 | if (ce->vardata<char *> () == NULL) |
1731 | PARAM_ERROR (ce); |
1752 | return param_error<config::no_param> (ce); |
1732 | |
1753 | |
1733 | if (saslsvs.host != NULL) |
1754 | if (saslsvs.host != NULL) |
1734 | sfree (saslsvs.host); |
1755 | sfree (saslsvs.host); |
1735 | saslsvs.host = sstrdup (ce->ce_vardata); |
1756 | saslsvs.host = sstrdup (ce->vardata<char *> ()); |
1736 | |
1757 | |
1737 | return 0; |
1758 | return 0; |
1738 | } |
1759 | } |
1739 | |
1760 | |
1740 | static int |
1761 | static int |
1741 | c_ss_real (config_entry_t *ce) |
1762 | c_ss_real (config_entry_t *ce) |
1742 | { |
1763 | { |
1743 | if (ce->ce_vardata == NULL) |
1764 | if (ce->vardata<char *> () == NULL) |
1744 | PARAM_ERROR (ce); |
1765 | return param_error<config::no_param> (ce); |
1745 | |
1766 | |
1746 | if (saslsvs.real != NULL) |
1767 | if (saslsvs.real != NULL) |
1747 | sfree (saslsvs.real); |
1768 | sfree (saslsvs.real); |
1748 | saslsvs.real = sstrdup (ce->ce_vardata); |
1769 | saslsvs.real = sstrdup (ce->vardata<char *> ()); |
1749 | |
1770 | |
1750 | return 0; |
1771 | return 0; |
1751 | } |
1772 | } |
1752 | |
1773 | |
1753 | static int |
1774 | static int |
1754 | c_ms_nick (config_entry_t *ce) |
1775 | c_ms_nick (config_entry_t *ce) |
1755 | { |
1776 | { |
1756 | if (ce->ce_vardata == NULL) |
1777 | if (ce->vardata<char *> () == NULL) |
1757 | PARAM_ERROR (ce); |
1778 | return param_error<config::no_param> (ce); |
1758 | |
1779 | |
1759 | if (memosvs.nick != NULL) |
1780 | if (memosvs.nick != NULL) |
1760 | sfree (memosvs.nick); |
1781 | sfree (memosvs.nick); |
1761 | memosvs.nick = sstrdup (ce->ce_vardata); |
1782 | memosvs.nick = sstrdup (ce->vardata<char *> ()); |
1762 | |
1783 | |
1763 | return 0; |
1784 | return 0; |
1764 | } |
1785 | } |
1765 | |
1786 | |
1766 | static int |
1787 | static int |
1767 | c_ms_user (config_entry_t *ce) |
1788 | c_ms_user (config_entry_t *ce) |
1768 | { |
1789 | { |
1769 | if (ce->ce_vardata == NULL) |
1790 | if (ce->vardata<char *> () == NULL) |
1770 | PARAM_ERROR (ce); |
1791 | return param_error<config::no_param> (ce); |
1771 | |
1792 | |
1772 | if (memosvs.user != NULL) |
1793 | if (memosvs.user != NULL) |
1773 | sfree (memosvs.user); |
1794 | sfree (memosvs.user); |
1774 | memosvs.user = sstrdup (ce->ce_vardata); |
1795 | memosvs.user = sstrdup (ce->vardata<char *> ()); |
1775 | |
1796 | |
1776 | return 0; |
1797 | return 0; |
1777 | } |
1798 | } |
1778 | |
1799 | |
1779 | static int |
1800 | static int |
1780 | c_ms_host (config_entry_t *ce) |
1801 | c_ms_host (config_entry_t *ce) |
1781 | { |
1802 | { |
1782 | if (ce->ce_vardata == NULL) |
1803 | if (ce->vardata<char *> () == NULL) |
1783 | PARAM_ERROR (ce); |
1804 | return param_error<config::no_param> (ce); |
1784 | |
1805 | |
1785 | if (memosvs.host != NULL) |
1806 | if (memosvs.host != NULL) |
1786 | sfree (memosvs.host); |
1807 | sfree (memosvs.host); |
1787 | memosvs.host = sstrdup (ce->ce_vardata); |
1808 | memosvs.host = sstrdup (ce->vardata<char *> ()); |
1788 | |
1809 | |
1789 | return 0; |
1810 | return 0; |
1790 | } |
1811 | } |
1791 | |
1812 | |
1792 | static int |
1813 | static int |
1793 | c_ms_real (config_entry_t *ce) |
1814 | c_ms_real (config_entry_t *ce) |
1794 | { |
1815 | { |
1795 | if (ce->ce_vardata == NULL) |
1816 | if (ce->vardata<char *> () == NULL) |
1796 | PARAM_ERROR (ce); |
1817 | return param_error<config::no_param> (ce); |
1797 | |
1818 | |
1798 | if (memosvs.real != NULL) |
1819 | if (memosvs.real != NULL) |
1799 | sfree (memosvs.real); |
1820 | sfree (memosvs.real); |
1800 | memosvs.real = sstrdup (ce->ce_vardata); |
1821 | memosvs.real = sstrdup (ce->vardata<char *> ()); |
1801 | |
1822 | |
1802 | return 0; |
1823 | return 0; |
1803 | } |
1824 | } |
1804 | |
1825 | |
1805 | static int |
1826 | static int |
1806 | c_gs_nick (config_entry_t *ce) |
1827 | c_gs_nick (config_entry_t *ce) |
1807 | { |
1828 | { |
1808 | if (ce->ce_vardata == NULL) |
1829 | if (ce->vardata<char *> () == NULL) |
1809 | PARAM_ERROR (ce); |
1830 | return param_error<config::no_param> (ce); |
1810 | |
1831 | |
1811 | if (gamesvs.nick != NULL) |
1832 | if (gamesvs.nick != NULL) |
1812 | sfree (gamesvs.nick); |
1833 | sfree (gamesvs.nick); |
1813 | gamesvs.nick = sstrdup (ce->ce_vardata); |
1834 | gamesvs.nick = sstrdup (ce->vardata<char *> ()); |
1814 | |
1835 | |
1815 | return 0; |
1836 | return 0; |
1816 | } |
1837 | } |
1817 | |
1838 | |
1818 | static int |
1839 | static int |
1819 | c_gs_user (config_entry_t *ce) |
1840 | c_gs_user (config_entry_t *ce) |
1820 | { |
1841 | { |
1821 | if (ce->ce_vardata == NULL) |
1842 | if (ce->vardata<char *> () == NULL) |
1822 | PARAM_ERROR (ce); |
1843 | return param_error<config::no_param> (ce); |
1823 | |
1844 | |
1824 | if (gamesvs.user != NULL) |
1845 | if (gamesvs.user != NULL) |
1825 | sfree (gamesvs.user); |
1846 | sfree (gamesvs.user); |
1826 | gamesvs.user = sstrdup (ce->ce_vardata); |
1847 | gamesvs.user = sstrdup (ce->vardata<char *> ()); |
1827 | |
1848 | |
1828 | return 0; |
1849 | return 0; |
1829 | } |
1850 | } |
1830 | |
1851 | |
1831 | static int |
1852 | static int |
1832 | c_gs_host (config_entry_t *ce) |
1853 | c_gs_host (config_entry_t *ce) |
1833 | { |
1854 | { |
1834 | if (ce->ce_vardata == NULL) |
1855 | if (ce->vardata<char *> () == NULL) |
1835 | PARAM_ERROR (ce); |
1856 | return param_error<config::no_param> (ce); |
1836 | |
1857 | |
1837 | if (gamesvs.host != NULL) |
1858 | if (gamesvs.host != NULL) |
1838 | sfree (gamesvs.host); |
1859 | sfree (gamesvs.host); |
1839 | gamesvs.host = sstrdup (ce->ce_vardata); |
1860 | gamesvs.host = sstrdup (ce->vardata<char *> ()); |
1840 | |
1861 | |
1841 | return 0; |
1862 | return 0; |
1842 | } |
1863 | } |
1843 | |
1864 | |
1844 | static int |
1865 | static int |
1845 | c_gs_real (config_entry_t *ce) |
1866 | c_gs_real (config_entry_t *ce) |
1846 | { |
1867 | { |
1847 | if (ce->ce_vardata == NULL) |
1868 | if (ce->vardata<char *> () == NULL) |
1848 | PARAM_ERROR (ce); |
1869 | return param_error<config::no_param> (ce); |
1849 | |
1870 | |
1850 | if (gamesvs.real != NULL) |
1871 | if (gamesvs.real != NULL) |
1851 | sfree (gamesvs.real); |
1872 | sfree (gamesvs.real); |
1852 | gamesvs.real = sstrdup (ce->ce_vardata); |
1873 | gamesvs.real = sstrdup (ce->vardata<char *> ()); |
1853 | |
1874 | |
1854 | return 0; |
1875 | return 0; |
1855 | } |
1876 | } |
1856 | |
1877 | |
1857 | static int |
1878 | static int |
1858 | c_gl_nick (config_entry_t *ce) |
1879 | c_gl_nick (config_entry_t *ce) |
1859 | { |
1880 | { |
1860 | if (ce->ce_vardata == NULL) |
1881 | if (ce->vardata<char *> () == NULL) |
1861 | PARAM_ERROR (ce); |
1882 | return param_error<config::no_param> (ce); |
1862 | |
1883 | |
1863 | if (globsvs.nick != NULL) |
1884 | if (globsvs.nick != NULL) |
1864 | sfree (globsvs.nick); |
1885 | sfree (globsvs.nick); |
1865 | globsvs.nick = sstrdup (ce->ce_vardata); |
1886 | globsvs.nick = sstrdup (ce->vardata<char *> ()); |
1866 | |
1887 | |
1867 | return 0; |
1888 | return 0; |
1868 | } |
1889 | } |
1869 | |
1890 | |
1870 | static int |
1891 | static int |
1871 | c_gl_user (config_entry_t *ce) |
1892 | c_gl_user (config_entry_t *ce) |
1872 | { |
1893 | { |
1873 | if (ce->ce_vardata == NULL) |
1894 | if (ce->vardata<char *> () == NULL) |
1874 | PARAM_ERROR (ce); |
1895 | return param_error<config::no_param> (ce); |
1875 | |
1896 | |
1876 | if (globsvs.user != NULL) |
1897 | if (globsvs.user != NULL) |
1877 | sfree (globsvs.user); |
1898 | sfree (globsvs.user); |
1878 | globsvs.user = sstrdup (ce->ce_vardata); |
1899 | globsvs.user = sstrdup (ce->vardata<char *> ()); |
1879 | |
1900 | |
1880 | return 0; |
1901 | return 0; |
1881 | } |
1902 | } |
1882 | |
1903 | |
1883 | static int |
1904 | static int |
1884 | c_gl_host (config_entry_t *ce) |
1905 | c_gl_host (config_entry_t *ce) |
1885 | { |
1906 | { |
1886 | if (ce->ce_vardata == NULL) |
1907 | if (ce->vardata<char *> () == NULL) |
1887 | PARAM_ERROR (ce); |
1908 | return param_error<config::no_param> (ce); |
1888 | |
1909 | |
1889 | if (globsvs.host != NULL) |
1910 | if (globsvs.host != NULL) |
1890 | sfree (globsvs.host); |
1911 | sfree (globsvs.host); |
1891 | globsvs.host = sstrdup (ce->ce_vardata); |
1912 | globsvs.host = sstrdup (ce->vardata<char *> ()); |
1892 | |
1913 | |
1893 | return 0; |
1914 | return 0; |
1894 | } |
1915 | } |
1895 | |
1916 | |
1896 | static int |
1917 | static int |
1897 | c_gl_real (config_entry_t *ce) |
1918 | c_gl_real (config_entry_t *ce) |
1898 | { |
1919 | { |
1899 | if (ce->ce_vardata == NULL) |
1920 | if (ce->vardata<char *> () == NULL) |
1900 | PARAM_ERROR (ce); |
1921 | return param_error<config::no_param> (ce); |
1901 | |
1922 | |
1902 | if (globsvs.real != NULL) |
1923 | if (globsvs.real != NULL) |
1903 | sfree (globsvs.real); |
1924 | sfree (globsvs.real); |
1904 | globsvs.real = sstrdup (ce->ce_vardata); |
1925 | globsvs.real = sstrdup (ce->vardata<char *> ()); |
1905 | |
1926 | |
1906 | return 0; |
1927 | return 0; |
1907 | } |
1928 | } |
1908 | |
1929 | |
1909 | static int |
1930 | static int |
1910 | c_db_user (config_entry_t *ce) |
1931 | c_db_user (config_entry_t *ce) |
1911 | { |
1932 | { |
1912 | if (ce->ce_vardata == NULL) |
1933 | if (ce->vardata<char *> () == NULL) |
1913 | PARAM_ERROR (ce); |
1934 | return param_error<config::no_param> (ce); |
1914 | |
1935 | |
1915 | if (database_options.user != NULL) |
1936 | if (database_options.user != NULL) |
1916 | sfree (database_options.user); |
1937 | sfree (database_options.user); |
1917 | database_options.user = sstrdup (ce->ce_vardata); |
1938 | database_options.user = sstrdup (ce->vardata<char *> ()); |
1918 | |
1939 | |
1919 | return 0; |
1940 | return 0; |
1920 | } |
1941 | } |
1921 | |
1942 | |
1922 | static int |
1943 | static int |
1923 | c_db_host (config_entry_t *ce) |
1944 | c_db_host (config_entry_t *ce) |
1924 | { |
1945 | { |
1925 | if (ce->ce_vardata == NULL) |
1946 | if (ce->vardata<char *> () == NULL) |
1926 | PARAM_ERROR (ce); |
1947 | return param_error<config::no_param> (ce); |
1927 | |
1948 | |
1928 | if (database_options.host != NULL) |
1949 | if (database_options.host != NULL) |
1929 | sfree (database_options.host); |
1950 | sfree (database_options.host); |
1930 | database_options.host = sstrdup (ce->ce_vardata); |
1951 | database_options.host = sstrdup (ce->vardata<char *> ()); |
1931 | |
1952 | |
1932 | return 0; |
1953 | return 0; |
1933 | } |
1954 | } |
1934 | |
1955 | |
1935 | static int |
1956 | static int |
1936 | c_db_password (config_entry_t *ce) |
1957 | c_db_password (config_entry_t *ce) |
1937 | { |
1958 | { |
1938 | if (ce->ce_vardata == NULL) |
1959 | if (ce->vardata<char *> () == NULL) |
1939 | PARAM_ERROR (ce); |
1960 | return param_error<config::no_param> (ce); |
1940 | |
1961 | |
1941 | if (database_options.pass != NULL) |
1962 | if (database_options.pass != NULL) |
1942 | sfree (database_options.pass); |
1963 | sfree (database_options.pass); |
1943 | database_options.pass = sstrdup (ce->ce_vardata); |
1964 | database_options.pass = sstrdup (ce->vardata<char *> ()); |
1944 | |
1965 | |
1945 | return 0; |
1966 | return 0; |
1946 | } |
1967 | } |
1947 | |
1968 | |
1948 | static int |
1969 | static int |
1949 | c_db_database (config_entry_t *ce) |
1970 | c_db_database (config_entry_t *ce) |
1950 | { |
1971 | { |
1951 | if (ce->ce_vardata == NULL) |
1972 | if (ce->vardata<char *> () == NULL) |
1952 | PARAM_ERROR (ce); |
1973 | return param_error<config::no_param> (ce); |
1953 | |
1974 | |
1954 | if (database_options.database != NULL) |
1975 | if (database_options.database != NULL) |
1955 | sfree (database_options.database); |
1976 | sfree (database_options.database); |
1956 | database_options.database = sstrdup (ce->ce_vardata); |
1977 | database_options.database = sstrdup (ce->vardata<char *> ()); |
1957 | |
1978 | |
1958 | return 0; |
1979 | return 0; |
1959 | } |
1980 | } |
1960 | |
1981 | |
1961 | static int |
1982 | static int |
1962 | c_db_port (config_entry_t *ce) |
1983 | c_db_port (config_entry_t *ce) |
1963 | { |
1984 | { |
1964 | if (ce->ce_vardatanum == 0) |
1985 | if (ce->vardata<int> () == 0) |
1965 | PARAM_ERROR (ce); |
1986 | return param_error<config::no_param> (ce); |
1966 | |
1987 | |
1967 | database_options.port = ce->ce_vardatanum; |
1988 | database_options.port = ce->vardata<int> (); |
1968 | |
1989 | |
1969 | return 0; |
1990 | return 0; |
1970 | } |
1991 | } |
1971 | |
1992 | |
1972 | static int |
1993 | static int |
1973 | c_logfile (config_entry_t *ce) |
1994 | c_logfile (config_entry_t *ce) |
1974 | { |
1995 | { |
1975 | config_entry_t *flce; |
1996 | config_entry_t *flce; |
1976 | unsigned int logval = 0; |
1997 | unsigned int logval = 0; |
1977 | |
1998 | |
1978 | if (ce->ce_vardata == NULL) |
1999 | if (ce->vardata<char *> () == NULL) |
1979 | PARAM_ERROR (ce); |
2000 | return param_error<config::no_param> (ce); |
1980 | |
2001 | |
1981 | for (flce = ce->ce_entries; flce; flce = flce->ce_next) |
2002 | for (flce = ce->ce_entries; flce; flce = flce->ce_next) |
1982 | { |
2003 | { |
1983 | int val; |
2004 | int val; |
1984 | |
2005 | |
… | |
… | |
1990 | { |
2011 | { |
1991 | slog (LG_INFO, "%s:%d: unknown flag: %s", flce->ce_fileptr->cf_filename, flce->ce_varlinenum, flce->ce_varname); |
2012 | slog (LG_INFO, "%s:%d: unknown flag: %s", flce->ce_fileptr->cf_filename, flce->ce_varlinenum, flce->ce_varname); |
1992 | } |
2013 | } |
1993 | } |
2014 | } |
1994 | |
2015 | |
1995 | logfile_new (ce->ce_vardata, logval); |
2016 | logfile_new (ce->vardata<char *> (), logval); |
1996 | |
2017 | |
1997 | return 0; |
2018 | return 0; |
1998 | } |
2019 | } |
1999 | |
2020 | |
2000 | bool |
2021 | bool |