Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3]: src/usr.bin/ftp Pull up revision 1.69 (requested by lukem in ...



details:   https://anonhg.NetBSD.org/src/rev/8aa498eb9fda
branches:  netbsd-3
changeset: 576768:8aa498eb9fda
user:      tron <tron%NetBSD.org@localhost>
date:      Sun Jul 24 10:29:52 2005 +0000

description:
Pull up revision 1.69 (requested by lukem in ticket #606):
Implement:
    int getline(FILE *stream, char *buf, size_t buflen, const char **errormsg)
        Read a line from the FILE stream into buf/buflen using fgets(), so up
        to buflen-1 chars will be read and the result will be NUL terminated.
        If the line has a trailing newline it will be removed.
        If the line is too long, excess characters will be read until
        newline/EOF/error.
        Various -ve return values indicate different errors, and errormsg
        will be changed to an error description if it's not NULL.
Convert to use getline() instead of fgets() whenever reading user input
to ensure that an overly long input line doesn't leave excess characters
for the next input operation to accidentally use as input.
Zero out the password & account after we've finished with it.
Consistently use getpass(3) (i.e, character echo suppressed) when
reading the account data.  For some reason, historically the "login"
code suppressed echo for Account: yet the "user" command did not!
Display the hostname in the "getaddrinfo failed" warning.
Appease some -Wcast-qual warnings.  Fixing all of these requires
significant code refactoring.  (mmm, legacy code).

diffstat:

 usr.bin/ftp/extern.h |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r f496c8f49673 -r 8aa498eb9fda usr.bin/ftp/extern.h
--- a/usr.bin/ftp/extern.h      Sun Jul 24 10:29:47 2005 +0000
+++ b/usr.bin/ftp/extern.h      Sun Jul 24 10:29:52 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.64.2.4 2005/07/24 10:19:21 tron Exp $     */
+/*     $NetBSD: extern.h,v 1.64.2.5 2005/07/24 10:29:52 tron Exp $     */
 
 /*-
  * Copyright (c) 1996-2005 The NetBSD Foundation, Inc.
@@ -141,6 +141,7 @@
 void   get(int, char **);
 struct cmd *getcmd(const char *);
 int    getit(int, char **, int, const char *);
+int    getline(FILE *, char *, size_t, const char **);
 struct option *getoption(const char *);
 char   *getoptionvalue(const char *);
 void   getremoteinfo(void);
@@ -199,8 +200,7 @@
 void   rmthelp(int, char **);
 void   rmtstatus(int, char **);
 char   *rprompt(void);
-int    ruserpass(const char *, const char **, const char **,
-           const char **);
+int    ruserpass(const char *, char **, char **, char **);
 void   sendrequest(const char *, const char *, const char *, int);
 void   setascii(int, char **);
 void   setbell(int, char **);



Home | Main Index | Thread Index | Old Index