/*
- * $Id: afs.c,v 1.15 2003-01-24 07:08:42 didg Exp $
+ * $Id: afs.c,v 1.16 2003-03-15 01:34:35 didg Exp $
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*/
if (( path = cname( vol, dir, &ibuf )) == NULL ) {
*rbuflen = 0;
- return afp_errno;
+ return get_afp_errno(AFPERR_PARAM);
}
if ( *path->m_name != '\0' ) {
*rbuflen = 0;
if (( path = cname( vol, dir, &ibuf )) == NULL ) {
*rbuflen = 0;
- return afp_errno;
+ return get_afp_errno(AFPERR_PARAM);
}
if ( *path->m_name != '\0' ) {
*rbuflen = 0;
/*
- * $Id: appl.c,v 1.11 2003-01-24 07:08:42 didg Exp $
+ * $Id: appl.c,v 1.12 2003-03-15 01:34:35 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
ibuf += sizeof( appltag );
if (( path = cname( vol, dir, &ibuf )) == NULL ) {
- return afp_errno;
+ return get_afp_errno(AFPERR_PARAM);
}
if ( path_isadir(path) ) {
return( AFPERR_BADTYPE );
ibuf += sizeof( creator );
if (( path = cname( vol, dir, &ibuf )) == NULL ) {
- return afp_errno;
+ return get_afp_errno(AFPERR_PARAM);
}
if ( path_isadir(path) ) {
return( AFPERR_BADTYPE );
/*
- * $Id: desktop.c,v 1.24 2003-03-09 19:55:33 didg Exp $
+ * $Id: desktop.c,v 1.25 2003-03-15 01:34:35 didg Exp $
*
* See COPYRIGHT.
*
}
if (NULL == ( path = cname( vol, dir, &ibuf )) ) {
- return afp_errno;
+ return get_afp_errno(AFPERR_NOOBJ);
}
if ((u_long)ibuf & 1 ) {
}
if (NULL == ( s_path = cname( vol, dir, &ibuf )) ) {
- return afp_errno;
+ return get_afp_errno(AFPERR_NOOBJ);
}
upath = s_path->u_name;
}
if (NULL == ( s_path = cname( vol, dir, &ibuf ))) {
- return afp_errno;
+ return get_afp_errno(AFPERR_NOOBJ);
}
upath = s_path->u_name;
/*
- * $Id: directory.c,v 1.63 2003-03-09 19:55:33 didg Exp $
+ * $Id: directory.c,v 1.64 2003-03-15 01:34:35 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
}
#endif
+int get_afp_errno(const int param)
+{
+ if (afp_errno != AFPERR_DID1)
+ return afp_errno;
+ return param;
+}
+
/* ------------------- */
struct dir *
dirsearch_byname( cdir, name )
/* dir is not valid anymore
we delete dir from the cache and abort.
*/
- if ( dir->d_did == DIRDID_ROOT_PARENT)
+ if ( dir->d_did == DIRDID_ROOT_PARENT) {
+ afp_errno = AFPERR_NOOBJ;
return NULL;
+ }
if (afp_errno == AFPERR_ACCESS)
return NULL;
dir_invalidate(vol, dir);
return( 0 );
}
if ( dir->d_did == DIRDID_ROOT_PARENT) {
- afp_errno = AFPERR_PARAM;
+ afp_errno = AFPERR_DID1; /* AFPERR_PARAM;*/
return( -1 );
}
ibuf += sizeof( bitmap );
if (NULL == ( path = cname( vol, dir, &ibuf )) ) {
- return afp_errno;
+ return get_afp_errno(AFPERR_NOOBJ);
}
/* FIXME access error or not a file */
}
if (NULL == ( s_path = cname( vol, dir, &ibuf )) ) {
- return afp_errno;
+ return get_afp_errno(AFPERR_PARAM);
}
/* cname was able to move curdir to it! */
if (*s_path->m_name == '\0')
}
if (NULL == ( path = cname( vol, parentdir, &ibuf )) ) {
- return afp_errno;
+ return get_afp_errno(AFPERR_PARAM);
}
if ( *path->m_name != '\0' ) {
/*
- * $Id: enumerate.c,v 1.36 2003-03-09 21:14:19 didg Exp $
+ * $Id: enumerate.c,v 1.37 2003-03-15 01:34:35 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*rbuflen = 0;
if (NULL == o_path ) {
- return afp_errno;
+ return get_afp_errno(AFPERR_NOOBJ);
}
if ( *o_path->m_name != '\0') {
/* it's a file or it's a dir and extendir() was unable to chdir in it */
/*
- * $Id: file.c,v 1.87 2003-03-09 19:55:34 didg Exp $
+ * $Id: file.c,v 1.88 2003-03-15 01:34:35 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
}
if (NULL == ( s_path = cname( vol, dir, &ibuf )) ) {
- return afp_errno;
+ return get_afp_errno(AFPERR_PARAM);
}
if ( *s_path->m_name == '\0' ) {
if ( ad_open( upath, vol_noadouble(vol)|ADFLAGS_DF|ADFLAGS_HF|ADFLAGS_NOHF,
openf, 0666, adp) < 0 ) {
switch ( errno ) {
+ case ENOENT : /* we were already in 'did folder' so chdir() didn't fail */
+ return ( AFPERR_NOOBJ );
case EEXIST :
return( AFPERR_EXIST );
case EACCES :
ibuf += sizeof( bitmap );
if (NULL == ( s_path = cname( vol, dir, &ibuf )) ) {
- return afp_errno;
+ return get_afp_errno(AFPERR_PARAM);
}
if (path_isadir(s_path)) {
ibuf += sizeof( ddid );
if (NULL == ( s_path = cname( vol, dir, &ibuf )) ) {
- return afp_errno;
+ return get_afp_errno(AFPERR_PARAM);
}
if ( path_isadir(s_path) ) {
return( AFPERR_BADTYPE );
}
if (( s_path = cname( vol, dir, &ibuf )) == NULL ) {
- return afp_errno;
+ return get_afp_errno(AFPERR_NOOBJ);
}
if ( *s_path->m_name != '\0' ) {
return (path_isadir( s_path))? AFPERR_PARAM:AFPERR_BADTYPE ;
ibuf += sizeof(did);
if (NULL == ( dir = dirlookup( vol, did )) ) {
- return( AFPERR_PARAM );
+ return afp_errno; /* was AFPERR_PARAM */
}
if (NULL == ( s_path = cname( vol, dir, &ibuf )) ) {
- return afp_errno; /* was AFPERR_PARAM */
+ return get_afp_errno(AFPERR_NOOBJ); /* was AFPERR_PARAM */
}
if ( path_isadir(s_path) ) {
/* source file */
if (NULL == (dir = dirlookup( vol, sid )) ) {
- return( AFPERR_PARAM );
+ return afp_errno; /* was AFPERR_PARAM */
}
if (NULL == ( path = cname( vol, dir, &ibuf )) ) {
- return afp_errno; /* was AFPERR_PARAM */
+ return get_afp_errno(AFPERR_NOOBJ);
}
if ( path_isadir(path) ) {
#endif /* CNID_DB */
if (NULL == ( dir = dirlookup( vol, did )) ) {
- return( AFPERR_PARAM );
+ return afp_errno; /* was AFPERR_PARAM */
}
if (NULL == ( path = cname( vol, dir, &ibuf )) ) {
- return( AFPERR_PARAM );
+ return get_afp_errno(AFPERR_NOOBJ);
}
if ( path_isadir(path) ) {
/*
- * $Id: filedir.c,v 1.42 2003-03-09 19:55:34 didg Exp $
+ * $Id: filedir.c,v 1.43 2003-03-15 01:34:35 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
ibuf += sizeof( dbitmap );
if (NULL == ( s_path = cname( vol, dir, &ibuf )) ) {
- return afp_errno;
+ return get_afp_errno(AFPERR_NOOBJ);
}
st = &s_path->st;
ibuf += sizeof( bitmap );
if (NULL == ( path = cname( vol, dir, &ibuf ))) {
- return afp_errno;
+ return get_afp_errno(AFPERR_NOOBJ);
}
st = &path->st;
/* source pathname */
if (NULL == ( path = cname( vol, sdir, &ibuf )) ) {
- return afp_errno;
+ return get_afp_errno(AFPERR_NOOBJ);
}
sdir = curdir;
}
if (NULL == ( s_path = cname( vol, dir, &ibuf )) ) {
- return afp_errno;
+ return get_afp_errno(AFPERR_NOOBJ);
}
upath = s_path->u_name;
memcpy( &did, ibuf, sizeof( did ));
ibuf += sizeof( int );
if (NULL == ( sdir = dirlookup( vol, did )) ) {
- return( AFPERR_PARAM );
+ return afp_errno; /* was AFPERR_PARAM */
}
memcpy( &did, ibuf, sizeof( did ));
/* source pathname */
if (NULL == ( path = cname( vol, sdir, &ibuf )) ) {
- return afp_errno;
+ return get_afp_errno(AFPERR_NOOBJ);
}
sdir = curdir;
/* get the destination directory */
if (NULL == ( ddir = dirlookup( vol, did )) ) {
- return( AFPERR_PARAM );
+ return afp_errno; /* was AFPERR_PARAM */
}
if (( path = cname( vol, ddir, &ibuf )) == NULL ) {
return( AFPERR_NOOBJ );
/*
- * $Id: fork.c,v 1.50 2003-03-09 19:55:35 didg Exp $
+ * $Id: fork.c,v 1.51 2003-03-15 01:34:35 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
}
if (NULL == ( s_path = cname( vol, dir, &ibuf ))) {
- return afp_errno;
+ return get_afp_errno(AFPERR_PARAM);
}
if (*s_path->m_name == '\0') {
/*
- * $Id: globals.h,v 1.16 2003-01-08 15:01:36 didg Exp $
+ * $Id: globals.h,v 1.17 2003-03-15 01:34:36 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
extern struct dir *curdir;
extern char getwdbuf[];
+extern int get_afp_errno __P((const int param));
extern void afp_options_init __P((struct afp_options *));
extern int afp_options_parse __P((int, char **, struct afp_options *));
extern int afp_options_parseline __P((char *, struct afp_options *));
#define AFPSRVRINFO_FASTBOZO (1<<15) /* fast copying */
#define AFP_OK 0
+#define AFPERR_DID1 -4000 /* not an afp error DID is 1*/
#define AFPERR_ACCESS -5000 /* permission denied */
#define AFPERR_AUTHCONT -5001 /* logincont */
#define AFPERR_BADUAM -5002 /* uam doesn't exist */