svnno****@sourc*****
svnno****@sourc*****
2010年 1月 28日 (木) 18:56:12 JST
Revision: 3747 http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=3747 Author: doda Date: 2010-01-28 18:56:12 +0900 (Thu, 28 Jan 2010) Log Message: ----------- TitleReportSequence に設定可能な値に empty を追加。 TitleReportSequence のデフォルト値を empty に変更。(セキュリティ対応) # タイトル文字列には改行等の制御文字を受け付けない為、致命的ではないのだけれど、念の為に変更。 Modified Paths: -------------- trunk/teraterm/common/tttypes.h trunk/teraterm/teraterm/vtterm.c trunk/teraterm/ttpset/ttset.c -------------- next part -------------- Modified: trunk/teraterm/common/tttypes.h =================================================================== --- trunk/teraterm/common/tttypes.h 2010-01-28 02:50:44 UTC (rev 3746) +++ trunk/teraterm/common/tttypes.h 2010-01-28 09:56:12 UTC (rev 3747) @@ -220,8 +220,13 @@ #define WF_CURSORCHANGE 1 #define WF_WINDOWCHANGE 2 #define WF_WINDOWREPORT 4 -#define WF_TITLEREPORT 8 +#define WF_TITLEREPORT 24 // (8 | 16) +// Title Reporting Type +#define IdTitleReportOff 0 +#define IdTitleReportOn 8 +#define IdTitleReportEmpty 24 + // iconf flags (used in ts.VTIcon and ts.TEKIcon) #define IdIconDefault 0 Modified: trunk/teraterm/teraterm/vtterm.c =================================================================== --- trunk/teraterm/teraterm/vtterm.c 2010-01-28 02:50:44 UTC (rev 3746) +++ trunk/teraterm/teraterm/vtterm.c 2010-01-28 09:56:12 UTC (rev 3747) @@ -1896,49 +1896,65 @@ } break; case 20: // Report icon label - if (ts.WindowFlag & WF_TITLEREPORT) { - switch (ts.AcceptTitleChangeRequest) { - case IdTitleChangeRequestOff: - len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "L%s", CLocale, ts.Title); - break; - case IdTitleChangeRequestAhead: - len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "L%s %s", CLocale, cv.TitleRemote, ts.Title); - break; - case IdTitleChangeRequestLast: - len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "L%s %s", CLocale, ts.Title, cv.TitleRemote); - break; - default: - if (cv.TitleRemote[0] == 0) { + switch (ts.WindowFlag & WF_TITLEREPORT) { + case IdTitleReportOff: + // nothing to do + break; + case IdTitleReportOn: + switch (ts.AcceptTitleChangeRequest) { + case IdTitleChangeRequestOff: len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "L%s", CLocale, ts.Title); - } - else { - len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "L%s", CLocale, cv.TitleRemote); - } - } - SendOSCstr(Report, len); + break; + case IdTitleChangeRequestAhead: + len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "L%s %s", CLocale, cv.TitleRemote, ts.Title); + break; + case IdTitleChangeRequestLast: + len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "L%s %s", CLocale, ts.Title, cv.TitleRemote); + break; + default: + if (cv.TitleRemote[0] == 0) { + len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "L%s", CLocale, ts.Title); + } + else { + len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "L%s", CLocale, cv.TitleRemote); + } + } + SendOSCstr(Report, len); + break; + default: // IdTitleReportEmpty: + SendOSCstr("L", 1); + break; } break; case 21: // Report window title - if (ts.WindowFlag & WF_TITLEREPORT) { - switch (ts.AcceptTitleChangeRequest) { - case IdTitleChangeRequestOff: - len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "l%s", CLocale, ts.Title); - break; - case IdTitleChangeRequestAhead: - len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "l%s %s", CLocale, cv.TitleRemote, ts.Title); - break; - case IdTitleChangeRequestLast: - len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "l%s %s", CLocale, ts.Title, cv.TitleRemote); - break; - default: - if (cv.TitleRemote[0] == 0) { + switch (ts.WindowFlag & WF_TITLEREPORT) { + case IdTitleReportOff: + // nothing to do + break; + case IdTitleReportOn: + switch (ts.AcceptTitleChangeRequest) { + case IdTitleChangeRequestOff: len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "l%s", CLocale, ts.Title); - } - else { - len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "l%s", CLocale, cv.TitleRemote); - } - } - SendOSCstr(Report, len); + break; + case IdTitleChangeRequestAhead: + len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "l%s %s", CLocale, cv.TitleRemote, ts.Title); + break; + case IdTitleChangeRequestLast: + len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "l%s %s", CLocale, ts.Title, cv.TitleRemote); + break; + default: + if (cv.TitleRemote[0] == 0) { + len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "l%s", CLocale, ts.Title); + } + else { + len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "l%s", CLocale, cv.TitleRemote); + } + } + SendOSCstr(Report, len); + break; + default: // IdTitleReportEmpty: + SendOSCstr("L", 1); + break; } break; } Modified: trunk/teraterm/ttpset/ttset.c =================================================================== --- trunk/teraterm/ttpset/ttset.c 2010-01-28 02:50:44 UTC (rev 3746) +++ trunk/teraterm/ttpset/ttset.c 2010-01-28 09:56:12 UTC (rev 3747) @@ -1324,8 +1324,13 @@ ts->WindowFlag |= WF_WINDOWREPORT; // Window report sequence - if (GetOnOff(Section, "TitleReportSequence", FName, TRUE)) - ts->WindowFlag |= WF_TITLEREPORT; + GetPrivateProfileString(Section, "TitleReportSequence", "Empty", Temp, sizeof(Temp), FName); + if (_stricmp(Temp, "on") == 0) + ts->WindowFlag |= IdTitleReportOn; + else if (_stricmp(Temp, "off") == 0) + ts->WindowFlag &= ~WF_TITLEREPORT; + else // empty + ts->WindowFlag |= IdTitleReportEmpty; // Line at a time mode ts->EnableLineMode = GetOnOff(Section, "EnableLineMode", FName, TRUE); @@ -2314,8 +2319,17 @@ ts->WindowFlag & WF_WINDOWREPORT); // Title report sequence - WriteOnOff(Section, "TitleReportSequence", FName, - ts->WindowFlag & WF_TITLEREPORT); + switch (ts->WindowFlag & WF_TITLEREPORT) { + case IdTitleReportOff: + WritePrivateProfileString(Section, "TitleReportSequence", "off", FName); + break; + case IdTitleReportOn: + WritePrivateProfileString(Section, "TitleReportSequence", "on", FName); + break; + default: // IdTitleReportEmpty + WritePrivateProfileString(Section, "TitleReportSequence", "empty", FName); + break; + } // Line at a time mode WriteOnOff(Section, "EnableLineMode", FName, ts->EnableLineMode);