From 2d7f1686976ab8047a05b1246e90d5d960f9ca9c Mon Sep 17 00:00:00 2001 From: jadestorm Date: Sat, 4 May 2002 17:54:34 +0000 Subject: [PATCH] Fixed configure to look in appropriate location for krb4 header files within a krb5 install. Fixed auth_user to actually work, and removed a warning from krb4/validate. --- apache1/auth_user.c | 13 +++++++++---- configure | 8 ++++---- configure.in | 8 ++++---- krb4/validate.c | 2 +- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/apache1/auth_user.c b/apache1/auth_user.c index 768d85c..4205239 100644 --- a/apache1/auth_user.c +++ b/apache1/auth_user.c @@ -1,9 +1,11 @@ int kerb_authenticate_user(request_rec *r) { + const char *name; /* AuthName specified */ const char *type; /* AuthType specified */ int KerberosV5 = 0; /* Kerberos V5 check enabled */ int KerberosV4 = 0; /* Kerberos V4 check enabled */ const char *sent_pw; /* Password sent by browser */ int res; /* Response holder */ + const char *t; /* Decoded auth_line */ const char *authtype; /* AuthType to send back to browser */ const char *auth_line = ap_table_get(r->headers_in, (r->proxyreq == STD_PROXY) @@ -30,21 +32,24 @@ int kerb_authenticate_user(request_rec *r) { return DECLINED; } - if (!ap_auth_name(r)) { + name = ap_auth_name(r); + if (!name) { ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, "need AuthName: %s", r->uri); return HTTP_INTERNAL_SERVER_ERROR; } if (!auth_line) { - ap_table_set(r->err_headers_out, "WWW-Authenticate", "Kerberos"); + ap_table_set(r->err_headers_out, "WWW-Authenticate", + ap_pstrcat(r->pool, "Basic realm=\"", name, "\"", NULL)); return HTTP_UNAUTHORIZED; } type = ap_getword_white(r->pool, &auth_line); - r->connection->user = ap_getword_nulls(r->pool, &auth_line, ':'); + t = ap_pbase64decode(r->pool, auth_line); + r->connection->user = ap_getword_nulls(r->pool, &t, ':'); r->connection->ap_auth_type = "Kerberos"; - sent_pw = ap_getword_white(r->pool, &auth_line); + sent_pw = ap_getword_white(r->pool, &t); #ifdef KRB5 if (KerberosV5) { diff --git a/configure b/configure index 26bfb6e..282218f 100755 --- a/configure +++ b/configure @@ -594,8 +594,8 @@ if test "${with_krb5+set}" = set; then withval="$with_krb5" if test -d $withval ; then - CFLAGS="$CFLAGS -I$withval/include" - CPPFLAGS="$CPPFLAGS -I$withval/include" + CFLAGS="$CFLAGS -I$withval/include -I$withval/include/kerberosIV" + CPPFLAGS="$CPPFLAGS -I$withval/include -I$withval/include/kerberosIV" LDFLAGS="$LDFLAGS -L$withval/lib" case "$host" in @@ -616,8 +616,8 @@ if test "${with_krb5_include+set}" = set; then withval="$with_krb5_include" if test -d $withval ; then - CFLAGS="$CFLAGS -I$withval" - CPPFLAGS="$CPPFLAGS -I$withval" + CFLAGS="$CFLAGS -I$withval -I$withval/include/kerberosIV" + CPPFLAGS="$CPPFLAGS -I$withval -I$withval/include/kerberosIV" else { echo "configure: error: Specified Kerberos 5 directory doesn't exist." 1>&2; exit 1; } fi diff --git a/configure.in b/configure.in index 3b0f9fc..a70b811 100644 --- a/configure.in +++ b/configure.in @@ -46,8 +46,8 @@ AC_ARG_WITH(krb5, [ --with-krb5=DIR path to Kerberos 5 install], [ if test -d $withval ; then - CFLAGS="$CFLAGS -I$withval/include" - CPPFLAGS="$CPPFLAGS -I$withval/include" + CFLAGS="$CFLAGS -I$withval/include -I$withval/include/kerberosIV" + CPPFLAGS="$CPPFLAGS -I$withval/include -I$withval/include/kerberosIV" LDFLAGS="$LDFLAGS -L$withval/lib" case "$host" in @@ -65,8 +65,8 @@ AC_ARG_WITH(krb5-include, [ --with-krb5-include=DIR include path to Kerberos 5 install], [ if test -d $withval ; then - CFLAGS="$CFLAGS -I$withval" - CPPFLAGS="$CPPFLAGS -I$withval" + CFLAGS="$CFLAGS -I$withval -I$withval/include/kerberosIV" + CPPFLAGS="$CPPFLAGS -I$withval -I$withval/include/kerberosIV" else AC_ERROR(Specified Kerberos 5 directory doesn't exist.) fi diff --git a/krb4/validate.c b/krb4/validate.c index 86665c4..1a844f9 100644 --- a/krb4/validate.c +++ b/krb4/validate.c @@ -6,7 +6,7 @@ int kerb4_password_validate(const char *user, const char *pass) { if (ret != KSUCCESS) return !KRB4_OK; - ret = krb_get_pw_in_tkt(user, "", realm, "krbtgt", realm, + ret = krb_get_pw_in_tkt((char *)user, "", realm, "krbtgt", realm, DEFAULT_TKT_LIFE, (char *)pass); switch (ret) { case INTK_OK: -- 2.1.4