From 2c09a52ace844af8c2475b7221b8d69d8a81b53e Mon Sep 17 00:00:00 2001 From: didg Date: Fri, 19 Feb 2010 01:26:03 +0000 Subject: [PATCH] use volume real path for chdir --- etc/afpd/catsearch.c | 2 +- etc/afpd/directory.c | 6 +++--- etc/afpd/filedir.c | 6 +++--- etc/afpd/volume.c | 4 +++- include/atalk/volume.h | 3 ++- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/etc/afpd/catsearch.c b/etc/afpd/catsearch.c index 58aab8e1..662a8766 100644 --- a/etc/afpd/catsearch.c +++ b/etc/afpd/catsearch.c @@ -497,7 +497,7 @@ static int catsearch(struct vol *vol, struct dir *dir, int result = AFP_OK; int ccr; struct path path; - char *vpath = vol->v_path; + char *vpath = vol->v_realpath; char *rrbuf = rbuf; time_t start_time; int num_rounds = NUM_ROUNDS; diff --git a/etc/afpd/directory.c b/etc/afpd/directory.c index f330d3ca..7c7eae72 100644 --- a/etc/afpd/directory.c +++ b/etc/afpd/directory.c @@ -1,5 +1,5 @@ /* - * $Id: directory.c,v 1.132 2010-02-10 14:05:37 franklahm Exp $ + * $Id: directory.c,v 1.133 2010-02-19 01:26:03 didg Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -1642,14 +1642,14 @@ int movecwd(struct vol *vol, struct dir *dir) memcpy( p, u, n ); } if ( d != curdir ) { - n = strlen( vol->v_path ); + n = strlen( vol->v_realpath ); if (p -n -1 < path) { afp_errno = AFPERR_PARAM; return -1; } *--p = '/'; p -= n; - memcpy( p, vol->v_path, n ); + memcpy( p, vol->v_realpath, n ); } if ( (ret = lchdir( p )) != 0 ) { LOG(log_debug, logtype_afpd, "movecwd('%s'): ret:%d, %u/%s", p, ret, errno, strerror(errno)); diff --git a/etc/afpd/filedir.c b/etc/afpd/filedir.c index 4451ae80..407e48a1 100644 --- a/etc/afpd/filedir.c +++ b/etc/afpd/filedir.c @@ -1,5 +1,5 @@ /* - * $Id: filedir.c,v 1.70 2010-02-10 14:05:37 franklahm Exp $ + * $Id: filedir.c,v 1.71 2010-02-19 01:26:03 didg Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -588,13 +588,13 @@ char *absupath(const struct vol *vol, struct dir *dir, char *u) p -= len; memcpy( p, u, len ); } - len = strlen( vol->v_path ); + len = strlen( vol->v_realpath ); if (p -len -1 < path) { return NULL; } *--p = '/'; p -= len; - memcpy( p, vol->v_path, len ); + memcpy( p, vol->v_realpath, len ); return( p ); } diff --git a/etc/afpd/volume.c b/etc/afpd/volume.c index fd174e17..5dfb3b66 100644 --- a/etc/afpd/volume.c +++ b/etc/afpd/volume.c @@ -1,5 +1,5 @@ /* - * $Id: volume.c,v 1.117 2010-02-08 10:29:22 franklahm Exp $ + * $Id: volume.c,v 1.118 2010-02-19 01:26:03 didg Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -1252,6 +1252,7 @@ static void volume_free(struct vol *vol) free(vol->v_macname); vol->v_macname = NULL; free(vol->v_path); + free(vol->v_realpath); free(vol->v_password); free(vol->v_veto); free(vol->v_volcodepage); @@ -1992,6 +1993,7 @@ int afp_openvol(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t LOG(log_error, logtype_afpd, "afp_openvol(%s): volume pathlen too long", volume->v_path); return AFPERR_MISC; } + volume->v_realpath = strdup(path); if (volume_codepage(obj, volume) < 0) { ret = AFPERR_MISC; diff --git a/include/atalk/volume.h b/include/atalk/volume.h index da8f173b..3c47bf06 100644 --- a/include/atalk/volume.h +++ b/include/atalk/volume.h @@ -1,5 +1,5 @@ /* - * $Id: volume.h,v 1.13 2010-02-08 10:29:22 franklahm Exp $ + * $Id: volume.h,v 1.14 2010-02-19 01:26:03 didg Exp $ * * Copyright (c) 1990,1994 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -25,6 +25,7 @@ struct vol { u_int16_t v_vid; int v_flags; char *v_path; + char *v_realpath; /* canonical path */ struct dir *v_dir, *v_root; struct dir *v_curdir; /* cache */ hash_t *v_hash; -- 2.39.2