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 [EMAIL PROTECTED]
> with "unsubscribe freebsd-current" in the body of the message
>
Brian Fundakowski Feldman _ __ ___ ____ ___ ___ ___
[EMAIL PROTECTED] _ __ ___ | _ ) __| \
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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message