You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Marc Slemko <ma...@znep.com> on 1999/06/08 21:24:48 UTC

RAW_ARGS and memory allocation

Something like the following:

  { "AuthName", set_string_slot, (void*)XtOffsetOf(core_dir_config, auth_name),
      OR_AUTHCFG, RAW_ARGS, "The authentication realm (e.g. \"Members Only\")" 

Doesn't work any more AFAIK.  The reason is that RAW_ARGS things have
to make their own copy of the string.  

Is that correct?  While the solution to make the above work is
pretty simple, that isn't very backwards compatible is it?

(yea, I have a server I'm upgrading to 1.3 and we really do have to 
support the old style AuthName, since we have two zillion user .htaccess 
files using unquoted strings and we can't change them)


Re: RAW_ARGS and memory allocation

Posted by Tony Finch <do...@dotat.at>.
Marc Slemko <ma...@znep.com> wrote:
>
>(yea, I have a server I'm upgrading to 1.3 and we really do have to 
>support the old style AuthName, since we have two zillion user .htaccess 
>files using unquoted strings and we can't change them)

Ditto. My solution is included below (apologies if the diff is
screwy). The idea is to attempt to be compatible with the old and new
AuthName syntax.

Tony.
-- 
f.a.n.finch   dot@dotat.at   fanf@demon.net   black dog


===================================================================
RCS file: /a/cvsroot/src/www/apache_1-3_fanf/src/main/http_core.c,v
retrieving revision 1.1.1.4
retrieving revision 1.25
diff -u -r1.1.1.4 -r1.25
--- src/www/apache_1-3_fanf/src/main/http_core.c        1999/03/26 11:58:11     1.1.1.4 apache_1-3-6
+++ src/www/apache_1-3_fanf/src/main/http_core.c        1999/03/26 13:25:45     1.25 HEAD
@@ -2508,7 +2531,14 @@
 static const char *set_authname(cmd_parms *cmd, void *mconfig, char *word1)
 {
     core_dir_config *aconfig = (core_dir_config *)mconfig;
+    char quote = *word1;
+    int len = strlen(word1);
 
+    /* strip off quotes if present -- a broken sort of ap_getword_conf() */
+    if ((quote == '"' || quote == '\'') && word1[len-1] == quote) {
+	word1[len-1] = '\0';
+	word1 += 1;
+    }
     aconfig->ap_auth_name = ap_escape_quotes(cmd->pool, word1);
     return NULL;
 }
@@ -2711,7 +2741,8 @@
 { "AuthType", ap_set_string_slot,
   (void*)XtOffsetOf(core_dir_config, ap_auth_type), OR_AUTHCFG, TAKE1,
   "An HTTP authorization type (e.g., \"Basic\")" },
-{ "AuthName", set_authname, NULL, OR_AUTHCFG, TAKE1,
+/* changed from TAKE1 to RAW_ARGS for backwards compatibility (yuck) */
+{ "AuthName", set_authname, NULL, OR_AUTHCFG, RAW_ARGS,
   "The authentication realm (e.g. \"Members Only\")" },
 { "Require", require, NULL, OR_AUTHCFG, RAW_ARGS,
   "Selects which authenticated users or groups may access a protected space" },