/*
* Configuration screens that are part of the text mode client.
*
- * Copyright (c) 1987-2012 by the citadel.org team
+ * Copyright (c) 1987-2018 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3.
#include <stdarg.h>
#include <libcitadel.h>
#include "sysdep.h"
-///#include "citadel.h"
#include "citadel_ipc.h"
#include "citadel_decls.h"
#include "tuiconfig.h"
#include "messages.h"
#include "routines.h"
#include "commands.h"
-///#ifndef HAVE_SNPRINTF
-///#include "snprintf.h"
-///#endif
#include "screen.h"
/* work around solaris include files */
/* Security parameters */
- snprintf(sc[7], sizeof sc[7], "%d", (boolprompt(
- "Require registration for new users",
- atoi(&sc[7][0]))));
- snprintf(sc[29], sizeof sc[29], "%d", (boolprompt(
- "Disable self-service user account creation",
- atoi(&sc[29][0]))));
+ snprintf(sc[7], sizeof sc[7], "%d", (boolprompt("Require registration for new users", atoi(&sc[7][0]))));
+ snprintf(sc[29], sizeof sc[29], "%d", (boolprompt("Disable self-service user account creation", atoi(&sc[29][0]))));
strprompt("Initial access level for new users", &sc[6][0], 1);
strprompt("Access level required to create rooms", &sc[19][0], 1);
- snprintf(sc[67], sizeof sc[67], "%d", (boolprompt(
- "Allow anonymous guest logins",
- atoi(&sc[67][0]))));
+ snprintf(sc[67], sizeof sc[67], "%d", (boolprompt("Allow anonymous guest logins", atoi(&sc[67][0]))));
snprintf(sc[4], sizeof sc[4], "%d", (boolprompt(
- "Automatically give room aide privs to a user who creates a private room",
+ "Automatically give room admin privs to a user who creates a private room",
atoi(&sc[4][0]))));
snprintf(sc[8], sizeof sc[8], "%d", (boolprompt(
"Restrict Internet mail to only those with that privilege",
atoi(&sc[11][0]))));
snprintf(sc[26], sizeof sc[26], "%d", (boolprompt(
- "Allow Aides to Zap (forget) rooms",
+ "Allow admins to Zap (forget) rooms",
atoi(&sc[26][0]))));
if (!IsEmptyStr(&sc[18][0])) {
strprompt("SMTP MTA server port (-1 to disable)", &sc[24][0], 5);
strprompt("SMTP MSA server port (-1 to disable)", &sc[38][0], 5);
strprompt("SMTPS server port (-1 to disable)", &sc[41][0], 5);
+ strprompt("NNTP server port (-1 to disable)", &sc[70][0], 5);
+ strprompt("NNTPS server port (-1 to disable)", &sc[71][0], 5);
strprompt("Postfix TCP Dictionary Port server port (-1 to disable)", &sc[50][0], 5);
strprompt("ManageSieve server port (-1 to disable)", &sc[51][0], 5);
*/
a = atoi(sc[25]);
a = (a ? 0 : 1);
- a = boolprompt("Correct forged From: lines during authenticated SMTP",
- a);
+ a = boolprompt("Correct forged From: lines during authenticated SMTP", a);
a = (a ? 0 : 1);
snprintf(sc[25], sizeof sc[25], "%d", a);
snprintf(sc[57], sizeof sc[57], "%d", (boolprompt(
"Perform RBL checks at greeting instead of after RCPT",
atoi(&sc[57][0]))));
- snprintf(sc[44], sizeof sc[44], "%d", (boolprompt(
- "Instantly expunge deleted IMAP messages",
- atoi(&sc[44][0]))));
/* LDAP settings */
if (ipc->ServInfo.supports_ldap) {
a = (a ? 1 : 0); /* Set only to 1 or 0 */
a = boolprompt("Do you want to configure LDAP authentication?", a);
if (a) {
- strprompt("Host name of LDAP server",
- &sc[32][0], 127);
- strprompt("Port number of LDAP service",
- &sc[33][0], 5);
+ strprompt("Host name of LDAP server", &sc[32][0], 127);
+ strprompt("Port number of LDAP service", &sc[33][0], 5);
strprompt("Base DN", &sc[34][0], 255);
strprompt("Bind DN (or blank for anonymous bind)", &sc[35][0], 255);
strprompt("Password for bind DN (or blank for anonymous bind)", &sc[36][0], 255);
&sc[48][0], 127);
}
- /* Funambol push stuff */
- int yes_funambol = 0;
- if (strlen(sc[53]) > 0) yes_funambol = 1;
- yes_funambol = boolprompt("Connect to an external Funambol sync server", yes_funambol);
- if (yes_funambol) {
- strprompt("Funambol server (blank to disable)", &sc[53][0], 63);
- strprompt("Funambol server port", &sc[54][0], 5);
- strprompt("Funambol sync source", &sc[55][0], 63);
- strprompt("Funambol authentication details (user:pass in Base64)", &sc[56][0],63);
- }
- else {
- sc[53][0] = 0;
- sc[54][0] = 0;
- sc[55][0] = 0;
- sc[56][0] = 0;
- }
+ /* No more Funambol */
+ sc[53][0] = 0;
+ sc[54][0] = 0;
+ sc[55][0] = 0;
+ sc[56][0] = 0;
/* External pager stuff */
int yes_pager = 0;
keyopt(" <1> localhost (Alias for this computer)\n");
keyopt(" <2> smart host (Forward all outbound mail to this host)\n");
keyopt(" <3> fallback host (Send mail to this host only if direct delivery fails)\n");
- keyopt(" <4> directory (Consult the Global Address Book)\n");
- keyopt(" <5> SpamAssassin (Address of SpamAssassin server)\n");
- keyopt(" <6> RBL (domain suffix of spam hunting RBL)\n");
- keyopt(" <7> masq domains (Domains as which users are allowed to masquerade)\n");
- keyopt(" <8> ClamAV (Address of ClamAV clamd server)\n");
+ keyopt(" <4> SpamAssassin (Address of SpamAssassin server)\n");
+ keyopt(" <5> RBL (domain suffix of spam hunting RBL)\n");
+ keyopt(" <6> masq domains (Domains as which users are allowed to masquerade)\n");
+ keyopt(" <7> ClamAV (Address of ClamAV clamd server)\n");
sel = intprompt("Which one", 1, 1, 8);
switch(sel) {
case 1: strcpy(buf, "localhost");
return;
case 3: strcpy(buf, "fallbackhost");
return;
- case 4: strcpy(buf, "directory");
- return;
- case 5: strcpy(buf, "spamassassin");
+ case 4: strcpy(buf, "spamassassin");
return;
- case 6: strcpy(buf, "rbl");
+ case 5: strcpy(buf, "rbl");
return;
- case 7: strcpy(buf, "masqdomain");
+ case 6: strcpy(buf, "masqdomain");
return;
- case 8: strcpy(buf, "clamav");
+ case 7: strcpy(buf, "clamav");
return;
}
}
while (!IsEmptyStr(resp)) {
extract_token(buf, resp, 0, '\n', sizeof buf);
remove_token(resp, 0, '\n');
+
+ // VILE SLEAZY HACK: replace obsolete "directory" domains with "localhost"
+ char *d = strstr(buf, "|directory");
+ if (d != NULL) {
+ strcpy(d, "|localhost");
+ }
+
++num_recs;
if (num_recs == 1) recs = malloc(sizeof(char *));
else recs = realloc(recs, (sizeof(char *)) * num_recs);
ch = keymenu("", "<A>dd|<D>elete|<S>ave|<Q>uit");
switch(ch) {
case 'a':
- newprompt("Enter host name: ",
- buf, 50);
+ newprompt("Enter host name: ", buf, 50);
striplt(buf);
if (!IsEmptyStr(buf)) {
++num_recs;
- if (num_recs == 1)
+ if (num_recs == 1) {
recs = malloc(sizeof(char *));
- else recs = realloc(recs,
- (sizeof(char *)) * num_recs);
+ }
+ else {
+ recs = realloc(recs, (sizeof(char *)) * num_recs);
+ }
strcat(buf, "|");
- get_inet_rec_type(ipc,
- &buf[strlen(buf)]);
+ get_inet_rec_type(ipc, &buf[strlen(buf)]);
recs[num_recs-1] = strdup(buf);
}
modified = 1;
break;
case 'd':
- i = intprompt("Delete which one",
- 1, 1, num_recs) - 1;
+ i = intprompt("Delete which one", 1, 1, num_recs) - 1;
free(recs[i]);
--num_recs;
- for (j=i; j<num_recs; ++j)
+ for (j=i; j<num_recs; ++j) {
recs[j] = recs[j+1];
+ }
modified = 1;
break;
case 's':
int r;
if (IsEmptyStr(editor_path)) {
- scr_printf("You must have an external editor configured in"
- " order to use this function.\n");
+ scr_printf("You must have an external editor configured in order to use this function.\n");
return;
}
}
-/*
- * IGnet node configuration
- */
-void do_ignet_configuration(CtdlIPC *ipc) {
- char buf[SIZ];
- int num_recs = 0;
- char **recs = NULL;
- char ch;
- int i, j;
- int quitting = 0;
- int modified = 0;
- char *listing = NULL;
- int r;
-
- r = CtdlIPCGetSystemConfigByType(ipc, IGNETCFG, &listing, buf);
- if (r / 100 == 1) while (*listing && !IsEmptyStr(listing)) {
- extract_token(buf, listing, 0, '\n', sizeof buf);
- remove_token(listing, 0, '\n');
-
- ++num_recs;
- if (num_recs == 1) recs = malloc(sizeof(char *));
- else recs = realloc(recs, (sizeof(char *)) * num_recs);
- recs[num_recs-1] = malloc(SIZ);
- strcpy(recs[num_recs-1], buf);
- }
- if (listing) free(listing);
-
- do {
- scr_printf("\n");
- color(BRIGHT_WHITE);
- scr_printf( "### "
- " Node "
- " Secret "
- " Host or IP "
- "Port#\n");
- color(DIM_WHITE);
- scr_printf( "--- "
- "---------------- "
- "------------------ "
- "-------------------------------- "
- "-----\n");
- for (i=0; i<num_recs; ++i) {
- color(DIM_WHITE);
- scr_printf("%3d ", i+1);
- extract_token(buf, recs[i], 0, '|', sizeof buf);
- color(BRIGHT_CYAN);
- scr_printf("%-16s ", buf);
- extract_token(buf, recs[i], 1, '|', sizeof buf);
- color(BRIGHT_MAGENTA);
- scr_printf("%-18s ", buf);
- extract_token(buf, recs[i], 2, '|', sizeof buf);
- color(BRIGHT_CYAN);
- scr_printf("%-32s ", buf);
- extract_token(buf, recs[i], 3, '|', sizeof buf);
- color(BRIGHT_MAGENTA);
- scr_printf("%-3s\n", buf);
- color(DIM_WHITE);
- }
- scr_printf("\n");
-
- ch = keymenu("", "<A>dd|<D>elete|<S>ave|<Q>uit");
- switch(ch) {
- case 'a':
- ++num_recs;
- if (num_recs == 1)
- recs = malloc(sizeof(char *));
- else recs = realloc(recs,
- (sizeof(char *)) * num_recs);
- newprompt("Enter node name : ", buf, 16);
- strcat(buf, "|");
- newprompt("Enter shared secret: ",
- &buf[strlen(buf)], 18);
- strcat(buf, "|");
- newprompt("Enter host or IP : ",
- &buf[strlen(buf)], 32);
- strcat(buf, "|504");
- strprompt("Enter port number : ",
- &buf[strlen(buf)-3], 5);
- recs[num_recs-1] = strdup(buf);
- modified = 1;
- break;
- case 'd':
- i = intprompt("Delete which one",
- 1, 1, num_recs) - 1;
- free(recs[i]);
- --num_recs;
- for (j=i; j<num_recs; ++j)
- recs[j] = recs[j+1];
- modified = 1;
- break;
- case 's':
- r = 1;
- for (i = 0; i < num_recs; ++i)
- r += 1 + strlen(recs[i]);
- listing = (char*) calloc(1, r);
- if (!listing) {
- scr_printf("Can't save config - out of memory!\n");
- logoff(ipc, 1);
- }
- if (num_recs) for (i = 0; i < num_recs; ++i) {
- strcat(listing, recs[i]);
- strcat(listing, "\n");
- }
- r = CtdlIPCSetSystemConfigByType(ipc, IGNETCFG, listing, buf);
- if (r / 100 != 4) {
- scr_printf("%s\n", buf);
- } else {
- scr_printf("Wrote %d records.\n", num_recs);
- modified = 0;
- }
- free(listing);
- break;
- case 'q':
- quitting = !modified || boolprompt(
- "Quit without saving", 0);
- break;
- default:
- break;
- }
- } while (!quitting);
-
- if (recs != NULL) {
- for (i=0; i<num_recs; ++i) free(recs[i]);
- free(recs);
- }
-}
-
-
-/*
- * Filter list configuration
- */
-void do_filterlist_configuration(CtdlIPC *ipc)
-{
- char buf[SIZ];
- int num_recs = 0;
- char **recs = NULL;
- char ch;
- int i, j;
- int quitting = 0;
- int modified = 0;
- char *listing = NULL;
- int r;
-
- r = CtdlIPCGetSystemConfigByType(ipc, FILTERLIST, &listing, buf);
- if (r / 100 == 1) while (*listing && !IsEmptyStr(listing)) {
- extract_token(buf, listing, 0, '\n', sizeof buf);
- remove_token(listing, 0, '\n');
-
- ++num_recs;
- if (num_recs == 1) recs = malloc(sizeof(char *));
- else recs = realloc(recs, (sizeof(char *)) * num_recs);
- recs[num_recs-1] = malloc(SIZ);
- strcpy(recs[num_recs-1], buf);
- }
- if (listing) free(listing);
-
- do {
- scr_printf("\n");
- color(BRIGHT_WHITE);
- scr_printf( "### "
- " User name "
- " Room name "
- " Node name "
- "\n");
- color(DIM_WHITE);
- scr_printf( "--- "
- "---------------------------- "
- "---------------------------- "
- "---------------- "
- "\n");
- for (i=0; i<num_recs; ++i) {
- color(DIM_WHITE);
- scr_printf("%3d ", i+1);
- extract_token(buf, recs[i], 0, '|', sizeof buf);
- color(BRIGHT_CYAN);
- scr_printf("%-28s ", buf);
- extract_token(buf, recs[i], 1, '|', sizeof buf);
- color(BRIGHT_MAGENTA);
- scr_printf("%-28s ", buf);
- extract_token(buf, recs[i], 2, '|', sizeof buf);
- color(BRIGHT_CYAN);
- scr_printf("%-16s\n", buf);
- extract_token(buf, recs[i], 3, '|', sizeof buf);
- color(DIM_WHITE);
- }
-
- ch = keymenu("", "<A>dd|<D>elete|<S>ave|<Q>uit");
- switch(ch) {
- case 'a':
- ++num_recs;
- if (num_recs == 1)
- recs = malloc(sizeof(char *));
- else recs = realloc(recs,
- (sizeof(char *)) * num_recs);
- newprompt("Enter user name: ", buf, 28);
- strcat(buf, "|");
- newprompt("Enter room name: ",
- &buf[strlen(buf)], 28);
- strcat(buf, "|");
- newprompt("Enter node name: ",
- &buf[strlen(buf)], 16);
- strcat(buf, "|");
- recs[num_recs-1] = strdup(buf);
- modified = 1;
- break;
- case 'd':
- i = intprompt("Delete which one",
- 1, 1, num_recs) - 1;
- free(recs[i]);
- --num_recs;
- for (j=i; j<num_recs; ++j)
- recs[j] = recs[j+1];
- modified = 1;
- break;
- case 's':
- r = 1;
- for (i = 0; i < num_recs; ++i)
- r += 1 + strlen(recs[i]);
- listing = (char*) calloc(1, r);
- if (!listing) {
- scr_printf("Can't save config - out of memory!\n");
- logoff(ipc, 1);
- }
- if (num_recs) for (i = 0; i < num_recs; ++i) {
- strcat(listing, recs[i]);
- strcat(listing, "\n");
- }
- r = CtdlIPCSetSystemConfigByType(ipc, FILTERLIST, listing, buf);
- if (r / 100 != 4) {
- scr_printf("%s\n", buf);
- } else {
- scr_printf("Wrote %d records.\n", num_recs);
- modified = 0;
- }
- free(listing);
- break;
- case 'q':
- quitting = !modified || boolprompt(
- "Quit without saving", 0);
- break;
- default:
- break;
- }
- } while (!quitting);
-
- if (recs != NULL) {
- for (i=0; i<num_recs; ++i) free(recs[i]);
- free(recs);
- }
-}
-
-
-
-
/*
* POP3 aggregation client configuration
*/
" Remote POP3 host "
" User name "
"Keep on server? "
- "Fetching inteval"
"\n");
color(DIM_WHITE);
scr_printf( "--- "
"---------------------------- "
"---------------------------- "
"--------------- "
- "---------------- "
"\n");
for (i=0; i<num_recs; ++i) {
color(DIM_WHITE);
scr_printf("%-28s ", buf);
color(BRIGHT_CYAN);
- scr_printf("%-15s ", (extract_int(recs[i], 4) ? "Yes" : "No") );
- color(BRIGHT_MAGENTA);
- scr_printf("%ld\n", extract_long(recs[i], 5) );
+ scr_printf("%-15s\n", (extract_int(recs[i], 4) ? "Yes" : "No") );
color(DIM_WHITE);
}
scr_printf("Keep messages on server instead of deleting them? ");
sprintf(&buf[strlen(buf)], "%d", yesno());
strcat(buf, "|");
- newprompt("Enter interval : ", &buf[strlen(buf)], 5);
- strcat(buf, "|");
recs[num_recs-1] = strdup(buf);
modified = 1;
break;