OSDN Git Service

Prepare for release of 1.98f.
[ffftp/ffftp.git] / connect.c
index fe01e66..122f441 100644 (file)
--- a/connect.c
+++ b/connect.c
 #include <string.h>\r
 #include <mbstring.h>\r
 #include <time.h>\r
-#include <winsock.h>\r
+// IPv6対応\r
+//#include <winsock.h>\r
+#include <winsock2.h>\r
+// 切断対策\r
+#include <mstcpip.h>\r
 #include <windowsx.h>\r
 #include <commctrl.h>\r
 \r
 \r
 /*===== プロトタイプ =====*/\r
 \r
-static BOOL CALLBACK QuickConDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
-static int SendInitCommand(char *Cmd);\r
+// 64ビット対応\r
+//static BOOL CALLBACK QuickConDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+static INT_PTR CALLBACK QuickConDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+// 同時接続対応\r
+//static int SendInitCommand(char *Cmd);\r
+static int SendInitCommand(SOCKET Socket, char *Cmd, int *CancelCheckWork);\r
 static void AskUseFireWall(char *Host, int *Fire, int *Pasv, int *List);\r
 static void SaveCurrentSetToHistory(void);\r
 static int ReConnectSkt(SOCKET *Skt);\r
@@ -65,6 +73,8 @@ static SOCKET DoConnect(HOSTDATA* HostData, char *Host, char *User, char *Pass,
 static int CheckOneTimePassword(char *Pass, char *Reply, int Type);\r
 static BOOL CALLBACK BlkHookFnc(void);\r
 static int Socks5MakeCmdPacket(SOCKS5REQUEST *Packet, char Cmd, int ValidIP, ulong IP, char *Host, ushort Port);\r
+// IPv6対応\r
+static int Socks5MakeCmdPacketIPv6(SOCKS5REQUEST *Packet, char Cmd, int ValidIP, char *IP, char *Host, ushort Port);\r
 static int SocksSendCmd(SOCKET Socket, void *Data, int Size, int *CancelCheckWork);\r
 // 同時接続対応\r
 //static int Socks5GetCmdReply(SOCKET Socket, SOCKS5REPLY *Packet);\r
@@ -94,6 +104,8 @@ extern int FwallLower;
 extern int FwallDelimiter;\r
 extern int PasvDefault;\r
 extern int QuickAnonymous;\r
+// 切断対策\r
+extern int TimeOut;\r
 \r
 /*===== ローカルなワーク =====*/\r
 \r
@@ -102,17 +114,19 @@ static int TryConnect = NO;
 static SOCKET CmdCtrlSocket = INVALID_SOCKET;\r
 static SOCKET TrnCtrlSocket = INVALID_SOCKET;\r
 static HOSTDATA CurHost;\r
-// UTF-8対応\r
-static int TmpNameKanjiCode;\r
 \r
 /* 接続中の接続先、SOCKSサーバのアドレス情報を保存しておく */\r
 /* この情報はlistenソケットを取得する際に用いる */\r
-static struct sockaddr_in SocksSockAddr;       /* SOCKSサーバのアドレス情報 */\r
-static struct sockaddr_in CurSockAddr;         /* 接続先ホストのアドレス情報 */\r
+// IPv6対応\r
+//static struct sockaddr_in SocksSockAddr;     /* SOCKSサーバのアドレス情報 */\r
+//static struct sockaddr_in CurSockAddr;               /* 接続先ホストのアドレス情報 */\r
 \r
 static int UseIPadrs;\r
 static char DomainName[HOST_ADRS_LEN+1];\r
 \r
+#if defined(HAVE_TANDEM)\r
+static int Oss = NO;  /* OSS ファイルシステムへアクセスしている場合は YES */\r
+#endif\r
 \r
 \r
 \r
@@ -151,7 +165,9 @@ void ConnectProc(int Type, int Num)
                InitPWDcommand();\r
                CopyHostFromList(AskCurrentHost(), &CurHost);\r
                // UTF-8対応\r
-               TmpNameKanjiCode = CurHost.NameKanjiCode;\r
+               CurHost.CurNameKanjiCode = CurHost.NameKanjiCode;\r
+               // IPv6対応\r
+               CurHost.CurNetType = CurHost.NetType;\r
 \r
                if(ConnectRas(CurHost.Dialup, CurHost.DialupAlways, CurHost.DialupNotify, CurHost.DialEntry) == FFFTP_SUCCESS)\r
                {\r
@@ -177,23 +193,53 @@ void ConnectProc(int Type, int Num)
                        CmdCtrlSocket = DoConnect(&CurHost, CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, Save, CurHost.Security, &CancelFlg);\r
                        TrnCtrlSocket = CmdCtrlSocket;\r
 \r
-                       // UTF-8対応\r
-                       if(TmpNameKanjiCode == KANJI_AUTO)\r
+                       if(CmdCtrlSocket != INVALID_SOCKET)\r
                        {\r
-                               if(DoDirListCmdSkt("", "", 999, &CancelFlg) == FTP_COMPLETE)\r
+                               // 暗号化通信対応\r
+                               switch(CurHost.CryptMode)\r
+                               {\r
+                               case CRYPT_NONE:\r
+                                       if(CurHost.UseFTPIS != NO || CurHost.UseSFTP != NO)\r
+                                       {\r
+                                               if(DialogBox(GetFtpInst(), MAKEINTRESOURCE(savecrypt_dlg), GetMainHwnd(), ExeEscDialogProc) == YES)\r
+                                                       SetHostExcryption(AskCurrentHost(), CurHost.UseNoEncryption, CurHost.UseFTPES, NO, NO);\r
+                                       }\r
+                                       break;\r
+                               case CRYPT_FTPES:\r
+                                       if(CurHost.UseNoEncryption != NO || CurHost.UseFTPIS != NO || CurHost.UseSFTP != NO)\r
+                                       {\r
+                                               if(DialogBox(GetFtpInst(), MAKEINTRESOURCE(savecrypt_dlg), GetMainHwnd(), ExeEscDialogProc) == YES)\r
+                                                       SetHostExcryption(AskCurrentHost(), NO, CurHost.UseFTPES, NO, NO);\r
+                                       }\r
+                                       break;\r
+                               case CRYPT_FTPIS:\r
+                                       if(CurHost.UseNoEncryption != NO || CurHost.UseFTPES != NO || CurHost.UseSFTP != NO)\r
+                                       {\r
+                                               if(DialogBox(GetFtpInst(), MAKEINTRESOURCE(savecrypt_dlg), GetMainHwnd(), ExeEscDialogProc) == YES)\r
+                                                       SetHostExcryption(AskCurrentHost(), NO, NO, CurHost.UseFTPIS, NO);\r
+                                       }\r
+                                       break;\r
+                               case CRYPT_SFTP:\r
+                                       if(CurHost.UseNoEncryption != NO || CurHost.UseFTPES != NO || CurHost.UseFTPIS != NO)\r
+                                       {\r
+                                               if(DialogBox(GetFtpInst(), MAKEINTRESOURCE(savecrypt_dlg), GetMainHwnd(), ExeEscDialogProc) == YES)\r
+                                                       SetHostExcryption(AskCurrentHost(), NO, NO, NO, CurHost.UseSFTP);\r
+                                       }\r
+                                       break;\r
+                               }\r
+\r
+                               // UTF-8対応\r
+                               if(CurHost.CurNameKanjiCode == KANJI_AUTO)\r
                                {\r
-                                       SetCache(999, "");\r
-                                       TmpNameKanjiCode = AnalyzeNameKanjiCode(999);\r
+                                       if(DoDirListCmdSkt("", "", 999, &CancelFlg) == FTP_COMPLETE)\r
+                                               CurHost.CurNameKanjiCode = AnalyzeNameKanjiCode(999);\r
                                }\r
-                       }\r
 \r
-                       if(CmdCtrlSocket != INVALID_SOCKET)\r
-                       {\r
                                strcpy(TitleHostName, CurHost.HostName);\r
                                DispWindowTitle();\r
                                SoundPlay(SND_CONNECT);\r
 \r
-                               SendInitCommand(CurHost.InitCmd);\r
+                               SendInitCommand(CmdCtrlSocket, CurHost.InitCmd, &CancelFlg);\r
 \r
                                if(strlen(CurHost.LocalInitDir) > 0)\r
                                {\r
@@ -246,7 +292,9 @@ void QuickConnectProc(void)
                InitPWDcommand();\r
                CopyDefaultHost(&CurHost);\r
                // UTF-8対応\r
-               TmpNameKanjiCode = CurHost.NameKanjiCode;\r
+               CurHost.CurNameKanjiCode = CurHost.NameKanjiCode;\r
+               // IPv6対応\r
+               CurHost.CurNetType = CurHost.NetType;\r
                if(SplitUNCpath(Tmp, CurHost.HostAdrs, CurHost.RemoteInitDir, File, CurHost.UserName, CurHost.PassWord, &CurHost.Port) == FFFTP_SUCCESS)\r
                {\r
                        if(strlen(CurHost.UserName) == 0)\r
@@ -271,18 +319,15 @@ void QuickConnectProc(void)
                        CmdCtrlSocket = DoConnect(&CurHost, CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security, &CancelFlg);\r
                        TrnCtrlSocket = CmdCtrlSocket;\r
 \r
-                       // UTF-8対応\r
-                       if(TmpNameKanjiCode == KANJI_AUTO)\r
+                       if(CmdCtrlSocket != INVALID_SOCKET)\r
                        {\r
-                               if(DoDirListCmdSkt("", "", 999, &CancelFlg) == FTP_COMPLETE)\r
+                               // UTF-8対応\r
+                               if(CurHost.CurNameKanjiCode == KANJI_AUTO)\r
                                {\r
-                                       SetCache(999, "");\r
-                                       TmpNameKanjiCode = AnalyzeNameKanjiCode(999);\r
+                                       if(DoDirListCmdSkt("", "", 999, &CancelFlg) == FTP_COMPLETE)\r
+                                               CurHost.CurNameKanjiCode = AnalyzeNameKanjiCode(999);\r
                                }\r
-                       }\r
 \r
-                       if(CmdCtrlSocket != INVALID_SOCKET)\r
-                       {\r
                                strcpy(TitleHostName, CurHost.HostAdrs);\r
                                DispWindowTitle();\r
                                SoundPlay(SND_CONNECT);\r
@@ -294,7 +339,7 @@ void QuickConnectProc(void)
                                EnableUserOpe();\r
 \r
                                if(strlen(File) > 0)\r
-                                       DirectDownLoadProc(File);\r
+                                       DirectDownloadProc(File);\r
                        }\r
                        else\r
                        {\r
@@ -319,7 +364,9 @@ void QuickConnectProc(void)
 *              BOOL TRUE/FALSE\r
 *----------------------------------------------------------------------------*/\r
 \r
-static BOOL CALLBACK QuickConDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+// 64ビット対応\r
+//static BOOL CALLBACK QuickConDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+static INT_PTR CALLBACK QuickConDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
 {\r
        static char *Buf;\r
        int i;\r
@@ -439,7 +486,9 @@ void DirectConnectProc(char *unc, int Kanji, int Kana, int Fkanji, int TrMode)
                CurHost.NameKanjiCode = Fkanji;\r
                CurHost.KanaCnv = YES;                  /* とりあえず */\r
                // UTF-8対応\r
-               TmpNameKanjiCode = CurHost.NameKanjiCode;\r
+               CurHost.CurNameKanjiCode = CurHost.NameKanjiCode;\r
+               // IPv6対応\r
+               CurHost.CurNetType = CurHost.NetType;\r
 \r
                SetHostKanaCnvImm(CurHost.KanaCnv);\r
                SetHostKanjiCodeImm(CurHost.KanjiCode);\r
@@ -458,18 +507,15 @@ void DirectConnectProc(char *unc, int Kanji, int Kana, int Fkanji, int TrMode)
                CmdCtrlSocket = DoConnect(&CurHost, CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security, &CancelFlg);\r
                TrnCtrlSocket = CmdCtrlSocket;\r
 \r
-               // UTF-8対応\r
-               if(TmpNameKanjiCode == KANJI_AUTO)\r
+               if(CmdCtrlSocket != INVALID_SOCKET)\r
                {\r
-                       if(DoDirListCmdSkt("", "", 999, &CancelFlg) == FTP_COMPLETE)\r
+                       // UTF-8対応\r
+                       if(CurHost.CurNameKanjiCode == KANJI_AUTO)\r
                        {\r
-                               SetCache(999, "");\r
-                               TmpNameKanjiCode = AnalyzeNameKanjiCode(999);\r
+                               if(DoDirListCmdSkt("", "", 999, &CancelFlg) == FTP_COMPLETE)\r
+                                       CurHost.CurNameKanjiCode = AnalyzeNameKanjiCode(999);\r
                        }\r
-               }\r
 \r
-               if(CmdCtrlSocket != INVALID_SOCKET)\r
-               {\r
                        strcpy(TitleHostName, CurHost.HostAdrs);\r
                        DispWindowTitle();\r
                        SoundPlay(SND_CONNECT);\r
@@ -481,7 +527,7 @@ void DirectConnectProc(char *unc, int Kanji, int Kana, int Fkanji, int TrMode)
                        EnableUserOpe();\r
 \r
                        if(strlen(File) > 0)\r
-                               DirectDownLoadProc(File);\r
+                               DirectDownloadProc(File);\r
                        else\r
                                ResetAutoExitFlg();\r
                }\r
@@ -526,7 +572,9 @@ void HistoryConnectProc(int MenuCmd)
                InitPWDcommand();\r
                CopyHistoryToHost(&Hist, &CurHost);\r
                // UTF-8対応\r
-               TmpNameKanjiCode = CurHost.NameKanjiCode;\r
+               CurHost.CurNameKanjiCode = CurHost.NameKanjiCode;\r
+               // IPv6対応\r
+               CurHost.CurNetType = CurHost.NetType;\r
 \r
                if(ConnectRas(CurHost.Dialup, CurHost.DialupAlways, CurHost.DialupNotify, CurHost.DialEntry) == FFFTP_SUCCESS)\r
                {\r
@@ -549,23 +597,20 @@ void HistoryConnectProc(int MenuCmd)
                        CmdCtrlSocket = DoConnect(&CurHost, CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security, &CancelFlg);\r
                        TrnCtrlSocket = CmdCtrlSocket;\r
 \r
-                       // UTF-8対応\r
-                       if(TmpNameKanjiCode == KANJI_AUTO)\r
+                       if(CmdCtrlSocket != INVALID_SOCKET)\r
                        {\r
-                               if(DoDirListCmdSkt("", "", 999, &CancelFlg) == FTP_COMPLETE)\r
+                               // UTF-8対応\r
+                               if(CurHost.CurNameKanjiCode == KANJI_AUTO)\r
                                {\r
-                                       SetCache(999, "");\r
-                                       TmpNameKanjiCode = AnalyzeNameKanjiCode(999);\r
+                                       if(DoDirListCmdSkt("", "", 999, &CancelFlg) == FTP_COMPLETE)\r
+                                               CurHost.CurNameKanjiCode = AnalyzeNameKanjiCode(999);\r
                                }\r
-                       }\r
 \r
-                       if(CmdCtrlSocket != INVALID_SOCKET)\r
-                       {\r
                                strcpy(TitleHostName, CurHost.HostAdrs);\r
                                DispWindowTitle();\r
                                SoundPlay(SND_CONNECT);\r
 \r
-                               SendInitCommand(CurHost.InitCmd);\r
+                               SendInitCommand(CmdCtrlSocket, CurHost.InitCmd, &CancelFlg);\r
 \r
                                DoLocalCWD(CurHost.LocalInitDir);\r
                                GetLocalDirForWnd();\r
@@ -604,7 +649,9 @@ void HistoryConnectProc(int MenuCmd)
 *                      cmd1\r\ncmd2\r\n\0\r
 *----------------------------------------------------------------------------*/\r
 \r
-static int SendInitCommand(char *Cmd)\r
+// 同時接続対応\r
+//static int SendInitCommand(char *Cmd)\r
+static int SendInitCommand(SOCKET Socket, char *Cmd, int *CancelCheckWork)\r
 {\r
        char Tmp[INITCMD_LEN+1];\r
        char *Pos;\r
@@ -615,7 +662,8 @@ static int SendInitCommand(char *Cmd)
                if((Pos = strchr(Tmp, '\r')) != NULL)\r
                        *Pos = NUL;\r
                if(strlen(Tmp) > 0)\r
-                       DoQUOTE(Tmp);\r
+//                     DoQUOTE(Tmp);\r
+                       DoQUOTE(Socket, Tmp, CancelCheckWork);\r
 \r
                if((Cmd = strchr(Cmd, '\n')) != NULL)\r
                        Cmd++;\r
@@ -709,7 +757,7 @@ int AskHostNameKanji(void)
 //             CopyHostFromListInConnect(AskCurrentHost(), &CurHost);\r
 //\r
 //     return(CurHost.NameKanjiCode);\r
-       return(TmpNameKanjiCode);\r
+       return(CurHost.CurNameKanjiCode);\r
 }\r
 \r
 \r
@@ -854,6 +902,14 @@ int AskHostType(void)
        if(AskCurrentHost() != HOSTNUM_NOENTRY)\r
                CopyHostFromListInConnect(AskCurrentHost(), &CurHost);\r
 \r
+#if defined(HAVE_TANDEM)\r
+       /* OSS ファイルシステムは UNIX ファイルシステムと同じでいいので AUTO を返す\r
+          ただし、Guardian ファイルシステムに戻ったときにおかしくならないように\r
+          CurHost.HostType 変数は更新しない */\r
+       if(CurHost.HostType == HTYPE_TANDEM && Oss == YES)\r
+               return(HTYPE_AUTO);\r
+#endif\r
+\r
        return(CurHost.HostType);\r
 }\r
 \r
@@ -1043,11 +1099,18 @@ int ReConnectTrnSkt(SOCKET *Skt, int *CancelCheckWork)
                HostData.UseFTPIS = NO;\r
        if(HostData.CryptMode != CRYPT_SFTP)\r
                HostData.UseSFTP = NO;\r
+       // UTF-8対応\r
+       HostData.CurNameKanjiCode = HostData.NameKanjiCode;\r
+       // IPv6対応\r
+       HostData.CurNetType = HostData.NetType;\r
+       // 同時接続対応\r
+       HostData.NoDisplayUI = YES;\r
        // 暗号化通信対応\r
        // 同時接続対応\r
 //     if((*Skt = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security)) != INVALID_SOCKET)\r
        if((*Skt = DoConnect(&HostData, CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security, CancelCheckWork)) != INVALID_SOCKET)\r
        {\r
+               SendInitCommand(*Skt, CurHost.InitCmd, CancelCheckWork);\r
 //             AskRemoteCurDir(Path, FMAX_PATH);\r
 //             DoCWD(Path, YES, YES, YES);\r
                Sts = FFFTP_SUCCESS;\r
@@ -1089,6 +1152,7 @@ static int ReConnectSkt(SOCKET *Skt)
 //     if((*Skt = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security)) != INVALID_SOCKET)\r
        if((*Skt = DoConnect(&CurHost, CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security, &CancelFlg)) != INVALID_SOCKET)\r
        {\r
+               SendInitCommand(*Skt, CurHost.InitCmd, &CancelFlg);\r
                AskRemoteCurDir(Path, FMAX_PATH);\r
                DoCWD(Path, YES, YES, YES);\r
                Sts = FFFTP_SUCCESS;\r
@@ -1200,13 +1264,17 @@ void DisconnectProc(void)
 \r
        if((CmdCtrlSocket != INVALID_SOCKET) && (CmdCtrlSocket != TrnCtrlSocket))\r
        {\r
-               DoQUIT(CmdCtrlSocket);\r
+               // 同時接続対応\r
+//             DoQUIT(CmdCtrlSocket);\r
+               DoQUIT(CmdCtrlSocket, &CancelFlg);\r
                DoClose(CmdCtrlSocket);\r
        }\r
 \r
        if(TrnCtrlSocket != INVALID_SOCKET)\r
        {\r
-               DoQUIT(TrnCtrlSocket);\r
+               // 同時接続対応\r
+//             DoQUIT(TrnCtrlSocket);\r
+               DoQUIT(TrnCtrlSocket, &CancelFlg);\r
                DoClose(TrnCtrlSocket);\r
 \r
                SaveCurrentSetToHistory();\r
@@ -1269,6 +1337,62 @@ int AskConnecting(void)
 }\r
 \r
 \r
+#if defined(HAVE_TANDEM)\r
+/*----- 接続している本当のホストのホストタイプを返す --------------------------\r
+*\r
+*      Parameter\r
+*              なし\r
+*\r
+*      Return Value\r
+*              char *ファイル名/オプション\r
+*----------------------------------------------------------------------------*/\r
+\r
+int AskRealHostType(void)\r
+{\r
+       if(AskCurrentHost() != HOSTNUM_NOENTRY)\r
+               CopyHostFromListInConnect(AskCurrentHost(), &CurHost);\r
+\r
+       return(CurHost.HostType);\r
+}\r
+\r
+/*----- OSS ファイルシステムにアクセスしているかどうかのフラグを変更する ------\r
+*\r
+*      Parameter\r
+*              int ステータス (YES/NO)\r
+*\r
+*      Return Value\r
+*              int ステータス (YES/NO)\r
+*----------------------------------------------------------------------------*/\r
+\r
+int SetOSS(int wkOss)\r
+{\r
+       if(Oss != wkOss) {\r
+               if (wkOss == YES) {\r
+                       strcpy(CurHost.InitCmd, "OSS");\r
+               } else {\r
+                       strcpy(CurHost.InitCmd, "GUARDIAN");\r
+               }\r
+       }\r
+       Oss = wkOss;\r
+       return(Oss);\r
+}\r
+\r
+/*----- OSS ファイルシステムにアクセスしているかどうかを返す ------------------\r
+*\r
+*      Parameter\r
+*              なし\r
+*\r
+*      Return Value\r
+*              int ステータス (YES/NO)\r
+*----------------------------------------------------------------------------*/\r
+\r
+int AskOSS(void)\r
+{\r
+       return(Oss);\r
+}\r
+#endif /* HAVE_TANDEM */\r
+\r
+\r
 /*----- ホストへ接続する ------------------------------------------------------\r
 *\r
 *      Parameter\r
@@ -1317,6 +1441,8 @@ static SOCKET DoConnectCrypt(int CryptMode, HOSTDATA* HostData, char *Host, char
        static const char *SiteTbl[4] = { "SITE", "site", "OPEN", "open" };\r
        char TmpBuf[ONELINE_BUF_SIZE];\r
        struct linger LingerOpt;\r
+       struct tcp_keepalive KeepAlive;\r
+       DWORD dwTmp;\r
 \r
        // 暗号化通信対応\r
        ContSock = INVALID_SOCKET;\r
@@ -1390,6 +1516,15 @@ static SOCKET DoConnectCrypt(int CryptMode, HOSTDATA* HostData, char *Host, char
                                        Flg = 1;\r
                                        if(setsockopt(ContSock, SOL_SOCKET, SO_KEEPALIVE, (LPSTR)&Flg, sizeof(Flg)) == SOCKET_ERROR)\r
                                                ReportWSError("setsockopt", WSAGetLastError());\r
+                                       // 切断対策\r
+                                       if(TimeOut > 0)\r
+                                       {\r
+                                               KeepAlive.onoff = 1;\r
+                                               KeepAlive.keepalivetime = TimeOut * 1000;\r
+                                               KeepAlive.keepaliveinterval = 1000;\r
+                                               if(WSAIoctl(ContSock, SIO_KEEPALIVE_VALS, &KeepAlive, sizeof(struct tcp_keepalive), NULL, 0, &dwTmp, NULL, NULL) == SOCKET_ERROR)\r
+                                                       ReportWSError("WSAIoctl", WSAGetLastError());\r
+                                       }\r
                                        LingerOpt.l_onoff = 1;\r
                                        LingerOpt.l_linger = 90;\r
                                        if(setsockopt(ContSock, SOL_SOCKET, SO_LINGER, (LPSTR)&LingerOpt, sizeof(LingerOpt)) == SOCKET_ERROR)\r
@@ -1455,8 +1590,11 @@ static SOCKET DoConnectCrypt(int CryptMode, HOSTDATA* HostData, char *Host, char
                                                else\r
                                                {\r
                                                        Anony = NO;\r
+                                                       // 同時接続対応\r
+//                                                     if((strlen(User) != 0) || \r
+//                                                        (InputDialogBox(username_dlg, GetMainHwnd(), NULL, User, USER_NAME_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES))\r
                                                        if((strlen(User) != 0) || \r
-                                                          (InputDialogBox(username_dlg, GetMainHwnd(), NULL, User, USER_NAME_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES))\r
+                                                          ((HostData->NoDisplayUI == NO) && (InputDialogBox(username_dlg, GetMainHwnd(), NULL, User, USER_NAME_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES)))\r
                                                        {\r
                                                                if(Anony == YES)\r
                                                                {\r
@@ -1499,6 +1637,18 @@ static SOCKET DoConnectCrypt(int CryptMode, HOSTDATA* HostData, char *Host, char
                                                                                Sts = FTP_ERROR;\r
                                                                }\r
 \r
+                                                               // FTPIS対応\r
+                                                               // "PBSZ 0"と"PROT P"は黙示的に設定されているはずだが念のため\r
+                                                               if(CryptMode == CRYPT_FTPIS)\r
+                                                               {\r
+                                                                       if((Sts = command(ContSock, Reply, CancelCheckWork, "PBSZ 0")) == 200)\r
+                                                                       {\r
+                                                                               if((Sts = command(ContSock, Reply, CancelCheckWork, "PROT P")) == 200)\r
+                                                                               {\r
+                                                                               }\r
+                                                                       }\r
+                                                               }\r
+\r
                                                                ReInPass = NO;\r
                                                                do\r
                                                                {\r
@@ -1510,8 +1660,11 @@ static SOCKET DoConnectCrypt(int CryptMode, HOSTDATA* HostData, char *Host, char
 //                                                                     if((Sts = command(ContSock, Reply, &CancelFlg, "USER %s", Buf) / 100) == FTP_CONTINUE)\r
                                                                        if((Sts = command(ContSock, Reply, CancelCheckWork, "USER %s", Buf) / 100) == FTP_CONTINUE)\r
                                                                        {\r
+                                                                               // 同時接続対応\r
+//                                                                             if((strlen(Pass) != 0) || \r
+//                                                                                (InputDialogBox(passwd_dlg, GetMainHwnd(), NULL, Pass, PASSWORD_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES))\r
                                                                                if((strlen(Pass) != 0) || \r
-                                                                                  (InputDialogBox(passwd_dlg, GetMainHwnd(), NULL, Pass, PASSWORD_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES))\r
+                                                                                  ((HostData->NoDisplayUI == NO) && (InputDialogBox(passwd_dlg, GetMainHwnd(), NULL, Pass, PASSWORD_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES)))\r
                                                                                {\r
                                                                                        CheckOneTimePassword(Pass, Reply, Security);\r
 \r
@@ -1525,7 +1678,9 @@ static SOCKET DoConnectCrypt(int CryptMode, HOSTDATA* HostData, char *Host, char
                                                                                        if(Sts == FTP_ERROR)\r
                                                                                        {\r
                                                                                                strcpy(Pass, "");\r
-                                                                                               if(InputDialogBox(re_passwd_dlg, GetMainHwnd(), NULL, Pass, PASSWORD_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES)\r
+                                                                                               // 同時接続対応\r
+//                                                                                             if(InputDialogBox(re_passwd_dlg, GetMainHwnd(), NULL, Pass, PASSWORD_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES)\r
+                                                                                               if(HostData->NoDisplayUI == NO && InputDialogBox(re_passwd_dlg, GetMainHwnd(), NULL, Pass, PASSWORD_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES)\r
                                                                                                        Continue = YES;\r
                                                                                                else\r
                                                                                                        DoPrintf("No password specified.");\r
@@ -1533,8 +1688,11 @@ static SOCKET DoConnectCrypt(int CryptMode, HOSTDATA* HostData, char *Host, char
                                                                                        }\r
                                                                                        else if(Sts == FTP_CONTINUE)\r
                                                                                        {\r
+                                                                                               // 同時接続対応\r
+//                                                                                             if((strlen(Acct) != 0) || \r
+//                                                                                                (InputDialogBox(account_dlg, GetMainHwnd(), NULL, Acct, ACCOUNT_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES))\r
                                                                                                if((strlen(Acct) != 0) || \r
-                                                                                                  (InputDialogBox(account_dlg, GetMainHwnd(), NULL, Acct, ACCOUNT_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES))\r
+                                                                                                  ((HostData->NoDisplayUI == NO) && (InputDialogBox(account_dlg, GetMainHwnd(), NULL, Acct, ACCOUNT_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES)))\r
                                                                                                {\r
                                                                                                        // 同時接続対応\r
 //                                                                                                     Sts = command(ContSock, NULL, &CancelFlg, "ACCT %s", Acct) / 100;\r
@@ -1550,6 +1708,9 @@ static SOCKET DoConnectCrypt(int CryptMode, HOSTDATA* HostData, char *Host, char
                                                                                        DoPrintf("No password specified.");\r
                                                                                }\r
                                                                        }\r
+                                                                       // FTPES対応\r
+                                                                       if(Continue == YES)\r
+                                                                               Sts = FTP_COMPLETE;\r
                                                                }\r
                                                                while(Continue == YES);\r
                                                        }\r
@@ -1567,7 +1728,9 @@ static SOCKET DoConnectCrypt(int CryptMode, HOSTDATA* HostData, char *Host, char
                                                        }\r
                                                        else if((SavePass == YES) && (ReInPass == YES))\r
                                                        {\r
-                                                               if(DialogBox(GetFtpInst(), MAKEINTRESOURCE(savepass_dlg), GetMainHwnd(), ExeEscDialogProc) == YES)\r
+                                                               // 同時接続対応\r
+//                                                             if(DialogBox(GetFtpInst(), MAKEINTRESOURCE(savepass_dlg), GetMainHwnd(), ExeEscDialogProc) == YES)\r
+                                                               if(HostData->NoDisplayUI == NO && DialogBox(GetFtpInst(), MAKEINTRESOURCE(savepass_dlg), GetMainHwnd(), ExeEscDialogProc) == YES)\r
                                                                        SetHostPassword(AskCurrentHost(), Pass);\r
                                                        }\r
                                                }\r
@@ -1613,18 +1776,21 @@ static SOCKET DoConnectCrypt(int CryptMode, HOSTDATA* HostData, char *Host, char
                                // IPv6対応\r
                                if(strstr(Reply, " EPRT ") || strstr(Reply, " EPSV "))\r
                                        HostData->Feature |= FEATURE_EPRT | FEATURE_EPSV;\r
+                               // ホスト側の日時取得\r
+                               if(strstr(Reply, " MDTM "))\r
+                                       HostData->Feature |= FEATURE_MDTM;\r
+                               // ホスト側の日時設定\r
+                               if(strstr(Reply, " MFMT "))\r
+                                       HostData->Feature |= FEATURE_MFMT;\r
                        }\r
                        // UTF-8対応\r
-                       if(TmpNameKanjiCode == KANJI_AUTO && (HostData->Feature & FEATURE_UTF8))\r
+                       if(HostData->CurNameKanjiCode == KANJI_AUTO && (HostData->Feature & FEATURE_UTF8))\r
                        {\r
                                if((Sts = command(ContSock, Reply, CancelCheckWork, "OPTS UTF8 ON")) == 200)\r
-                                       TmpNameKanjiCode = KANJI_UTF8N;\r
+                                       HostData->CurNameKanjiCode = KANJI_UTF8N;\r
                        }\r
                }\r
        }\r
-       else if(CryptMode == CRYPT_SFTP)\r
-       {\r
-       }\r
 \r
        return(ContSock);\r
 }\r
@@ -1636,12 +1802,6 @@ static SOCKET DoConnect(HOSTDATA* HostData, char *Host, char *User, char *Pass,
        SOCKET ContSock;\r
        ContSock = INVALID_SOCKET;\r
        *CancelCheckWork = NO;\r
-       if(*CancelCheckWork == NO && ContSock == INVALID_SOCKET && HostData->UseSFTP == YES)\r
-       {\r
-               SetTaskMsg(MSGJPN317);\r
-               if((ContSock = DoConnectCrypt(CRYPT_SFTP, HostData, Host, User, Pass, Acct, Port, Fwall, SavePass, Security, CancelCheckWork)) != INVALID_SOCKET)\r
-                       HostData->CryptMode = CRYPT_SFTP;\r
-       }\r
        if(*CancelCheckWork == NO && ContSock == INVALID_SOCKET && HostData->UseFTPIS == YES)\r
        {\r
                SetTaskMsg(MSGJPN316);\r
@@ -1789,8 +1949,131 @@ static int CheckOneTimePassword(char *Pass, char *Reply, int Type)
 *              SOCKET ソケット\r
 *----------------------------------------------------------------------------*/\r
 \r
+// IPv6対応\r
+typedef SOCKET (__cdecl* LPCONNECTSOCK)(char*, int, char*, int*);\r
+\r
+typedef struct\r
+{\r
+       HANDLE h;\r
+       DWORD ExitCode;\r
+       char *host;\r
+       int port;\r
+       char *PreMsg;\r
+       int CancelCheckWork;\r
+       LPCONNECTSOCK f;\r
+       SOCKET s;\r
+} CONNECTSOCKDATA;\r
+\r
+DWORD WINAPI connectsockThreadProc(LPVOID lpParameter)\r
+{\r
+       CONNECTSOCKDATA* pData;\r
+       pData = (CONNECTSOCKDATA*)lpParameter;\r
+       pData->s = pData->f(pData->host, pData->port, pData->PreMsg, &pData->CancelCheckWork);\r
+       return 0;\r
+}\r
+\r
+// IPv6対応\r
 SOCKET connectsock(char *host, int port, char *PreMsg, int *CancelCheckWork)\r
 {\r
+       SOCKET Result;\r
+       CONNECTSOCKDATA DataIPv4;\r
+       CONNECTSOCKDATA DataIPv6;\r
+       Result = INVALID_SOCKET;\r
+       switch(CurHost.CurNetType)\r
+       {\r
+       case NTYPE_AUTO:\r
+//             if((Result = connectsockIPv4(host, port, PreMsg, CancelCheckWork)) != INVALID_SOCKET)\r
+//                     CurHost.CurNetType = NTYPE_IPV4;\r
+//             else if((Result = connectsockIPv6(host, port, PreMsg, CancelCheckWork)) != INVALID_SOCKET)\r
+//                     CurHost.CurNetType = NTYPE_IPV6;\r
+               DataIPv4.host = host;\r
+               DataIPv4.port = port;\r
+               DataIPv4.PreMsg = PreMsg;\r
+               DataIPv4.CancelCheckWork = *CancelCheckWork;\r
+               DataIPv4.f = connectsockIPv4;\r
+               DataIPv4.h = CreateThread(NULL, 0, connectsockThreadProc, &DataIPv4, 0, NULL);\r
+               DataIPv6.host = host;\r
+               DataIPv6.port = port;\r
+               DataIPv6.PreMsg = PreMsg;\r
+               DataIPv6.CancelCheckWork = *CancelCheckWork;\r
+               DataIPv6.f = connectsockIPv6;\r
+               DataIPv6.h = CreateThread(NULL, 0, connectsockThreadProc, &DataIPv6, 0, NULL);\r
+               while(1)\r
+               {\r
+                       if(GetExitCodeThread(DataIPv4.h, &DataIPv4.ExitCode))\r
+                       {\r
+                               if(DataIPv4.ExitCode != STILL_ACTIVE)\r
+                               {\r
+                                       if(DataIPv4.s != INVALID_SOCKET)\r
+                                       {\r
+                                               Result = DataIPv4.s;\r
+                                               CurHost.CurNetType = NTYPE_IPV4;\r
+                                               break;\r
+                                       }\r
+                               }\r
+                       }\r
+                       if(GetExitCodeThread(DataIPv6.h, &DataIPv6.ExitCode))\r
+                       {\r
+                               if(DataIPv6.ExitCode != STILL_ACTIVE)\r
+                               {\r
+                                       if(DataIPv6.s != INVALID_SOCKET)\r
+                                       {\r
+                                               Result = DataIPv6.s;\r
+                                               CurHost.CurNetType = NTYPE_IPV6;\r
+                                               break;\r
+                                       }\r
+                               }\r
+                       }\r
+                       if(GetExitCodeThread(DataIPv4.h, &DataIPv4.ExitCode) && GetExitCodeThread(DataIPv6.h, &DataIPv6.ExitCode))\r
+                       {\r
+                               if(DataIPv4.ExitCode != STILL_ACTIVE && DataIPv6.ExitCode != STILL_ACTIVE)\r
+                               {\r
+                                       if(DataIPv4.s == INVALID_SOCKET && DataIPv6.s == INVALID_SOCKET)\r
+                                               break;\r
+                               }\r
+                       }\r
+                       DataIPv4.CancelCheckWork = *CancelCheckWork;\r
+                       DataIPv6.CancelCheckWork = *CancelCheckWork;\r
+                       BackgrndMessageProc();\r
+                       Sleep(1);\r
+               }\r
+               while(1)\r
+               {\r
+                       if(GetExitCodeThread(DataIPv4.h, &DataIPv4.ExitCode) && GetExitCodeThread(DataIPv6.h, &DataIPv6.ExitCode))\r
+                       {\r
+                               if(DataIPv4.ExitCode != STILL_ACTIVE && DataIPv6.ExitCode != STILL_ACTIVE)\r
+                               {\r
+                                       CloseHandle(DataIPv4.h);\r
+                                       CloseHandle(DataIPv6.h);\r
+                                       break;\r
+                               }\r
+                       }\r
+                       DataIPv4.CancelCheckWork = YES;\r
+                       DataIPv6.CancelCheckWork = YES;\r
+                       BackgrndMessageProc();\r
+                       Sleep(1);\r
+               }\r
+               break;\r
+       case NTYPE_IPV4:\r
+               Result = connectsockIPv4(host, port, PreMsg, CancelCheckWork);\r
+               CurHost.CurNetType = NTYPE_IPV4;\r
+               break;\r
+       case NTYPE_IPV6:\r
+               Result = connectsockIPv6(host, port, PreMsg, CancelCheckWork);\r
+               CurHost.CurNetType = NTYPE_IPV6;\r
+               break;\r
+       }\r
+       return Result;\r
+}\r
+\r
+\r
+// IPv6対応\r
+//SOCKET connectsock(char *host, int port, char *PreMsg, int *CancelCheckWork)\r
+SOCKET connectsockIPv4(char *host, int port, char *PreMsg, int *CancelCheckWork)\r
+{\r
+       // IPv6対応\r
+       struct sockaddr_in SocksSockAddr;       /* SOCKSサーバのアドレス情報 */\r
+       struct sockaddr_in CurSockAddr;         /* 接続先ホストのアドレス情報 */\r
        struct sockaddr_in saSockAddr;\r
        char HostEntry[MAXGETHOSTSTRUCT];\r
        struct hostent *pHostEntry;\r
@@ -1830,31 +2113,43 @@ SOCKET connectsock(char *host, int port, char *PreMsg, int *CancelCheckWork)
                else\r
                {\r
                        // アドレスを取得\r
-                       SetTaskMsg(MSGJPN016, DomainName);\r
-                       pHostEntry = do_gethostbyname(host, HostEntry, MAXGETHOSTSTRUCT, CancelCheckWork);\r
+                       // IPv6対応\r
+//                     SetTaskMsg(MSGJPN016, DomainName);\r
+                       SetTaskMsg(MSGJPN016, DomainName, MSGJPN333);\r
+                       // IPv6対応\r
+//                     pHostEntry = do_gethostbyname(host, HostEntry, MAXGETHOSTSTRUCT, CancelCheckWork);\r
+                       pHostEntry = do_gethostbynameIPv4(host, HostEntry, MAXGETHOSTSTRUCT, CancelCheckWork);\r
                }\r
 \r
                if(pHostEntry != NULL)\r
                {\r
                        memcpy((char *)&CurSockAddr.sin_addr, pHostEntry->h_addr, pHostEntry->h_length);\r
-                       SetTaskMsg(MSGJPN017, PreMsg, DomainName, inet_ntoa(CurSockAddr.sin_addr), ntohs(CurSockAddr.sin_port));\r
+                       // IPv6対応\r
+//                     SetTaskMsg(MSGJPN017, PreMsg, DomainName, inet_ntoa(CurSockAddr.sin_addr), ntohs(CurSockAddr.sin_port));\r
+                       SetTaskMsg(MSGJPN017, PreMsg, DomainName, inet_ntoa(CurSockAddr.sin_addr), ntohs(CurSockAddr.sin_port), MSGJPN333);\r
                }\r
                else\r
                {\r
                        if((Fwall == FWALL_SOCKS5_NOAUTH) || (Fwall == FWALL_SOCKS5_USER))\r
                        {\r
                                UseIPadrs = NO;\r
-                               SetTaskMsg(MSGJPN018, PreMsg, DomainName, ntohs(CurSockAddr.sin_port));\r
+                               // IPv6対応\r
+//                             SetTaskMsg(MSGJPN018, PreMsg, DomainName, ntohs(CurSockAddr.sin_port));\r
+                               SetTaskMsg(MSGJPN018, PreMsg, DomainName, ntohs(CurSockAddr.sin_port), MSGJPN333);\r
                        }\r
                        else\r
                        {\r
-                               SetTaskMsg(MSGJPN019, host);\r
+                               // IPv6対応\r
+//                             SetTaskMsg(MSGJPN019, host);\r
+                               SetTaskMsg(MSGJPN019, host, MSGJPN333);\r
                                return(INVALID_SOCKET);\r
                        }\r
                }\r
        }\r
        else\r
-               SetTaskMsg(MSGJPN020, PreMsg, inet_ntoa(CurSockAddr.sin_addr), ntohs(CurSockAddr.sin_port));\r
+               // IPv6対応\r
+//             SetTaskMsg(MSGJPN020, PreMsg, inet_ntoa(CurSockAddr.sin_addr), ntohs(CurSockAddr.sin_port));\r
+               SetTaskMsg(MSGJPN020, PreMsg, inet_ntoa(CurSockAddr.sin_addr), ntohs(CurSockAddr.sin_port), MSGJPN333);\r
 \r
        if((Fwall == FWALL_SOCKS4) || (Fwall == FWALL_SOCKS5_NOAUTH) || (Fwall == FWALL_SOCKS5_USER))\r
        {\r
@@ -1877,17 +2172,23 @@ SOCKET connectsock(char *host, int port, char *PreMsg, int *CancelCheckWork)
                memset(&SocksSockAddr, 0, sizeof(SocksSockAddr));\r
                if((SocksSockAddr.sin_addr.s_addr = inet_addr(FwallHost)) == INADDR_NONE)\r
                {\r
-                       if((pHostEntry = do_gethostbyname(FwallHost, HostEntry, MAXGETHOSTSTRUCT, CancelCheckWork)) != NULL)\r
+                       // IPv6対応\r
+//                     if((pHostEntry = do_gethostbyname(FwallHost, HostEntry, MAXGETHOSTSTRUCT, CancelCheckWork)) != NULL)\r
+                       if((pHostEntry = do_gethostbynameIPv4(FwallHost, HostEntry, MAXGETHOSTSTRUCT, CancelCheckWork)) != NULL)\r
                                memcpy((char *)&SocksSockAddr.sin_addr, pHostEntry->h_addr, pHostEntry->h_length);\r
                        else\r
                        {\r
-                               SetTaskMsg(MSGJPN021, FwallHost);\r
+                               // IPv6対応\r
+//                             SetTaskMsg(MSGJPN021, FwallHost);\r
+                               SetTaskMsg(MSGJPN021, FwallHost, MSGJPN333);\r
                                return INVALID_SOCKET;\r
                        }\r
                }\r
                SocksSockAddr.sin_port = htons((u_short)FwallPort);\r
                SocksSockAddr.sin_family = AF_INET;\r
-               SetTaskMsg(MSGJPN022, inet_ntoa(SocksSockAddr.sin_addr), ntohs(SocksSockAddr.sin_port));\r
+               // IPv6対応\r
+//             SetTaskMsg(MSGJPN022, inet_ntoa(SocksSockAddr.sin_addr), ntohs(SocksSockAddr.sin_port));\r
+               SetTaskMsg(MSGJPN022, inet_ntoa(SocksSockAddr.sin_addr), ntohs(SocksSockAddr.sin_port), MSGJPN333);\r
                // connectで接続する先はSOCKSサーバ\r
                memcpy(&saSockAddr, &SocksSockAddr, sizeof(SocksSockAddr));\r
        }\r
@@ -1903,6 +2204,8 @@ SOCKET connectsock(char *host, int port, char *PreMsg, int *CancelCheckWork)
 \r
        if((sSocket = do_socket(AF_INET, SOCK_STREAM, TCP_PORT)) != INVALID_SOCKET)\r
        {\r
+               // ソケットにデータを付与\r
+               SetAsyncTableDataIPv4(sSocket, &CurSockAddr, &SocksSockAddr);\r
                if(do_connect(sSocket, (struct sockaddr *)&saSockAddr, sizeof(saSockAddr), CancelCheckWork) != SOCKET_ERROR)\r
                {\r
                        if(Fwall == FWALL_SOCKS4)\r
@@ -1916,7 +2219,9 @@ SOCKET connectsock(char *host, int port, char *PreMsg, int *CancelCheckWork)
                                   (Socks4GetCmdReply(sSocket, &Socks4Reply, CancelCheckWork) != FFFTP_SUCCESS) || \r
                                   (Socks4Reply.Result != SOCKS4_RES_OK))\r
                                {\r
-                                       SetTaskMsg(MSGJPN023, Socks4Reply.Result);\r
+                                       // IPv6対応\r
+//                                     SetTaskMsg(MSGJPN023, Socks4Reply.Result);\r
+                                       SetTaskMsg(MSGJPN023, Socks4Reply.Result, MSGJPN333);\r
                                        DoClose(sSocket);\r
                                        sSocket = INVALID_SOCKET;\r
                                }\r
@@ -1938,7 +2243,9 @@ SOCKET connectsock(char *host, int port, char *PreMsg, int *CancelCheckWork)
                                   (Socks5GetCmdReply(sSocket, &Socks5Reply, CancelCheckWork) != FFFTP_SUCCESS) || \r
                                   (Socks5Reply.Result != SOCKS5_RES_OK))\r
                                {\r
-                                       SetTaskMsg(MSGJPN024, Socks5Reply.Result);\r
+                                       // IPv6対応\r
+//                                     SetTaskMsg(MSGJPN024, Socks5Reply.Result);\r
+                                       SetTaskMsg(MSGJPN024, Socks5Reply.Result, MSGJPN333);\r
                                        DoClose(sSocket);\r
                                        sSocket = INVALID_SOCKET;\r
                                }\r
@@ -1946,18 +2253,176 @@ SOCKET connectsock(char *host, int port, char *PreMsg, int *CancelCheckWork)
                        }\r
 \r
                        if(sSocket != INVALID_SOCKET)\r
-                               SetTaskMsg(MSGJPN025);\r
+                               // IPv6対応\r
+//                             SetTaskMsg(MSGJPN025);\r
+                               SetTaskMsg(MSGJPN025, MSGJPN333);\r
                }\r
                else\r
                {\r
 //#pragma aaa\r
-                       SetTaskMsg(MSGJPN026/*"接続できません(2) %x", sSocket*/);\r
+                       // IPv6対応\r
+//                     SetTaskMsg(MSGJPN026/*"接続できません(2) %x", sSocket*/);\r
+                       SetTaskMsg(MSGJPN026/*"接続できません(2) %x", sSocket*/, MSGJPN333);\r
                        DoClose(sSocket);\r
                        sSocket = INVALID_SOCKET;\r
                }\r
        }\r
        else\r
-               SetTaskMsg(MSGJPN027);\r
+               // IPv6対応\r
+//             SetTaskMsg(MSGJPN027);\r
+               SetTaskMsg(MSGJPN027, MSGJPN333);\r
+\r
+       return(sSocket);\r
+}\r
+\r
+\r
+SOCKET connectsockIPv6(char *host, int port, char *PreMsg, int *CancelCheckWork)\r
+{\r
+       struct sockaddr_in6 SocksSockAddr;      /* SOCKSサーバのアドレス情報 */\r
+       struct sockaddr_in6 CurSockAddr;                /* 接続先ホストのアドレス情報 */\r
+       struct sockaddr_in6 saSockAddr;\r
+       char HostEntry[MAXGETHOSTSTRUCT];\r
+       struct hostent *pHostEntry;\r
+       SOCKET sSocket;\r
+       int Len;\r
+       int Fwall;\r
+       SOCKS5REQUEST Socks5Cmd;\r
+       SOCKS5REPLY Socks5Reply;\r
+\r
+       //////////////////////////////\r
+       // ホスト名解決と接続の準備\r
+       //////////////////////////////\r
+\r
+       Fwall = FWALL_NONE;\r
+       if(AskHostFireWall() == YES)\r
+               Fwall = FwallType;\r
+\r
+       sSocket = INVALID_SOCKET;\r
+\r
+       UseIPadrs = YES;\r
+       strcpy(DomainName, host);\r
+       memset(&CurSockAddr, 0, sizeof(CurSockAddr));\r
+       CurSockAddr.sin6_port = htons((u_short)port);\r
+       CurSockAddr.sin6_family = AF_INET6;\r
+       CurSockAddr.sin6_addr = inet6_addr(host);\r
+       if(memcmp(&CurSockAddr.sin6_addr, &IN6ADDR_NONE, sizeof(struct in6_addr)) == 0)\r
+       {\r
+               // ホスト名が指定された\r
+               // ホスト名からアドレスを求める\r
+               if(((Fwall == FWALL_SOCKS5_NOAUTH) || (Fwall == FWALL_SOCKS5_USER)) &&\r
+                  (FwallResolv == YES))\r
+               {\r
+                       // ホスト名解決はSOCKSサーバに任せる\r
+                       pHostEntry = NULL;\r
+               }\r
+               else\r
+               {\r
+                       // アドレスを取得\r
+                       SetTaskMsg(MSGJPN016, DomainName, MSGJPN334);\r
+                       pHostEntry = do_gethostbynameIPv6(host, HostEntry, MAXGETHOSTSTRUCT, CancelCheckWork);\r
+               }\r
+\r
+               if(pHostEntry != NULL)\r
+               {\r
+                       memcpy((char *)&CurSockAddr.sin6_addr, pHostEntry->h_addr, pHostEntry->h_length);\r
+                       SetTaskMsg(MSGJPN017, PreMsg, DomainName, inet6_ntoa(CurSockAddr.sin6_addr), ntohs(CurSockAddr.sin6_port), MSGJPN334);\r
+               }\r
+               else\r
+               {\r
+                       if((Fwall == FWALL_SOCKS5_NOAUTH) || (Fwall == FWALL_SOCKS5_USER))\r
+                       {\r
+                               UseIPadrs = NO;\r
+                               SetTaskMsg(MSGJPN018, PreMsg, DomainName, ntohs(CurSockAddr.sin6_port), MSGJPN334);\r
+                       }\r
+                       else\r
+                       {\r
+                               SetTaskMsg(MSGJPN019, host, MSGJPN334);\r
+                               return(INVALID_SOCKET);\r
+                       }\r
+               }\r
+       }\r
+       else\r
+               SetTaskMsg(MSGJPN020, PreMsg, inet6_ntoa(CurSockAddr.sin6_addr), ntohs(CurSockAddr.sin6_port), MSGJPN334);\r
+\r
+       if((Fwall == FWALL_SOCKS5_NOAUTH) || (Fwall == FWALL_SOCKS5_USER))\r
+       {\r
+               // SOCKSを使う\r
+               // SOCKSに接続する準備\r
+               {\r
+                       Len = Socks5MakeCmdPacketIPv6(&Socks5Cmd, SOCKS5_CMD_CONNECT, UseIPadrs, (char*)&CurSockAddr.sin6_addr, DomainName, CurSockAddr.sin6_port);\r
+               }\r
+\r
+               memset(&SocksSockAddr, 0, sizeof(SocksSockAddr));\r
+               SocksSockAddr.sin6_addr = inet6_addr(FwallHost);\r
+               if(memcmp(&SocksSockAddr.sin6_addr, &IN6ADDR_NONE, sizeof(struct in6_addr)) == 0)\r
+               {\r
+                       if((pHostEntry = do_gethostbynameIPv6(FwallHost, HostEntry, MAXGETHOSTSTRUCT, CancelCheckWork)) != NULL)\r
+                               memcpy((char *)&SocksSockAddr.sin6_addr, pHostEntry->h_addr, pHostEntry->h_length);\r
+                       else\r
+                       {\r
+                               SetTaskMsg(MSGJPN021, FwallHost, MSGJPN334);\r
+                               return INVALID_SOCKET;\r
+                       }\r
+               }\r
+               SocksSockAddr.sin6_port = htons((u_short)FwallPort);\r
+               SocksSockAddr.sin6_family = AF_INET6;\r
+               SetTaskMsg(MSGJPN022, inet6_ntoa(SocksSockAddr.sin6_addr), ntohs(SocksSockAddr.sin6_port), MSGJPN334);\r
+               // connectで接続する先はSOCKSサーバ\r
+               memcpy(&saSockAddr, &SocksSockAddr, sizeof(SocksSockAddr));\r
+       }\r
+       else\r
+       {\r
+               // connectで接続するのは接続先のホスト\r
+               memcpy(&saSockAddr, &CurSockAddr, sizeof(CurSockAddr));\r
+       }\r
+\r
+       /////////////\r
+       // 接続実行\r
+       /////////////\r
+\r
+       if((sSocket = do_socket(AF_INET6, SOCK_STREAM, TCP_PORT)) != INVALID_SOCKET)\r
+       {\r
+               // ソケットにデータを付与\r
+               SetAsyncTableDataIPv6(sSocket, &CurSockAddr, &SocksSockAddr);\r
+               if(do_connect(sSocket, (struct sockaddr *)&saSockAddr, sizeof(saSockAddr), CancelCheckWork) != SOCKET_ERROR)\r
+               {\r
+                       if((Fwall == FWALL_SOCKS5_NOAUTH) || (Fwall == FWALL_SOCKS5_USER))\r
+                       {\r
+                               if(Socks5SelMethod(sSocket, CancelCheckWork) == FFFTP_FAIL)\r
+                               {\r
+                                       DoClose(sSocket);\r
+                                       sSocket = INVALID_SOCKET;\r
+                               }\r
+\r
+                               Socks5Reply.Result = -1;\r
+                               // 同時接続対応\r
+//                             if((SocksSendCmd(sSocket, &Socks5Cmd, Len, CancelCheckWork) != FFFTP_SUCCESS) ||\r
+//                                (Socks5GetCmdReply(sSocket, &Socks5Reply) != FFFTP_SUCCESS) || \r
+//                                (Socks5Reply.Result != SOCKS5_RES_OK))\r
+                               if((SocksSendCmd(sSocket, &Socks5Cmd, Len, CancelCheckWork) != FFFTP_SUCCESS) ||\r
+                                  (Socks5GetCmdReply(sSocket, &Socks5Reply, CancelCheckWork) != FFFTP_SUCCESS) || \r
+                                  (Socks5Reply.Result != SOCKS5_RES_OK))\r
+                               {\r
+                                       SetTaskMsg(MSGJPN024, Socks5Reply.Result, MSGJPN334);\r
+                                       DoClose(sSocket);\r
+                                       sSocket = INVALID_SOCKET;\r
+                               }\r
+\r
+                       }\r
+\r
+                       if(sSocket != INVALID_SOCKET)\r
+                               SetTaskMsg(MSGJPN025, MSGJPN334);\r
+               }\r
+               else\r
+               {\r
+//#pragma aaa\r
+                       SetTaskMsg(MSGJPN026/*"接続できません(2) %x", sSocket*/, MSGJPN334);\r
+                       DoClose(sSocket);\r
+                       sSocket = INVALID_SOCKET;\r
+               }\r
+       }\r
+       else\r
+               SetTaskMsg(MSGJPN027, MSGJPN334);\r
 \r
        return(sSocket);\r
 }\r
@@ -1972,8 +2437,31 @@ SOCKET connectsock(char *host, int port, char *PreMsg, int *CancelCheckWork)
 *              SOCKET リッスンソケット\r
 *----------------------------------------------------------------------------*/\r
 \r
+// IPv6対応\r
 SOCKET GetFTPListenSocket(SOCKET ctrl_skt, int *CancelCheckWork)\r
 {\r
+       SOCKET Result;\r
+       Result = INVALID_SOCKET;\r
+       switch(CurHost.CurNetType)\r
+       {\r
+       case NTYPE_IPV4:\r
+               Result = GetFTPListenSocketIPv4(ctrl_skt, CancelCheckWork);\r
+               break;\r
+       case NTYPE_IPV6:\r
+               Result = GetFTPListenSocketIPv6(ctrl_skt, CancelCheckWork);\r
+               break;\r
+       }\r
+       return Result;\r
+}\r
+\r
+\r
+// IPv6対応\r
+//SOCKET GetFTPListenSocket(SOCKET ctrl_skt, int *CancelCheckWork)\r
+SOCKET GetFTPListenSocketIPv4(SOCKET ctrl_skt, int *CancelCheckWork)\r
+{\r
+       // IPv6対応\r
+       struct sockaddr_in SocksSockAddr;       /* SOCKSサーバのアドレス情報 */\r
+       struct sockaddr_in CurSockAddr;         /* 接続先ホストのアドレス情報 */\r
     SOCKET listen_skt;\r
     int iLength;\r
     char *a,*p;\r
@@ -1987,6 +2475,9 @@ SOCKET GetFTPListenSocket(SOCKET ctrl_skt, int *CancelCheckWork)
        int Len;\r
        int Fwall;\r
 \r
+       // ソケットにデータを付与\r
+       GetAsyncTableDataIPv4(ctrl_skt, &CurSockAddr, &SocksSockAddr);\r
+\r
        Fwall = FWALL_NONE;\r
        if(AskHostFireWall() == YES)\r
                Fwall = FwallType;\r
@@ -2015,7 +2506,9 @@ SOCKET GetFTPListenSocket(SOCKET ctrl_skt, int *CancelCheckWork)
                                   (Socks4GetCmdReply(listen_skt, &Socks4Reply, CancelCheckWork) != FFFTP_SUCCESS) || \r
                                   (Socks4Reply.Result != SOCKS4_RES_OK))\r
                                {\r
-                                       SetTaskMsg(MSGJPN028, Socks4Reply.Result);\r
+                                       // IPv6対応\r
+//                                     SetTaskMsg(MSGJPN028, Socks4Reply.Result);\r
+                                       SetTaskMsg(MSGJPN028, Socks4Reply.Result, MSGJPN333);\r
                                        DoClose(listen_skt);\r
                                        listen_skt = INVALID_SOCKET;\r
                                }\r
@@ -2051,16 +2544,22 @@ SOCKET GetFTPListenSocket(SOCKET ctrl_skt, int *CancelCheckWork)
                                   (Socks5GetCmdReply(listen_skt, &Socks5Reply, CancelCheckWork) != FFFTP_SUCCESS) || \r
                                   (Socks5Reply.Result != SOCKS5_RES_OK))\r
                                {\r
-                                       SetTaskMsg(MSGJPN029, Socks5Reply.Result);\r
+                                       // IPv6対応\r
+//                                     SetTaskMsg(MSGJPN029, Socks5Reply.Result);\r
+                                       SetTaskMsg(MSGJPN029, Socks5Reply.Result, MSGJPN333);\r
                                        DoClose(listen_skt);\r
                                        listen_skt = INVALID_SOCKET;\r
                                }\r
 \r
-                               if(Socks5Reply.AdrsInt == 0)\r
-                                       Socks5Reply.AdrsInt = SocksSockAddr.sin_addr.s_addr;\r
+                               // IPv6対応\r
+//                             if(Socks5Reply.AdrsInt == 0)\r
+//                                     Socks5Reply.AdrsInt = SocksSockAddr.sin_addr.s_addr;\r
 \r
-                               a = (char *)&Socks5Reply.AdrsInt;\r
-                               p = (char *)&Socks5Reply.Port;\r
+                               // IPv6対応\r
+//                             a = (char *)&Socks5Reply.AdrsInt;\r
+//                             p = (char *)&Socks5Reply.Port;\r
+                               a = (char *)&Socks5Reply._dummy[0];\r
+                               p = (char *)&Socks5Reply._dummy[4];\r
                        }\r
                }\r
                else\r
@@ -2107,7 +2606,9 @@ SOCKET GetFTPListenSocket(SOCKET ctrl_skt, int *CancelCheckWork)
                        }\r
 \r
                        if(listen_skt == INVALID_SOCKET)\r
-                               SetTaskMsg(MSGJPN030);\r
+                               // IPv6対応\r
+//                             SetTaskMsg(MSGJPN030);\r
+                               SetTaskMsg(MSGJPN030, MSGJPN333);\r
                }\r
        }\r
        else\r
@@ -2124,7 +2625,148 @@ SOCKET GetFTPListenSocket(SOCKET ctrl_skt, int *CancelCheckWork)
                                UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]),\r
                                UC(p[0]), UC(p[1])) / 100) != FTP_COMPLETE)\r
                {\r
-                       SetTaskMsg(MSGJPN031);\r
+                       // IPv6対応\r
+//                     SetTaskMsg(MSGJPN031);\r
+                       SetTaskMsg(MSGJPN031, MSGJPN333);\r
+                       do_closesocket(listen_skt);\r
+                       listen_skt = INVALID_SOCKET;\r
+               }\r
+//             else\r
+//                     DoPrintf("Skt=%u : listener %s port %u",listen_skt,inet_ntoa(saCtrlAddr.sin_addr),ntohs(saCtrlAddr.sin_port));\r
+       }\r
+\r
+       return(listen_skt);\r
+}\r
+\r
+\r
+SOCKET GetFTPListenSocketIPv6(SOCKET ctrl_skt, int *CancelCheckWork)\r
+{\r
+       struct sockaddr_in6 SocksSockAddr;      /* SOCKSサーバのアドレス情報 */\r
+       struct sockaddr_in6 CurSockAddr;                /* 接続先ホストのアドレス情報 */\r
+    SOCKET listen_skt;\r
+    int iLength;\r
+    char *a,*p;\r
+       struct sockaddr_in6 saCtrlAddr;\r
+       struct sockaddr_in6 saTmpAddr;\r
+       SOCKS5REQUEST Socks5Cmd;\r
+       SOCKS5REPLY Socks5Reply;\r
+\r
+       int Len;\r
+       int Fwall;\r
+\r
+       char Adrs[40];\r
+\r
+       // ソケットにデータを付与\r
+       GetAsyncTableDataIPv6(ctrl_skt, &CurSockAddr, &SocksSockAddr);\r
+\r
+       Fwall = FWALL_NONE;\r
+       if(AskHostFireWall() == YES)\r
+               Fwall = FwallType;\r
+\r
+       if((listen_skt = do_socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP)) != INVALID_SOCKET)\r
+       {\r
+               if((Fwall == FWALL_SOCKS5_NOAUTH) || (Fwall == FWALL_SOCKS5_USER))\r
+               {\r
+                       /*===== SOCKS5を使う =====*/\r
+                       DoPrintf("Use SOCKS5 BIND");\r
+                       if(do_connect(listen_skt, (struct sockaddr *)&SocksSockAddr, sizeof(SocksSockAddr), CancelCheckWork) != SOCKET_ERROR)\r
+                       {\r
+                               if(Socks5SelMethod(listen_skt, CancelCheckWork) == FFFTP_FAIL)\r
+                               {\r
+                                       DoClose(listen_skt);\r
+                                       listen_skt = INVALID_SOCKET;\r
+                                       return(listen_skt);\r
+                               }\r
+\r
+                               Len = Socks5MakeCmdPacketIPv6(&Socks5Cmd, SOCKS5_CMD_BIND, UseIPadrs, (char*)&CurSockAddr.sin6_addr, DomainName, CurSockAddr.sin6_port);\r
+\r
+                               Socks5Reply.Result = -1;\r
+                               // 同時接続対応\r
+//                             if((SocksSendCmd(listen_skt, &Socks5Cmd, Len, CancelCheckWork) != FFFTP_SUCCESS) ||\r
+//                                (Socks5GetCmdReply(listen_skt, &Socks5Reply) != FFFTP_SUCCESS) || \r
+//                                (Socks5Reply.Result != SOCKS5_RES_OK))\r
+                               if((SocksSendCmd(listen_skt, &Socks5Cmd, Len, CancelCheckWork) != FFFTP_SUCCESS) ||\r
+                                  (Socks5GetCmdReply(listen_skt, &Socks5Reply, CancelCheckWork) != FFFTP_SUCCESS) || \r
+                                  (Socks5Reply.Result != SOCKS5_RES_OK))\r
+                               {\r
+                                       SetTaskMsg(MSGJPN029, Socks5Reply.Result, MSGJPN334);\r
+                                       DoClose(listen_skt);\r
+                                       listen_skt = INVALID_SOCKET;\r
+                               }\r
+\r
+                               // IPv6対応\r
+//                             if(Socks5Reply.AdrsInt == 0)\r
+//                                     Socks5Reply.AdrsInt = SocksSockAddr.sin_addr.s_addr;\r
+\r
+                               // IPv6対応\r
+//                             a = (char *)&Socks5Reply.AdrsInt;\r
+//                             p = (char *)&Socks5Reply.Port;\r
+                               a = (char *)&Socks5Reply._dummy[0];\r
+                               p = (char *)&Socks5Reply._dummy[16];\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       /*===== SOCKSを使わない =====*/\r
+                       DoPrintf("Use normal BIND");\r
+                       saCtrlAddr.sin6_port = htons(0);\r
+                       saCtrlAddr.sin6_family = AF_INET6;\r
+                       memset(&saCtrlAddr.sin6_addr, 0, 16);\r
+\r
+                       if(bind(listen_skt, (struct sockaddr *)&saCtrlAddr, sizeof(struct sockaddr_in6)) != SOCKET_ERROR)\r
+                       {\r
+                               iLength = sizeof(saCtrlAddr);\r
+                               if(getsockname(listen_skt, (struct sockaddr *)&saCtrlAddr, &iLength) != SOCKET_ERROR)\r
+                               {\r
+                                       if(do_listen(listen_skt, 1) == 0)\r
+                                       {\r
+                                               iLength = sizeof(saTmpAddr);\r
+                                               if(getsockname(ctrl_skt, (struct sockaddr *)&saTmpAddr, &iLength) == SOCKET_ERROR)\r
+                                                       ReportWSError("getsockname", WSAGetLastError());\r
+\r
+                                               a = (char *)&saTmpAddr.sin6_addr;\r
+                                               p = (char *)&saCtrlAddr.sin6_port;\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               ReportWSError("listen", WSAGetLastError());\r
+                                               do_closesocket(listen_skt);\r
+                                               listen_skt = INVALID_SOCKET;\r
+                                       }\r
+                               }\r
+                               else\r
+                               {\r
+                                       ReportWSError("getsockname", WSAGetLastError());\r
+                                       do_closesocket(listen_skt);\r
+                                       listen_skt = INVALID_SOCKET;\r
+                               }\r
+                       }\r
+                       else\r
+                       {\r
+                               ReportWSError("bind", WSAGetLastError());\r
+                               do_closesocket(listen_skt);\r
+                               listen_skt = INVALID_SOCKET;\r
+                       }\r
+\r
+                       if(listen_skt == INVALID_SOCKET)\r
+                               SetTaskMsg(MSGJPN030, MSGJPN334);\r
+               }\r
+       }\r
+       else\r
+               ReportWSError("socket create", WSAGetLastError());\r
+\r
+       if(listen_skt != INVALID_SOCKET)\r
+       {\r
+#define  UC(b)  (((int)b)&0xff)\r
+               // 同時接続対応\r
+//             if((command(ctrl_skt,NULL, &CancelFlg, "PORT %d,%d,%d,%d,%d,%d",\r
+//                             UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]),\r
+//                             UC(p[0]), UC(p[1])) / 100) != FTP_COMPLETE)\r
+               if((command(ctrl_skt,NULL, CancelCheckWork, "EPRT |2|%s|%d|",\r
+                               AddressToStringIPv6(Adrs, a),\r
+                               (UC(p[0]) << 8) | UC(p[1])) / 100) != FTP_COMPLETE)\r
+               {\r
+                       SetTaskMsg(MSGJPN031, MSGJPN334);\r
                        do_closesocket(listen_skt);\r
                        listen_skt = INVALID_SOCKET;\r
                }\r
@@ -2229,6 +2871,44 @@ static int Socks5MakeCmdPacket(SOCKS5REQUEST *Packet, char Cmd, int ValidIP, ulo
 }\r
 \r
 \r
+// IPv6対応\r
+static int Socks5MakeCmdPacketIPv6(SOCKS5REQUEST *Packet, char Cmd, int ValidIP, char *IP, char *Host, ushort Port)\r
+{\r
+       uchar *Pos;\r
+       int Len;\r
+       int TotalLen;\r
+\r
+       Pos = (uchar *)Packet;\r
+       Pos += SOCKS5REQUEST_SIZE;\r
+       TotalLen = SOCKS5REQUEST_SIZE + 2;      /* +2はポートの分 */\r
+\r
+       Packet->Ver = SOCKS5_VER;\r
+       Packet->Cmd = Cmd;\r
+       Packet->Rsv = 0;\r
+       if(ValidIP == YES)\r
+       {\r
+               /* IPアドレスを指定 */\r
+               Packet->Type = SOCKS5_ADRS_IPV6;\r
+               memcpy(Pos, IP, 16);\r
+               Pos += 16;\r
+               TotalLen += 16;\r
+       }\r
+       else\r
+       {\r
+               /* ホスト名を指定 */\r
+               Packet->Type = SOCKS5_ADRS_NAME;\r
+               Len = strlen(Host);\r
+               *Pos++ = Len;\r
+               strcpy(Pos, Host);\r
+               Pos += Len;\r
+               TotalLen += Len + 1;\r
+       }\r
+       *((ushort *)Pos) = Port;\r
+\r
+       return(TotalLen);\r
+}\r
+\r
+\r
 /*----- SOCKSのコマンドを送る -------------------------------------------------\r
 *\r
 *      Parameter\r
@@ -2281,7 +2961,7 @@ static int Socks5GetCmdReply(SOCKET Socket, SOCKS5REPLY *Packet, int *CancelChec
                if(Packet->Type == SOCKS5_ADRS_IPV4)\r
                        Len = 4 + 2;\r
                else if(Packet->Type == SOCKS5_ADRS_IPV6)\r
-                       Len = 6 + 2;\r
+                       Len = 16 + 2;\r
                else\r
                {\r
                        // 同時接続対応\r
@@ -2496,8 +3176,25 @@ int AskUseMLSD(void)
 }\r
 \r
 // IPv6対応\r
-int AskUseIPv6(void)\r
+int AskCurNetType(void)\r
+{\r
+       return(CurHost.CurNetType);\r
+}\r
+\r
+// 自動切断対策\r
+int AskNoopInterval(void)\r
+{\r
+       return(CurHost.NoopInterval);\r
+}\r
+\r
+// 再転送対応\r
+int AskTransferErrorMode(void)\r
+{\r
+       return(CurHost.TransferErrorMode);\r
+}\r
+\r
+int AskTransferErrorNotify(void)\r
 {\r
-       return(CurHost.UseIPv6);\r
+       return(CurHost.TransferErrorNotify);\r
 }\r
 \r