From owner-freebsd-current Fri Jul 2 1:53:32 1999 Delivered-To: freebsd-current@freebsd.org Received: from janus.syracuse.net (janus.syracuse.net [205.232.47.15]) by hub.freebsd.org (Postfix) with ESMTP id AE89E14CF9 for ; Fri, 2 Jul 1999 01:53:28 -0700 (PDT) (envelope-from green@unixhelp.org) Received: from localhost (green@localhost) by janus.syracuse.net (8.9.2/8.8.7) with ESMTP id EAA94262; Fri, 2 Jul 1999 04:51:07 -0400 (EDT) Date: Fri, 2 Jul 1999 04:51:07 -0400 (EDT) From: "Brian F. Feldman" X-Sender: green@janus.syracuse.net To: Dominic Mitchell Cc: current@FreeBSD.ORG Subject: Re: fetch(1) and realms with whitespace... In-Reply-To: <19990701120825.A41541@palmerharvey.co.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, 1 Jul 1999, Dominic Mitchell wrote: > Is there any way to specify a realm with whitespace to fetch? I've > just had a fun time trying to do: > > % export HTTP_AUTH="basic:SunSolve Online:x:y" > % fetch -v http://online.sunsolve.sun.co.uk/whatever > senddoc: cannot authenticate with server > > Looking at the code it appears that there isn't a way to escape the > whitespace... Try the patch I've attached. I haven't tested it except to see that it compiles. > -- > Dom Mitchell -- Palmer & Harvey McLane -- Unix Systems Administrator > > "How Unix vendors can ship ancient shells with no job control and no cursor > editing by default and still wonder why people buy NT is beyond me." - Alan Cox > -- > ********************************************************************** > This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom they > are addressed. If you have received this email in error please notify > the system manager. > > This footnote also confirms that this email message has been swept by > MIMEsweeper for the presence of computer viruses. > ********************************************************************** > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message > Brian Fundakowski Feldman _ __ ___ ____ ___ ___ ___ green@FreeBSD.org _ __ ___ | _ ) __| \ FreeBSD: The Power to Serve! _ __ | _ \._ \ |) | http://www.FreeBSD.org/ _ |___/___/___/ --- http.c.orig Fri Jul 2 04:08:04 1999 +++ http.c Fri Jul 2 04:44:10 1999 @@ -1682,6 +1682,17 @@ return EX_NOPERM; } +static inline char * +unescify(register char *s) { + char *o = s; + + for (; *s; s++) + if (*s < 0) + *s = -*s; + + return o; +} + static void parse_http_auth_env(const char *env, struct http_auth_head *ha_tqh) { @@ -1690,7 +1701,15 @@ struct http_auth_method *ham; nenv = alloca(strlen(env) + 1); - strcpy(nenv, env); + for (p = nenv; *p; env++) + if (!*env) + *p = '\0'; + else if (*env != '\\') + *p++ = *env; + else if (*++env) + *p++ = -*env; + else + *p = '\0'; while ((p = strsep(&nenv, " \t")) != 0) { scheme = strsep(&p, ":"); @@ -1707,9 +1726,9 @@ if (ham == 0) continue; ha = safe_malloc(sizeof *ha); - ha->ha_scheme = safe_strdup(scheme); - ha->ha_realm = safe_strdup(realm); - ha->ha_params = params ? safe_strdup(params) : 0; + ha->ha_scheme = unescify(safe_strdup(scheme)); + ha->ha_realm = unescify(safe_strdup(realm)); + ha->ha_params = params ? unescify(safe_strdup(params)) : 0; ha->ha_ham = ham; TAILQ_INSERT_TAIL(ha_tqh, ha, ha_link); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message