]> arthur.barton.de Git - netatalk.git/commitdiff
error code for dirlookup, cname.
authordidg <didg>
Sat, 15 Mar 2003 01:34:35 +0000 (01:34 +0000)
committerdidg <didg>
Sat, 15 Mar 2003 01:34:35 +0000 (01:34 +0000)
etc/afpd/afs.c
etc/afpd/appl.c
etc/afpd/desktop.c
etc/afpd/directory.c
etc/afpd/enumerate.c
etc/afpd/file.c
etc/afpd/filedir.c
etc/afpd/fork.c
etc/afpd/globals.h
include/atalk/afp.h

index 67f320b0c0f0a8a6f3afb86aae4407ed4195ef49..69618382fa5c43fd64f7593d44dc48f7b2b7f6d3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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.
  */
@@ -99,7 +99,7 @@ int           ibuflen, *rbuflen;
 
     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;
@@ -192,7 +192,7 @@ int         ibuflen, *rbuflen;
 
     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;
index bd7c88ddc8fb2bd1eab416bf62c9c169f19cf306..c17ce29fec6df3fbb0805b795353dce8c9b99e16 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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.
@@ -198,7 +198,7 @@ int         ibuflen, *rbuflen;
     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 );
@@ -281,7 +281,7 @@ int         ibuflen, *rbuflen;
     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 );
index a329bec8178daf797f556a8c802c30d1e1f79422..3df5481a387f25c629355051484ec86e9c9bafb6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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.
  *
@@ -1021,7 +1021,7 @@ int               ibuflen, *rbuflen;
     }
 
     if (NULL == ( path = cname( vol, dir, &ibuf )) ) {
-       return afp_errno;
+       return get_afp_errno(AFPERR_NOOBJ);
     }
 
     if ((u_long)ibuf & 1 ) {
@@ -1098,7 +1098,7 @@ int               ibuflen, *rbuflen;
     }
 
     if (NULL == ( s_path = cname( vol, dir, &ibuf )) ) {
-       return afp_errno;
+       return get_afp_errno(AFPERR_NOOBJ);
     }
 
     upath = s_path->u_name;
@@ -1164,7 +1164,7 @@ int               ibuflen, *rbuflen;
     }
 
     if (NULL == ( s_path = cname( vol, dir, &ibuf ))) {
-       return afp_errno;
+       return get_afp_errno(AFPERR_NOOBJ);
     }
 
     upath = s_path->u_name;
index 14a0a1498a402a8df9a3cd4a293e51c9eaadff72..7f4b44eb1e66254aeded9af2d2ad2b169d15db53 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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.
@@ -131,6 +131,13 @@ int path_isadir(struct path *o_path)
 }
 #endif
 
+int get_afp_errno(const int param)
+{
+    if (afp_errno != AFPERR_DID1)
+        return afp_errno;
+    return param;
+}
+
 /* ------------------- */
 struct dir *
             dirsearch_byname( cdir, name )
@@ -1044,8 +1051,10 @@ char     **cpath;
                        /* 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);
@@ -1088,7 +1097,7 @@ struct dir        *dir;
         return( 0 );
     }
     if ( dir->d_did == DIRDID_ROOT_PARENT) {
-        afp_errno = AFPERR_PARAM;
+        afp_errno = AFPERR_DID1; /* AFPERR_PARAM;*/
         return( -1 );
     }
 
@@ -1408,7 +1417,7 @@ int               ibuflen, *rbuflen;
     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 */
@@ -1777,7 +1786,7 @@ int               ibuflen, *rbuflen;
     }
 
     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')
@@ -2227,7 +2236,7 @@ int               ibuflen, *rbuflen;
     }
 
     if (NULL == ( path = cname( vol, parentdir, &ibuf )) ) {
-        return afp_errno;
+        return get_afp_errno(AFPERR_PARAM);
     }
 
     if ( *path->m_name != '\0' ) {
index db831b2b58a19473a0cfc502cceedaaa52891a8b..61b578a2db07a72e907ff5effb54b4c0c08a7437 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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.
@@ -311,7 +311,7 @@ int     ext;
 
     *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 */
index f88976bf51915e0105f1fd241b74614175b9447b..8eadbbc5e0803a032dd84f8adfe585b0582749a7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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.
@@ -581,7 +581,7 @@ int         ibuflen, *rbuflen;
     }
 
     if (NULL == ( s_path = cname( vol, dir, &ibuf )) ) {
-        return afp_errno;
+        return get_afp_errno(AFPERR_PARAM);
     }
 
     if ( *s_path->m_name == '\0' ) {
@@ -617,6 +617,8 @@ int         ibuflen, *rbuflen;
     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 :
@@ -700,7 +702,7 @@ int         ibuflen, *rbuflen;
     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)) {
@@ -1101,7 +1103,7 @@ int               ibuflen, *rbuflen;
     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 );
@@ -1139,7 +1141,7 @@ int               ibuflen, *rbuflen;
     }
 
     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 ;
@@ -1481,11 +1483,11 @@ int             ibuflen, *rbuflen;
     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) ) {
@@ -1744,11 +1746,11 @@ int             ibuflen, *rbuflen;
 
     /* 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) ) {
@@ -1794,11 +1796,11 @@ int             ibuflen, *rbuflen;
 #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) ) {
index dd2795af039502a37468f5d537bd5baa25df395c..65044f0fd678c088887f5c14d84291c30173e080 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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.
@@ -178,7 +178,7 @@ int         ibuflen, *rbuflen;
     ibuf += sizeof( dbitmap );
 
     if (NULL == ( s_path = cname( vol, dir, &ibuf )) ) {
-        return afp_errno;
+        return get_afp_errno(AFPERR_NOOBJ); 
     }
 
     st   = &s_path->st;
@@ -272,7 +272,7 @@ int         ibuflen, *rbuflen;
     ibuf += sizeof( bitmap );
 
     if (NULL == ( path = cname( vol, dir, &ibuf ))) {
-       return afp_errno;    
+        return get_afp_errno(AFPERR_NOOBJ); 
     }
 
     st   = &path->st;
@@ -490,7 +490,7 @@ int         ibuflen, *rbuflen;
 
     /* source pathname */
     if (NULL == ( path = cname( vol, sdir, &ibuf )) ) {
-       return afp_errno;    
+        return get_afp_errno(AFPERR_NOOBJ); 
     }
 
     sdir = curdir;
@@ -577,7 +577,7 @@ int         ibuflen, *rbuflen;
     }
 
     if (NULL == ( s_path = cname( vol, dir, &ibuf )) ) {
-        return afp_errno;
+        return get_afp_errno(AFPERR_NOOBJ); 
     }
 
     upath = s_path->u_name;
@@ -693,7 +693,7 @@ int         ibuflen, *rbuflen;
     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 ));
@@ -701,7 +701,7 @@ int         ibuflen, *rbuflen;
 
     /* source pathname */
     if (NULL == ( path = cname( vol, sdir, &ibuf )) ) {
-        return afp_errno;
+        return get_afp_errno(AFPERR_NOOBJ); 
     }
 
     sdir = curdir;
@@ -722,7 +722,7 @@ int         ibuflen, *rbuflen;
 
     /* 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 );
index 0430e1a0d1d36b02909d4f37aa888e5a38284d12..ddc01fb31c2a7bd5ffea9391901d0e872b9d3573 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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.
@@ -307,7 +307,7 @@ int         ibuflen, *rbuflen;
     }
 
     if (NULL == ( s_path = cname( vol, dir, &ibuf ))) {
-       return afp_errno;    
+       return get_afp_errno(AFPERR_PARAM);    
     }
 
     if (*s_path->m_name == '\0') {
index 5b5ad504dfcaf48a44f1c4537b75dd00ff0d7b5b..986fc0e714f5cd43e7dea2c41d1e92e3cc9fb7ae 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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.
@@ -94,6 +94,7 @@ extern unsigned char  nologin;
 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 *));
index 7cd08fc5430b7b4ec6350cc79fcb5aa70db42297..85a79747b770197df3d2dc1b5448352a2079f185 100644 (file)
@@ -59,6 +59,7 @@ typedef u_int16_t AFPUserBytes;
 #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 */