2
* $Id: appl.c,v 1.18 2009-10-15 10:43:13 didg Exp $
2
* $Id: appl.c,v 1.18.4.1 2010-02-01 10:56:08 franklahm Exp $
4
4
* Copyright (c) 1990,1993 Regents of The University of Michigan.
5
5
* All Rights Reserved. See COPYRIGHT.
122
124
* See afp_getappl() for the backward compatiblity code.
125
makemacpath(char *mpath, int mpathlen, struct dir *dir, char *path)
127
makemacpath(const struct vol *vol, char *mpath, int mpathlen, struct dir *dir, char *path)
130
132
p -= strlen( path );
131
133
memcpy( p, path, strlen( path ));
133
while ( dir->d_parent != NULL ) {
134
p -= strlen( dir->d_m_name ) + 1;
135
while ( dir->d_did != DIRDID_ROOT ) {
136
p -= blength(dir->d_m_name) + 1;
136
138
/* FIXME: pathname too long */
139
strcpy( p, dir->d_m_name );
141
memcpy(p, cfrombstr(dir->d_m_name), blength(dir->d_m_name) + 1);
142
if ((dir = dirlookup(vol, dir->d_pdid)) == NULL)
149
char buffer[12 + MAXPATHLEN + 1];
150
int buflen = 12 + MAXPATHLEN + 1;
154
struct bstrList *pathlist = NULL;
155
cnid_t cnid = dir->d_pdid;
157
/* Create list for path elements, request 16 list elements for now*/
158
if ((pathlist = bstListCreateMin(16)) == NULL) {
159
LOG(log_error, logtype_afpd, "makemacpath: OOM: %s", strerror(errno));
163
while ( cnid != DIRDID_ROOT ) {
165
/* construct path, copy already found uname to path element list*/
166
if ((bstrListPush(pathlist, bfromcstr(path))) != BSTR_OK) {
167
afp_errno = AFPERR_MISC;
173
if ((uname = cnid_resolve(vol->v_cdb, &cnid, buffer, buflen)) == NULL ) {
174
afp_errno = AFPERR_NOOBJ;
179
if ((path = utompath(vol, uname, cnid, utf8_encoding())) == NULL) {
180
afp_errno = AFPERR_MISC;
190
bstrListDestroy(pathlist);
197
248
return( AFPERR_PARAM );
199
250
mpath = obj->newtmp;
200
mp = makemacpath( mpath, AFPOBJ_TMPSIZ, curdir, path->m_name );
251
mp = makemacpath( vol, mpath, AFPOBJ_TMPSIZ, curdir, path->m_name );
202
253
return AFPERR_PARAM;
280
331
return( AFPERR_PARAM );
282
333
mpath = obj->newtmp;
283
mp = makemacpath( mpath, AFPOBJ_TMPSIZ, curdir, path->m_name );
334
mp = makemacpath( vol, mpath, AFPOBJ_TMPSIZ, curdir, path->m_name );
285
336
return AFPERR_PARAM ;