~ubuntu-branches/debian/wheezy/netatalk/wheezy

« back to all changes in this revision

Viewing changes to etc/afpd/appl.c

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2011-06-05 21:04:21 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20110605210421-19gag2srevj0ocxh
Tags: 2.2~beta4-1
* New upstream release.
  + Fixes "Internal Error" after ad_open on sparc.
    Closes: bug#606005. Thanks to Alfredo Sola.
* Adjust references to unofficial packages in README.Debian.
* Use dversionmangle (not uversionmangle) in watch file. Fix add
  leading dash (-) to upstream version in mangling.
* Update patches:
  + Drop patches 107 and 294 (Zeroconf support): Implemented
    (differently) upstream now.
  + Drop patches 109 and 112 (avoid broken XFS linkage) obsolete.
  + Drop patch 200 (hostname resolving): adopted upstream.
  + Refresh patch 205.
* Rewrite copyright file using draft 174 of DEP-5 format.
* Build-depend on and recommend unversioned (i.e. default) BerkeleyDB
  packages.
  Closes: bug#621413. Thanks to Ondřej Surý.
  Simplify suggestions on older versioned BerkeleyDB packages.
* Stop installing some documentation dropped upstream, and let CDBS
  automagically handle some of the remains.
* Update control file:
  + Bump policy compliance to standards-version 3.9.2.
  + Shorten Vcs-* URLs.
* Add patches 115 and (for automade file) 214 to avoid installing
  unneeded /default dir.
  Closes: bug#628119. Thanks to Russell Muetzelfeldt and Luk Claes.
* Don't ship .la files. Closes: bug#621849. Thanks to Andreas Metzler
  and Luk Claes.
* Stop renaming afile and achfile, dropped upstream.
* Explicitly enable DDP (AppleTalk), now disabled by default.
* Enable Zeroconf, should be stable now.
* Simplify package relations:
  + Drop (build-)dependency fallback unneeded even for oldstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
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 $
3
3
 *
4
4
 * Copyright (c) 1990,1993 Regents of The University of Michigan.
5
5
 * All Rights Reserved.  See COPYRIGHT.
20
20
 
21
21
#include <atalk/adouble.h>
22
22
#include <atalk/afp.h>
 
23
#include <atalk/bstrlib.h>
 
24
#include <atalk/bstradd.h>
23
25
 
24
26
#include "volume.h"
25
27
#include "globals.h"
122
124
 * See afp_getappl() for the backward compatiblity code.
123
125
 */
124
126
static char *
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)
126
128
{
127
129
    char        *p;
128
130
 
130
132
    p -= strlen( path );
131
133
    memcpy( p, path, strlen( path )); 
132
134
 
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;
135
137
        if (p < mpath) {
136
138
            /* FIXME: pathname too long */
137
139
            return NULL;
138
140
        }
139
 
        strcpy( p, dir->d_m_name );
140
 
        dir = dir->d_parent;
 
141
        memcpy(p, cfrombstr(dir->d_m_name), blength(dir->d_m_name) + 1);
 
142
        if ((dir = dirlookup(vol, dir->d_pdid)) == NULL)
 
143
            return NULL;
141
144
    }
142
145
    return( p );
 
146
 
 
147
 
 
148
#if 0
 
149
    char buffer[12 + MAXPATHLEN + 1];
 
150
    int buflen = 12 + MAXPATHLEN + 1;
 
151
    char *ret = mpath;
 
152
    char *path = name;
 
153
    char *uname = NULL;
 
154
    struct bstrList *pathlist = NULL;
 
155
    cnid_t cnid = dir->d_pdid;
 
156
 
 
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));
 
160
        return NULL;
 
161
    }
 
162
 
 
163
    while ( cnid != DIRDID_ROOT ) {
 
164
 
 
165
        /* construct path, copy already found uname to path element list*/
 
166
        if ((bstrListPush(pathlist, bfromcstr(path))) != BSTR_OK) {
 
167
            afp_errno = AFPERR_MISC;
 
168
            ret = NULL;
 
169
            goto exit;
 
170
        }
 
171
 
 
172
        /* next part */
 
173
        if ((uname = cnid_resolve(vol->v_cdb, &cnid, buffer, buflen)) == NULL ) {
 
174
            afp_errno = AFPERR_NOOBJ;
 
175
            ret = NULL;
 
176
            goto exit;
 
177
        }
 
178
 
 
179
        if ((path = utompath(vol, uname, cnid, utf8_encoding())) == NULL) {
 
180
            afp_errno = AFPERR_MISC;
 
181
            ret = NULL;
 
182
            goto exit;
 
183
        }
 
184
    }
 
185
 
 
186
 
 
187
 
 
188
exit:
 
189
    if (pathlist)
 
190
        bstrListDestroy(pathlist);
 
191
 
 
192
    return(ret);
 
193
#endif
143
194
}
144
195
 
145
196
 
197
248
        return( AFPERR_PARAM );
198
249
    }
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 );
201
252
    if (!mp) {
202
253
        return AFPERR_PARAM;
203
254
    }
280
331
        return( AFPERR_PARAM );
281
332
    }
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 );
284
335
    if (!mp) {
285
336
        return AFPERR_PARAM ;
286
337
    }
418
469
    memcpy( q, p, len );
419
470
    q = cbuf;
420
471
 
421
 
    if (( path = cname( vol, vol->v_dir, &q )) == NULL ) {
 
472
    if (( path = cname( vol, vol->v_root, &q )) == NULL ) {
422
473
        *rbuflen = 0;
423
474
        return( AFPERR_NOITEM );
424
475
    }