From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64482 invoked by alias); 26 Jan 2018 16:56:54 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 64308 invoked by uid 89); 26 Jan 2018 16:56:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,KAM_SHORT,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*F:D*hu, 1179 X-HELO: mx3.mail.elte.hu Received: from mx3.mail.elte.hu (HELO mx3.mail.elte.hu) (157.181.1.138) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 26 Jan 2018 16:56:50 +0000 Received: from mailbox1.caesar.elte.hu ([157.181.151.157]) by mx3.mail.elte.hu with esmtp (Exim) id 1ef7J0-00081w-R8 from for ; Fri, 26 Jan 2018 17:56:48 +0100 Received: (Authenticated sender: szgyg) by mailbox1.caesar.elte.hu with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ef7J0-0003H9-P8 for cygwin-apps@cygwin.com; Fri, 26 Jan 2018 17:56:46 +0100 From: SZAVAI Gyula To: cygwin-apps@cygwin.com Subject: [PATCH setup 1/5] Remove direct(legacy) connection type Date: Fri, 26 Jan 2018 16:56:00 -0000 Message-Id: <20180126165636.2944-2-szgyg@ludens.elte.hu> In-Reply-To: <20180126165636.2944-1-szgyg@ludens.elte.hu> References: <0dd4274b-fd3a-2857-bdb5-087243444407@dronecode.org.uk> <20180126165636.2944-1-szgyg@ludens.elte.hu> X-ELTE-SpamScore: -6.7 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 3.0 X-ELTE-SpamCheck-Details: score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00,L_AUTH,RP_MATCHES_RCVD autolearn=ham autolearn_force=no SpamAssassin version=3.4.0 -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -5.0 L_AUTH Caesar auth -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.1 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-IsSubscribed: yes X-SW-Source: 2018-01/txt/msg00085.txt.bz2 --- ConnectionSetting.cc | 5 -- Makefile.am | 2 - net.cc | 9 +-- netio.cc | 20 ------ nio-ftp.cc | 179 --------------------------------------------------- nio-ftp.h | 41 ------------ res.rc | 2 - resource.h | 1 - 8 files changed, 3 insertions(+), 256 deletions(-) delete mode 100644 nio-ftp.cc delete mode 100644 nio-ftp.h diff --git a/ConnectionSetting.cc b/ConnectionSetting.cc index 1154d94..5baf76c 100644 --- a/ConnectionSetting.cc +++ b/ConnectionSetting.cc @@ -49,9 +49,6 @@ ConnectionSetting::~ConnectionSetting () sprintf(port_str, "%d", NetIO::net_proxy_port); UserSettings::instance().set("net-proxy-port", port_str); break; - case IDC_NET_DIRECT_LEGACY: - UserSettings::instance().set("net-method", "Legacy"); - break; default: break; } @@ -66,8 +63,6 @@ ConnectionSetting::typeFromString(const std::string& aType) return IDC_NET_IE5; if (!casecompare(aType, "Proxy")) return IDC_NET_PROXY; - if (!casecompare(aType, "Legacy")) - return IDC_NET_DIRECT_LEGACY; /* A sanish default */ return IDC_NET_IE5; diff --git a/Makefile.am b/Makefile.am index a238d88..aca3ccc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -194,8 +194,6 @@ inilint_SOURCES = \ nio-ie5.h \ nio-file.cc \ nio-file.h \ - nio-ftp.cc \ - nio-ftp.h \ nio-http.cc \ nio-http.h \ package_db.cc \ diff --git a/net.cc b/net.cc index fa6f1e3..5ff3713 100644 --- a/net.cc +++ b/net.cc @@ -37,7 +37,7 @@ extern ThreeBarProgressPage Progress; static StringOption ProxyOption ("", 'p', "proxy", "HTTP/FTP proxy (host:port)", false); -static int rb[] = { IDC_NET_IE5, IDC_NET_DIRECT, IDC_NET_PROXY, IDC_NET_DIRECT_LEGACY, 0 }; +static int rb[] = { IDC_NET_IE5, IDC_NET_DIRECT, IDC_NET_PROXY, 0 }; static bool doing_loading = false; void @@ -47,8 +47,7 @@ NetPage::CheckIfEnableNext () DWORD ButtonFlags = PSWIZB_BACK; if (NetIO::net_method == IDC_NET_IE5 || - NetIO::net_method == IDC_NET_DIRECT || - NetIO::net_method == IDC_NET_DIRECT_LEGACY) + NetIO::net_method == IDC_NET_DIRECT) e = 1; else if (NetIO::net_method == IDC_NET_PROXY) { @@ -132,8 +131,7 @@ NetPage::OnInit () // Check to see if any radio buttons are selected. If not, select a default. if (SendMessage (GetDlgItem (IDC_NET_DIRECT), BM_GETCHECK, 0, 0) != BST_CHECKED - && SendMessage (GetDlgItem (IDC_NET_PROXY), BM_GETCHECK, 0, 0) != BST_CHECKED - && SendMessage (GetDlgItem (IDC_NET_DIRECT_LEGACY), BM_GETCHECK, 0, 0) != BST_CHECKED) + && SendMessage (GetDlgItem (IDC_NET_PROXY), BM_GETCHECK, 0, 0) != BST_CHECKED) SendMessage (GetDlgItem (IDC_NET_IE5), BM_CLICK, 0, 0); } @@ -169,7 +167,6 @@ NetPage::OnMessageCmd (int id, HWND hwndctl, UINT code) case IDC_NET_IE5: case IDC_NET_DIRECT: case IDC_NET_PROXY: - case IDC_NET_DIRECT_LEGACY: case IDC_PROXY_HOST: case IDC_PROXY_PORT: save_dialog (GetHWND()); diff --git a/netio.cc b/netio.cc index cf634c1..86bb69a 100644 --- a/netio.cc +++ b/netio.cc @@ -31,7 +31,6 @@ #include "nio-file.h" #include "nio-ie5.h" #include "nio-http.h" -#include "nio-ftp.h" #include "dialog.h" int NetIO::net_method; @@ -147,23 +146,6 @@ NetIO::open (char const *url, bool cachable) rv = new NetIO_HTTP (url); else if (net_method == IDC_NET_DIRECT) rv = new NetIO_IE5 (url, true, cachable); - else if (net_method == IDC_NET_DIRECT_LEGACY) - { - switch (proto) - { - case http: - rv = new NetIO_HTTP (url); - break; - case ftp: - rv = new NetIO_FTP (url); - break; - case file: - rv = new NetIO_File (url); - break; - default: - mbox (NULL, "Protocol not handled by legacy URL handler", "Cygwin Setup", MB_OK); - } - } if (rv && !rv->ok ()) { @@ -304,8 +286,6 @@ NetIO::net_method_name () return "Direct"; case IDC_NET_PROXY: return "Proxy"; - case IDC_NET_DIRECT_LEGACY: - return "Direct (legacy)"; default: return "Unknown"; } diff --git a/nio-ftp.cc b/nio-ftp.cc deleted file mode 100644 index 65625d5..0000000 --- a/nio-ftp.cc +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2000, 2001, Red Hat, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * A copy of the GNU General Public License can be found at - * http://www.gnu.org/ - * - * Written by DJ Delorie - * - */ - -/* This file is responsible for implementing all direct FTP protocol - channels. It is intentionally simplistic. */ - -#include "nio-ftp.h" - -#include "LogSingleton.h" - -#include "win32.h" -#include -#include -#include -#include - -#include "resource.h" -#include "state.h" -#include "simpsock.h" - -static SimpleSocket *cmd = 0; -static char *cmd_host = 0; -static int cmd_port = 0; - -static char *last_line; - -static int -ftp_line (SimpleSocket * s) -{ - do - { - last_line = s->gets (); - Log (LOG_BABBLE) << "ftp > " << (last_line ? last_line : "error") - << endLog; - } - while (last_line && (!isdigit (last_line[0]) || last_line[3] != ' ')); - return atoi (last_line ? : "0"); -} - -NetIO_FTP::NetIO_FTP (char const *Purl):NetIO (Purl) -{ - s = 0; - int - code; - - if (port == 0) - port = 21; - -control_reconnect: - if ((cmd_host && strcmp (host, cmd_host) != 0) || port != cmd_port) - { - if (cmd) - cmd->printf ("QUIT\r\n"); - delete cmd; - delete [] cmd_host; - cmd = 0; - cmd_host = 0; - } - - if (cmd == 0) - { - SimpleSocket * - c = new SimpleSocket (host, port); - code = ftp_line (c); - - auth_retry: - if (net_ftp_user) - c->printf ("USER %s\r\n", net_ftp_user); - else - c->printf ("USER anonymous\r\n"); - code = ftp_line (c); - if (code == 331) - { - if (net_ftp_passwd) - c->printf ("PASS %s\r\n", net_ftp_passwd); - else - c->printf ("PASS cygwin-setup@\r\n"); - code = ftp_line (c); - } - if (code == 530) /* Authentication failed, retry */ - { - get_ftp_auth (NULL); - if (net_ftp_user && net_ftp_passwd) - goto auth_retry; - } - - if (code < 200 || code >= 300) - { - delete - c; - return; - } - - cmd = c; - cmd_host = new char [strlen (host) + 1]; - strcpy (cmd_host, host); - cmd_port = port; - - cmd->printf ("TYPE I\r\n"); - code = ftp_line (cmd); - } - - cmd->printf ("PASV\r\n"); - do - { - code = ftp_line (cmd); - } - while (code == 226); /* previous RETR */ - if (code == 421) /* Timeout, retry */ - { - Log (LOG_BABBLE) << "FTP timeout -- reconnecting" << endLog; - delete [] cmd_host; - cmd_host = new char[1]; cmd_host[0] = '\0'; - goto control_reconnect; - } - if (code != 227) - return; - - char * - digit = strpbrk (last_line + 3, "0123456789"); - if (!digit) - return; - - int - i1, i2, i3, i4, p1, p2; - sscanf (digit, "%d,%d,%d,%d,%d,%d", &i1, &i2, &i3, &i4, &p1, &p2); - char - tmp[20]; - sprintf (tmp, "%d.%d.%d.%d", i1, i2, i3, i4); - s = new SimpleSocket (tmp, p1 * 256 + p2); - - cmd->printf ("RETR %s\r\n", path); - code = ftp_line (cmd); - if (code != 150 && code != 125) - { - delete - s; - s = 0; - return; - } -} - -NetIO_FTP::~NetIO_FTP () -{ - if (s) - delete s; -} - -int -NetIO_FTP::ok () -{ - if (s && s->ok ()) - return 1; - return 0; -} - -int -NetIO_FTP::read (char *buf, int nbytes) -{ - int rv; - if (!ok ()) - return 0; - rv = s->read (buf, nbytes); - if (rv == 0) - ftp_line (cmd); - return rv; -} diff --git a/nio-ftp.h b/nio-ftp.h deleted file mode 100644 index 6944fc1..0000000 --- a/nio-ftp.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2000, 2001, Red Hat, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * A copy of the GNU General Public License can be found at - * http://www.gnu.org/ - * - * Written by DJ Delorie - * - */ - -#ifndef SETUP_NIO_FTP_H -#define SETUP_NIO_FTP_H - -#include "netio.h" - -/* Direct FTP (without proxy) */ - -class SimpleSocket; - -class NetIO_FTP:public NetIO -{ - SimpleSocket *s; - -public: - NetIO_FTP (char const *url); - virtual ~ NetIO_FTP (); - - /* If !ok() that means the transfer isn't happening. */ - virtual int ok (); - - /* Read `nbytes' bytes from the file. Returns zero when the file - is complete. */ - virtual int read (char *buf, int nbytes); -}; - -#endif /* SETUP_NIO_FTP_H */ diff --git a/res.rc b/res.rc index 5b7d239..d89dd33 100644 --- a/res.rc +++ b/res.rc @@ -163,8 +163,6 @@ BEGIN BS_AUTORADIOBUTTON | WS_TABSTOP,60,70,73,10 CONTROL "Use HTTP/FTP &Proxy:",IDC_NET_PROXY,"Button", BS_AUTORADIOBUTTON | WS_TABSTOP,60,85,88,10 - CONTROL "&Direct Connection (legacy)",IDC_NET_DIRECT_LEGACY,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,60,150,94,10 EDITTEXT IDC_PROXY_HOST,120,105,120,12,ES_AUTOHSCROLL | WS_DISABLED | WS_GROUP EDITTEXT IDC_PROXY_PORT,120,125,30,12,ES_AUTOHSCROLL | diff --git a/resource.h b/resource.h index 70d90ca..59c19da 100644 --- a/resource.h +++ b/resource.h @@ -176,6 +176,5 @@ #define IDC_FILE_INUSE_EDIT 590 #define IDC_FILE_INUSE_MSG 591 #define IDC_FILE_INUSE_HELP 592 -#define IDC_NET_DIRECT_LEGACY 593 #define IDC_DOWNLOAD_EDIT 594 #define IDC_CHOOSE_DO_SEARCH 595 -- 2.14.3