1    | /***************************************
2    |   $Revision:
3    | 
4    |   CA module: Values defined at compile time.
5    | 
6    |   Status: NOT REVIEWED, NOT TESTED
7    | 
8    |   Author(s):       Ambrose Magee
9    | 
10   | ******************//******************
11   | Modification History:
12   | 
13   | ******************/
14   | 
15   | /************************************
16   | Copyright (c) 2000,2001,2002                    RIPE NCC
17   | 
18   | All Rights Reserved
19   | 
20   | Permission to use, copy, modify, and distribute this software and its
21   | documentation for any purpose and without fee is hereby granted,
22   | provided that the above copyright notice appear in all copies and that
23   | both that copyright notice and this permission notice appear in
24   | supporting documentation, and that the name of the author not be
25   | used in advertising or publicity pertaining to distribution of the
26   | software without specific, written prior permission.
27   | 
28   | THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
29   | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
30   | AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
31   | DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
32   | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
33   | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
34   | ***************************************/
35   | 
36   | #include "rip.h"
37   | 
38   | /*
39   |  * int bport = 43;
40   |  */
41   | 
42   | GSList *sourceList = NULL;
43   | 
44   | GSList *dbList = NULL;
45   | 
46   | GSList *nrtmList = NULL;
47   | 
48   | /*
49   |  * 20000609 Experiment: The GSList variable, "mySrcList", is defined in the
50   |  * ca_defs.h file (with an 'extern' modifier). GSList *mySrcList = NULL;
51   |  */
52   | 
53   | /*
54   |  * int testmode = 0;
55   |  */
56   | 
57   | /*
58   |  * values_t globals[]  =  { {"43", &bport}, {"/ncc/db2/doc/HELP",
59   |  * "/ncc/db2/doc/HELP"}, {"% Rights restricted by copyright. See
60   |  * http://www.ripe.net/db/dbcopyright.html", "% Rights restricted by
61   |  * copyright. See http://www.ripe.net/db/dbcopyright.html"}, {"SourceList",
62   |  * NULL}, {"0", &testmode}, {"1Bt9RNSMWcA.Y", "1Bt9RNSMWcA.Y"},
63   |  * {"/ncc/db2/doc/WHOIS-HELP", "/ncc/db2/doc/WHOIS-HELP"},
64   |  * {"/ncc/db2/doc/AUTO-DBM-HELP", "/ncc/db2/doc/AUTO-DBM-HELP"},
65   |  * {"/ncc/db2/etc/attr-desc.config", "/ncc/db2/etc/attr-desc.config"},
66   |  * {"RIPE", "RIPE"}, {"RIPE          /ncc/db2/data/ripe/ripe.db SPLIT", "RIPE
67   |  * /ncc/db2/data/ripe/ripe.db         SPLIT"}, {"RIPE", "RIPE"},
68   |  * {"SourceList", NULL}, {"dbase", "dbase"}, {"/ncc/db2/log/qry/qrylog",
69   |  * "/ncc/db2/log/qry/qrylog"}, {"/ncc/db2/log/qry/qry2log",
70   |  * "/ncc/db2/log/qry/qry2log"}, {"/ncc/db2/log/err/errlog",
71   |  * "/ncc/db2/log/err/errlog"}, {"/ncc/db2/log/audit/auditlog",
72   |  * "/ncc/db2/log/audit/auditlog"}, {"/ncc/db2/log/upd", "/ncc/db2/log/upd"},
73   |  * {"/ncc/db2/log/ack", "/ncc/db2/log/ack"}, {"/ncc/db2/locks",
74   |  * "/ncc/db2/locks"}, {"whoisd.pid", "whoisd.pid"}, {"STOPUPDATES",
75   |  * "STOPUPDATES"}, {"CLEANDB.LOCK", "CLEANDB.LOCK"},
76   |  * {"/ncc/db2/serials/current", "/ncc/db2/serials/current"},
77   |  * {"/ncc/db2/serials/old", "/ncc/db2/serials/old"},
78   |  * {"/ncc/db2/serials/incoming", "/ncc/db2/serials/incoming"}, {"180",
79   |  * "180"}, {"RIPE-NCC-HM-MNT ", "RIPE-NCC-HM-MNT "}, {"127.0.0.1",
80   |  * "127.0.0.1"}, {"193.0.0.1[345678][0-9]", "193.0.0.1[345678][0-9]"},
81   |  * {"195.88.156.1", "195.88.156.1"}, {"/ncc/db2/tmp", "/ncc/db2/tmp"},
82   |  * {"/usr/local/bin/pgpv", "/usr/local/bin/pgpv"}, {"/usr/local/bin/pgpk",
83   |  * "/usr/local/bin/pgpk"}, {"/ncc/db2/.pgp", "/ncc/db2/.pgp"},
84   |  * {"/var/qmail/bin/qmail-inject -fripe-dbm", "/var/qmail/bin/qmail-inject
85   |  * -fripe-dbm"}, {"8096", "8096"}, {"2097152", "2097152"}, {"2", "2"},
86   |  * {"ripe-dbm@ripe.net", "ripe-dbm@ripe.net"}, {"ripe-dbm@ripe.net",
87   |  * "ripe-dbm@ripe.net"}, {"auto-dbm@ripe.net", "auto-dbm@ripe.net"},
88   |  * {"nostrict", "nostrict"}, {"% No entries found for the selected
89   |  * source(s).", "% No entries found for the selected source(s)."}, {"Subject:
90   |  * RIPE RR: Addition of overlapping routes", "Subject: RIPE RR: Addition of
91   |  * overlapping routes"}, {"Subject: RIPE RR: Removal  of overlapping routes",
92   |  * "Subject: RIPE RR: Removal  of overlapping routes"}, {"The addition of
93   |  * your route object ... ", "The addition of your route object ... "}, {"The
94   |  * deletion of your route object ... ", "The deletion of your route object
95   |  * ... "}, {"created new overlaps with the following routes ...", "created
96   |  * new overlaps with the following routes ..."}, {"removed the overlaps with
97   |  * the following routes ...", "removed the overlaps with the following routes
98   |  * ..."}, {"Subject: RIPE RR: Addition of overlapping routes", "Subject: RIPE
99   |  * RR: Addition of overlapping routes"}, {"Subject: RIPE RR: Removal  of
100  |  * overlapping routes", "Subject: RIPE RR: Removal  of overlapping routes"},
101  |  * {"The addition of the route object ... ", "The addition of the route
102  |  * object ... "}, {"The deletion of the route object ... ", "The deletion of
103  |  * the route object ... "}, {"created new overlaps with your following routes
104  |  * ...", "created new overlaps with your following routes ..."}, {"removed
105  |  * the overlaps with your following routes ...", "removed the overlaps with
106  |  * your following routes ..."}, {"Your e-mail:", "Your e-mail:"}, {"From:
107  |  * RIPE Database Management <$HUMAILBOX>", "From: RIPE Database Management
108  |  * <$HUMAILBOX>"}, {"From: RIPE Database Management <$HUMAILBOX>", "From:
109  |  * RIPE Database Management <$HUMAILBOX>"}, {"Subject: SUCCEEDED: $SUBJECT",
110  |  * "Subject: SUCCEEDED: $SUBJECT"}, {"Help file requested so body of message
111  |  * ignored.", "Help file requested so body of message ignored."}, {"Objects
112  |  * that just generated a WARNING have been updated as shown.", "Objects that
113  |  * just generated a WARNING have been updated as shown."}, {"No errors were
114  |  * found in your database update.  Congratulations.", "No errors were found
115  |  * in your database update.  Congratulations."}, {"RIPE Database Maintenance
116  |  * Department (Automatic Section)", "RIPE Database Maintenance Department
117  |  * (Automatic Section)"}, {"This is to notify you that some object(s) in the
118  |  * RIPE database", "This is to notify you that some object(s) in the RIPE
119  |  * database"}, {"The update causing these changes had the following mail
120  |  * headers:", "The update causing these changes had the following mail
121  |  * headers:"}, {"The update causing these changes came from the following
122  |  * host:", "The update causing these changes came from the following host:"},
123  |  * {"From: RIPE Database Notifications <$HUMAILBOX>", "From: RIPE Database
124  |  * Notifications <$HUMAILBOX>"}, {"From: RIPE Database Maintainer Forwarding
125  |  * <$HUMAILBOX>", "From: RIPE Database Maintainer Forwarding <$HUMAILBOX>"},
126  |  * {"This is to notify you that some objects in which you are mentioned as",
127  |  * "This is to notify you that some objects in which you are mentioned as"},
128  |  * {"The mail message causing these failures had the following mail
129  |  * headers:", "The mail message causing these failures had the following mail
130  |  * headers:"}, {"The update causing these failures came from the following
131  |  * host:", "The update causing these failures came from the following
132  |  * host:"}, {"From: RIPE Database Maintainer Creation <$HUMAILBOX>", "From:
133  |  * RIPE Database Maintainer Creation <$HUMAILBOX>"}, {"A maintainer object is
134  |  * requested by:", "A maintainer object is requested by:"}, {"* A C C E S S D
135  |  * E N I E D *", "* A C C E S S    D E N I E D *"}, {"The object shown below
136  |  * is NOT in the RIPE database.", "The object shown below is NOT in the RIPE
137  |  * database."}, {"Referred query to host $REFERHOST at port $REFERPORT",
138  |  * "Referred query to host $REFERHOST at port $REFERPORT"}, {"Referral loop
139  |  * detected when querying ", "Referral loop detected when querying "},
140  |  * {"Referred query to host $REFERHOST at port $REFERPORT", "Referred query
141  |  * to host $REFERHOST at port $REFERPORT"}, {"Result TRUNCATED. Answer lenght
142  |  * exceeded limit.", "Result TRUNCATED. Answer lenght exceeded limit."},
143  |  * {"%%% End of referred query result", "%%% End of referred query result"},
144  |  * {"10", "10"}, {"2000", "2000"}, {"Copyright
145  |  * (c)1992/1993/1994/1995/1996/1997/1998/1999 by RIPE NCC ", "Copyright
146  |  * (c)1992/1993/1994/1995/1996/1997/1998/1999 by RIPE NCC "}, {"IE ie", "IE
147  |  * ie"} }; values_t locals[]  =  { {"43", &bport}, {"/ncc/db2/doc/HELP",
148  |  * "/ncc/db2/doc/HELP"}, {"% Rights restricted by copyright. See
149  |  * http://www.ripe.net/db/dbcopyright.html", "% Rights restricted by
150  |  * copyright. See http://www.ripe.net/db/dbcopyright.html"}, {"SourceList",
151  |  * NULL}, {"0", &testmode}, {"1Bt9RNSMWcA.Y", "1Bt9RNSMWcA.Y"},
152  |  * {"/ncc/db2/doc/WHOIS-HELP", "/ncc/db2/doc/WHOIS-HELP"},
153  |  * {"/ncc/db2/doc/AUTO-DBM-HELP", "/ncc/db2/doc/AUTO-DBM-HELP"},
154  |  * {"/ncc/db2/etc/attr-desc.config", "/ncc/db2/etc/attr-desc.config"},
155  |  * {"RIPE", "RIPE"}, {"RIPE          /ncc/db2/data/ripe/ripe.db SPLIT", "RIPE
156  |  * /ncc/db2/data/ripe/ripe.db         SPLIT"}, {"RIPE", "RIPE"},
157  |  * {"SourceList", NULL}, {"dbase", "dbase"}, {"/ncc/db2/log/qry/qrylog",
158  |  * "/ncc/db2/log/qry/qrylog"}, {"/ncc/db2/log/qry/qry2log",
159  |  * "/ncc/db2/log/qry/qry2log"}, {"/ncc/db2/log/err/errlog",
160  |  * "/ncc/db2/log/err/errlog"}, {"/ncc/db2/log/audit/auditlog",
161  |  * "/ncc/db2/log/audit/auditlog"}, {"/ncc/db2/log/upd", "/ncc/db2/log/upd"},
162  |  * {"/ncc/db2/log/ack", "/ncc/db2/log/ack"}, {"/ncc/db2/locks",
163  |  * "/ncc/db2/locks"}, {"whoisd.pid", "whoisd.pid"}, {"STOPUPDATES",
164  |  * "STOPUPDATES"}, {"CLEANDB.LOCK", "CLEANDB.LOCK"},
165  |  * {"/ncc/db2/serials/current", "/ncc/db2/serials/current"},
166  |  * {"/ncc/db2/serials/old", "/ncc/db2/serials/old"},
167  |  * {"/ncc/db2/serials/incoming", "/ncc/db2/serials/incoming"}, {"180",
168  |  * "180"}, {"RIPE-NCC-HM-MNT ", "RIPE-NCC-HM-MNT "}, {"127.0.0.1",
169  |  * "127.0.0.1"}, {"193.0.0.1[345678][0-9]", "193.0.0.1[345678][0-9]"},
170  |  * {"195.88.156.1", "195.88.156.1"}, {"/ncc/db2/tmp", "/ncc/db2/tmp"},
171  |  * {"/usr/local/bin/pgpv", "/usr/local/bin/pgpv"}, {"/usr/local/bin/pgpk",
172  |  * "/usr/local/bin/pgpk"}, {"/ncc/db2/.pgp", "/ncc/db2/.pgp"},
173  |  * {"/var/qmail/bin/qmail-inject -fripe-dbm", "/var/qmail/bin/qmail-inject
174  |  * -fripe-dbm"}, {"8096", "8096"}, {"2097152", "2097152"}, {"2", "2"},
175  |  * {"ripe-dbm@ripe.net", "ripe-dbm@ripe.net"}, {"ripe-dbm@ripe.net",
176  |  * "ripe-dbm@ripe.net"}, {"auto-dbm@ripe.net", "auto-dbm@ripe.net"},
177  |  * {"nostrict", "nostrict"}, {"% No entries found for the selected
178  |  * source(s).", "% No entries found for the selected source(s)."}, {"Subject:
179  |  * RIPE RR: Addition of overlapping routes", "Subject: RIPE RR: Addition of
180  |  * overlapping routes"}, {"Subject: RIPE RR: Removal  of overlapping routes",
181  |  * "Subject: RIPE RR: Removal  of overlapping routes"}, {"The addition of
182  |  * your route object ... ", "The addition of your route object ... "}, {"The
183  |  * deletion of your route object ... ", "The deletion of your route object
184  |  * ... "}, {"created new overlaps with the following routes ...", "created
185  |  * new overlaps with the following routes ..."}, {"removed the overlaps with
186  |  * the following routes ...", "removed the overlaps with the following routes
187  |  * ..."}, {"Subject: RIPE RR: Addition of overlapping routes", "Subject: RIPE
188  |  * RR: Addition of overlapping routes"}, {"Subject: RIPE RR: Removal  of
189  |  * overlapping routes", "Subject: RIPE RR: Removal  of overlapping routes"},
190  |  * {"The addition of the route object ... ", "The addition of the route
191  |  * object ... "}, {"The deletion of the route object ... ", "The deletion of
192  |  * the route object ... "}, {"created new overlaps with your following routes
193  |  * ...", "created new overlaps with your following routes ..."}, {"removed
194  |  * the overlaps with your following routes ...", "removed the overlaps with
195  |  * your following routes ..."}, {"Your e-mail:", "Your e-mail:"}, {"From:
196  |  * RIPE Database Management <$HUMAILBOX>", "From: RIPE Database Management
197  |  * <$HUMAILBOX>"}, {"From: RIPE Database Management <$HUMAILBOX>", "From:
198  |  * RIPE Database Management <$HUMAILBOX>"}, {"Subject: SUCCEEDED: $SUBJECT",
199  |  * "Subject: SUCCEEDED: $SUBJECT"}, {"Help file requested so body of message
200  |  * ignored.", "Help file requested so body of message ignored."}, {"Objects
201  |  * that just generated a WARNING have been updated as shown.", "Objects that
202  |  * just generated a WARNING have been updated as shown."}, {"No errors were
203  |  * found in your database update.  Congratulations.", "No errors were found
204  |  * in your database update.  Congratulations."}, {"RIPE Database Maintenance
205  |  * Department (Automatic Section)", "RIPE Database Maintenance Department
206  |  * (Automatic Section)"}, {"This is to notify you that some object(s) in the
207  |  * RIPE database", "This is to notify you that some object(s) in the RIPE
208  |  * database"}, {"The update causing these changes had the following mail
209  |  * headers:", "The update causing these changes had the following mail
210  |  * headers:"}, {"The update causing these changes came from the following
211  |  * host:", "The update causing these changes came from the following host:"},
212  |  * {"From: RIPE Database Notifications <$HUMAILBOX>", "From: RIPE Database
213  |  * Notifications <$HUMAILBOX>"}, {"From: RIPE Database Maintainer Forwarding
214  |  * <$HUMAILBOX>", "From: RIPE Database Maintainer Forwarding <$HUMAILBOX>"},
215  |  * {"This is to notify you that some objects in which you are mentioned as",
216  |  * "This is to notify you that some objects in which you are mentioned as"},
217  |  * {"The mail message causing these failures had the following mail
218  |  * headers:", "The mail message causing these failures had the following mail
219  |  * headers:"}, {"The update causing these failures came from the following
220  |  * host:", "The update causing these failures came from the following
221  |  * host:"}, {"From: RIPE Database Maintainer Creation <$HUMAILBOX>", "From:
222  |  * RIPE Database Maintainer Creation <$HUMAILBOX>"}, {"A maintainer object is
223  |  * requested by:", "A maintainer object is requested by:"}, {"* A C C E S S D
224  |  * E N I E D *", "* A C C E S S    D E N I E D *"}, {"The object shown below
225  |  * is NOT in the RIPE database.", "The object shown below is NOT in the RIPE
226  |  * database."}, {"Referred query to host $REFERHOST at port $REFERPORT",
227  |  * "Referred query to host $REFERHOST at port $REFERPORT"}, {"Referral loop
228  |  * detected when querying ", "Referral loop detected when querying "},
229  |  * {"Referred query to host $REFERHOST at port $REFERPORT", "Referred query
230  |  * to host $REFERHOST at port $REFERPORT"}, {"Result TRUNCATED. Answer lenght
231  |  * exceeded limit.", "Result TRUNCATED. Answer lenght exceeded limit."},
232  |  * {"%%% End of referred query result", "%%% End of referred query result"},
233  |  * {"10", "10"}, {"2000", "2000"}, {"Copyright
234  |  * (c)1992/1993/1994/1995/1996/1997/1998/1999 by RIPE NCC ", "Copyright
235  |  * (c)1992/1993/1994/1995/1996/1997/1998/1999 by RIPE NCC "}, {"IE ie", "IE
236  |  * ie"} };
237  |  */
238  | 
239  | /*
240  |  * ca_database_t ripe    =   { "rowan.ripe.net", "4343", "Idiot", "scramble",
241  |  * "RIPE6" };
242  |  * 
243  |  * ca_database_t arin    = {
244  |  * 
245  |  * "rowan", "2005", "dbint", "passwrd", "ARIN2" };
246  |  */
247  | 
248  | /*
249  |  * ca_database_t radb    = { "rowan", "default", "default", "default",
250  |  * "RADB1" };
251  |  */
252  | 
253  | /*
254  |  * ca_database_t radb = { ca_defHost, ca_defPort, ca_defUser, ca_defPassword,
255  |  * "RADB1"  };
256  |  */
257  | 
258  | /*
259  |  * ca_database_t radb = { CA_DEFHOST, CA_DEFPORT, CA_DEFUSER, CA_DEFPASSWORD,
260  |  * "RADB1"  };
261  |  * 
262  |  * ca_database_list_t ripeComponent = { "RIPE",  { "rowan.ripe.net", "4343",
263  |  * "Idiot", "scramble", "RIPE6" } };
264  |  * 
265  |  * ca_database_list_t arinComponent = { "ARIN", { "rowan", "2005", "dbint",
266  |  * "passwd", "ARIN2" } };
267  |  */
268  | 
269  | /*
270  |  * char ca_defHost[64] = "rowan"; char ca_defPort[16] = "43"; char
271  |  * ca_defUser[16] = "dbase"; char ca_defPassword[9] = "encrypt1"; char
272  |  * ca_defdbName[16] = "default-db";
273  |  */
274  | 
275  | /*
276  |  * ca_database_list_t radbComponent = { "RADB", { CA_DEFHOST, CA_DEFPORT,
277  |  * CA_DEFUSER, CA_DEFPASSWORD, "RADB1" } };
278  |  */
279  | 
280  | /*
281  |  * The test configuration file.
282  |  */
283  | const char *testFile = "test.config";
284  | const char *tempFile = "temp.config";
285  | const char *dictFile = "dictionary.txt";
286  | const char *confFile = "rip.config";
287  | 
288  | /*
289  |  * const char *confFile = "./dbupdate.conf";
290  |  */
291  | const char *sourcesFile = "sources.config";
292  | 
293  | values_t confVars[VARS];
294  | values_t globals[VARS];
295  | values_t locals[VARS];
296  | 
297  | /*
298  |  * We do not need this now; the dictionary is hardcoded.
299  |  * dict_t dictionary[VARS];
300  |  */
301  | 
302  | ca_dbSource_t *theSrc;
303  | 
304  | const char *configWarningStr = "Warning: undefined configuration variable:";
305  | const char *configError_1Str = "Error: Incomplete configuration file.  Was this intended ???\n";
306  | const char *configError_2Str = " configuration variables undefined.\n";
307  | const char *configVarChk_OK_Str = "..... mandatory variables check completed.\n";
308  |