fix: segfault from double close on ftpGetFileDesc ftpAbort path.
authorjbj <devnull@localhost>
Mon, 22 Mar 1999 16:23:05 +0000 (16:23 +0000)
committerjbj <devnull@localhost>
Mon, 22 Mar 1999 16:23:05 +0000 (16:23 +0000)
CVS patchset: 2908
CVS date: 1999/03/22 16:23:05

CHANGES
ftp.c
po/rpm.pot
url.c

diff --git a/CHANGES b/CHANGES
index 0026860..f635fe4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
 2.92 -> 2.93
        - eliminate old rpmrc configuration syntax.
        - pgp5 support (Carlo Wood <carlo@runaway.xs4all.nl>)
+       - fix: segfault from double close on ftpGetFileDesc ftpAbort path.
 
 2.91 -> 2.92
        - update with libtool-2.4f.
diff --git a/ftp.c b/ftp.c
index 17c2f5e..2e6fcb7 100644 (file)
--- a/ftp.c
+++ b/ftp.c
@@ -500,9 +500,11 @@ fprintf(stderr, "-> ABOR\n");
 }
 
 static int ftpGetFileDone(urlinfo *u) {
-    if (u->ftpGetFileDoneNeeded && ftpCheckResponse(u, NULL))
-       return FTPERR_BAD_SERVER_RESPONSE;
-    u->ftpGetFileDoneNeeded = 0;
+    if (u->ftpGetFileDoneNeeded) {
+       u->ftpGetFileDoneNeeded = 0;
+       if (ftpCheckResponse(u, NULL))
+           return FTPERR_BAD_SERVER_RESPONSE;
+    }
     return 0;
 }
 
index c800c50..85728a1 100644 (file)
@@ -7,7 +7,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-03-21 14:06-0500\n"
+"POT-Creation-Date: 1999-03-22 11:02-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -212,55 +212,55 @@ msgstr ""
 msgid "rpmconvert 1.0 - converting database in /var/lib/rpm\n"
 msgstr ""
 
-#: ../ftp.c:640
+#: ../ftp.c:642
 msgid "Success"
 msgstr ""
 
-#: ../ftp.c:643
+#: ../ftp.c:645
 msgid "Bad server response"
 msgstr ""
 
-#: ../ftp.c:646
+#: ../ftp.c:648
 msgid "Server IO error"
 msgstr ""
 
-#: ../ftp.c:649
+#: ../ftp.c:651
 msgid "Server timeout"
 msgstr ""
 
-#: ../ftp.c:652
+#: ../ftp.c:654
 msgid "Unable to lookup server host address"
 msgstr ""
 
-#: ../ftp.c:655
+#: ../ftp.c:657
 msgid "Unable to lookup server host name"
 msgstr ""
 
-#: ../ftp.c:658
+#: ../ftp.c:660
 msgid "Failed to connect to server"
 msgstr ""
 
-#: ../ftp.c:661
+#: ../ftp.c:663
 msgid "Failed to establish data connection to server"
 msgstr ""
 
-#: ../ftp.c:664
+#: ../ftp.c:666
 msgid "IO error to local file"
 msgstr ""
 
-#: ../ftp.c:667
+#: ../ftp.c:669
 msgid "Error setting remote server to passive mode"
 msgstr ""
 
-#: ../ftp.c:670
+#: ../ftp.c:672
 msgid "File not found on server"
 msgstr ""
 
-#: ../ftp.c:673
+#: ../ftp.c:675
 msgid "Abort in progress"
 msgstr ""
 
-#: ../ftp.c:677
+#: ../ftp.c:679
 msgid "Unknown or unexpected error"
 msgstr ""
 
@@ -1464,17 +1464,18 @@ msgstr ""
 msgid "url port must be a number\n"
 msgstr ""
 
-#: ../url.c:307
+#. XXX PARANOIA
+#: ../url.c:308
 #, c-format
 msgid "logging into %s as %s, pw %s\n"
 msgstr ""
 
-#: ../lib/rpmdb.c:168 ../url.c:418
+#: ../lib/rpmdb.c:168 ../url.c:420
 #, c-format
 msgid "failed to open %s\n"
 msgstr ""
 
-#: ../url.c:433
+#: ../url.c:435
 #, c-format
 msgid "failed to create %s\n"
 msgstr ""
diff --git a/url.c b/url.c
index 8e7f53f..bd6f3e3 100644 (file)
--- a/url.c
+++ b/url.c
@@ -304,6 +304,7 @@ static int urlConnect(const char * url, urlinfo ** uret)
 
     if (!strcmp(u->service, "ftp") && u->ftpControl < 0) {
 
+       u->ftpGetFileDoneNeeded = 0;    /* XXX PARANOIA */
        rpmMessage(RPMMESS_DEBUG, _("logging into %s as %s, pw %s\n"),
                u->host,
                u->user ? u->user : "ftp",
@@ -355,6 +356,7 @@ int ufdClose(FD_t fd)
        /* Close the ftp control channel (not strictly necessary, but ... */
        if (u->ftpControl >= 0) {
            ftpAbort(fd);
+           fd = NULL;  /* XXX ftpAbort does fdClose(fd) */
            close(u->ftpControl);
            u->ftpControl = -1;
        }