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