Initial version of new room sharing poller. I don't really like this because it...
[citadel.git] / citadel / config.c
1 /*
2  * Read and write the citadel.config file
3  *
4  * Copyright (c) 1987-2017 by the citadel.org team
5  *
6  * This program is open source software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 3.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  */
14
15 #include "sysdep.h"
16 #include <stdlib.h>
17 #include <unistd.h>
18 #include <stdio.h>
19 #include <netdb.h>
20 #include <sys/utsname.h>
21 #include <libcitadel.h>
22 #include <assert.h>
23 #include "config.h"
24 #include "ctdl_module.h"
25
26 long config_msgnum = 0;
27 HashList *ctdlconfig = NULL;    // new configuration
28
29
30 void config_warn_if_port_unset(char *key, int default_port)                     \
31 {
32         int p = CtdlGetConfigInt(key);
33         if ((p < -1) || (p == 0) || (p > UINT16_MAX))
34         {
35                 syslog(LOG_ERR,
36                         "config: setting %s is not -1 (disabled) or a valid TCP-Port - check your config! Default setting is: %d",
37                         key, default_port
38                 );
39         }
40 }
41
42
43 void config_warn_if_empty(char *key)
44 {
45         if (IsEmptyStr(CtdlGetConfigStr(key)))
46         {
47                 syslog(LOG_ERR, "config: setting %s is empty, but must not - check your config!", key);
48         }
49 }
50
51
52 void validate_config(void) {
53
54         /*
55          * these shouldn't be empty
56          */
57         config_warn_if_empty("c_fqdn");
58         config_warn_if_empty("c_baseroom");
59         config_warn_if_empty("c_aideroom");
60         config_warn_if_empty("c_twitroom");
61         config_warn_if_empty("c_nodename");
62         config_warn_if_empty("c_default_cal_zone");
63
64         /*
65          * Sanity check for port bindings
66          */
67         config_warn_if_port_unset("c_smtp_port", 25);
68         config_warn_if_port_unset("c_pop3_port", 110);
69         config_warn_if_port_unset("c_imap_port", 143);
70         config_warn_if_port_unset("c_msa_port", 587);
71         config_warn_if_port_unset("c_port_number", 504);
72         config_warn_if_port_unset("c_smtps_port", 465);
73         config_warn_if_port_unset("c_pop3s_port", 995);
74         config_warn_if_port_unset("c_imaps_port", 993);
75         config_warn_if_port_unset("c_pftcpdict_port", -1);
76         config_warn_if_port_unset("c_managesieve_port", 2020);
77         config_warn_if_port_unset("c_xmpp_c2s_port", 5222);
78         config_warn_if_port_unset("c_xmpp_s2s_port", 5269);
79         config_warn_if_port_unset("c_nntp_port", 119);
80         config_warn_if_port_unset("c_nntps_port", 563);
81
82         if (getpwuid(ctdluid) == NULL) {
83                 syslog(LOG_ERR, "config: UID (%d) citadel is configured to use is not defined in your system (/etc/passwd?)!", ctdluid);
84         }
85 }
86
87
88 /*
89  * Put some sane default values into our configuration.  Some will be overridden when we run setup.
90  */
91 void brand_new_installation_set_defaults(void) {
92
93         struct utsname my_utsname;
94         struct hostent *he;
95         char detected_hostname[256];
96
97         /* Determine our host name, in case we need to use it as a default */
98         uname(&my_utsname);
99
100         /* set some sample/default values in place of blanks... */
101         extract_token(detected_hostname, my_utsname.nodename, 0, '.', sizeof detected_hostname);
102         CtdlSetConfigStr("c_nodename", detected_hostname);
103
104         if ((he = gethostbyname(my_utsname.nodename)) != NULL) {
105                 CtdlSetConfigStr("c_fqdn", he->h_name);
106         }
107         else {
108                 CtdlSetConfigStr("c_fqdn", my_utsname.nodename);
109         }
110
111         CtdlSetConfigStr("c_humannode",         "Citadel Server");
112         CtdlSetConfigInt("c_initax",            4);
113         CtdlSetConfigStr("c_moreprompt",        "<more>");
114         CtdlSetConfigStr("c_twitroom",          "Trashcan");
115         CtdlSetConfigStr("c_baseroom",          BASEROOM);
116         CtdlSetConfigStr("c_aideroom",          "Aide");
117         CtdlSetConfigInt("c_sleeping",          900);
118
119         if (CtdlGetConfigInt("c_createax") == 0) {
120                 CtdlSetConfigInt("c_createax", 3);
121         }
122
123         /*
124          * Default port numbers for various services
125          */
126         CtdlSetConfigInt("c_port_number",       504);
127         CtdlSetConfigInt("c_smtp_port",         25);
128         CtdlSetConfigInt("c_pop3_port",         110);
129         CtdlSetConfigInt("c_imap_port",         143);
130         CtdlSetConfigInt("c_msa_port",          587);
131         CtdlSetConfigInt("c_smtps_port",        465);
132         CtdlSetConfigInt("c_pop3s_port",        995);
133         CtdlSetConfigInt("c_imaps_port",        993);
134         CtdlSetConfigInt("c_pftcpdict_port",    -1);
135         CtdlSetConfigInt("c_managesieve_port",  2020);
136         CtdlSetConfigInt("c_xmpp_c2s_port",     5222);
137         CtdlSetConfigInt("c_xmpp_s2s_port",     5269);
138         CtdlSetConfigInt("c_nntp_port",         119);
139         CtdlSetConfigInt("c_nntps_port",        563);
140
141         /*
142          * Prevent the "new installation, set defaults" behavior from occurring again
143          */
144         CtdlSetConfigLong("c_config_created_or_migrated", (long)time(NULL));
145 }
146
147
148 /*
149  * Migrate a supplied legacy configuration to the new in-db format.
150  * No individual site should ever have to do this more than once.
151  */
152 void migrate_legacy_config(struct legacy_config *lconfig)
153 {
154         CtdlSetConfigStr(       "c_nodename"            ,       lconfig->c_nodename             );
155         CtdlSetConfigStr(       "c_fqdn"                ,       lconfig->c_fqdn                 );
156         CtdlSetConfigStr(       "c_humannode"           ,       lconfig->c_humannode            );
157         CtdlSetConfigInt(       "c_creataide"           ,       lconfig->c_creataide            );
158         CtdlSetConfigInt(       "c_sleeping"            ,       lconfig->c_sleeping             );
159         CtdlSetConfigInt(       "c_initax"              ,       lconfig->c_initax               );
160         CtdlSetConfigInt(       "c_regiscall"           ,       lconfig->c_regiscall            );
161         CtdlSetConfigInt(       "c_twitdetect"          ,       lconfig->c_twitdetect           );
162         CtdlSetConfigStr(       "c_twitroom"            ,       lconfig->c_twitroom             );
163         CtdlSetConfigStr(       "c_moreprompt"          ,       lconfig->c_moreprompt           );
164         CtdlSetConfigInt(       "c_restrict"            ,       lconfig->c_restrict             );
165         CtdlSetConfigStr(       "c_site_location"       ,       lconfig->c_site_location        );
166         CtdlSetConfigStr(       "c_sysadm"              ,       lconfig->c_sysadm               );
167         CtdlSetConfigInt(       "c_maxsessions"         ,       lconfig->c_maxsessions          );
168         CtdlSetConfigStr(       "c_ip_addr"             ,       lconfig->c_ip_addr              );
169         CtdlSetConfigInt(       "c_port_number"         ,       lconfig->c_port_number          );
170         CtdlSetConfigInt(       "c_ep_mode"             ,       lconfig->c_ep.expire_mode       );
171         CtdlSetConfigInt(       "c_ep_value"            ,       lconfig->c_ep.expire_value      );
172         CtdlSetConfigInt(       "c_userpurge"           ,       lconfig->c_userpurge            );
173         CtdlSetConfigInt(       "c_roompurge"           ,       lconfig->c_roompurge            );
174         CtdlSetConfigStr(       "c_logpages"            ,       lconfig->c_logpages             );
175         CtdlSetConfigInt(       "c_createax"            ,       lconfig->c_createax             );
176         CtdlSetConfigLong(      "c_maxmsglen"           ,       lconfig->c_maxmsglen            );
177         CtdlSetConfigInt(       "c_min_workers"         ,       lconfig->c_min_workers          );
178         CtdlSetConfigInt(       "c_max_workers"         ,       lconfig->c_max_workers          );
179         CtdlSetConfigInt(       "c_pop3_port"           ,       lconfig->c_pop3_port            );
180         CtdlSetConfigInt(       "c_smtp_port"           ,       lconfig->c_smtp_port            );
181         CtdlSetConfigInt(       "c_rfc822_strict_from"  ,       lconfig->c_rfc822_strict_from   );
182         CtdlSetConfigInt(       "c_aide_zap"            ,       lconfig->c_aide_zap             );
183         CtdlSetConfigInt(       "c_imap_port"           ,       lconfig->c_imap_port            );
184         CtdlSetConfigLong(      "c_net_freq"            ,       lconfig->c_net_freq             );
185         CtdlSetConfigInt(       "c_disable_newu"        ,       lconfig->c_disable_newu         );
186         CtdlSetConfigInt(       "c_enable_fulltext"     ,       lconfig->c_enable_fulltext      );
187         CtdlSetConfigStr(       "c_baseroom"            ,       lconfig->c_baseroom             );
188         CtdlSetConfigStr(       "c_aideroom"            ,       lconfig->c_aideroom             );
189         CtdlSetConfigInt(       "c_purge_hour"          ,       lconfig->c_purge_hour           );
190         CtdlSetConfigInt(       "c_mbxep_mode"          ,       lconfig->c_mbxep.expire_mode    );
191         CtdlSetConfigInt(       "c_mbxep_value"         ,       lconfig->c_mbxep.expire_value   );
192         CtdlSetConfigStr(       "c_ldap_host"           ,       lconfig->c_ldap_host            );
193         CtdlSetConfigInt(       "c_ldap_port"           ,       lconfig->c_ldap_port            );
194         CtdlSetConfigStr(       "c_ldap_base_dn"        ,       lconfig->c_ldap_base_dn         );
195         CtdlSetConfigStr(       "c_ldap_bind_dn"        ,       lconfig->c_ldap_bind_dn         );
196         CtdlSetConfigStr(       "c_ldap_bind_pw"        ,       lconfig->c_ldap_bind_pw         );
197         CtdlSetConfigInt(       "c_msa_port"            ,       lconfig->c_msa_port             );
198         CtdlSetConfigInt(       "c_imaps_port"          ,       lconfig->c_imaps_port           );
199         CtdlSetConfigInt(       "c_pop3s_port"          ,       lconfig->c_pop3s_port           );
200         CtdlSetConfigInt(       "c_smtps_port"          ,       lconfig->c_smtps_port           );
201         CtdlSetConfigInt(       "c_auto_cull"           ,       lconfig->c_auto_cull            );
202         CtdlSetConfigInt(       "c_allow_spoofing"      ,       lconfig->c_allow_spoofing       );
203         CtdlSetConfigInt(       "c_journal_email"       ,       lconfig->c_journal_email        );
204         CtdlSetConfigInt(       "c_journal_pubmsgs"     ,       lconfig->c_journal_pubmsgs      );
205         CtdlSetConfigStr(       "c_journal_dest"        ,       lconfig->c_journal_dest         );
206         CtdlSetConfigStr(       "c_default_cal_zone"    ,       lconfig->c_default_cal_zone     );
207         CtdlSetConfigInt(       "c_pftcpdict_port"      ,       lconfig->c_pftcpdict_port       );
208         CtdlSetConfigInt(       "c_managesieve_port"    ,       lconfig->c_managesieve_port     );
209         CtdlSetConfigInt(       "c_auth_mode"           ,       lconfig->c_auth_mode            );
210         CtdlSetConfigStr(       "c_funambol_host"       ,       lconfig->c_funambol_host        );
211         CtdlSetConfigInt(       "c_funambol_port"       ,       lconfig->c_funambol_port        );
212         CtdlSetConfigStr(       "c_funambol_source"     ,       lconfig->c_funambol_source      );
213         CtdlSetConfigStr(       "c_funambol_auth"       ,       lconfig->c_funambol_auth        );
214         CtdlSetConfigInt(       "c_rbl_at_greeting"     ,       lconfig->c_rbl_at_greeting      );
215         CtdlSetConfigStr(       "c_master_user"         ,       lconfig->c_master_user          );
216         CtdlSetConfigStr(       "c_master_pass"         ,       lconfig->c_master_pass          );
217         CtdlSetConfigStr(       "c_pager_program"       ,       lconfig->c_pager_program        );
218         CtdlSetConfigInt(       "c_imap_keep_from"      ,       lconfig->c_imap_keep_from       );
219         CtdlSetConfigInt(       "c_xmpp_c2s_port"       ,       lconfig->c_xmpp_c2s_port        );
220         CtdlSetConfigInt(       "c_xmpp_s2s_port"       ,       lconfig->c_xmpp_s2s_port        );
221         CtdlSetConfigLong(      "c_pop3_fetch"          ,       lconfig->c_pop3_fetch           );
222         CtdlSetConfigLong(      "c_pop3_fastest"        ,       lconfig->c_pop3_fastest         );
223         CtdlSetConfigInt(       "c_spam_flag_only"      ,       lconfig->c_spam_flag_only       );
224         CtdlSetConfigInt(       "c_guest_logins"        ,       lconfig->c_guest_logins         );
225         CtdlSetConfigInt(       "c_nntp_port"           ,       lconfig->c_nntp_port            );
226         CtdlSetConfigInt(       "c_nntps_port"          ,       lconfig->c_nntps_port           );
227 }
228
229
230 /*
231  * Called during the initialization of Citadel server.
232  * It verifies the system's integrity and reads citadel.config into memory.
233  */
234 void initialize_config_system(void) {
235         FILE *cfp;
236         int rv;
237         struct legacy_config lconfig;   // legacy configuration
238         ctdlconfig = NewHash(1, NULL);  // set up the real config system
239
240         /* Ensure that we are linked to the correct version of libcitadel */
241         if (libcitadel_version_number() < LIBCITADEL_VERSION_NUMBER) {
242                 fprintf(stderr, "You are running libcitadel version %d\n", libcitadel_version_number());
243                 fprintf(stderr, "citserver was compiled against version %d\n", LIBCITADEL_VERSION_NUMBER);
244                 exit(CTDLEXIT_LIBCITADEL);
245         }
246
247         if (chdir(ctdl_bbsbase_dir) != 0) {
248                 fprintf(stderr,
249                         "This program could not be started.\nUnable to change directory to %s\nError: %s\n",
250                         ctdl_bbsbase_dir,
251                         strerror(errno)
252                 );
253                 exit(CTDLEXIT_HOME);
254         }
255
256         memset(&lconfig, 0, sizeof(struct legacy_config));
257         cfp = fopen(file_citadel_config, "rb");
258         if (cfp != NULL) {
259                 if (CtdlGetConfigLong("c_config_created_or_migrated") > 0) {
260                         fprintf(stderr, "Citadel Server found BOTH legacy and new configurations present.\n");
261                         fprintf(stderr, "Exiting to prevent data corruption.\n");
262                         exit(CTDLEXIT_CONFIG);
263                 }
264                 rv = fread((char *) &lconfig, sizeof(struct legacy_config), 1, cfp);
265                 if (rv != 1)
266                 {
267                         fprintf(stderr, 
268                                 "Warning: Found a legacy config file %s has unexpected size. \n",
269                                 file_citadel_config
270                         );
271                 }
272
273                 migrate_legacy_config(&lconfig);
274
275                 fclose(cfp);
276                 if (unlink(file_citadel_config) != 0) {
277                         fprintf(stderr, "Unable to remove legacy config file %s after migrating it.\n", file_citadel_config);
278                         fprintf(stderr, "Exiting to prevent data corruption.\n");
279                         exit(CTDLEXIT_CONFIG);
280                 }
281
282                 /*
283                  * Prevent migration/initialization from happening again.
284                  */
285                 CtdlSetConfigLong("c_config_created_or_migrated", (long)time(NULL));
286
287         }
288
289         /* New installation?  Set up configuration */
290         if (CtdlGetConfigLong("c_config_created_or_migrated") <= 0) {
291                 brand_new_installation_set_defaults();
292         }
293
294         /* Only allow LDAP auth mode if we actually have LDAP support */
295 #ifndef HAVE_LDAP
296         if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) {
297                 fprintf(stderr, "Your system is configured for LDAP authentication,\n"
298                                 "but you are running a server built without OpenLDAP support.\n");
299                 exit(CTDL_EXIT_UNSUP_AUTH);
300         }
301 #endif
302
303         /* Default maximum message length is 10 megabytes.  This is site
304          * configurable.  Also check to make sure the limit has not been
305          * set below 8192 bytes.
306          */
307         if (CtdlGetConfigLong("c_maxmsglen") <= 0)      CtdlSetConfigLong("c_maxmsglen", 10485760);
308         if (CtdlGetConfigLong("c_maxmsglen") < 8192)    CtdlSetConfigLong("c_maxmsglen", 8192);
309
310         /*
311          * Default lower and upper limits on number of worker threads
312          */
313         if (CtdlGetConfigInt("c_min_workers") < 5)      CtdlSetConfigInt("c_min_workers", 5);   // min
314         if (CtdlGetConfigInt("c_max_workers") == 0)     CtdlSetConfigInt("c_max_workers", 256); // default max
315         if (CtdlGetConfigInt("c_max_workers") < CtdlGetConfigInt("c_min_workers")) {
316                 CtdlSetConfigInt("c_max_workers", CtdlGetConfigInt("c_min_workers"));           // max >= min
317         }
318
319         /* Networking more than once every five minutes just isn't sane */
320         if (CtdlGetConfigLong("c_net_freq") == 0)       CtdlSetConfigLong("c_net_freq", 3600);  // once per hour default
321         if (CtdlGetConfigLong("c_net_freq") < 300)      CtdlSetConfigLong("c_net_freq", 300);   // minimum 5 minutes
322
323         /* Same goes for POP3 */
324         if (CtdlGetConfigLong("c_pop3_fetch") == 0)     CtdlSetConfigLong("c_pop3_fetch", 3600);        // once per hour default
325         if (CtdlGetConfigLong("c_pop3_fetch") < 300)    CtdlSetConfigLong("c_pop3_fetch", 300);         // 5 minutes min
326         if (CtdlGetConfigLong("c_pop3_fastest") == 0)   CtdlSetConfigLong("c_pop3_fastest", 3600);      // once per hour default
327         if (CtdlGetConfigLong("c_pop3_fastest") < 300)  CtdlSetConfigLong("c_pop3_fastest", 300);       // 5 minutes min
328
329         /* "create new user" only works with native authentication mode */
330         if (CtdlGetConfigInt("c_auth_mode") != AUTHMODE_NATIVE) {
331                 CtdlSetConfigInt("c_disable_newu", 1);
332         }
333 }
334
335
336 /*
337  * Called when Citadel server is shutting down.
338  * Clears out the config hash table.
339  */
340 void shutdown_config_system(void) 
341 {
342         DeleteHash(&ctdlconfig);
343 }
344
345
346 /*
347  * Set a system config value.  Simple key/value here.
348  */
349 void CtdlSetConfigStr(char *key, char *value)
350 {
351         int key_len = strlen(key);
352         int value_len = strlen(value);
353
354         /* Save it in memory */
355         Put(ctdlconfig, key, key_len, strdup(value), NULL);
356
357         /* Also write it to the config database */
358
359         int dbv_size = key_len + value_len + 2;
360         char *dbv = malloc(dbv_size);
361         strcpy(dbv, key);
362         strcpy(&dbv[key_len + 1], value);
363         cdb_store(CDB_CONFIG, key, key_len, dbv, dbv_size);
364         free(dbv);
365 }
366
367
368 /*
369  * Set a numeric system config value (long integer)
370  */
371 void CtdlSetConfigLong(char *key, long value)
372 {
373         char longstr[256];
374         sprintf(longstr, "%ld", value);
375         CtdlSetConfigStr(key, longstr);
376 }
377
378
379 /*
380  * Set a numeric system config value (integer)
381  */
382 void CtdlSetConfigInt(char *key, int value)
383 {
384         char intstr[256];
385         sprintf(intstr, "%d", value);
386         CtdlSetConfigStr(key, intstr);
387 }
388
389
390 /*
391  * Delete a system config value.
392  */
393 void CtdlDelConfig(char *key)
394 {
395         int key_len = strlen(key);
396
397         if (IsEmptyStr(key)) return;
398
399         /* Delete from the database. */
400         cdb_delete(CDB_CONFIG, key, key_len);
401
402         /* Delete from the in-memory cache */
403         HashPos *Pos = GetNewHashPos(ctdlconfig, 1);
404         if (GetHashPosFromKey(ctdlconfig, key, key_len, Pos)) {
405                 DeleteEntryFromHash(ctdlconfig, Pos);
406         }
407         DeleteHashPos(&Pos);
408
409         assert(Pos == NULL);    // no memory leaks allowed
410 }
411
412
413 /*
414  * Fetch a system config value.  Caller does *not* own the returned value and may not alter it.
415  */
416 char *CtdlGetConfigStr(char *key)
417 {
418         char *value = NULL;
419         struct cdbdata *cdb;
420         int key_len = strlen(key);
421
422         if (IsEmptyStr(key)) return(NULL);
423
424         /* First look in memory */
425         if (GetHash(ctdlconfig, key, key_len, (void *)&value))
426         {
427                 return value;
428         }
429
430         /* Then look in the database. */
431
432         cdb = cdb_fetch(CDB_CONFIG, key, key_len);
433
434         if (cdb == NULL) {      /* nope, not there either. */
435                 return(NULL);
436         }
437
438         /* Got it.  Save it in memory for the next fetch. */
439         value = strdup(cdb->ptr + key_len + 1);         /* The key was stored there too; skip past it */
440         cdb_free(cdb);
441         Put(ctdlconfig, key, key_len, value, NULL);
442         return value;
443 }
444
445
446 /*
447  * Fetch a system config value - integer
448  */
449 int CtdlGetConfigInt(char *key)
450 {
451         char *s = CtdlGetConfigStr(key);
452         if (s) return atoi(s);
453         return 0;
454 }
455
456
457 /*
458  * Fetch a system config value - long integer
459  */
460 long CtdlGetConfigLong(char *key)
461 {
462         char *s = CtdlGetConfigStr(key);
463         if (s) return atol(s);
464         return 0;
465 }
466
467
468 void CtdlGetSysConfigBackend(long msgnum, void *userdata) {
469         config_msgnum = msgnum;
470 }
471
472
473 char *CtdlGetSysConfig(char *sysconfname) {
474         char hold_rm[ROOMNAMELEN];
475         long msgnum;
476         char *conf;
477         struct CtdlMessage *msg;
478         char buf[SIZ];
479         
480         strcpy(hold_rm, CC->room.QRname);
481         if (CtdlGetRoom(&CC->room, SYSCONFIGROOM) != 0) {
482                 CtdlGetRoom(&CC->room, hold_rm);
483                 return NULL;
484         }
485
486         /* We want the last (and probably only) config in this room */
487         begin_critical_section(S_CONFIG);
488         config_msgnum = (-1L);
489         CtdlForEachMessage(MSGS_LAST, 1, NULL, sysconfname, NULL,
490                            CtdlGetSysConfigBackend, NULL);
491         msgnum = config_msgnum;
492         end_critical_section(S_CONFIG);
493
494         if (msgnum < 0L) {
495                 conf = NULL;
496         }
497         else {
498                 msg = CtdlFetchMessage(msgnum, 1, 1);
499                 if (msg != NULL) {
500                         conf = strdup(msg->cm_fields[eMesageText]);
501                         CM_Free(msg);
502                 }
503                 else {
504                         conf = NULL;
505                 }
506         }
507
508         CtdlGetRoom(&CC->room, hold_rm);
509
510         if (conf != NULL) do {
511                         extract_token(buf, conf, 0, '\n', sizeof buf);
512                         strcpy(conf, &conf[strlen(buf)+1]);
513                 } while ( (!IsEmptyStr(conf)) && (!IsEmptyStr(buf)) );
514
515         return(conf);
516 }
517
518
519 void CtdlPutSysConfig(char *sysconfname, char *sysconfdata) {
520         CtdlWriteObject(SYSCONFIGROOM, sysconfname, sysconfdata, (strlen(sysconfdata)+1), NULL, 0, 1, 0);
521 }