Index: build/Makefile.src =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/build/Makefile.src,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -r1.1.1.1 -r1.3 --- build/Makefile.src 27 Nov 2002 01:12:15 -0000 1.1.1.1 +++ build/Makefile.src 27 Nov 2002 11:12:23 -0000 1.3 @@ -12,7 +12,7 @@ SHELL = /bin/sh ARCH = __ARCH__ WHEN = __WHEN__ -WHO = whoami +WHO = __WHOAMI__ WHERE = hostname CC = __CC__ LIBS = __LIB__ @@ -24,6 +24,7 @@ MAN_DIR = _MAN_DIR_ STRIP = strip COMM STRIP = echo +MKDIRHIER = mkdir -p VERSION = 1.22PL5 NET_OPT = _NET_OPT_ @@ -326,27 +327,30 @@ ${CC} ${C_FLAG2} -c ${SRC_DIR}/mimepart.c install: all - cp ${EXE} ${BIN_DIR} - chmod 755 ${BIN_DIR}/${EXE} + -${MKDIRHIER} ${DESTDIR}${BIN_DIR} + cp ${EXE} ${DESTDIR}${BIN_DIR} + chmod 755 ${DESTDIR}${BIN_DIR}/${EXE} @if [ -f default-domain ] ; then \ - cp default-domain ${LIB_DIR} ; \ - chmod 644 ${LIB_DIR}/default-domain ; \ + -${MKDIRHIER} ${DESTDIR}${LIB_DIR} ; \ + cp default-domain ${DESTDIR}${LIB_DIR} ; \ + chmod 644 ${DESTDIR}${LIB_DIR}/default-domain ; \ fi @if [ -f "/sbin/i860" ] ; then \ "/sbin/i860" ; \ if [ $? -eq 0 ]; then \ echo "Change group & permission." ; \ - chgrp mail ${BIN_DIR}/${EXE} ; \ - chmod g+s ${BIN_DIR}/${EXE} ; \ + chgrp mail ${DESTDIR}${BIN_DIR}/${EXE} ; \ + chmod g+s ${DESTDIR}${BIN_DIR}/${EXE} ; \ fi ; \ fi - @if [ -d ${MAN_DIR}/japanese/man1 ] ; then \ - cp ${DOC_DIR}/mnews.1 ${MAN_DIR}/japanese/man1 ; \ - chmod 644 ${MAN_DIR}/japanese/man1/mnews.1 ; \ + @if [ -d ${DESTDIR}${MAN_DIR}/ja_JP.euc/man1 ] ; then \ + cp ${DOC_DIR}/mnews.1 ${DESTDIR}${MAN_DIR}/ja_JP.euc/man1 ; \ + chmod 644 ${DESTDIR}${MAN_DIR}/ja_JP.euc/man1/mnews.1 ; \ fi - @if [ -d ${MAN_DIR}/man1 ] ; then \ - cp ${DOC_DIR}/mnews.1 ${MAN_DIR}/man1 ; \ - chmod 644 ${MAN_DIR}/man1/mnews.1 ; \ + -${MKDIRHIER} ${DESTDIR}${MAN_DIR}/man1 + @if [ -d ${DESTDIR}${MAN_DIR}/man1 ] ; then \ + cp ${DOC_DIR}/mnews.1 ${DESTDIR}${MAN_DIR}/man1 ; \ + chmod 644 ${DESTDIR}${MAN_DIR}/man1/mnews.1 ; \ fi help: Index: build/config.sh =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/build/config.sh,v retrieving revision 1.1.1.1 retrieving revision 1.17 diff -u -r1.1.1.1 -r1.17 --- build/config.sh 27 Nov 2002 01:12:16 -0000 1.1.1.1 +++ build/config.sh 10 May 2020 04:40:13 -0000 1.17 @@ -11,28 +11,29 @@ SED=sed LIB="" RANLIB=ranlib +WHOAMI=whoami DEFAULT_CPP="" DEFAULT_BIN_DIR="/usr/local/bin" -DEFAULT_LIB_DIR="/usr/local/lib" +DEFAULT_LIB_DIR="/usr/local/lib/mnews" DEFAULT_MAN_DIR="/usr/local/man" DEFAULT_TMP_DIR="/tmp" -DEFAULT_CONF_OPT="-DCTRL_L -DCOMPLETION -DREF_SORT -DLARGE -DDISPLAY_CTRL" +DEFAULT_CONF_OPT="-DCTRL_L -DCOMPLETION -DREF_SORT -DLARGE -DDISPLAY_CTRL -DXOVER" DEFAULT_CFLAGS="-O" -DEFAULT_POSTNEWS="/usr/lib/news/inews -h" DEFAULT_SENDMAIL="/usr/lib/sendmail -t -om -oi" DEFAULT_EDITOR="/usr/local/bin/emacs -nw" DEFAULT_PAGER="/usr/local/bin/less" DEFAULT_LPR_COMMAND="lpr" DEFAULT_MPEG_COMMAND="mpeg_play" -DEFAULT_JPEG_COMMAND="xv" -DEFAULT_GIF_COMMAND="xv" +DEFAULT_JPEG_COMMAND="display" +DEFAULT_GIF_COMMAND="display" DEFAULT_AUDIO_COMMAND="audioplay" DEFAULT_PS_COMMAND="ghostview" DEFAULT_MH_PATH="/usr/local/bin/mh" DEFAULT_MAIL_SPOOL="/var/spool/mail" DEFAULT_BOARD_SPOOL="/var/spool/board" -DEFAULT_NEWS_SPOOL="/usr/spool/news" -DEFAULT_NEWS_LIB="/usr/lib/news" +DEFAULT_NEWS_SPOOL="/var/spool/news/articles" +DEFAULT_NEWS_LIB="/var/spool/news/db" +DEFAULT_POSTNEWS="/usr/local/news/bin/inews -h" SITE_DEPEND="site_dep.h" MAKEFILE="Makefile" @@ -156,6 +157,7 @@ # echo " NEC EWS4800/30 (CISC) EWS-UX/V (EWOS21) rel 8.1" # echo " Mitsubishi ME (CISC) series.(ME/UX)..." # echo "15.MS-DOS for MS-DOS with socket library" + echo "16.QNXRTP for QNX 6.X.X" echo "Q.quit" echo "" @@ -216,12 +218,16 @@ fi ;; "7") ARCH="LINUX" - DEFAULT_CFLAGS="-O -DUSE_TERMIOS" + DEFAULT_CFLAGS="-O -DUSE_TERMIOS -DDONT_HAVE_FTIME" + DEFAULT_CPP="cpp -traditional-cpp" DEFAULT_SENDMAIL="/usr/lib/sendmail -t -om -oi" DEFAULT_CC="/usr/bin/cc" DEFAULT_INSTALL="/usr/bin/install" - DEFAULT_MAIL_SPOOL="/usr/spool/mail" - DEFAULT_BOARD_SPOOL="/usr/spool/board" + DEFAULT_MAIL_SPOOL="/var/mail" + DEFAULT_BOARD_SPOOL="/var/spool/board" + DEFAULT_PAGER="/bin/env LANG=ja_JP.eucJP /usr/bin/less" + DEFAULT_AUDIO_COMMAND="aplay" + DEFAULT_EDITOR="/bin/env LANG=ja_JP.eucJP /usr/bin/vim" if [ -f /proc/net/if_inet6 ]; then DEFAULT_IPV6_ENABLE="yes" DEFAULT_IPV6_CFLAGS="" @@ -322,6 +328,31 @@ "15") ARCH="MSDOS" DEFAULT_CFLAGS="-O" ;; + "16") ARCH="QNXRTP" + ## QNX packager excludes /usr/local + ## and recommends /opt as install path + ## (procmgr_symlinks to /usr) + WHOAMI=id -nu + DEFAULT_BIN_DIR="/opt/bin" + DEFAULT_LIB_DIR="/opt/share/mnews" + DEFAULT_MAN_DIR="/opt/man" + DEFAULT_CC="/usr/bin/gcc" + ## has ftime(), but buggy + DEFAULT_CFLAGS="-O -DUSE_TERMIOS -DDONT_HAVE_FTIME -DGET_DOMAIN_FROM__RES -DMNEWS_VERSION_SUFFIX=\\\\\"-qnx\\\\\"" + DEFAULT_EDITOR="/bin/vi" + DEFAULT_PAGER="/usr/bin/less" + DEFAULT_JPEG_COMMAND="pv" + DEFAULT_GIF_COMMAND="pv" + DEFAULT_MPEG_COMMAND="mpegvideo" + DEFAULT_AUDIO_COMMAND="playsound_noph" + DEFAULT_POSTNEWS="/usr/local/news/bin/inews -h" + DEFAULT_MAIL_SPOOL="/var/mail" + if [ ! -x /usr/lib/sendmail ]; then + DEFAULT_SENDMAIL="/bin/false -t -om -oi" + fi + LIB="-lsocket" + test -z "$DOMAINNAME" && DOMAINNAME=qnx.example.com + ;; "Q") exit 0 ;; *) echo "Illegal number." @@ -370,7 +401,7 @@ LIB_DIR="" while [ "$LIB_DIR" = "" ] do - echo "Please input library install directory." + echo "Please input mnews config file install directory." echo "Library install directory(default:$DEFAULT_LIB_DIR):" read INPUT if [ "$INPUT" = "" ] ; then @@ -380,6 +411,10 @@ LIB_DIR="$INPUT" else echo "\"$INPUT\" not found." + Y_or_n "Ignore this error?" + if [ $? -ne 0 ] ; then + LIB_DIR="$INPUT" + fi fi done echo "" @@ -404,6 +439,10 @@ MAN_DIR="$INPUT" else echo "\"$INPUT\" not found." + Y_or_n "Ignore this error?" + if [ $? -ne 0 ] ; then + MAN_DIR="$INPUT" + fi fi done echo "" @@ -457,6 +496,10 @@ y_or_N "Support POP3 mode(POP3)?" if [ $? -eq 1 ] ; then NET_OPT="$NET_OPT -DPOP3" + echo "Some providers use OAUTH2 authentication for POP3." + y_or_N "Support XOAUTH2 authentication in POP3 mode(POP3_OAUTH2)?" + test $? -eq 1 && NET_OPT="$NET_OPT -DPOP3_OAUTH2" + # echo "" fi echo "" @@ -471,6 +514,7 @@ while [ "$NEWS_SPOOL" = "" ] do echo "Please input news spool directory." + echo "Used for NSPL mode. The directory should be in 'tradspool' format." echo "News spool directory(default:$DEFAULT_NEWS_SPOOL):" read INPUT if [ "$INPUT" = "" ] ; then @@ -491,7 +535,8 @@ NEWS_LIB="" while [ "$NEWS_LIB" = "" ] do - echo "Please input news library directory." + echo "Please input news library directory, where active(5) and " + echo "newsgroups(5) file resides. Used for NSPL mode." echo "News lib directory(default:$DEFAULT_NEWS_LIB):" read INPUT if [ "$INPUT" = "" ] ; then @@ -522,6 +567,10 @@ MAIL_SPOOL="$INPUT" else echo "\"$INPUT\" not found." + Y_or_n "Ignore this error?" + if [ $? -ne 0 ] ; then + MAIL_SPOOL="$INPUT" + fi fi done echo "" @@ -807,13 +856,16 @@ echo "-DNNTP_AUTH support INN authority function." echo "-DRECOVER_SUBJECT recover subject without ESC code." echo "-DREF_SORT support reference sort." - echo "-DRESOLVE use resolver." + echo "-DRESOLVE use resolver to get my FQDN." echo "-DSAVE_PAGER support saving article with internal pager." echo "-DSELECT_EDITOR ask editor when writting article." echo "-DSEND_CONFIRM confirm when news post or mail send." + echo "-DSETLOCALE call setlocale() on startup." echo "-DSJIS_SRC use SHIFT-JIS code for mnews source." echo "-DSMALL restrict function for small size." echo "-DSUPPORT_X0201 support JIS-X0201 kana character." + echo "-DTITLE_NO_NNTP_CHECK do not check NNTP connection in every screen." + echo " (speedup on remote servers)" echo "-DTRI use TRI tree-search algorithm for speedup." echo "-DUSE_FCNTL_LOCK use fcntl for mail spool lock." echo "-DUSE_FLOCK use flock for mail spool lock." @@ -1174,7 +1226,7 @@ $CPP -D$ARCH $CONS_OPT $MOD_OPT temp.c | $SED -e "s/_CONS_OPT_/$CONS_OPT/g" \ -e "s/_CONF_OPT_/$CONF_OPT/g" -e "s/_MOD_OPT_/$MOD_OPT/g" \ -e "s/_NET_OPT_/$NET_OPT/g" -e "s/__ARCH__/$ARCH/g" \ - -e "s@__CC__@$CC@g" \ + -e "s@__WHOAMI__@$WHOAMI@g" -e "s@__CC__@$CC@g" \ -e "s@_BIN_DIR_@$BIN_DIR@g" -e "s@_MAN_DIR_@$MAN_DIR@g" \ -e "s@_LIB_DIR_@$LIB_DIR@g" -e "s@_CFLAGS_@$CFLAGS@g" \ -e "s@__LIB__@$LIB@g" -e "s@_RANLIB_@$RANLIB@g" \ Index: compat/compat.h =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/compat/compat.h,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -r1.1.1.1 -r1.3 --- compat/compat.h 27 Nov 2002 01:12:16 -0000 1.1.1.1 +++ compat/compat.h 24 Apr 2017 01:45:16 -0000 1.3 @@ -36,17 +36,13 @@ * キャスト型 */ -#ifdef ALPHA -typedef int TIMEVALUE; -typedef long CASTPTR; -#else /* !ALPHA */ -typedef long TIMEVALUE; #if defined(MSDOS) && !defined(__GO32__) +typedef long TIMEVALUE; typedef long CASTPTR; #else /* !(MSDOS || !__GO32__) */ -typedef int CASTPTR; +typedef time_t TIMEVALUE; +typedef void* CASTPTR; #endif /* !(MSDOS || !__GO32__) */ -#endif /* !ALPHA */ #ifndef include_dirent #define include_dirent @@ -124,6 +120,16 @@ #define vfork() fork() #endif /* (SVR3 || IRIX || OS2) */ +#ifdef __QNXNTO__ +/* EUC locale がないので、C-TRADITIONALで代用。CだとUTF-8になってしまう */ +/* setlocale() しておかないとEUCのprintf()が動かない */ +#define SETLOCALE_CTYPE "C-TRADITIONAL" +#define SETLOCALE 1 +#endif /* QNXNTO */ +#ifdef SETLOCALE +#include +#endif /* SETLOCALE */ + /* * 可変引数関数 */ Index: doc/mnews.1 =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/doc/mnews.1,v retrieving revision 1.1.1.1 retrieving revision 1.5 diff -u -r1.1.1.1 -r1.5 --- doc/mnews.1 27 Nov 2002 01:12:17 -0000 1.1.1.1 +++ doc/mnews.1 10 May 2020 03:57:39 -0000 1.5 @@ -1,5 +1,11 @@ .\" Copyright (C) 1991-2001 Matsushita Soft-Research, INC. Akira Takuma +.ll 76m \" line length +.ev 1 +.lt 76m \" title line length +.ev +.ad l \" adjust left, ragged right .TH MNEWS 1 "2001年02月05日" +.nr IN 4n \" shorter indent .SH 名前 mnews \- ミニ・ニュースリーダ (Ver 1.22PL5 用) .SH 形式 @@ -2152,7 +2158,7 @@ ユーザ名です。 指定されていない場合はパスワードエントリに従います。 .TP 15 -.B NANE +.B NAME ユーザのフルネームです。 指定されていない場合はパスワードエントリに従います。 .TP 15 @@ -2525,6 +2531,14 @@ pop3_mode on または off off メールスプールを参照する代わりに POP3 通信を使用 します。 +pop3_user POP3 認証名 なし + POP3 認証で使うユーザ名を指定します。(POP3 時のみ) +pop3_oauth2_access_token_cmd POP3でのOAUTH2認証トークン取得コマンド なし + POP3 の認証で、OAUTH2 認証を使う際に access token を + 出力するコマンドを指定します。"oauth2 -q refresh" など。 + この設定があると、パスワード認証ではなく + 自動的に OAUTH2 認証を使うようになります。 + POP3_OAUTH2_CMD 環境変数でも指定可能。 post_filter 文字列 なし ニュース投稿時にエディタ終了後、記事を確認す るまでの間にここで指定したフィルタを通します。 Index: doc/mnews.doc =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/doc/mnews.doc,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -r1.1.1.1 -r1.3 --- doc/mnews.doc 27 Nov 2002 01:12:16 -0000 1.1.1.1 +++ doc/mnews.doc 10 May 2020 03:57:39 -0000 1.3 @@ -2017,9 +2017,17 @@ POP3 モード時に取り込んだメールを POP3 サーバから削除 します。(MH モードでは .mh_profile で inc のオプション に -notruncate を指定して下さい) + pop3_user POP3 認証名 なし + POP3 認証で使うユーザ名を指定します。(POP3 時のみ) pop3_mode on または off off メールスプールを参照する代わりに POP3 通信を使用 します。 + pop3_oauth2_access_token_cmd POP3でのOAUTH2認証トークン取得コマンド なし + POP3 の認証で、OAUTH2 認証を使う際に access token を + 出力するコマンドを指定します。"oauth2 -q refresh" など。 + この設定があると、パスワード認証ではなく + 自動的に OAUTH2 認証を使うようになります。 + POP3_OAUTH2_CMD 環境変数でも指定可能。 post_filter 文字列 なし ニュース投稿時にエディタ終了後、記事を確認す るまでの間にここで指定したフィルタを通します。 Index: doc/update.doc =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/doc/update.doc,v retrieving revision 1.1.1.1 retrieving revision 1.9 diff -u -r1.1.1.1 -r1.9 --- doc/update.doc 27 Nov 2002 01:12:16 -0000 1.1.1.1 +++ doc/update.doc 10 May 2020 03:57:39 -0000 1.9 @@ -2308,6 +2308,46 @@ (84) ニュース/BOARD/MH 記事最大一覧表示数を .mnews_setup で 記述できるようにしました。 + -- QNX -- 200?-??-?? + (**) QNXRTP プラットフォームでのビルドとパッケージ作成に + 対応しました。 + (**) パッケージ作成用に、インストール時の ${DESTDIR} 変数 + を使えるようにしました。 + (**) 自分のメール差出人アドレスとして、$LOGNAME→$USER→ + pw_name の順に検索するようにしました。 + (**) mnews -v にて、自ホスト名・メール差出人・NNTPサーバ名 + を出力するようにしました。 + (**) 英語専用コンパイル用に -DLOCK_LANGUAGE コンパイルオプション + を追加しました。'x'での言語切替を無効にします。 + (**) ニュース記事送信時、Message-IDを生成しないようにしました。 + PL4の動作に戻しました。FQDNなホスト名が無い場合対策。 + (**) ソート・パック時に記事のダウンロードを行うなど、 + 時間のかかる処理を行う際のステータスメッセージを + 追加しました。 + (**) 未ソートのニュース記事範囲を閲覧する際、一覧の + 取得をXOVERにて高速化しました。 + (**) -DTITLE_NO_NNTP_CHECK コンパイルオプションを追加しました。 + 画面更新時に毎回 NNTP の NOOP を発行しないようにします。 + 遠方のNNTPサーバの利用が劇的に快適になります。 + (**) パック処理中に^Cで中止できるようにしました。 + (**) POP3 のログイン処理、ダウンロード中のステータスメッセージを + 追加しました。遠方のPOP3サーバの利用時の情況が + わかりやすくなりました。 + (**) POP3 のログインに失敗した際、ステータスメッセージを + 出すようにしました。 + (**) pop3_user 設定で、POP3で使う認証ユーザー名を + 変更できるようにしました。 + POP3USER 環境変数でも変更可能です。 + (**) SMTPサーバーなどに接続する際、ホスト名のほかに + ポート番号も表示するようにしました。 + (**) user_name に @ がすでに含まれている場合、 + - SMTP MAIL FROM でuser_nameの値をそのまま + 使うようにしました。@ を追加しません。 + (**) POP3 での OAUTH2 認証に部分対応しました。 + OAUTH2 access token を出力する外部プログラムを、 + pop3_oauth2_access_token_cmd 設定、もしくは + POP3_OAUTH2_CMD 環境変数に設定してください。 + バグ、制限事項についてはマニュアルを参照して下さい。 保留事項 Index: mimelib/mimelib.c =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/mimelib/mimelib.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- mimelib/mimelib.c 27 Nov 2002 01:12:18 -0000 1.1.1.1 +++ mimelib/mimelib.c 28 Apr 2017 00:37:47 -0000 1.2 @@ -964,6 +964,10 @@ /* * MIME BASE64 エンコード(バイナリ用) + * char *ptr1: エンコードしたいデータ + * char *ptr2 (呼出側バッファ) base64出力,'\0'終端 + * int size: ptr1 の長さ + * @return char* ptr2の終端'\0'の位置。連続してエンコードする用 */ #ifdef __STDC__ @@ -1018,6 +1022,9 @@ /* * MIME BASE64 エンコード(文字列用) + * char *ptr1 エンコードしたいASCIZ文字列 + * char *ptr2 (呼出側バッファ) base64出力,'\0'終端 + * @return char* ptr2の終端'\0'の位置。連続してエンコードする用 */ #ifdef __STDC__ Index: nntplib/nntplib.c =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/nntplib/nntplib.c,v retrieving revision 1.1.1.1 retrieving revision 1.5 diff -u -r1.1.1.1 -r1.5 --- nntplib/nntplib.c 27 Nov 2002 01:12:19 -0000 1.1.1.1 +++ nntplib/nntplib.c 28 Apr 2017 00:37:47 -0000 1.5 @@ -69,8 +69,6 @@ /* NNTP 認証名 */ short nntp_auth_mode = 0; /* NNTP 認証モード */ -short nntp_get_pass = 0; - /* NNTP のパスワード入力フラグ */ #endif /* NNTP_AUTH */ #endif /* NNTP */ #ifdef NSPL @@ -571,9 +569,11 @@ return(NNTP_OK); } if (first) { - nntp_get_pass = 1; + user[0] = '\0'; /* default set by tcp_get_user_pass() */ + if (nntp_user[0]) { + strcpy(user, nntp_user); /*XXX bound check SMALL_BUF*/ + } tcp_get_user_pass(nntp_server, user, pass); - nntp_get_pass = 0; } if (!*user) { return(NNTP_OK); @@ -1682,10 +1682,12 @@ char buff2[BUFF_SIZE]; char *ptr; #endif /* NNTP */ +#if 0 /* used in PL6 */ static struct cpy_hdr nntp_fields[] = { {DATE_FIELD, date_buff, sizeof(date_buff)}, {MESSAGE_FIELD, message_buff, sizeof(message_buff)}, }; +#endif struct tm *tm; time_t now_time; char date_buff2[MAX_FIELD_LEN]; @@ -1787,6 +1789,7 @@ ptr++; } nntp_send(date_buff2); +#if 0 /* do not unconditionally send Message-ID; wait PL7 to pickup from file? */ ptr = message_buff2; while (*ptr) { if (*ptr == '\n') { @@ -1796,6 +1799,7 @@ ptr++; } nntp_send(message_buff2); +#endif nntp_send(""); while (fgets(buff1, sizeof(buff1) - 1, fp1)) { ptr = buff1; Index: nntplib/nntplib.h =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/nntplib/nntplib.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- nntplib/nntplib.h 27 Nov 2002 01:12:19 -0000 1.1.1.1 +++ nntplib/nntplib.h 24 Apr 2017 04:16:45 -0000 1.2 @@ -226,7 +226,6 @@ #ifdef NNTP_AUTH extern char nntp_user[]; /* NNTP 認証名 */ extern short nntp_auth_mode; /* NNTP 認証モード */ -extern short nntp_get_pass; /* NNTP パスワード入力フラグ */ #endif /* NNTP_AUTH */ #ifdef __STDC__ Index: package/qnxrtp/Makefile =================================================================== RCS file: package/qnxrtp/Makefile diff -N package/qnxrtp/Makefile --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ package/qnxrtp/Makefile 28 Jan 2003 03:27:36 -0000 1.10 @@ -0,0 +1,62 @@ +# +# +# + +DESTDIR=./DEST +BUILDDIR=../../build +DOCDIR=../../doc + +RM=rm -f + +## +## to make a package::: +## * build it in ../../build +## * make destdir (./DEST/ is populated) +## * make packager (packager is invoked to make initial *qpr) +## * make repack (re-populate the *qpr for missing things) +## + +all: packager + +## (rewrite ReleaseDate according to binary's timestamp) +mnewsT.qpg: $(BUILDDIR)/mnews mnews.qpg + D=`diff -u $(BUILDDIR)/mnews /dev/null | head -1| \ + awk 'BEGIN{ \ + split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec",n); \ + for(i=1;i<=12;i++) m[n[i]]=i; \ + } \ + /^---/ { printf("%04d/%02d/%02d", $$7,m[$$4],$$5) }'` ; \ + sed -e 's;\(QPG:PackageReleaseDate\)/>;\1>'$$D';' mnews.qpg >$@ +clean:: + $(RM) mnewsT.qpg + +## (this section not used; rewrite mnews.qpg for file assembly +### prepare packaging directory in ./DEST/ +### +destdir: $(BUILDDIR)/mnews + -mkdir -p $(DESTDIR)/opt/bin + -mkdir -p $(DESTDIR)/opt/man/man1 + #-mkdir -p $(DESTDIR)/opt/man/ja_JP.euc/man1 + -mkdir -p $(DESTDIR)/opt/share/mnews + cp -p $(BUILDDIR)/mnews $(DESTDIR)/opt/bin/mnews + #-mkdir -p $(DESTDIR)/opt/man/man1/mnews.1 + #cp -p $(DOCDIR)/mnews.1 $(DESTDIR)/opt/man/man1/mnews.1 + -mkdir -p $(DESTDIR)/opt/man/ja_JP.euc/man1/mnews.1 + cp -p $(DOCDIR)/mnews.1 $(DESTDIR)/opt/man/ja_JP.euc/man1/mnews.1 + -mkdir -p $(DESTDIR)/opt/share/mnews/ + cp -pr $(DOCDIR) $(DESTDIR)/opt/share/mnews/ + echo "inn.qnx.com" > $(DESTDIR)/opt/share/mnews/default-server + #echo "sending-mta.example.com" > $(DESTDIR)/opt/share/mnews/default-smtpsv + #echo "pop3-server.example.com" > $(DESTDIR)/opt/share/mnews/default-pop3sv + +clean:: + $(RM) -r $(DESTDIR) + $(RM) -r *.qpm *.qpk *.repdata public + +veryclean:: clean + $(RM) *qpr + +### make initial package.... +packager: mnewsT.qpg + packager -u mnewsT.qpg + Index: package/qnxrtp/default-server =================================================================== RCS file: package/qnxrtp/default-server diff -N package/qnxrtp/default-server --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ package/qnxrtp/default-server 28 Jan 2003 01:56:13 -0000 1.1 @@ -0,0 +1 @@ +inn.qnx.com Index: package/qnxrtp/default-server.sh =================================================================== RCS file: package/qnxrtp/default-server.sh diff -N package/qnxrtp/default-server.sh --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ package/qnxrtp/default-server.sh 22 Jan 2003 23:57:15 -0000 1.5 @@ -0,0 +1,21 @@ +#!/bin/sh +: ${NNTPSERVER:=inn.qnx.com} +NNTPS_FILE=/usr/share/mnews/default-server + +echo +echo "== mnews post-install script ==" +echo '' +echo This will set default value for ${NNTPS_FILE}, +echo which will hold the machinewide default NNTP server mnews will use. +echo Environment '`'NNTPSERVER"'" will override this on runtime. +echo -n Input your default NNTP server "[$NNTPSERVER]: " +read line +if [ "$line" == "" ]; then line=$NNTPSERVER; fi + +echo $line > $NNTPS_FILE || exit 1; + +NNTPSERVER=`cat $NNTPS_FILE` +echo +echo Default NNTP server set to '`'${NNTPSERVER}"'". +echo Edit $NNTPS_FILE to change later. +echo Index: package/qnxrtp/license-en.txt =================================================================== RCS file: package/qnxrtp/license-en.txt diff -N package/qnxrtp/license-en.txt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ package/qnxrtp/license-en.txt 10 Dec 2002 04:51:11 -0000 1.2 @@ -0,0 +1,28 @@ +(This is a loose translation of the readme file originally in japanese) + +NOTICE + This software is provided "as is" and there is no gurantees + or warrantries thereof, although it is believed to be + developed to work properly. + ----------------------------------- + The author disclaims and does not hold any liabilities caused + by the usage of this software, inluding but not limited to, + loss of mail messages or unsent news articles. + (But bug reports and patches are welcome.) + Use at your own risk. + +DISTRIBUTION + This program is freely distributable, provided that the + needed files are kept intact, and not distributed for a profit. + Distribution such as in a magazine attachment is allowed + when mnews itself is not solely sold as a product. + When modification is needed for fixing defects in the program, you + should contact the author. Modification for adding features should + be contacted to author and modification should be notified to author + afterwards; modified programs should not be distributed. + This is to prevent confision by derived versions. + +CONTACT + Matsushita Soft-Research, INC. Akira Takuma + E-mail takuma@msr.mei.co.jp + Index: package/qnxrtp/mnews.qpg =================================================================== RCS file: package/qnxrtp/mnews.qpg diff -N package/qnxrtp/mnews.qpg --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ package/qnxrtp/mnews.qpg 28 Jan 2003 03:27:36 -0000 1.8 @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Application + + + 1.9 + + + + mnews: Mini News Reader + mnews + + Public + public + + + kabe@sra-tohoku.co.jp + Akira Takuma + + + takuma@msr.mei.co.jp + + + mnews: Mini News Reader + mnews is a compact Mail/News reader, which aims at compactness, speed and portability. It supports NNTP/NSPL (direct spool read), SMTP/MTAP (pipe out to sendmail), POP3/MSPL (direct spool read) for reading news, sending mail and receiving mail. + + + + + + 1.22PL5 + Medium + Beta + + Configuration: + *) put your mail domain name into /usr/share/mnews/default-domain; + *) put yout default NNTP server into /usr/share/mnews/default-server; + *) put your default SMTP/POP3 server into /usr/share/mnews/default-smtpsv,/usr/share/mnews/default-pop3sv . + default-server is defaulting to "inn.qnx.com" . + Environmental variables DOMAINNAME, NNTPSERVER, SMTPSERVER, POP3SERVER will override + the above file-supplied defaults. + + + Custom License + + + + Communication and Connectivity/News (Usenet) Clients + mnews,news,nntp,japanese + qnx6 + none + Console + User + + + repdata://LicenseUrl/license-en.txt + + + + + + + + + + + + pkg://scripts/default-server.sh + Install + Post + No + Ignore + Set default NNTP server + No + Recommended + + + + /usr/photon/bin/launchmenu_notify + Post + Use + + + + /usr/photon/bin/launchmenu_notify + Post + Unuse + + + + + + + + + + + + + + + + + + + + + + Index: pop3lib/pop3lib.c =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/pop3lib/pop3lib.c,v retrieving revision 1.1.1.1 retrieving revision 1.7 diff -u -r1.1.1.1 -r1.7 --- pop3lib/pop3lib.c 27 Nov 2002 01:12:20 -0000 1.1.1.1 +++ pop3lib/pop3lib.c 10 May 2020 03:57:41 -0000 1.7 @@ -31,7 +31,11 @@ #include "md5lib.h" #endif /* APOP */ +/* src/mnews.h */ extern void convert_article_date(); /* 記事日付フォーマット変換 */ +#ifdef MNEWS +extern short japanese; /* 日本語モード */ +#endif /* MNEWS */ #ifdef POP3 extern char tmp_dir[]; /* 作業ディレクトリ */ @@ -53,6 +57,8 @@ #endif /* !NI_MAXHOST */ char pop3_server_file[PATH_BUFF] = POP3_SERVER_FILE; /* POP3 サーバ指定ファイル */ +char pop3_user[SMALL_BUFF]; + /* POP3 でのユーザー名 */ char mail_spool[PATH_BUFF] = MAIL_SPOOL; /* メールスプール */ short pop3_connect_mode = 2; @@ -65,6 +71,10 @@ /* POP3 APOP 使用モード */ static char timestamp[SMALL_BUFF]; #endif /* APOP */ +#if defined(POP3) && defined(POP3_OAUTH2) +char pop3_oauth2_access_token_cmd[PATH_BUFF] = ""; + /* POP3 XOAUTH アクセストークン取得外部コマンド */ +#endif short pop3_from_mode = 0; /* POP3 From 復元モード */ char *pop3_connect_string[] = { @@ -299,6 +309,11 @@ #ifdef POP3_DEBUG print_warning("Connecting to POP3 server %s.", pop3_server); #endif /* POP3_DEBUG */ + print_mode_line( +#ifdef MNEWS + japanese ? "POP3サーバー %s へ接続中です。" : +#endif /*MNEWS*/ + "Connecting to POP3 server %s", pop3_server); #ifdef POP3 if (pop3_rpop_mode) { #ifdef MSDOS @@ -663,6 +678,7 @@ if (pop3_receive(buff, sizeof(buff))) { break; } + /* "+OK 38 5930589" */ if (strncmp(buff, POP3_OKAY_RES, sizeof(POP3_OKAY_RES) - 1)) { break; } @@ -673,6 +689,14 @@ } if ((rd_stat == POP3_RD_FROM) || (rd_stat == POP3_RD_END)) { if (read_num < spool_num) { + print_mode_line( +#ifdef MNEWS + japanese ? "メッセージ#%d/%d を受信しています。" : +#endif /* MNEWS */ + "Receiving message #%d/%d", read_num + 1, spool_num); + /* XXX ここでは read_num+1 は1からカウントアップしているが、 + * POP3のメッセージ番号がすきま無しの逐次であることは + * 保証されていない、はず */ sprintf(buff, "%s %d", POP3_RETR_CMD, read_num + 1); if (pop3_cmd(buff)) { rd_stat = POP3_RD_EOF; @@ -715,6 +739,7 @@ } head_fp = fopen(tmp_file, "w"); if (head_fp != (FILE*)NULL) { + /* read headers and write into head_fp */ do { if (pop3_receive(buff, sizeof(buff))) { rd_stat = POP3_RD_EOF; @@ -746,7 +771,7 @@ status = POP3_ERR_FILE; } break; - } + }/*pop3_from_mode*/ /* break 不要 */ case POP3_RD_HEAD: if (!strncasecmp(ptr, LENGTH_FIELD, sizeof(LENGTH_FIELD) - 1)) { @@ -794,7 +819,7 @@ default: rd_stat = POP3_RD_EOF; /* エラー */ break; - } + }/*switch (rd_stat)*/ #else /* !POP3 */ status = POP3_ERR_RSV; rd_stat = POP3_RD_EOF; @@ -803,7 +828,7 @@ default: rd_stat = POP3_RD_EOF; break; - } + }/*switch pop3_connect_mode*/ *stat_ptr = rd_stat; return(status); } @@ -984,13 +1009,29 @@ POP3_ERR_CODE status; if (first) { + user[0] = '\0'; /* default set by tcp_get_user_pass() */ + if (pop3_user[0]) { + strcpy(user, pop3_user); + } +#ifdef POP3_OAUTH2 + if (!pop3_oauth2_access_token_cmd[0]) { /* OAUTHの時はパスワードは聞かない */ +#endif if (pop3_rpop_mode) { tcp_get_user_pass(pop3_server, user, (char*)NULL); strcpy(pass, user); } else { tcp_get_user_pass(pop3_server, user, pass); } +#ifdef POP3_OAUTH2 + } +#endif } + /* print_mode_line()はsrc/mnews.cの関数なので、ライブラリ側で使うのは本来は望ましくないが... */ + print_mode_line( +#ifdef MNEWS + japanese ? "POP3サーバーにログインしています。" : +#endif /* MNEWS */ + "Authenticating with POP3 server..."); #ifdef APOP if (!pop3_rpop_mode && pop3_apop_mode) { MD5_CONTEXT context; @@ -1021,15 +1062,62 @@ sprintf(buff, "%s %s", pop3_rpop_mode ? POP3_RPOP_CMD : POP3_PASS_CMD, pass); } #else /* !APOP */ - sprintf(buff, "%s %s", POP3_USER_CMD, user); - status = pop3_cmd(buff); - if (status != POP3_OK) { - return(status); + +#if POP3_OAUTH2 + if (pop3_oauth2_access_token_cmd[0]) { + char access_token[1024]; + char xoauth2_b64[1024]; + FILE *atf; + atf = popen(pop3_oauth2_access_token_cmd, "r"); + if (atf == NULL) { + print_mode_line( +#ifdef MNEWS + japanese ? "OAUTH2 アクセストークン取得コマンドの起動に失敗しました。" : +#endif /* MNEWS */ + "Failed to invoke pop3 OAUTH2 access token provider command."); + sleep(/*ERROR_SLEEP*/3); + return(POP3_ERR_AUTH); + } + fgets(access_token, (sizeof access_token)-1, atf); + pclose(atf); + /* アクセストークンには" "は含まれていない。含まれていたら + * エラーが発生したとみなす。 + */ + if (strchr(access_token, ' ') != NULL) { + print_mode_line( +#ifdef MNEWS + japanese ? "OAUTH2 アクセストークン取得に失敗しました。" : +#endif /* MNEWS */ + "Failed to acquire pop3 OAUTH2 access token."); + sleep(/*ERROR_SLEEP*/3); + return(POP3_ERR_AUTH); + } + if (isspace(access_token[strlen(access_token)-1])) + access_token[strlen(access_token)-1] = '\0'; //chomp + sprintf(buff,"user=%s\001auth=Bearer %s\001\001", user, access_token); + mime_encodeB64(buff, xoauth2_b64); + sprintf(buff, "AUTH XOAUTH2 %s", xoauth2_b64); + //fprintf(stderr,"Sending XOAUTH2: %s\n", buff); sleep(3); + } else { +#endif + sprintf(buff, "%s %s", POP3_USER_CMD, user); + status = pop3_cmd(buff); + if (status != POP3_OK) { + return(status); + } + sprintf(buff, "%s %s", pop3_rpop_mode ? POP3_RPOP_CMD : POP3_PASS_CMD, pass); +#if POP3_OAUTH2 } - sprintf(buff, "%s %s", pop3_rpop_mode ? POP3_RPOP_CMD : POP3_PASS_CMD, pass); +#endif #endif /* !APOP */ status = pop3_cmd(buff); if (status != POP3_OK) { + print_mode_line( +#ifdef MNEWS + japanese ? "POP3サーバーとの認証に失敗しました。" : +#endif /* MNEWS */ + "Failed to authenticate with POP3 server."); + sleep(/*ERROR_SLEEP*/1); return(status); } first = 0; Index: smtplib/smtplib.c =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/smtplib/smtplib.c,v retrieving revision 1.1.1.1 retrieving revision 1.12 diff -u -r1.1.1.1 -r1.12 --- smtplib/smtplib.c 27 Nov 2002 01:12:19 -0000 1.1.1.1 +++ smtplib/smtplib.c 10 May 2020 01:02:45 -0000 1.12 @@ -67,7 +67,7 @@ static void send_pipe_error(void); /* パイプエラーハンドラ */ #endif /* MTAP */ #ifdef SMTP -static SMTP_ERR_CODE smtp_cmd(char*, int); /* SMTP コマンド送信, */ +static int smtp_cmd(char*); /* SMTP コマンド送信, */ /* ステータス受信 */ #endif /* SMTP */ #else /* !__STDC__ */ @@ -75,7 +75,7 @@ static void send_pipe_error(); /* パイプエラーハンドラ */ #endif /* MTAP */ #ifdef SMTP -static SMTP_ERR_CODE smtp_cmd(); /* SMTP コマンド送信, */ +static int smtp_cmd(); /* SMTP コマンド送信, */ /* ステータス受信 */ #endif /* SMTP */ #endif /* !__STDC__ */ @@ -322,7 +322,7 @@ break; } #endif /* !MSDOS */ - smtp_cmd(SMTP_QUIT_CMD, SMTP_QUIT_RES); + (void)smtp_cmd(SMTP_QUIT_CMD); #ifdef MSDOS tcp_close(&read_fd, &write_fd); #else /* !MSDOS */ @@ -425,7 +425,8 @@ break; case 1: /* SMTP 接続 */ #ifdef SMTP - return(smtp_cmd(SMTP_NOOP_CMD, SMTP_OKAY_RES)); + if (smtp_cmd(SMTP_NOOP_CMD) == SMTP_OKAY_RES) + return SMTP_OK; #else /* !SMTP */ break; #endif /* !SMTP */ @@ -458,6 +459,7 @@ char *ptr; register int i, j; static struct cpy_hdr smtp_fields[] = { + /* To, Cc, Bcc must be first */ {TO_FIELD, to_buff, sizeof(to_buff)}, {CC_FIELD, cc_buff, sizeof(cc_buff)}, {BCC_FIELD, bcc_buff, sizeof(bcc_buff)}, @@ -546,64 +548,106 @@ #ifdef SMTP fp1 = fopen(file_name, "r"); if (fp1 != (FILE*)NULL) { + int smtp_status; copy_fields(fp1, smtp_fields, sizeof(smtp_fields) / sizeof(struct cpy_hdr), CF_CLR_MASK | CF_GET_MASK | CF_ADD_MASK | CF_SPC_MASK); fseek(fp1, 0L, 0); - for (i = 0; i < 4; i++) { - switch (i) { - case 0: - if (gethostname(buff2, sizeof(buff2))) { - strcpy(buff2, domain_name); - } else { - if (strchr(buff2, '.') == (char*)NULL) { - strcpy(buff2, domain_name); - } + + /* HELO */ + if (official_name[0]) { + strcpy(buff2, official_name); + } else { /* below approximates official_name setup */ + if (gethostname(buff2, sizeof(buff2))) { + /* failed gethostname; use domain argument */ + strcpy(buff2, domain_name); + } else { + if (strchr(buff2, '.') == (char*)NULL) { + /* got hostname but not FQDN */ + strcat(buff2, domain_name); } - if (!strcmp(buff2, smtp_server)) { - strcpy(buff2, SMTP_LOCAL_HOST_NAME); + } + } + /* 結局、自分宛のSMTPなのであれば、"localhost"を使う */ + if (!strcmp(buff2, smtp_server)) { + strcpy(buff2, SMTP_LOCAL_HOST_NAME); + } + sprintf(buff1, "%s %s", SMTP_HELO_CMD, buff2); + if ((smtp_status = smtp_cmd(buff1)) != SMTP_OKAY_RES) { + print_fatal("Server rejected %s by code %d", buff1, smtp_status); + status = SMTP_ERR_COMM; + goto smtp_bail; + } + + /* MAIL From: */ + if (strchr(user_name, '@') == NULL) { + sprintf(buff1, "%s %s <%s@%s>", SMTP_MAIL_CMD, FROM_FIELD, + user_name, domain_name); + } else { + sprintf(buff1, "%s %s <%s>", SMTP_MAIL_CMD, FROM_FIELD, user_name); + } + if ((smtp_status = smtp_cmd(buff1)) != SMTP_OKAY_RES) { + print_fatal("Server rejected %s by code %d", buff1, smtp_status); + status = SMTP_ERR_COMM; + goto smtp_bail; + } + + /* RCPT To: */ + for (j = 0; j < 3; j++) { /* To:, Cc:, Bcc: */ + ptr = smtp_fields[j].field_buff; + while (*ptr) { + ptr = get_real_adrs(ptr, buff2); + sprintf(buff1, "%s %s <%s>", SMTP_RCPT_CMD, TO_FIELD, buff2); + if ((smtp_status = smtp_cmd(buff1)) != SMTP_OKAY_RES) { + print_fatal("Server rejected %s by code %d", buff1, smtp_status); + status = status2; + goto smtp_bail; } - sprintf(buff1, "%s %s", SMTP_HELO_CMD, buff2); - break; - case 1: -#ifdef USE_QMAIL - sprintf(buff1, "%s %s <%s@%s>", SMTP_MAIL_CMD, FROM_FIELD, - user_name, domain_name); -#else /* !USE_QMAIL */ - sprintf(buff1, "%s %s %s@%s", SMTP_MAIL_CMD, FROM_FIELD, - user_name, domain_name); -#endif /* !USE_QMAIL */ - break; - case 2: - for (j = 0; j < 3; j++) { - ptr = smtp_fields[j].field_buff; + } + } + + /* DATA */ + strcpy(buff1, SMTP_DATA_CMD); + if ((smtp_status = smtp_cmd(buff1)) != SMTP_INPUT_RES) { + print_fatal("Server rejected %s by code %d", buff1, smtp_status); + status = SMTP_ERR_COMM; + goto smtp_bail; + } + + /* DATA content */ + status = SMTP_OK; + while (fgets(buff1, sizeof(buff1) - 1, fp1)) { + ptr = buff1; + while (*ptr) { + if (*ptr == '\n') { + *ptr = '\0'; + break; + } + ptr++; + } + /* Bcc: ヘッダの削除はしていない。SMTPサーバー任せ */ + + if (head_flag && !buff1[0]) { /* header separator blank line */ + head_flag = 0; + /* Date: がデータ中になければ、date_buff2 を送信 */ + if (!date_buff[0]) { + ptr = date_buff2; while (*ptr) { - ptr = get_real_adrs(ptr, buff2); -#ifdef USE_QMAIL - sprintf(buff1, "%s %s <%s>", SMTP_RCPT_CMD, TO_FIELD, buff2); -#else /* !USE_QMAIL */ - sprintf(buff1, "%s %s %s", SMTP_RCPT_CMD, TO_FIELD, buff2); -#endif /* !USE_QMAIL */ - status2 = smtp_cmd(buff1, SMTP_OKAY_RES); - if (status2 != SMTP_OK) { - status = status2; + if (*ptr == '\n') { + *ptr = '\0'; break; } + ptr++; } - if (*ptr) { + status2 = smtp_send(date_buff2); + if (status2 != SMTP_OK) { + status = status2; break; } } - if (*ptr) { - buff1[0] = '\0'; - } else { - strcpy(buff1, SMTP_DATA_CMD); - } - break; - default: - status = SMTP_OK; - while (fgets(buff1, sizeof(buff1) - 1, fp1)) { - ptr = buff1; + /* Message-ID: がなければ、message_buff2 を送信 */ + if (!message_buff[0]) { + ptr = message_buff2; while (*ptr) { if (*ptr == '\n') { *ptr = '\0'; @@ -611,81 +655,51 @@ } ptr++; } - if (!buff1[0]) { - if (head_flag) { - head_flag = 0; - if (!date_buff[0]) { - ptr = date_buff2; - while (*ptr) { - if (*ptr == '\n') { - *ptr = '\0'; - break; - } - ptr++; - } - status2 = smtp_send(date_buff2); - if (status2 != SMTP_OK) { - status = status2; - break; - } - } - if (!message_buff[0]) { - ptr = message_buff2; - while (*ptr) { - if (*ptr == '\n') { - *ptr = '\0'; - break; - } - ptr++; - } - status2 = smtp_send(message_buff2); - if (status2 != SMTP_OK) { - status = status2; - break; - } - } - } - } - if (buff1[0] == TCP_END_MARK) { - sprintf(buff2, "%c%s", TCP_END_MARK, buff1); - status2 = smtp_send(buff2); - } else { - status2 = smtp_send(buff1); - } + status2 = smtp_send(message_buff2); if (status2 != SMTP_OK) { status = status2; break; } } - if (status != SMTP_OK) { - buff1[0] = '\0'; - } else { - buff1[0] = TCP_END_MARK; - buff1[1] = '\0'; - } - break; - } - if (buff1[0]) { - if (smtp_cmd(buff1, (i == 2) ? SMTP_INPUT_RES : SMTP_OKAY_RES)) { - status = SMTP_ERR_COMM; - break; - } + }/* blank line */ + if (buff1[0] == TCP_END_MARK) { + /* "." は ".."にして送信 */ + sprintf(buff2, "%c%s", TCP_END_MARK, buff1); + status2 = smtp_send(buff2); } else { - break; + status2 = smtp_send(buff1); + } + if (status2 != SMTP_OK) { + goto smtp_bail; } + }/*fgets*/ + if (status != SMTP_OK) { /* error */ + goto smtp_bail; + } + buff1[0] = TCP_END_MARK; + buff1[1] = '\0'; + if ((smtp_status = smtp_cmd(buff1)) != SMTP_OKAY_RES) { + print_fatal("Server rejected DATA termination %s by code %d", buff1, smtp_status); + status = SMTP_ERR_COMM; + goto smtp_bail; } +smtp_bail: fclose(fp1); } #endif /* SMTP */ break; default: break; - } + }/* endsw smtp_connect_mode */ return(status); } /* * 実アドレス取得 + * char *str1: ""Sato Taro" (administrator) , suzuki@example.jp" + * char *str2: (呼出側バッファ) "sato@example.com" が記入される + * return char*: str1 の次の場所。連続して呼び出す際にstr1として渡す。 + * *return='\0' ならば終了。 */ #ifdef __STDC__ @@ -800,21 +814,23 @@ /* * SMTP コマンド送信/ステータス受信 + * cmd: 送信する行 + * return: SMTPステータス (250など) */ #ifdef SMTP #ifdef __STDC__ -static SMTP_ERR_CODE smtp_cmd(char *cmd, int code) +static int smtp_cmd(char *cmd) #else /* !__STDC__ */ -static SMTP_ERR_CODE smtp_cmd(cmd, code) +static int smtp_cmd(cmd) char *cmd; - int code; #endif /* !__STDC__ */ { char *ptr1; - char *ptr2; char buff[BUFF_SIZE]; + strcpy(buff, "(none)"); /* default received condition */ + if (smtp_send(cmd) == SMTP_OK) { do { ptr1 = (char*)NULL; @@ -827,23 +843,17 @@ } } while (*ptr1 == '-'); if (ptr1 != (char*)NULL) { - if (atoi(buff) == code) { - return(SMTP_OK); + int code = atoi(buff); + if (code == 0 || code >= 400) { + /* エラーメッセージは、全文をログに残す */ + print_fatal("On %s, server returned: %s", cmd, buff); } + return(code); } + print_fatal("On %s, server returned nothing!", cmd); } - ptr1 = buff; - ptr2 = cmd; - while (*ptr2) { - if (*ptr2 <= ' ') { - break; - } - *ptr1++ = *ptr2++; - } - *ptr1 = '\0'; - print_fatal("SMTP error at %s command.", buff); - print_fatal("%s", buff); - return(SMTP_ERR_COMM); + print_fatal("Sending %s failed", cmd); + return 0; } #endif /* SMTP */ Index: smtplib/smtplib.h =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/smtplib/smtplib.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- smtplib/smtplib.h 27 Nov 2002 01:12:19 -0000 1.1.1.1 +++ smtplib/smtplib.h 27 Nov 2002 09:21:49 -0000 1.2 @@ -104,6 +104,8 @@ /* (0:MTAP,1:SMTP,2:DEAD) */ extern char *smtp_connect_string[]; /* SMTP 接続モード文字列 */ +extern char official_name[]; + /* best FQDN of myself */ #ifdef __STDC__ extern SMTP_ERR_CODE smtp_select_server(char*); Index: smtplib/update.doc =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/smtplib/update.doc,v retrieving revision 1.1.1.1 retrieving revision 1.4 diff -u -r1.1.1.1 -r1.4 --- smtplib/update.doc 27 Nov 2002 01:12:20 -0000 1.1.1.1 +++ smtplib/update.doc 28 Apr 2017 01:19:32 -0000 1.4 @@ -61,3 +61,12 @@ Ver 1.02 2001-02/07 (1) Message-ID と Date フィールドがない場合は自動付加 するようにしました。 + * 2002-11-27 + (*) HELO にてFQDNを使用するようにしました。 + * + (*) USE_QMAIL を廃止し、デフォルトにしました。 2017-04-26 + MAIL From: と <> でくくるのが + USE_QMAILでしたが、これがSMTP的には正式なので、 + デフォルトを < > つきにしました。 + (*) SMTP でエラーが起こった際、全文をログ 2017-04-28 + (mnews -E) に残すようにしました。 Index: src/article.c =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/src/article.c,v retrieving revision 1.1.1.1 retrieving revision 1.11 diff -u -r1.1.1.1 -r1.11 --- src/article.c 27 Nov 2002 01:12:20 -0000 1.1.1.1 +++ src/article.c 17 Sep 2007 14:26:06 -0000 1.11 @@ -400,7 +400,15 @@ if (news_group[current_group].max_article == 0L) { return(0); } + print_mode_line(japanese ? + "%s を選択しています。" : + "Selecting %s.", select_name); if (nntp_group(select_name) != NNTP_OK) { + print_warning(japanese ? + "サーバーへの接続が切れています。" : + "Connection to NNTP server dead."); + term_bell(); + sleep(ERROR_SLEEP); return(0); } if ((news_group[current_group].max_article @@ -1141,6 +1149,7 @@ print_fatal("Can't open extract file."); return(1); } + print_mode_line(japanese ? "%ld番目の記事を取得中です。" : "Downloading article %ld.", real_number); status = nntp_article(real_number, fp); fclose(fp); if (status != NNTP_OK) { @@ -1318,10 +1327,13 @@ break; } } + /* + * ^ptr2 ^ptr1 */ } + /* reiterate search from ptr1 */ } ptr1 = refer_message; - while (*ptr2) { + while (*ptr2) { /* copy refID ptr2 to refer_message[] */ if (*ptr2 == '>') { *ptr1++ = *ptr2; break; @@ -1340,6 +1352,7 @@ print_fatal("Can't open reference file."); return(1); } + print_mode_line(japanese ? "記事を取得中です。%s" : "Downloading article %s", refer_message); status = nntp_article2((CASTPTR)refer_message, fp); fclose(fp); if (status != NNTP_OK) { @@ -1375,6 +1388,7 @@ print_fatal("Can't open reference file."); return(1); } + print_mode_line(japanese ? "記事を取得中です。%s" : "Downloading article %s", message_id); status = nntp_article2((CASTPTR)message_id, fp); fclose(fp); if (status != NNTP_OK) { @@ -1701,8 +1715,13 @@ /* パック処理 */ if (news_article_mask) { - pack_articles(current_group, &news_article_number, - news_get_field, news_add_mark); + if (0 == pack_articles(current_group, &news_article_number, + news_get_field, news_add_mark)) { + ;/* パック成功 */ + } else { + /* パック失敗/abort。再度パックしない */ + news_article_mask = 0; + } } return(0); } @@ -1760,6 +1779,12 @@ if ((current_article < 0) || (current_article >= news_article_number)) { return(1); } + if (nntp_connect_mode == 1) /*NNTP XXX*/ + print_mode_line(japanese ? + "%ld番目の記事のヘッダを取得中です。" : + "Getting fields for article %ld", + article_list[current_article].real_number + ); article_list[current_article].mark &= ~UNFETCH_MARK; status = nntp_copy_fields(article_list[current_article].real_number, news_fields, @@ -2335,18 +2360,40 @@ } } term_attrib(RESET_ATTRIB); - switch (article_format) { - case 0: - l = term_columns - 36; - break; - case 1: - l = term_columns - 26; - break; - case 2: - default: - l = term_columns - 7; - break; +#ifdef XOVER /* { */ + /* preload to-be-visible articles */ + if (xover_mode) { + /* get upper & lower bound where is isn't cached */ + for (i=0,j=top_position; ; i++,j++) { + if (j >= max_article) goto _end_preload; /* all cached */ + if (i>=term_lines-mode_lines) goto _end_preload; + if (article_list[j].mark & UNFETCH_MARK) break; + } + /* Got unloaded top. Get bottom */ + k=j; /* k: upper bound */ + for (l=j; ; i++,j++) { + if (j >= max_article) break; + if (i>=term_lines-mode_lines) break; + if (article_list[j].mark & UNFETCH_MARK) l=j; + } + /* now l: lower bound. xover k-l range */ + print_mode_line(japanese ? + "記事 %ld - %ld の概要を取得中です。" : + "Downloading overview of articles %ld - %ld", + article_list[k].real_number, article_list[l].real_number); + if (nntp_xover(group, article_list[k].real_number, article_list[l].real_number) + != NNTP_OK) + goto _end_preload; + /* fill-in still unavailable entries as CANCELed */ + for (k; k<=l; k++) { + if (article_list[k].mark & UNFETCH_MARK) { + article_list[k].mark &= ~UNFETCH_MARK; + article_list[k].mark |= CANCEL_MARK; + } + } +_end_preload: ; } +#endif /* XOVER } */ for (i = 0, j = top_position; i < term_lines - mode_lines; i++, j++) { if (j >= max_article) { break; @@ -2440,6 +2487,18 @@ term_attrib(color_code[SUBJECT_COLOR]); } #endif /* COLOR */ + switch (article_format) { + case 0: + l = term_columns - 36; + break; + case 1: + l = term_columns - 26; + break; + case 2: + default: + l = term_columns - 7; + break; + } euc_strncpy(buff, article_list[j].subject, l); euc_printf("%s", buff); } @@ -3436,6 +3495,10 @@ } #ifdef XOVER if (xover_mode && (mark == news_add_mark)) { + print_mode_line(japanese ? + "記事 %ld - %ld の概要を取得中です。" : + "Downloading overview of articles %ld - %ld", + article_list[min_number].real_number, article_list[article_number - 1].real_number); if (nntp_xover(current_group, article_list[min_number].real_number, article_list[article_number - 1].real_number) == NNTP_OK) { @@ -3551,6 +3614,14 @@ register int i, j, k; article_number = *article_ptr; + +#ifndef DONT_USE_ABORT + term_enable_abort(); + print_mode_line(japanese ? "パック用に %d 個の記事を取得中 (^C:中断)" : "Retrieving %d articles to pack (^C:abort)", article_number); +#else + print_mode_line(japanese ? "パック用に %d 個の記事を取得中" : "Retrieving %d articles to pack", article_number); +#endif + for (i = 0; i < article_number; i++) { if ((article_list[i].mark & UNFETCH_MARK) && (!(article_list[i].mark & (READ_MARK | CANCEL_MARK)))) { @@ -3565,8 +3636,17 @@ print_fatal("Unexpected unfetched article-%d.", i); } } +#ifndef DONT_USE_ABORT + /* abort 時は 再度パックしないよう *_article_mask をリセットすべきだが、 + * ここからではできない + */ + if (check_abort()) { term_disable_abort(); return 1; } +#endif } + term_disable_abort(); + i = j = 0; + /*print_mode_line( japanese ? "パック処理中" : "Packing" );*/ while (j < article_number) { k = j; if (!(article_list[j].mark & (READ_MARK | CANCEL_MARK))) { @@ -3579,6 +3659,13 @@ print_fatal("ARTICLE=%d(%ld)->%d(%ld)", j, article_list[j].real_number, i, article_list[i].real_number); #endif /* DEBUG */ + /* ++++CCCCC+++ + * k j + * / copy + * i v + * CCCCCcccc+++ + * i j + */ if (i != k) { memmove(&article_list[i], &article_list[k], (j - k) * sizeof(struct article_struct)); @@ -3981,8 +4068,11 @@ /* * get_list すると *article_ptr が変化するので注意 + * ソートアルゴリズム(パックする・しない)は *mask_ptr にて決定 + * (USE_SORT_ABORT未対応) */ + /*print_mode_line(japanese ? "ソート/パックしています。" : "Sort/Packing.");*/ if (current_group >= 0) { get_list(current_group); } else { Index: src/board.c =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/src/board.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- src/board.c 27 Nov 2002 01:12:20 -0000 1.1.1.1 +++ src/board.c 10 May 2020 01:02:47 -0000 1.2 @@ -2862,7 +2862,11 @@ sizeof(cancel_fields) / sizeof(struct cpy_hdr), CF_CLR_MASK | CF_GET_MASK | CF_SPC_MASK); fclose(fp); - sprintf(buff, "%s@%s", user_name, domain_name); + if (strchr(user_name. '@') == NULL) { + sprintf(buff, "%s@%s", user_name, domain_name); + } else { + sprintf(buff, "%s", user_name); + } if (strindex(from_buff, buff)) { if (yes_or_no(CARE_YN_MODE, "記事をキャンセルしてよろしいですか?", "Cancel article.Are you sure?")) { Index: src/config.c =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/src/config.c,v retrieving revision 1.1.1.1 retrieving revision 1.8 diff -u -r1.1.1.1 -r1.8 --- src/config.c 27 Nov 2002 01:12:21 -0000 1.1.1.1 +++ src/config.c 10 May 2020 03:57:42 -0000 1.8 @@ -52,6 +52,9 @@ #ifdef MSVC #include #endif /* MSVC */ +#ifdef GET_DOMAIN_FROM__RES +#include +#endif /* GET_DOMAIN_FROM__RES */ #if !(defined(MSDOS) || defined(BEOS)) extern struct passwd *passwd; /* パスワードエントリ */ @@ -88,6 +91,12 @@ extern short xover_mode; /* XOVER 有効スイッチ */ #endif /* XOVER */ extern char auth_file[]; /* ユーザ認証ファイル */ +#ifdef POP3 +extern char pop3_user[]; /* POP3 でのユーザー名 */ +#ifdef POP3_OAUTH2 +extern char pop3_oauth2_access_token_cmd[]; /* XOAUTH2 access token 取得コマンド */ +#endif +#endif #ifdef MIME extern int mime_encode_jis(); /* MIME エンコード(JIS 出力) */ @@ -395,6 +404,12 @@ {"nntp_user", PARAM_STRING_TYPE, (CASTPTR)nntp_user}, {"nntp_auth_mode", PARAM_SW_TYPE, (CASTPTR)&nntp_auth_mode}, #endif /* NNTP_AUTH */ +#ifdef POP3 + {"pop3_user", PARAM_STRING_TYPE, (CASTPTR)pop3_user}, +#ifdef POP3_OAUTH2 + {"pop3_oauth2_access_token_cmd", PARAM_STRING_TYPE, (CASTPTR)pop3_oauth2_access_token_cmd}, +#endif +#endif /* POP3 */ {"smtp_mode", PARAM_SW_TYPE, (CASTPTR)&smtp_mode}, {"pop3_mode", PARAM_SW_TYPE, (CASTPTR)&pop3_mode}, {"pop3_del_mode", PARAM_SW_TYPE, (CASTPTR)&pop3_del_mode}, @@ -621,6 +636,7 @@ * ドメイン名 */ + official_name[0]='\0'; #ifndef BEOS if (gethostname(localhost, sizeof(localhost))) { fprintf(stderr, "Can't get server host entry.\n"); @@ -633,17 +649,21 @@ if (host_ent = gethostbyname(localhost)) { #else /* !notdef */ if (tcp_get_canonname(localhost, cname_buf, sizeof(cname_buf))) { -#endif /* !notdef */ +#endif /* !notdef } */ #ifdef ADD_HOSTNAME #ifdef notdef + strcpy(official_name, host_ent->h_name); sprintf(domain_name, "%s.", host_ent->h_name); #else /* !notdef */ - sprintf(domain_name, "%s.", xname_buf); + strcpy(official_name, cname_buf); + sprintf(domain_name, "%s.", cname_buf); #endif /* !notdef */ #else /* !ADD_HOSTNAME */ #ifdef notdef + strcpy(official_name, host_ent->h_name); ptr = strchr(host_ent->h_name, '.'); #else /* !notdef */ + strcpy(official_name, cname_buf); ptr = strchr(cname_buf, '.'); #endif /* !notdef */ if (ptr != (char*)NULL) { @@ -664,7 +684,13 @@ #ifdef DOMAIN_NAME strcpy(domain_name, DOMAIN_NAME); #else /* !DOMAIN_NAME */ - buff[0] = '\0'; + domain_name[0] = '\0'; +#if GET_DOMAIN_FROM__RES + res_init(); + if (_res.defdname) { + strcpy(domain_name, _res.defdname); + } +#endif /* GET_DOMAIN_FROM__RES */ fp = fopen(DOMAIN_FILE, "r"); if (fp != (FILE*)NULL) { if (fgets(buff, sizeof(buff) - 1, fp)) { @@ -676,38 +702,54 @@ } ptr++; } + strcpy(domain_name, buff); } fclose(fp); } -#ifdef ADD_HOSTNAME - sprintf(domain_name, "%s.%s", localhost, buff); -#else /* !ADD_HOSTNAME */ - strcpy(domain_name, buff); +#ifdef ADD_HOSTNAME /* as RHS of user@domain */ + if (strchr(localhost, '.') == NULL && domain_name[0] != '\0' ) { + sprintf(buff, "%s.%s", localhost, domain_name); + strcpy(domain_name, buff); + } else { + strcpy(domain_name, localhost); + } #endif /* !ADD_HOSTNAME */ #endif /* !DOMAIN_NAME */ #endif /* !RESOLVE */ - env_ptr = (char*)getenv(DOMAIN_ENV); - if (env_ptr != (char*)NULL) { - strcpy(domain_name, env_ptr); - } - if (!domain_name[0]) { - fprintf(stderr, - "Installation problem,default-domain name is not configured.\n"); - return(1); - } + #ifdef OFFICIAL_NAME strcpy(official_name, OFFICIAL_NAME); #else /* !OFFICIAL_NAME */ - ptr = strchr(localhost, '.'); - if (ptr != (char*)NULL) { - *ptr = '\0'; + if (official_name[0] == '\0') { + strcpy(official_name, localhost); + ptr = strchr(localhost, '.'); + if (ptr == (char*)NULL) { + /* localhost != FQDN */ +#ifdef ADD_HOSTNAME + strcpy(official_name, domain_name); +#else /* !ADD_HOSTNAME */ + if (domain_name[0] != '\0') { + sprintf(official_name, "%s.%s", localhost, domain_name); + } +#endif /* !ADD_HOSTNAME */ + } } - sprintf(official_name, "%s.%s", localhost, domain_name); #endif /* !OFFICIAL_NAME */ env_ptr = (char*)getenv(OFFICIAL_ENV); if (env_ptr != (char*)NULL) { strcpy(official_name, env_ptr); } + + env_ptr = (char*)getenv(DOMAIN_ENV); + if (env_ptr != (char*)NULL) { + strcpy(domain_name, env_ptr); + } + + if (!domain_name[0]) { + fprintf(stderr, + "Installation problem,default-domain name is not configured.\n"); + return(1); + } return(0); } @@ -753,16 +795,16 @@ } else { strcpy(dot_dir, home_dir); } - env_ptr = (char*)getenv(USER_ENV); - if (env_ptr != (char*)NULL) { - strcpy(user_name, env_ptr); - } else { + if ((env_ptr = (char*)getenv("LOGNAME")) == (char*)NULL && + (env_ptr = (char*)getenv(USER_ENV) ) == (char*)NULL) { #if defined(MSDOS) || defined(OS2) || defined(BEOS) fprintf(stderr, "Can't get %s environment.\n", USER_ENV); exit(1); #else /* !(MSDOS || OS2 || BEOS) */ strcpy(user_name, passwd->pw_name); #endif /* !(MSDOS || OS2 || BEOS) */ + } else { + strcpy(user_name, env_ptr); } #ifdef MSPL ptr = mail_spool; @@ -793,7 +835,7 @@ } while (*env_ptr) { if (*env_ptr == '&') { - strcpy(ptr, user_name); + strcpy(ptr, passwd->pw_name); if (islower(*ptr)) { *ptr = toupper(*ptr); } @@ -900,6 +942,22 @@ if (i < 0) { i = 0; } + + /* 環境変数による追加上書設定 */ + +#ifdef POP3 + env_ptr = (char*)getenv("POP3USER"); + if (env_ptr != (char*)NULL) { + strcpy(pop3_user, env_ptr); + } +#ifdef POP3_OAUTH2 + env_ptr = (char*)getenv("POP3_OAUTH2_CMD"); + if (env_ptr != (char*)NULL) { + strcpy(pop3_oauth2_access_token_cmd, env_ptr); + } +#endif +#endif /*POP3*/ + x_nsubj_mode = x_nsubj_org; #ifndef PAGER pager_mode = 1; @@ -984,19 +1042,19 @@ switch (*ptr) { case 'e': case 'E': - *(int*)parameter[i].variable = (CASTPTR)EUC_CODE; + *(int*)parameter[i].variable = EUC_CODE; break; case 'j': case 'J': - *(int*)parameter[i].variable = (CASTPTR)JIS_CODE; + *(int*)parameter[i].variable = JIS_CODE; break; case 's': case 'S': - *(int*)parameter[i].variable = (CASTPTR)SJIS_CODE; + *(int*)parameter[i].variable = SJIS_CODE; break; case 'a': case 'A': - *(int*)parameter[i].variable = (CASTPTR)ASCII_CODE; + *(int*)parameter[i].variable = ASCII_CODE; break; default: fprintf(stderr, Index: src/config.h =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/src/config.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- src/config.h 27 Nov 2002 01:12:22 -0000 1.1.1.1 +++ src/config.h 27 Nov 2002 02:26:35 -0000 1.2 @@ -459,7 +459,7 @@ #define ARTICLE_FORMAT 0 /* 記事一覧フォーマット */ #define MIME_FORMAT 1 /* MIMEフォーマット処理 */ #define MIME_MMEDIA_MODE 1 /* MIME マルチメディア処理 */ -#define MSGCHK_RULE 1 /* メールチェック方法 */ +#define MSGCHK_RULE 0 /* メールチェック方法 */ #define SORT_RULE 0 /* ソート方法 */ #define REPLY_INDICATOR ">> " /* 引用するインジケータ */ @@ -475,7 +475,7 @@ #define NEWS_MAX_ARTICLE 256 #define BOARD_MAX_ARTICLE 256 #else /* !(SMALL || (MSDOS && !__GO32__ && !__WIN32__ & !X68K)) */ -#define NEWS_MAX_ARTICLE 1024 +#define NEWS_MAX_ARTICLE 16384 #define BOARD_MAX_ARTICLE 1024 #endif /* !(SMALL || (MSDOS && !__GO32__ && !__WIN32__ & !X68K)) */ Index: src/jnames.c =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/src/jnames.c,v retrieving revision 1.1.1.1 retrieving revision 1.1 diff -u -r1.1.1.1 -r1.1 --- src/jnames.c 27 Nov 2002 01:12:21 -0000 1.1.1.1 +++ src/jnames.c 27 Nov 2002 01:12:21 -0000 1.1 @@ -1,6 +1,6 @@ #ifndef lint static char -rcs[] = "@(#)$Header: /home/kabe/CVSroot/mnews-1.22-qnx/src/jnames.c,v 1.1.1.1 2002/11/27 01:12:21 root Exp $"; +rcs[] = "@(#)$Header: /home/kabe/CVSroot/mnews-1.22-qnx/src/jnames.c,v 1.1 2002/11/27 01:12:21 root Exp $"; #endif /* !lint */ /* @@ -8,9 +8,8 @@ */ /* $Log: jnames.c,v $ -/* Revision 1.1.1.1 2002/11/27 01:12:21 root -/* -/* Original mnews-1.22PL5 +/* Revision 1.1 2002/11/27 01:12:21 root +/* Initial revision /* * Revision 1.1 87/11/20 10:32:47 sanewo * Initial revision Index: src/mailsend.c =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/src/mailsend.c,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -r1.1.1.1 -r1.3 --- src/mailsend.c 27 Nov 2002 01:12:21 -0000 1.1.1.1 +++ src/mailsend.c 4 May 2021 03:20:29 -0000 1.3 @@ -102,7 +102,11 @@ return(1); } if (add_cc_mode) { - sprintf(cc_buff, "%s@%s", user_name, domain_name); + if (strchr(user_name, '@') == NULL) { + sprintf(cc_buff, "%s@%s", user_name, domain_name); + } else { + sprintf(cc_buff, "%s", user_name); + } } else { cc_buff[0] = '\0'; } @@ -339,7 +343,11 @@ } } strcpy(reply_buff, buff1); - sprintf(buff2, "%s@%s", user_name, domain_name); + if (strchr(user_name, '@') == NULL) { + sprintf(buff2, "%s@%s", user_name, domain_name); + } else { + sprintf(buff2, "%s", user_name); + } if (!reply_to_mode) { to_buff[0] = '\0'; } @@ -877,10 +885,18 @@ return(0); } if (user_gecos[0]) { - fprintf(fp2, "%s %s@%s (%s)\n", SENDER_FIELD, user_name, domain_name, + if (strchr(user_name, '@') == NULL) { + fprintf(fp2, "%s %s@%s (%s)\n", SENDER_FIELD, user_name, domain_name, user_gecos); + } else { + fprintf(fp2, "%s %s (%s)\n", SENDER_FIELD, user_name, user_gecos); + } } else { - fprintf(fp2, "%s %s@%s\n", SENDER_FIELD, user_name, domain_name); + if (strchr(user_name, '@') == NULL) { + fprintf(fp2, "%s %s@%s\n", SENDER_FIELD, user_name, domain_name); + } else { + fprintf(fp2, "%s %s\n", SENDER_FIELD, user_name); + } } fprintf(fp2, "%s %s\n", FROM_FIELD, from_buff); fprintf(fp2, "%s %s\n", TO_FIELD, to_buff2); @@ -1269,7 +1285,11 @@ * 後で Fcc: 用に使用するために一旦 from_buff に展開する */ - sprintf(from_buff, "%s@%s", user_name, domain_name); + if (strchr(user_name, '@') == NULL) { + sprintf(from_buff, "%s@%s", user_name, domain_name); + } else { + sprintf(from_buff, "%s", user_name); + } if (user_gecos[0]) { if (from_mode) { length += (long)fprintf2(fp2, "%s %s <%s>\n", FROM_FIELD, Index: src/mh.c =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/src/mh.c,v retrieving revision 1.1.1.1 retrieving revision 1.5 diff -u -r1.1.1.1 -r1.5 --- src/mh.c 27 Nov 2002 01:12:21 -0000 1.1.1.1 +++ src/mh.c 2 Oct 2012 09:01:46 -0000 1.5 @@ -1232,7 +1232,7 @@ mh_exec_command(MH_INC_COMMAND, mh_folder[current_folder].folder_name, (char*)NULL); #endif /* !BUILTIN_MMH */ - } + }/*key==I*/ mh_count(current_folder, 0); mh_get_list(current_folder); current_article = @@ -3338,9 +3338,9 @@ } } } - } + } /*wend *ptr*/ } - } + } /*mh_read_field*/ } /* ソート処理 */ @@ -3365,8 +3365,13 @@ /* パック処理 */ if (mail_article_mask) { - pack_articles(current_folder, &mh_article_number, mh_get_field, - (void (*)())NULL); + if (0 == pack_articles(current_folder, &mh_article_number, mh_get_field, + (void (*)())NULL)) { + ; /* pack ok */ + } else { + /* パックに失敗/abortしたら、再度パックしない */ + mail_article_mask = 0; + } } return(0); } @@ -4066,11 +4071,13 @@ count = 0; fp = (FILE*)NULL; + print_mode_line(japanese ? "MSPL/POP3サーバに接続中" : "Connecting to MSPL/POP3 server..."); status = pop3_open(); if (status != POP3_OK) { print_fatal("Can't connect MSPL/POP3 server."); return(-1); } + print_mode_line(japanese ? "メールを取得中" : "Retrieving mail messages..."); while (status == POP3_OK) { status = pop3_read(buff1, sizeof(buff1), &rd_stat); switch (rd_stat) { @@ -4121,8 +4128,10 @@ fclose(fp); } if ((status == POP3_OK) && r_flag) { + print_mode_line(japanese ? "メールスプールを削除中..." : "Deleting mail spool..."); pop3_delete(); } + print_mode_line(japanese ? "接続を切断しています" : "Disconnecting"); pop3_close(); if (status != POP3_OK) { return(-1); Index: src/mnews.c =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/src/mnews.c,v retrieving revision 1.1.1.1 retrieving revision 1.8 diff -u -r1.1.1.1 -r1.8 --- src/mnews.c 27 Nov 2002 01:12:21 -0000 1.1.1.1 +++ src/mnews.c 10 May 2020 01:02:47 -0000 1.8 @@ -318,6 +318,15 @@ {'M', &smtp_server_ptr, &smtp_mode, "SMTP"}, {'P', &pop3_server_ptr, &pop3_mode, "POP3"}, }; + int flag_usage = 0; + +#ifdef SETLOCALE + setlocale(LC_ALL, ""); /* LANG環境変数を使用する */ +#endif +#ifdef SETLOCALE_CTYPE + /* QNX needs to set "C-TRADITIONAL" locale to handle EUC printf */ + setlocale(LC_CTYPE, SETLOCALE_CTYPE); +#endif nntp_server_ptr = smtp_server_ptr = pop3_server_ptr = (char*)NULL; opt_print_code = UNKNOWN_CODE; @@ -391,11 +400,13 @@ ptr++; } } else if (*ptr == 'h') { - usage(1); - exit(0); + flag_usage = 1 | 0x80; + ptr++; + break; } else if (*ptr == 'v') { - usage(0); - exit(0); + flag_usage = 0 | 0x80; + ptr++; + break; } else if (*ptr++ == 'n') { break; } @@ -403,7 +414,7 @@ } } nntp_connect_mode = nntp_mode; - nntp_select_server(nntp_server_ptr); + nntp_select_server(nntp_server_ptr); /* will gethostname */ i = env_config(file_ptr); if (i) { fprintf(stderr, "%s : Configuration error.\n", prog_name); @@ -414,6 +425,10 @@ sleep(ERROR_SLEEP); } } + if (flag_usage) { + usage(flag_usage & 0x7f); + exit(0); + } #ifndef MIME mime_format = 0; #endif /* !MIME */ @@ -718,6 +733,8 @@ */ if (nntp_status == NNTP_OK) { + print_mode_line(japanese ? "サーバーとの接続を終了します。" : + "Disconnecting from server."); nntp_close(); } if (article_list != (ARTICLE_LIST*)NULL) { @@ -857,12 +874,16 @@ #endif /* TERM_REGION_CLR */ int mode; +#ifdef TITLE_NO_NNTP_CHECK + mode = nntp_connect_mode; +#else mode = 2; if (!mail_mode) { if (nntp_noop() == NNTP_OK) { mode = nntp_connect_mode; } } +#endif /* TITLE_NO_NNTP_CHECK */ #ifdef TERM_REGION_CLR term_locate(0, 3 - wide_mode * 2); for (i = 0; i < (term_lines - mode_lines); i++) { @@ -3623,7 +3644,11 @@ char *ptr; #endif /* LARGE */ - sprintf(from_buff, "%s@%s", user_name, domain_name); + if (strchr(user_name, '@') == NULL) { + sprintf(from_buff, "%s@%s", user_name, domain_name); + } else { + sprintf(from_buff, "%s", user_name); + } if (!strcmp(from_buff, real_adrs)) { return(1); } @@ -4550,6 +4575,13 @@ fprintf(stderr, "Configuration:%s\n", conf_opt); fprintf(stderr, "Architecture :%s\n", arch_opt); #endif /* !(MSDOS || OS2) */ - fprintf(stderr, "Domain name :%s\n", domain_name); + fprintf(stderr, "\n"); + fprintf(stderr, "My FQDN :%s\n", official_name); + if (strchr(user_name, '@') == NULL) { + fprintf(stderr, "Your envelope:%s@%s (%s)\n", user_name, domain_name, user_gecos); + } else { + fprintf(stderr, "Your envelope:%s (%s)\n", user_name, user_gecos); + } + fprintf(stderr, "NNTP server :%s\n", nntp_server); } } Index: src/mnews.h =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/src/mnews.h,v retrieving revision 1.1.1.1 retrieving revision 1.4 diff -u -r1.1.1.1 -r1.4 --- src/mnews.h 27 Nov 2002 01:12:22 -0000 1.1.1.1 +++ src/mnews.h 9 Dec 2002 06:02:29 -0000 1.4 @@ -22,8 +22,12 @@ #endif /* __GLIBC__ && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0) */ #define READER_NAME "mnews" +#ifdef MNEWS_VERSION_SUFFIX +#define MNEWS_VERSION "1.22PL5" MNEWS_VERSION_SUFFIX +#else #define MNEWS_VERSION "1.22PL5" -#define MNEWS_DATE "2001-02/07(Wed)" +#endif +#define MNEWS_DATE "2002-11-27(Wed)" #define ERROR_FILE "mnewserr" #if defined(MSDOS) && !defined(USE_LONG_FNAME) @@ -61,7 +65,7 @@ #define REPLY_MESSAGE "Your message of " #define TEXT_SEPARATOR "--text follows this line--" #define MULTI_END_MARK "\001\n"/* マルチ記事のセパレータ */ -#define ERROR_SLEEP 3 /* エラー発生時の待ち時間 */ +#define ERROR_SLEEP 1 /* エラー発生時の待ち時間 */ #define HEAD_LINES 3 #define BOTTOM_LINES 1 #define MODE_LINES (HEAD_LINES + BOTTOM_LINES) Index: src/newspost.c =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/src/newspost.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- src/newspost.c 27 Nov 2002 01:12:21 -0000 1.1.1.1 +++ src/newspost.c 10 May 2020 01:02:47 -0000 1.2 @@ -478,17 +478,24 @@ } *ptr1 = '\0'; } else { + char myfrom[SMALL_BUFF]; + if (strchr(user_name, '@') == NULL) { + sprintf(myfrom, "%s@%s", user_name, domain_name); + } else { + sprintf(myfrom, "%s", user_name); + } + if (user_gecos[0]) { if (from_mode) { - sprintf(ptr1, "%s <%s@%s>", user_gecos, user_name, domain_name); + sprintf(ptr1, "%s <%s>", user_gecos, myfrom); } else { - sprintf(ptr1, "%s@%s (%s)", user_name, domain_name, user_gecos); + sprintf(ptr1, "%s (%s)", myfrom, user_gecos); } } else { if (from_mode) { - sprintf(ptr1, "<%s@%s>", user_name, domain_name); + sprintf(ptr1, "<%s>", myfrom); } else { - sprintf(ptr1, "%s@%s", user_name, domain_name); + sprintf(ptr1, "%s", myfrom); } } } @@ -910,7 +917,11 @@ * 後で Fcc: 用に使用するために一旦 from_buff に展開する */ - sprintf(from_buff, "%s@%s", user_name, domain_name); + if (strchr(user_name, '@') == NULL) { + sprintf(from_buff, "%s@%s", user_name, domain_name); + } else { + sprintf(from_buff, "%s", user_name); + } if (user_gecos[0]) { if (from_mode) { length += (long)fprintf2(fp2, "%s %s <%s>\n", FROM_FIELD, Index: src/pager.c =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/src/pager.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- src/pager.c 27 Nov 2002 01:12:21 -0000 1.1.1.1 +++ src/pager.c 29 Oct 2016 00:21:21 -0000 1.2 @@ -1137,7 +1137,7 @@ } /* - * 前行取得(下位関数) + * 前行取得(下位関数) 現在のglobal FILE *fp のfposのnumber行前へfseek(fp)する */ #ifdef __STDC__ @@ -1208,10 +1208,10 @@ } /* - * positon = 行頭位置 + * position = 行頭位置 */ - noread = first; /* OPTIMIZE: use old buffer if "first" */ + noread = first; /* OPTIMIZE: use old buffer if "first" */ /* XXX すでに*ptr1='\0' で書き潰されているとダメかも! */ if (!noread) { fseek(fp, position, 0); } @@ -1329,21 +1329,21 @@ length2 = 0; ptr1 = &buff1[length1]; status++; - while (1) { + while (1) { /* ptr1 から80カラムずつ最後まで試しに切り出し、最後の物理行の先頭をptr2に入れる*/ /* XXX このへんバグあり 漢字が奇数カラムで終わるとcharsetの同期が取れない?*/ ptr2 = ptr1; first = kanji_strposcpy(buff2, ptr1, term_columns); ptr1 += first; if (!*ptr1) { break; } - length2 += first; + length2 += first; /* buff1[length] から、前の画面行の最後までのデータ長 */ } - *ptr2 = '\0'; - if (!buff1[length1]) { - break; + *ptr2 = '\0'; /* ソース側の前の行(無い可能性も!?)を終端; 最後の物理行の頭を書き潰し */ + if (!buff1[length1]) { /* 物理行1行だけだった(上で頭が書き潰された)*/ + break; /* この論理行がnumber物理行を埋めないので、抜ける */ } } - position += (length1 + length2); + position += (length1 + length2); /* 最初の物理行だけ、になる */ break; } } else { @@ -1374,13 +1374,13 @@ } } } - } + } /*1*/ fseek(fp, position, 0); #ifdef LOG_DEBUG print_fatal("WEND prev_position() NUM=%d POSITION=%d", number, (int)position); #endif /* LOG_DEBUG */ - } + } /*number-- > 0*/ #endif /* !notdef */ return(status); } Index: src/youbin.c =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/src/youbin.c,v retrieving revision 1.1.1.1 retrieving revision 1.1 diff -u -r1.1.1.1 -r1.1 --- src/youbin.c 27 Nov 2002 01:12:22 -0000 1.1.1.1 +++ src/youbin.c 27 Nov 2002 01:12:22 -0000 1.1 @@ -22,7 +22,7 @@ * * IPv6 support: H.YOSHIFUJI , 1999-11/19,22,24. * - * $Revision: 1.1.1.1 $ $Date: 2002/11/27 01:12:22 $ + * $Revision: 1.1 $ $Date: 2002/11/27 01:12:22 $ */ #include Index: tcplib/tcplib.c =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/tcplib/tcplib.c,v retrieving revision 1.1.1.1 retrieving revision 1.13 diff -u -r1.1.1.1 -r1.13 --- tcplib/tcplib.c 27 Nov 2002 01:12:20 -0000 1.1.1.1 +++ tcplib/tcplib.c 7 May 2020 13:18:58 -0000 1.13 @@ -238,7 +238,6 @@ } #endif /* !INET6 */ - print_warning("Trying to connect %s.", server_name); s = x = -1; while (1) { #ifdef INET6 @@ -249,6 +248,7 @@ hints.ai_flags = AI_ADDRCONFIG; #endif /* USE_GAI_ADDRCONFIG */ res = res0 = NULL; + print_warning("Trying to connect %s:%s", server_name, serv_buff); gaierr = getaddrinfo(server_name, serv_buff, &hints, &res0); if (gaierr) { if ((gaierr == EAI_SERVICE) && @@ -265,13 +265,15 @@ } #else /* !INET6 */ sock_in.sin_port = htons(port); + print_warning("Trying to connect %s:%d", server_name, port); #endif /* !INET6 */ + #if defined(INET6) || defined(h_addr) #ifdef INET6 for (res = res0; res; res = res->ai_next) { #else /* !INET6 */ for (pptr = host_ent->h_addr_list; pptr && *pptr; pptr++) { -#endif /* INET6 vs !INET6 */ +#endif /* INET6 vs !INET6 } */ #ifdef INET6 s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); if (s < 0) { @@ -326,7 +328,7 @@ #else /* !BEOS */ (void)close(s); #endif /* !BEOS */ - } + }/* host_ent->h_addr_list */ #else /* !(h_addr || INET6) */ #ifdef EXCELAN @@ -380,7 +382,7 @@ if (s > 0) { break; } - } + }/*wend 1*/ if (x < 0) { print_fatal("Can't connect %s server %s.", service_name, server_name); if (s >= 0) { @@ -502,7 +504,7 @@ { int len = fp->len; char *ptr = fp->ptr; - int cnt = 0; + int cnt = 0; /* counter for return buf */ while (--length > 0) { if (!len) { @@ -512,7 +514,7 @@ if ((len = recv(fp->fd, fp->buf, sizeof fp->buf, 0)) < 0) { #else /* !BEOS */ if ((len = read(fp->fd, fp->buf, sizeof fp->buf)) < 0) { -#endif /* !BEOS */ +#endif /* !BEOS } */ if (errno == EINTR) { goto again; } @@ -671,7 +673,7 @@ char *string; #endif /* !__STDC__ */ { - char buff[BUFF_SIZE]; + char buff[BUFF_SIZE+3]; int len; #ifdef MSDOS @@ -683,16 +685,21 @@ return(1); } #ifdef TCP_DEBUG - fprintf(stderr, "SEND:%s\n", string); + print_fatal("SEND:%s\n", string); #endif /* TCP_DEBUG */ /* * DECstation では setenv PROG_ENV POSIX して compile しないと * printf の戻り値が正常時に 0 なのでうまく動きません。 */ + /* todo: efficiency of large input string, without copy */ + strncpy(buff, string, (sizeof buff)-3); /*XXX overflow!!*/ len = strlen(string); - strcpy(buff, string); + if (len > (sizeof buff)-3) { + print_fatal("%s string to send length %d too long, truncating", service_name, len); + len = (sizeof buff)-3; + } buff[len++] = '\r'; buff[len++] = '\n'; buff[len] = '\0'; @@ -838,7 +845,7 @@ } } #ifdef TCP_DEBUG - fprintf(stderr, "RECEIVE:%s\n", ptr); + print_fatal("RECEIVE:%s\n", ptr); #endif /* TCP_DEBUG */ return(0); } @@ -957,7 +964,7 @@ #ifdef DONT_HAVE_STRDUP if (t = (s != (char*)NULL) ? ((char*)malloc(strlen(s) + 1)) : (char*)NULL) { - strcpy(t, s); + strcpy(t, s); /*XXX core if t=NULL*/ } #else /* !DONT_HAVE_STRDUP */ t = strdup(s); @@ -993,7 +1000,7 @@ ptr1 = (char*)getenv(env_name); if (ptr1 != (char*)NULL) { - strcpy(server_name, ptr1); + strcpy(server_name, ptr1); /*XXX bound check NI_MAXHOST or MAXHOSTNAMELEN*/ ptr2 = tcp_split_port(server_name); if (ptr2 != (char*)NULL) { if (atoi(ptr2) > 0) { @@ -1026,7 +1033,7 @@ *ptr1 = '\0'; } fclose(fp); - strcpy(server_name, ptr2); + strcpy(server_name, ptr2); /*XXX bound check NI_MAXHOST or MAXHOSTNAMELEN*/ return(0); } fclose(fp); @@ -1035,6 +1042,9 @@ /* * ユーザ/パスワード取得 + * server_name: .netrcと照合するホスト名 + * user_ptr (呼出元のバッファ) 入力されたユーザー名 + * pass_ptr (呼出元のバッファ) 入力されたパスワード */ #ifdef __STDC__ @@ -1072,35 +1082,30 @@ #endif /* !MSDOS */ #endif /* !(MNEWS || MMH) */ - *user_ptr = '\0'; if (pass_ptr != (char*)NULL) { *pass_ptr = '\0'; } + if (user_ptr[0] == '\0') { /* デフォルトが無いので、埋める */ #if defined(MNEWS) || defined(MMH) - strcpy(user_ptr, user_name); + strcpy(user_ptr, user_name); /*XXX bound check SMALL_BUF*/ #else /* !(MNEWS || MMH) */ #ifdef MSDOS - if (env_ptr = (char*)getenv("USER")) { - strcpy(user_ptr, env_ptr); - } else { - return(1); - } + if (env_ptr = (char*)getenv("USER")) { + strcpy(user_ptr, env_ptr); /*XXX bound check SMALL_BUF*/ + } else { + return(1); + } #else /* !MSDOS */ - passwd = (struct passwd*)getpwuid(geteuid()); - if (passwd != (struct passwd*)NULL) { - strcpy(user_ptr, passwd->pw_name); - } else { - return(1); - } + passwd = (struct passwd*)getpwuid(geteuid()); + if (passwd != (struct passwd*)NULL) { + strcpy(user_ptr, passwd->pw_name); /*XXX bound check SMALL_BUF*/ + } else { + return(1); + } #endif /* !MSDOS */ #endif /* !(MNEWS || MMH) */ -#ifdef NNTP_AUTH - if (nntp_get_pass) { - if (nntp_user[0]) { - strcpy(user_ptr, nntp_user); - } - } -#endif /* NNTP_AUTH */ + }/*user_ptr=""*/ + #ifdef USE_NEWSAUTH if (pass_ptr == (char*)NULL) { return(0); @@ -1108,6 +1113,7 @@ #else /* !USE_NEWSAUTH */ full_match = match = line = 0; #endif /* !USE_NEWSAUTH */ + /* .netrc ファイルを読み込み、一致するmachineのpasswordを抜き出す */ if (auth_file[0]) { fp = fopen(auth_file, "r"); if (fp != (FILE*)NULL) { @@ -1141,21 +1147,21 @@ #else /* !notdef */ if (tcp_get_canonname(ptr1,cname_buf,sizeof(cname_buf)) == (char*)NULL) { -#endif /* !notdef */ +#endif /* !notdef } */ continue; } #ifdef notdef if (!strcmp(server_entry->h_name, server_name)) { #else /* !notdef */ if (!strcmp(cname_buf, server_name)) { -#endif /* !notdef */ +#endif /* !notdef } */ while ((*ptr2 == '\t') || (*ptr2 == ' ')) { ptr2++; } if ((!*ptr2) || (*ptr2 == '#')) { continue; } - strcpy(pass_ptr, ptr2); + strcpy(pass_ptr, ptr2); /*XXX bound check SMALL_BUF*/ break; } #else /* !USE_NEWSAUTH */ @@ -1195,7 +1201,7 @@ #endif /* !notdef */ match = 1; } - } + } /*}}*/ break; case 1: /* default */ match = -1; @@ -1221,7 +1227,7 @@ *ptr2++ = '\0'; } if (match) { - strcpy(user_ptr, ptr3); + strcpy(user_ptr, ptr3); /*XXX bound check SMALL_BUF*/ } break; case 3: /* password */ @@ -1239,7 +1245,7 @@ } if (match) { if (pass_ptr != (char*)NULL) { - strcpy(pass_ptr, ptr3); + strcpy(pass_ptr, ptr3); /*XXX bound check SMALL_BUF*/ full_match = match; } } @@ -1254,40 +1260,43 @@ print_fatal("Line %4d : Illegal keyword in \"%s\".", line, auth_file); break; - } + }/*endsw*/ break; } - } + }/*next i*/ while ((*ptr2 == '\t') || (*ptr2 == ' ')) { *ptr2++ = '\0'; } ptr1 = ptr2; - } + }/*wend *ptr1*/ #endif /* !USE_NEWSAUTH */ if (full_match > 0) { break; } - } + }/*wend fgets*/ fclose(fp); } - } + }/*auth_file[0]*/ if (*user_ptr && (pass_ptr ? *pass_ptr : 1)) { return(0); } #ifdef MNEWS - strcpy(buff, user_ptr); + /* input_line()は src/mnews.c の関数なので、本来はライブラリ側で使ってはいけない...*/ + strcpy(buff, user_ptr); /*XXX bound check, ok as BUFF_SIZE > SMALL_BUF*/ input_line(INPUT_SPCCUT_MASK ,"ユーザ名を入力して下さい:", "Input user name :" , buff); if (!buff[0]) { *user_ptr = '\0'; return(1); } - strcpy(user_ptr, buff); - buff[0] = '\0'; - input_line(INPUT_SHADOW_MASK, - "パスワードを入力して下さい:", - "Input password :", buff); - strcpy(pass_ptr, buff); + strcpy(user_ptr, buff); /*XXX bound check SMALL_BUF*/ + if (pass_ptr) { + buff[0] = '\0'; + input_line(INPUT_SHADOW_MASK, + "パスワードを入力して下さい:", + "Input password :", buff); + strcpy(pass_ptr, buff); /*XXX bound check SMALL_BUF*/ + } #else /* !MNEWS */ #ifdef MMH term_init(0); @@ -1417,7 +1426,7 @@ } } if ((int)(strlen(ptr1) + strlen(ptr2)) < (hdr_ptr2->buff_size)) { - strcat(ptr1, ptr2); + strcat(ptr1, ptr2); /*safe? bound check, hdr_ptr2->buff_size*/ ptr2 = ptr1; while (*ptr2) { if ((*ptr2 == '\n') && (!*(ptr2 + 1))) { @@ -1443,12 +1452,12 @@ if ((mask & CF_ADD_MASK) && *ptr1) { if ((int)(strlen(ptr1) + strlen(ptr2) + 1) < (hdr_ptr2->buff_size)) { - strcat(ptr1, "\n"); - strcat(ptr1, ptr2); + strcat(ptr1, "\n"); /*safe? bound check, field_buff could be SMALL_BUFF*/ + strcat(ptr1, ptr2); /*safe? bound check, field_buff could be SMALL_BUFF*/ } } else { if ((int)strlen(ptr2) < (hdr_ptr2->buff_size)) { - strcpy(ptr1, ptr2); + strcpy(ptr1, ptr2); /*XXX bound check, field_buff could be SMALL_BUFF*/ } } ptr2 = ptr1; @@ -1514,6 +1523,9 @@ /* * 記事フィールドコピー + * + * copy_field("From: whatever ", buff, FROM_FIELD) + * @return buff := "whatever 0) { if ((*ptr1++ & 0xdf) != (*field++ & 0xdf)) { return((char*)NULL); @@ -1539,8 +1551,8 @@ while ((*ptr1 == ' ') || (*ptr1 == '\t')) { ptr1++; } - strcpy((char*)ptr2, (char*)ptr1); - while (*ptr2) { + strcpy((char*)ptr2, (char*)ptr1); /*XXX bound check, MAX_FIELD_LEN et al*/ + while (*ptr2) { /*XXX bound check */ if (*ptr2 == '\n') { *ptr2 = '\0'; break; @@ -1670,4 +1682,52 @@ va_end(ap); } #endif /* !DONT_HAVE_DOPRNT */ + +/* + * ステータス表示 + * (-DMNEWS では src/mnews.c:print_mode_line() に丸投げ) + */ + +#ifdef DONT_HAVE_DOPRNT +#ifdef __STDC__ +void print_mode_line(char *fmt, int arg1, int arg2, int arg3, int arg4, + int arg5, int arg6, int arg7, int arg8) +#else /* !__STDC__ */ +void print_mode_line(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) + char *fmt; + int arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8; +#endif /* !__STDC__ */ +{ + char buff[SMALL_BUFF]; + + if (!quiet_mode) { + sprintf(buff, fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); + fprintf(stderr, "%s : Status : %s\n", prog_name, buff); + fflush(stderr); + } +} +#else /* !DONT_HAVE_DOPRNT */ +#ifdef __STDC__ +void print_mode_line(char *fmt, ...) +#else /* !__STDC__ */ +void print_mode_line(fmt, va_alist) + char *fmt; +#endif /* !__STDC__ */ +{ + va_list ap; + char buff[SMALL_BUFF]; + +#ifdef __STDC__ + va_start(ap, fmt); +#else /* !__STDC__ */ + va_start(ap); +#endif /* !__STDC__ */ + vsprintf(buff, fmt, ap); + if (!quiet_mode) { + fprintf(stderr, "%s : Status : %s\n", prog_name, buff); + fflush(stderr); + } + va_end(ap); +} +#endif /* !DONT_HAVE_DOPRNT */ #endif /* !(MNEWS || MANEKIN || MMH) */ Index: tcplib/tcplib.h =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/tcplib/tcplib.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- tcplib/tcplib.h 27 Nov 2002 01:12:20 -0000 1.1.1.1 +++ tcplib/tcplib.h 3 Apr 2012 08:26:52 -0000 1.2 @@ -189,11 +189,13 @@ extern void print_warning(char*, ...); /* 警告エラー表示 */ extern void print_fatal(char*, ...);/* 致命的エラー表示 */ +extern void print_mode_line(char*, ...);/* 情況表示 */ #else /* (!__STDC__ || DONT_HAVE_DOPRNT) */ extern int copy_fields(); /* 記事ヘッダコピー(複数) */ extern char *copy_field(); /* 記事ヘッダコピー */ extern void print_warning(); /* 警告エラー表示 */ extern void print_fatal(); /* 致命的エラー表示 */ +extern void print_mode_line(); /* 情況表示 */ #endif /* (!__STDC__ || DONT_HAVE_DOPRNT) */ #endif /* !__TCPLIB_H__ */ Index: tcplib/update.doc =================================================================== RCS file: /home/kabe/CVSroot/mnews-1.22-qnx/tcplib/update.doc,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- tcplib/update.doc 27 Nov 2002 01:12:20 -0000 1.1.1.1 +++ tcplib/update.doc 18 Sep 2007 01:55:56 -0000 1.2 @@ -69,3 +69,6 @@ (1) IPv4 だけを検索できるモード指定を可能にしました。 Ver 1.12 2001-02/07 (1) Message-ID 作成ルーチンを追加しました。 + * 2007-09-14 + (*) 1022文字以上の行の送信時にcore dump + する事象に暫定対応しました。