=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ftp/fetch.c,v retrieving revision 1.10 retrieving revision 1.11 diff -c -r1.10 -r1.11 *** src/usr.bin/ftp/fetch.c 1997/04/23 20:33:06 1.10 --- src/usr.bin/ftp/fetch.c 1997/04/28 21:10:06 1.11 *************** *** 1,5 **** ! /* $OpenBSD: fetch.c,v 1.10 1997/04/23 20:33:06 deraadt Exp $ */ ! /* $NetBSD: fetch.c,v 1.6 1997/04/14 09:09:19 lukem Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. --- 1,5 ---- ! /* $OpenBSD: fetch.c,v 1.11 1997/04/28 21:10:06 millert Exp $ */ ! /* $NetBSD: fetch.c,v 1.8 1997/04/21 18:45:47 lukem Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. *************** *** 38,44 **** */ #ifndef lint ! static char rcsid[] = "$OpenBSD: fetch.c,v 1.10 1997/04/23 20:33:06 deraadt Exp $"; #endif /* not lint */ /* --- 38,44 ---- */ #ifndef lint ! static char rcsid[] = "$OpenBSD: fetch.c,v 1.11 1997/04/28 21:10:06 millert Exp $"; #endif /* not lint */ /* *************** *** 436,448 **** dir = strchr(host, '/'); /* Look for [user:pass@]host[:port] */ ! user = host; ! pass = strpbrk(user, ":@/"); if (pass == NULL || *pass == '/') { ! user = pass = NULL; goto parsed_url; } ! if (*pass == '@') { warnx("Bad ftp URL: %s", argv[argpos]); rval = argpos + 1; continue; --- 436,448 ---- dir = strchr(host, '/'); /* Look for [user:pass@]host[:port] */ ! pass = strpbrk(host, ":@/"); if (pass == NULL || *pass == '/') { ! pass = NULL; goto parsed_url; } ! if (pass == host || *pass == '@') { ! bad_ftp_url: warnx("Bad ftp URL: %s", argv[argpos]); rval = argpos + 1; continue; *************** *** 451,465 **** cp = strpbrk(pass, ":@/"); if (cp == NULL || *cp == '/') { portnum = pass; ! user = pass = NULL; goto parsed_url; } ! if (*cp == ':') { ! warnx("Bad ftp URL: %s", argv[argpos]); ! rval = argpos + 1; ! continue; ! } *cp++ = '\0'; host = cp; portnum = strchr(host, ':'); if (portnum != NULL) --- 451,465 ---- cp = strpbrk(pass, ":@/"); if (cp == NULL || *cp == '/') { portnum = pass; ! pass = NULL; goto parsed_url; } ! if (EMPTYSTRING(cp) || *cp == ':') ! goto bad_ftp_url; *cp++ = '\0'; + user = host; + if (EMPTYSTRING(user)) + goto bad_ftp_url; host = cp; portnum = strchr(host, ':'); if (portnum != NULL)