From dfabc462b4ea9a568da0f1cbffe0fb8c8ef11823 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 20 Sep 2007 04:29:40 +0000 Subject: [PATCH] * Add CONF options for master user/pass * tools.c: fix some compiler warnings --- citadel/citadel.h | 34 +++--- citadel/control.c | 8 ++ citadel/modules/vandelay/serv_vandelay.c | 134 +---------------------- citadel/tools.c | 10 +- 4 files changed, 31 insertions(+), 155 deletions(-) diff --git a/citadel/citadel.h b/citadel/citadel.h index 26028aa53..b36762151 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -47,12 +47,12 @@ extern "C" { * usually more strict because you're not really supposed to dump/load and * upgrade at the same time. */ -#define REV_LEVEL 720 /* This version */ +#define REV_LEVEL 721 /* This version */ #define REV_MIN 591 /* Oldest compatible database */ -#define EXPORT_REV_MIN 706 /* Oldest compatible export files */ +#define EXPORT_REV_MIN 721 /* Oldest compatible export files */ -#define SERVER_TYPE 0 /* zero for stock Citadel; other developers please - obtain SERVER_TYPE codes for your implementations */ +#define SERVER_TYPE 0 /* zero for stock Citadel; other developers please + obtain SERVER_TYPE codes for your implementations */ /* Various length constants */ @@ -126,19 +126,19 @@ struct ctdluser { /* User record */ #include "dtds/user-defs.h" #include "undef_data.h" */ - int version; /* Cit vers. which created this rec */ - uid_t uid; /* Associate with a unix account? */ - char password[32]; /* password (for Citadel-only users)*/ - unsigned flags; /* See US_ flags below */ - long timescalled; /* Total number of logins */ - long posted; /* Number of messages posted (ever) */ - cit_uint8_t axlevel; /* Access level */ - long usernum; /* User number (never recycled) */ - time_t lastcall; /* Last time the user called */ - int USuserpurge; /* Purge time (in days) for user */ - char fullname[64]; /* Name for Citadel messages & mail */ - cit_uint8_t USscreenwidth; /* Screen width (for textmode users)*/ - cit_uint8_t USscreenheight; /* Screen height(for textmode users)*/ + int version; /* Cit vers. which created this rec */ + uid_t uid; /* Associate with a unix account? */ + char password[32]; /* password */ + unsigned flags; /* See US_ flags below */ + long timescalled; /* Total number of logins */ + long posted; /* Number of messages ever submitted */ + cit_uint8_t axlevel; /* Access level */ + long usernum; /* User number (never recycled) */ + time_t lastcall; /* Date/time of most recent login */ + int USuserpurge; /* Purge time (in days) for user */ + char fullname[64]; /* Display name (primary identifier) */ + cit_uint8_t USscreenwidth; /* Screen width (for textmode users) */ + cit_uint8_t USscreenheight; /* Screen height(for textmode users) */ }; diff --git a/citadel/control.c b/citadel/control.c index 710c38d63..d378f8e15 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -272,6 +272,8 @@ void cmd_conf(char *argbuf) cprintf("%s\n", config.c_funambol_source); cprintf("%s\n", config.c_funambol_auth); cprintf("%d\n", config.c_rbl_at_greeting); + cprintf("%s\n", config.c_master_user); + cprintf("%s\n", config.c_master_pass); cprintf("000\n"); } @@ -499,6 +501,12 @@ void cmd_conf(char *argbuf) case 57: config.c_rbl_at_greeting = atoi(buf); break; + case 58: + safestrncpy(config.c_master_user, buf, sizeof config.c_master_user); + break; + case 59: + safestrncpy(config.c_master_pass, buf, sizeof config.c_master_pass); + break; } ++a; } diff --git a/citadel/modules/vandelay/serv_vandelay.c b/citadel/modules/vandelay/serv_vandelay.c index 07dd5358c..5dbe7b4ee 100644 --- a/citadel/modules/vandelay/serv_vandelay.c +++ b/citadel/modules/vandelay/serv_vandelay.c @@ -287,79 +287,13 @@ void artv_do_export(void) { cprintf("version\n%d\n", REV_LEVEL); - /* export the config file */ + /* export the config file (this is done using x-macros) */ cprintf("config\n"); #include "artv_serialize.h" #include "dtds/config-defs.h" #include "undef_data.h" -/* - cprintf("%s\n", config.c_nodename); - cprintf("%s\n", config.c_fqdn); - cprintf("%s\n", config.c_humannode); - cprintf("%s\n", config.c_phonenum); - cprintf("%ld\n", (long)config.c_ctdluid); - cprintf("%d\n", config.c_creataide); - cprintf("%d\n", config.c_sleeping); - cprintf("%d\n", config.c_initax); - cprintf("%d\n", config.c_regiscall); - cprintf("%d\n", config.c_twitdetect); - cprintf("%s\n", config.c_twitroom); - cprintf("%s\n", config.c_moreprompt); - cprintf("%d\n", config.c_restrict); - cprintf("%s\n", config.c_site_location); - cprintf("%s\n", config.c_sysadm); - cprintf("%d\n", config.c_setup_level); - cprintf("%d\n", config.c_maxsessions); - cprintf("%d\n", config.c_port_number); - cprintf("%d\n", config.c_ep.expire_mode); - cprintf("%d\n", config.c_ep.expire_value); - cprintf("%d\n", config.c_userpurge); - cprintf("%d\n", config.c_roompurge); - cprintf("%s\n", config.c_logpages); - cprintf("%d\n", config.c_createax); - cprintf("%ld\n", config.c_maxmsglen); - cprintf("%d\n", config.c_min_workers); - cprintf("%d\n", config.c_max_workers); - cprintf("%d\n", config.c_pop3_port); - cprintf("%d\n", config.c_smtp_port); - cprintf("%d\n", config.c_purge_hour); - cprintf("%d\n", config.c_mbxep.expire_mode); - cprintf("%d\n", config.c_mbxep.expire_value); - cprintf("%s\n", config.c_ldap_host); - cprintf("%d\n", config.c_ldap_port); - cprintf("%s\n", config.c_ldap_base_dn); - cprintf("%s\n", config.c_ldap_bind_dn); - cprintf("%s\n", config.c_ldap_bind_pw); - cprintf("%s\n", config.c_ip_addr); - cprintf("%d\n", config.c_msa_port); - cprintf("%d\n", config.c_imaps_port); - cprintf("%d\n", config.c_pop3s_port); - cprintf("%d\n", config.c_smtps_port); - cprintf("%d\n", config.c_rfc822_strict_from); - cprintf("%d\n", config.c_aide_zap); - cprintf("%d\n", config.c_imap_port); - cprintf("%ld\n", config.c_net_freq); - cprintf("%d\n", config.c_disable_newu); - cprintf("%s\n", config.c_baseroom); - cprintf("%s\n", config.c_aideroom); - cprintf("%d\n", config.c_auto_cull); - cprintf("%d\n", config.c_instant_expunge); - cprintf("%d\n", config.c_allow_spoofing); - cprintf("%d\n", config.c_journal_email); - cprintf("%d\n", config.c_journal_pubmsgs); - cprintf("%s\n", config.c_journal_dest); - cprintf("%s\n", config.c_default_cal_zone); - cprintf("%d\n", config.c_pftcpdict_port); - cprintf("%d\n", config.c_managesieve_port); - cprintf("%d\n", config.c_auth_mode); - cprintf("%s\n", config.c_funambol_host); - cprintf("%d\n", config.c_funambol_port); - cprintf("%s\n", config.c_funambol_source); - cprintf("%s\n", config.c_funambol_auth); - cprintf("%d\n", config.c_rbl_at_greeting); -*/ /* Export the control file */ get_control(); cprintf("control\n"); @@ -391,72 +325,6 @@ void artv_import_config(void) { #include "dtds/config-defs.h" #include "undef_data.h" -/* - client_getln(config.c_nodename, sizeof config.c_nodename); - client_getln(config.c_fqdn, sizeof config.c_fqdn); - client_getln(config.c_humannode, sizeof config.c_humannode); - client_getln(config.c_phonenum, sizeof config.c_phonenum); - client_getln(buf, sizeof buf); config.c_ctdluid = atoi(buf); - client_getln(buf, sizeof buf); config.c_creataide = atoi(buf); - client_getln(buf, sizeof buf); config.c_sleeping = atoi(buf); - client_getln(buf, sizeof buf); config.c_initax = atoi(buf); - client_getln(buf, sizeof buf); config.c_regiscall = atoi(buf); - client_getln(buf, sizeof buf); config.c_twitdetect = atoi(buf); - client_getln(config.c_twitroom, sizeof config.c_twitroom); - client_getln(config.c_moreprompt, sizeof config.c_moreprompt); - client_getln(buf, sizeof buf); config.c_restrict = atoi(buf); - client_getln(config.c_site_location, sizeof config.c_site_location); - client_getln(config.c_sysadm, sizeof config.c_sysadm); - client_getln(buf, sizeof buf); config.c_setup_level = atoi(buf); - client_getln(buf, sizeof buf); config.c_maxsessions = atoi(buf); - client_getln(buf, sizeof buf); config.c_port_number = atoi(buf); - client_getln(buf, sizeof buf); config.c_ep.expire_mode = atoi(buf); - client_getln(buf, sizeof buf); config.c_ep.expire_value = atoi(buf); - client_getln(buf, sizeof buf); config.c_userpurge = atoi(buf); - client_getln(buf, sizeof buf); config.c_roompurge = atoi(buf); - client_getln(config.c_logpages, sizeof config.c_logpages); - client_getln(buf, sizeof buf); config.c_createax = atoi(buf); - client_getln(buf, sizeof buf); config.c_maxmsglen = atol(buf); - client_getln(buf, sizeof buf); config.c_min_workers = atoi(buf); - client_getln(buf, sizeof buf); config.c_max_workers = atoi(buf); - client_getln(buf, sizeof buf); config.c_pop3_port = atoi(buf); - client_getln(buf, sizeof buf); config.c_smtp_port = atoi(buf); - client_getln(buf, sizeof buf); config.c_purge_hour = atoi(buf); - client_getln(buf, sizeof buf); config.c_mbxep.expire_mode = atoi(buf); - client_getln(buf, sizeof buf); config.c_mbxep.expire_value = atoi(buf); - client_getln(config.c_ldap_host, sizeof config.c_ldap_host); - client_getln(buf, sizeof buf); config.c_ldap_port = atoi(buf); - client_getln(config.c_ldap_base_dn, sizeof config.c_ldap_base_dn); - client_getln(config.c_ldap_bind_dn, sizeof config.c_ldap_bind_dn); - client_getln(config.c_ldap_bind_pw, sizeof config.c_ldap_bind_pw); - client_getln(config.c_ip_addr, sizeof config.c_ip_addr); - client_getln(buf, sizeof buf); config.c_msa_port = atoi(buf); - client_getln(buf, sizeof buf); config.c_imaps_port = atoi(buf); - client_getln(buf, sizeof buf); config.c_pop3s_port = atoi(buf); - client_getln(buf, sizeof buf); config.c_smtps_port = atoi(buf); - client_getln(buf, sizeof buf); config.c_rfc822_strict_from = atoi(buf); - client_getln(buf, sizeof buf); config.c_aide_zap = atoi(buf); - client_getln(buf, sizeof buf); config.c_imap_port = atoi(buf); - client_getln(buf, sizeof buf); config.c_net_freq = atol(buf); - client_getln(buf, sizeof buf); config.c_disable_newu = atoi(buf); - client_getln(config.c_baseroom, sizeof config.c_baseroom); - client_getln(config.c_aideroom, sizeof config.c_aideroom); - client_getln(buf, sizeof buf); config.c_auto_cull = atoi(buf); - client_getln(buf, sizeof buf); config.c_instant_expunge = atoi(buf); - client_getln(buf, sizeof buf); config.c_allow_spoofing = atoi(buf); - client_getln(buf, sizeof buf); config.c_journal_email = atoi(buf); - client_getln(buf, sizeof buf); config.c_journal_pubmsgs = atoi(buf); - client_getln(config.c_journal_dest, sizeof config.c_journal_dest); - client_getln(config.c_default_cal_zone, sizeof config.c_default_cal_zone); - client_getln(buf, sizeof buf); config.c_pftcpdict_port = atoi(buf); - client_getln(buf, sizeof buf); config.c_managesieve_port = atoi(buf); - client_getln(buf, sizeof buf); config.c_auth_mode = atoi(buf); - client_getln(config.c_funambol_host, sizeof config.c_funambol_host); - client_getln(buf, sizeof buf); config.c_funambol_port = atoi(buf); - client_getln(config.c_funambol_source, sizeof config.c_funambol_source); - client_getln(config.c_funambol_auth, sizeof config.c_funambol_auth); - client_getln(buf, sizeof buf); config.c_rbl_at_greeting = atoi(buf); -*/ config.c_enable_fulltext = 0; /* always disable */ put_config(); lprintf(CTDL_INFO, "Imported config file\n"); diff --git a/citadel/tools.c b/citadel/tools.c index 7016d96b0..4e1129a73 100644 --- a/citadel/tools.c +++ b/citadel/tools.c @@ -160,8 +160,8 @@ long extract_token(char *dest, const char *source, int parmnum, char separator, * / long extract_token(char *dest, const char *source, int parmnum, char separator, int maxlen) { - char *d; //* dest * / - const char *s; //* source * / + char *d; // dest + const char *s; // source int count = 0; int len = 0; @@ -170,10 +170,10 @@ long extract_token(char *dest, const char *source, int parmnum, char separator, lprintf (CTDL_DEBUG, "test >: n: %d sep: %c source: %s \n willi \n", parmnum, separator, source); strcpy(dest, ""); - //* Locate desired parameter * / + // Locate desired parameter s = source; while (count < parmnum) { - //* End of string, bail! * / + // End of string, bail! if (!*s) { s = NULL; break; @@ -185,7 +185,7 @@ long extract_token(char *dest, const char *source, int parmnum, char separator, } if (!s) { lprintf (CTDL_DEBUG,"test