Commit 945df75b authored by Jeff Trawick's avatar Jeff Trawick
Browse files

fix some warnings in resolve_symlink(), one of which seems to be for

a genuine bug...

The old logic

  if (!(opts & OPT_SYM_OWNER | OPT_SYM_LINKS))

wouldn't seem to work properly.  I think it would act like

  if (!((opts & OPT_SYM_OWNER) | OPT_SYM_LINKS))

This clearly isn't intended since OPT_SYM_LINKS is a constant non-zero, such
that we never really fail invalid parameters.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89860 13f79535-47bb-0310-9956-ffa450edef68
parent b3e11922
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -171,11 +171,11 @@ static int resolve_symlink(char *d, apr_finfo_t *lfi, int opts, apr_pool_t *p)
    apr_finfo_t fi;
    int res;

    if (!(opts & OPT_SYM_OWNER | OPT_SYM_LINKS))
    if (!(opts & (OPT_SYM_OWNER | OPT_SYM_LINKS)))
        return HTTP_FORBIDDEN;

    if (opts & OPT_SYM_LINKS) {
        if (res = apr_stat(&fi, d, lfi->valid, p) != APR_SUCCESS)
        if ((res = apr_stat(&fi, d, lfi->valid, p)) != APR_SUCCESS)
            return HTTP_FORBIDDEN;
        return OK;
    }
@@ -185,11 +185,11 @@ static int resolve_symlink(char *d, apr_finfo_t *lfi, int opts, apr_pool_t *p)
     * owner of the symlink, then get the info of the target.
     */
    if (!(lfi->valid & APR_FINFO_OWNER))
        if (res = apr_lstat(&fi, d, lfi->valid | APR_FINFO_OWNER, p)
        if ((res = apr_lstat(&fi, d, lfi->valid | APR_FINFO_OWNER, p))
                != APR_SUCCESS)
            return HTTP_FORBIDDEN;

    if (res = apr_stat(&fi, d, lfi->valid, p) != APR_SUCCESS)
    if ((res = apr_stat(&fi, d, lfi->valid, p)) != APR_SUCCESS)
        return HTTP_FORBIDDEN;

    if (apr_compare_users(fi.user, lfi->user) != APR_SUCCESS)