diff options
author | bnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68> | 2003-01-06 19:15:40 +0000 |
---|---|---|
committer | bnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68> | 2003-01-06 19:15:40 +0000 |
commit | e8bdc01b277a13551cb929c3ed30c6151ac303a2 (patch) | |
tree | a9f5ff620b6139be996d03791c24da683dda9c7a | |
parent | dcfdd22237bce82133eb5c5980f508d1188392cc (diff) | |
download | libapr-e8bdc01b277a13551cb929c3ed30c6151ac303a2.tar.gz |
NETWARE: Only use the path context from the stat cache if the request
thread is running with the server identity.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64270 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | file_io/netware/filestat.c | 26 | ||||
-rw-r--r-- | file_io/unix/open.c | 14 |
2 files changed, 28 insertions, 12 deletions
diff --git a/file_io/netware/filestat.c b/file_io/netware/filestat.c index b86213fc7..2b99fa8cf 100644 --- a/file_io/netware/filestat.c +++ b/file_io/netware/filestat.c @@ -184,14 +184,13 @@ APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, return apr_file_perms_set(fname, finfo.protection); } -int cstat (const char *path, struct stat *buf, char **casedName, apr_pool_t *pool) +int cstat (NXPathCtx_t pathCtx, const char *path, struct stat *buf, char **casedName, apr_pool_t *pool) { apr_hash_t *statCache = (apr_hash_t *)getStatCache(CpuCurrentProcessor); apr_pool_t *gPool = (apr_pool_t *)getGlobalPool(CpuCurrentProcessor); apr_stat_entry_t *stat_entry; struct stat *info; apr_time_t now = apr_time_now(); - NXPathCtx_t pathCtx = 0; char *key; int ret; int found = 0; @@ -205,7 +204,6 @@ int cstat (const char *path, struct stat *buf, char **casedName, apr_pool_t *poo char poolname[50]; if (apr_pool_create(&gPool, NULL) != APR_SUCCESS) { - getcwdpath(NULL, &pathCtx, CTX_ACTUAL_CWD); ret = getstat(pathCtx, path, buf, ST_STAT_BITS|ST_NAME_BIT); if (ret == 0) { *casedName = apr_pstrdup (pool, buf->st_name); @@ -259,9 +257,7 @@ int cstat (const char *path, struct stat *buf, char **casedName, apr_pool_t *poo char *dirPath = NULL, *fname = NULL; char *ptr; int err, len; - char pathbuf[256]; - getcwdpath(pathbuf, &pathCtx, CTX_ACTUAL_CWD); ret = getstat(pathCtx, path, buf, ST_STAT_BITS|ST_NAME_BIT); if (ret) { @@ -309,8 +305,6 @@ int cstat (const char *path, struct stat *buf, char **casedName, apr_pool_t *poo ST_MODE_BIT|ST_ATIME_BIT|ST_MTIME_BIT|ST_CTIME_BIT|ST_SIZE_BIT|ST_NAME_BIT); } else { - char pathbuf[256]; - getcwdpath(pathbuf, &pathCtx, CTX_ACTUAL_CWD); ret = getstat(pathCtx, path, buf, ST_MODE_BIT|ST_ATIME_BIT|ST_MTIME_BIT|ST_CTIME_BIT|ST_SIZE_BIT|ST_NAME_BIT); } @@ -339,7 +333,6 @@ int cstat (const char *path, struct stat *buf, char **casedName, apr_pool_t *poo } } else { - getcwdpath(NULL, &pathCtx, CTX_ACTUAL_CWD); ret = getstat(pathCtx, path, buf, ST_STAT_BITS|ST_NAME_BIT); if (ret == 0) { *casedName = apr_pstrdup(pool, buf->st_name); @@ -359,8 +352,23 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, struct stat info; int srv; char *casedName = NULL; + NXPathCtx_t pathCtx = 0; + int identity; + int ret; + + getcwdpath(NULL, &pathCtx, CTX_ACTUAL_CWD); + ret= get_identity (pathCtx, &identity); - srv = cstat(fname, &info, &casedName, pool); + if (ret || identity) { + srv = getstat(pathCtx, fname, &info, ST_STAT_BITS|ST_NAME_BIT); + if (srv == 0) { + casedName = apr_pstrdup(pool, info.st_name); + } + errno = srv; + } + else { + srv = cstat(pathCtx, fname, &info, &casedName, pool); + } if (srv == 0) { finfo->pool = pool; diff --git a/file_io/unix/open.c b/file_io/unix/open.c index 8b93f7119..fb42e9e05 100644 --- a/file_io/unix/open.c +++ b/file_io/unix/open.c @@ -106,8 +106,10 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, #endif #ifdef NETWARE - apr_hash_t *statCache = (apr_hash_t *)getStatCache(CpuCurrentProcessor); + apr_hash_t *statCache = NULL; apr_stat_entry_t *stat_entry = NULL; + NXPathCtx_t pathCtx = 0; + int identity; #endif if ((flag & APR_READ) && (flag & APR_WRITE)) { @@ -156,9 +158,15 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, #endif #ifdef NETWARE - if (statCache) { - stat_entry = (apr_stat_entry_t*) apr_hash_get(statCache, fname, APR_HASH_KEY_STRING); + if (!getcwdpath(NULL, &pathCtx, CTX_ACTUAL_CWD) && + !get_identity (pathCtx, &identity) && !identity) { + + statCache = (apr_hash_t *)getStatCache(CpuCurrentProcessor); + if (statCache) { + stat_entry = (apr_stat_entry_t*) apr_hash_get(statCache, fname, APR_HASH_KEY_STRING); + } } + if (stat_entry) { errno = NXFileOpen (stat_entry->pathCtx, stat_entry->casedName, oflags, &fd); } |