From 6768af35bd0cfde9c6342dc8c1b150fa167c5d3d Mon Sep 17 00:00:00 2001 From: "Roy T. Fielding" Date: Fri, 17 Jan 2003 04:42:43 +0000 Subject: [PATCH] Use ap_strchr instead of strchr and get the constness right. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98304 13f79535-47bb-0310-9956-ffa450edef68 --- modules/aaa/mod_authn_dbm.c | 4 ++-- modules/aaa/mod_authz_dbm.c | 13 ++++++++----- modules/aaa/mod_authz_host.c | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/modules/aaa/mod_authn_dbm.c b/modules/aaa/mod_authn_dbm.c index 164e032f24..0547cb77f6 100644 --- a/modules/aaa/mod_authn_dbm.c +++ b/modules/aaa/mod_authn_dbm.c @@ -175,7 +175,7 @@ static authn_status check_dbm_pw(request_rec *r, const char *user, return AUTH_USER_NOT_FOUND; } - colon_pw = strchr(dbm_password, ':'); + colon_pw = ap_strchr(dbm_password, ':'); if (colon_pw) { *colon_pw = '\0'; } @@ -213,7 +213,7 @@ static authn_status get_dbm_realm_hash(request_rec *r, const char *user, return AUTH_USER_NOT_FOUND; } - colon_hash = strchr(dbm_hash, ':'); + colon_hash = ap_strchr(dbm_hash, ':'); if (colon_hash) { *colon_hash = '\0'; } diff --git a/modules/aaa/mod_authz_dbm.c b/modules/aaa/mod_authz_dbm.c index 3f4b0b9d18..759b80ae2f 100644 --- a/modules/aaa/mod_authz_dbm.c +++ b/modules/aaa/mod_authz_dbm.c @@ -156,7 +156,7 @@ static apr_status_t get_dbm_grp(request_rec *r, char *key1, char *key2, char *dbmgrpfile, char *dbtype, const char ** out) { - char *grp_colon; + char *grp_colon, *val; apr_status_t retval; apr_dbm_t *f; @@ -168,20 +168,23 @@ static apr_status_t get_dbm_grp(request_rec *r, char *key1, char *key2, } /* Try key2 only if key1 failed */ - if (!(*out = get_dbm_entry_as_str(r->pool, f, key1))) { - *out = get_dbm_entry_as_str(r->pool, f, key2); + if (!(val = get_dbm_entry_as_str(r->pool, f, key1))) { + val = get_dbm_entry_as_str(r->pool, f, key2); } apr_dbm_close(f); - if (*out && (grp_colon = strchr(*out, ':')) != NULL) { - char *grp_colon2 = strchr(++grp_colon, ':'); + if (val && (grp_colon = ap_strchr(val, ':')) != NULL) { + char *grp_colon2 = ap_strchr(++grp_colon, ':'); if (grp_colon2) { *grp_colon2 = '\0'; } *out = grp_colon; } + else { + *out = val; + } return retval; } diff --git a/modules/aaa/mod_authz_host.c b/modules/aaa/mod_authz_host.c index c6a53ae161..554ab990f7 100644 --- a/modules/aaa/mod_authz_host.c +++ b/modules/aaa/mod_authz_host.c @@ -173,7 +173,7 @@ static const char *allow_cmd(cmd_parms *cmd, void *dv, const char *from, else if (!strcasecmp(where, "all")) { a->type = T_ALL; } - else if ((s = strchr(where, '/'))) { + else if ((s = ap_strchr(where, '/'))) { *s++ = '\0'; rv = apr_ipsubnet_create(&a->x.ip, where, s, cmd->pool); if(APR_STATUS_IS_EINVAL(rv)) { -- 2.40.0