From a434ba27723656bf6f29de1d25891b80789afc68 Mon Sep 17 00:00:00 2001 From: Nathan Bryant Date: Mon, 11 Mar 2002 03:55:25 +0000 Subject: [PATCH] - fixes for building without OpenSSL - setenv doesn't exist on all systems, use putenv instead - support Solaris' curses implementation --- citadel/ChangeLog | 6 +++++- citadel/acconfig.h | 3 --- citadel/citadel.c | 11 ++++++++++- citadel/commands.c | 18 +++++++++++++++--- citadel/configure.ac | 3 +-- citadel/messages.c | 5 ++++- citadel/rooms.c | 5 ++++- citadel/routines2.c | 2 +- citadel/screen.c | 4 +++- 9 files changed, 43 insertions(+), 14 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 7572043d4..bb92fdac6 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,9 @@ $Log$ + Revision 590.135 2002/03/11 03:55:24 nbryant + - fixes for building without OpenSSL + - setenv doesn't exist on all systems, use putenv instead + - support Solaris' curses implementation + Revision 590.134 2002/03/09 22:52:04 ajc * Applied a patch submitted by to fix a potential buffer overflow problem in lprintf(). I also did the same fix to cprintf(). @@ -3415,4 +3420,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/acconfig.h b/citadel/acconfig.h index a3d6e0d85..958d43d11 100644 --- a/citadel/acconfig.h +++ b/citadel/acconfig.h @@ -24,6 +24,3 @@ /* Define if you have OpenSSL. */ #undef HAVE_OPENSSL - -/* Define if curses implementation has vw_printw */ -#undef VW_PRINTW_IN_CURSES diff --git a/citadel/citadel.c b/citadel/citadel.c index 5d0d90b69..fc93f3e07 100644 --- a/citadel/citadel.c +++ b/citadel/citadel.c @@ -952,7 +952,9 @@ int main(int argc, char **argv) signal(SIGTERM, dropcarr); /* Cleanup gracefully if terminated */ signal(SIGCONT, catch_sigcont); /* Catch SIGCONT so we can reset terminal */ +#ifdef HAVE_OPENSSL arg_encrypt = RC_DEFAULT; +#endif #ifdef HAVE_CURSES_H arg_screen = RC_DEFAULT; #endif @@ -967,12 +969,19 @@ int main(int argc, char **argv) argc = shift(argc, argv, a, 2); } if (!strcmp(argv[a], "-x")) { +#ifdef HAVE_OPENSSL arg_encrypt = RC_NO; +#endif argc = shift(argc, argv, a, 1); } if (!strcmp(argv[a], "-X")) { +#ifdef HAVE_OPENSSL arg_encrypt = RC_YES; - argc = shift(argc, argv, a, 1); + argc = shift(argc, argv, a, 1); +#else + fprintf(stderr, "Not compiled with encryption support"); + return 1; +#endif } if (!strcmp(argv[a], "-s")) { #ifdef HAVE_CURSES_H diff --git a/citadel/commands.c b/citadel/commands.c index 089f7b176..5b8a09765 100644 --- a/citadel/commands.c +++ b/citadel/commands.c @@ -698,7 +698,9 @@ void load_command_set(void) rc_force_mail_prompts = 0; rc_ansi_color = 0; strcpy(rc_url_cmd, ""); +#ifdef HAVE_OPENSSL rc_encrypt = RC_DEFAULT; +#endif #ifdef HAVE_CURSES_H rc_screen = RC_DEFAULT; #endif @@ -730,12 +732,22 @@ void load_command_set(void) buf[strlen(buf) - 1] = 0; if (!strncasecmp(buf, "encrypt=", 8)) { - if (!strcasecmp(&buf[8], "yes")) + if (!strcasecmp(&buf[8], "yes")) { +#ifdef HAVE_OPENSSL rc_encrypt = RC_YES; - else if (!strcasecmp(&buf[8], "no")) +#else + fprintf(stderr, "citadel.rc requires encryption support but citadel is not compiled with OpenSSL"); + logoff(1); +#endif + } +#ifdef HAVE_OPENSSL + else if (!strcasecmp(&buf[8], "no")) { rc_encrypt = RC_NO; - else if (!strcasecmp(&buf[8], "default")) + } + else if (!strcasecmp(&buf[8], "default")) { rc_encrypt = RC_DEFAULT; + } +#endif } #ifdef HAVE_CURSES_H diff --git a/citadel/configure.ac b/citadel/configure.ac index e633c23a9..720ffd487 100644 --- a/citadel/configure.ac +++ b/citadel/configure.ac @@ -222,10 +222,9 @@ save_LIBS=$LIBS LIBS=$CURSES AC_SEARCH_LIBS(tgetent, [curses termcap]) AC_SEARCH_LIBS(initscr, [curses ncurses]) +AC_CHECK_FUNCS(vw_printw wcolor_set) CURSES=$LIBS LIBS=$save_LIBS -SCURS=`echo $CURSES | sed -e s/-l//` -AC_CHECK_LIB($SCURS, vw_printw, AC_DEFINE(VW_PRINTW_IN_CURSES)) dnl Check for libpthread(s) if we're not using Digital UNIX or FreeBSD. (On dnl which the -pthread flag takes care of this.) diff --git a/citadel/messages.c b/citadel/messages.c index 8f64a1e9f..39c286d86 100644 --- a/citadel/messages.c +++ b/citadel/messages.c @@ -775,10 +775,13 @@ ME1: switch (mode) { editor_pid = fork(); cksum = file_checksum(filename); if (editor_pid == 0) { + char tmp[SIZ]; + chmod(filename, 0600); screen_reset(); sttybbs(SB_RESTORE); - setenv("WINDOW_TITLE", header, 1); + snprintf(tmp, sizeof tmp, "WINDOW_TITLE=%s", header); + putenv(tmp); execlp(editor_path, editor_path, filename, NULL); exit(1); } diff --git a/citadel/rooms.c b/citadel/rooms.c index 66395de4c..21aa5e41a 100644 --- a/citadel/rooms.c +++ b/citadel/rooms.c @@ -1057,7 +1057,10 @@ void do_edit(char *desc, char *read_cmd, char *check_cmd, char *write_cmd) cksum = file_checksum(temp); if (strlen(editor_path) > 0) { - setenv("WINDOW_TITLE", desc, 1); + char tmp[SIZ]; + + snprintf(tmp, sizeof tmp, "WINDOW_TITLE=%s", desc); + putenv(tmp); editor_pid = fork(); if (editor_pid == 0) { chmod(temp, 0600); diff --git a/citadel/routines2.c b/citadel/routines2.c index bb53c4c68..c6ab3ae27 100644 --- a/citadel/routines2.c +++ b/citadel/routines2.c @@ -1018,7 +1018,7 @@ void network_config_management(char *entrytype, char *comment) { chmod(filename, 0600); screen_reset(); sttybbs(SB_RESTORE); - setenv("WINDOW_TITLE", "Network configuration", 1); + putenv("WINDOW_TITLE=Network configuration"); execlp(editor_path, editor_path, filename, NULL); exit(1); } diff --git a/citadel/screen.c b/citadel/screen.c index 0de6d1fb7..7e1d1e770 100644 --- a/citadel/screen.c +++ b/citadel/screen.c @@ -13,7 +13,7 @@ #include #include #include -#ifdef VW_PRINTW_IN_CURSES +#ifdef HAVE_VW_PRINTW #define _vwprintw vw_printw #else /* Ancient curses implementations, this needs testing. Anybody got XENIX? */ @@ -336,7 +336,9 @@ int scr_color(int colornum) { #ifdef HAVE_CURSES_H if (mainwindow) { +#ifdef HAVE_WCOLOR_SET wcolor_set(mainwindow, 1 + (colornum & 7), NULL); +#endif if (colornum & 8) { wattron(mainwindow, A_BOLD); } else { -- 2.39.2