Emiliano wrote:
> 
> > > Could someone with 1.3.9 try the patch below?
> >
> > I did, but I have apache 1.3.6 (from SuSE 6.2). After patching,
> > compilation breaks with:
> >
> > mgd_apache.c: In function `mgd_get_basic_auth_pw':
> > mgd_apache.c:33: warning: assignment makes pointer from integer without
> > a cast
> > mgd_apache.c: In function `mgd_note_basic_auth_failure':
> > mgd_apache.c:80: `STD_PROXY' undeclared (first use in this function)
> 
> What is APACHE_RELEASE defined to httpd.h?
The problem is not in APACHE_RELEASE value, you forgot to change second
MODULE_MAGIC_NUMBER to APACHE_RELEASE.
Also, a code flow with APACHE_RELEASE added is broken (there is no need
to do r->proxyreq comparision).

Frank, could check new version of mgd_apache.c attached to this letter?

--
Alexander
#include "mgd_apache.h"

int mgd_get_basic_auth_pw(request_rec * r, const char **usr, const char **pw)
{
        const char *auth_line = ap_table_get(r->headers_in,
#if APACHE_RELEASE >= 10310000
                 r->proxyreq == STD_PROXY
                     ? "Proxy-Authorization" : 
#endif
                                             "Authorization");
        const char *t;

        if (!auth_line)
        {
                return AUTH_REQUIRED;
        }

        if (strcasecmp(ap_getword(r->pool, &auth_line, ' '), "Basic"))
        {
                /* Client tried to authenticate using wrong auth scheme */
                ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r,
                              "client used wrong authentication scheme: %s",
                              r->uri);
                return AUTH_REQUIRED;
        }

        /* CHARSET_EBCDIC Issue's here ?!? Compare with 32/9 instead
         * as we are operating on an octed stream ?
         */
        while (*auth_line == ' ' || *auth_line == '\t')
                auth_line++;

        t = ap_pbase64decode(r->pool, auth_line);
        /* Note that this allocation has to be made from r->connection->pool
         * because it has the lifetime of the connection.  The other allocations
         * are temporary and can be tossed away any time.
         */
        *usr = ap_getword_nulls(r->connection->pool, &t, ':');
        *pw = t;

        return OK;
}

void mgd_set_apache_auth_env(request_rec *r, const char* user)
{
   r->connection->user = (char*)user;
        r->connection->ap_auth_type = "Basic";
}

void mgd_note_basic_auth_failure(request_rec *r, midgard *mgd, midgard_server_config 
*scfg)
{
char* realm =  "Basic realm = \"Midgard\"";

#ifdef MIDGARD_SITEGROUPS
midgard_res *res;
int sitegroup = mgd_sitegroup(mgd);

   if (sitegroup == 0)
         realm = ap_pstrcat(r->pool, "Basic realm = \"", scfg->default_realm, " 
(SG0)\"", NULL);
   else
   {
      res = mgd_ungrouped_select(mgd, "name,realm", "sitegroup", "id=$d",
         NULL, sitegroup);

      if (!res ||!mgd_fetch(res)) {
         if (res) mgd_release(res);
         realm = ap_pstrcat(r->pool, "Basic realm = \"", scfg->default_realm, " 
(???)\"", NULL);
      }
      else {
         realm = ap_pstrcat(r->pool, "Basic realm = \"", mgd_colvalue(res, 1), " (", 
mgd_colvalue(res, 0), ")\"", NULL);
      }
   }
#endif

        ap_table_setn(r->err_headers_out,
#if APACHE_RELEASE >= 10310000
      r->proxyreq
      == STD_PROXY
      ? "Proxy-Authenticate" : 
#endif
      "WWW-Authenticate",
      realm);
}


--
This is The Midgard Project's mailing list. For more information,
please visit the project's web site at http://www.midgard-project.org

To unsubscribe the list, send an empty email message to address
[EMAIL PROTECTED]

Reply via email to