]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/appl.c
Merge remote branch 'sf/product-2-2' into develop
[netatalk.git] / etc / afpd / appl.c
index d7e72f2395a5e78c9821d83160342eb11fde090b..3cba16e0c2ae7eab2fe07c28a4cbc6b11498ad85 100644 (file)
 #include <atalk/afp.h>
 #include <atalk/bstrlib.h>
 #include <atalk/bstradd.h>
+#include <atalk/globals.h>
+#include <atalk/netatalk_conf.h>
 
 #include "volume.h"
-#include "globals.h"
 #include "directory.h"
 #include "file.h"
 #include "desktop.h"
@@ -87,8 +88,8 @@ static int copyapplfile(int sfd, int dfd, char *mpath, u_short mplen)
 {
     int                cc;
     char       *p;
-    u_int16_t  len;
-    u_char     appltag[ 4 ];
+    uint16_t   len;
+    unsigned char      appltag[ 4 ];
     char       buf[ MAXPATHLEN ];
 
     while (( cc = read( sfd, buf, sizeof(appltag) + sizeof( u_short ))) > 0 ) {
@@ -138,7 +139,7 @@ makemacpath(const struct vol *vol, char *mpath, int mpathlen, struct dir *dir, c
             /* FIXME: pathname too long */
             return NULL;
         }
-        memcpy(p, cfrombstring(dir->d_m_name), blength(dir->d_m_name) + 1);
+        memcpy(p, cfrombstr(dir->d_m_name), blength(dir->d_m_name) + 1);
         if ((dir = dirlookup(vol, dir->d_pdid)) == NULL)
             return NULL;
     }
@@ -199,12 +200,12 @@ int afp_addappl(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, siz
     struct vol         *vol;
     struct dir         *dir;
     int                        tfd, cc;
-    u_int32_t           did;
-    u_int16_t          vid, mplen;
+    uint32_t           did;
+    uint16_t           vid, mplen;
     struct path         *path;
     char                *dtf, *p, *mp;
-    u_char             creator[ 4 ];
-    u_char             appltag[ 4 ];
+    unsigned char              creator[ 4 ];
+    unsigned char              appltag[ 4 ];
     char               *mpath, *tempfile;
 
     *rbuflen = 0;
@@ -250,6 +251,7 @@ int afp_addappl(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, siz
     mpath = obj->newtmp;
     mp = makemacpath( vol, mpath, AFPOBJ_TMPSIZ, curdir, path->m_name );
     if (!mp) {
+        close(tfd);
         return AFPERR_PARAM;
     }
     mplen =  mpath + AFPOBJ_TMPSIZ - mp;
@@ -263,6 +265,7 @@ int afp_addappl(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, siz
     memcpy(p, appltag, sizeof( appltag ));
     cc = mpath + AFPOBJ_TMPSIZ - p;
     if ( write( tfd, p, cc ) != cc ) {
+        close(tfd);
         unlink( tempfile );
         return( AFPERR_PARAM );
     }
@@ -286,11 +289,11 @@ int afp_rmvappl(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, siz
     struct vol         *vol;
     struct dir         *dir;
     int                        tfd, cc;
-    u_int32_t           did;
-    u_int16_t          vid, mplen;
+    uint32_t           did;
+    uint16_t           vid, mplen;
     struct path        *path;
     char                *dtf, *mp;
-    u_char             creator[ 4 ];
+    unsigned char              creator[ 4 ];
     char                *tempfile, *mpath;
 
     *rbuflen = 0;
@@ -333,6 +336,7 @@ int afp_rmvappl(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, siz
     mpath = obj->newtmp;
     mp = makemacpath( vol, mpath, AFPOBJ_TMPSIZ, curdir, path->m_name );
     if (!mp) {
+        close(tfd);
         return AFPERR_PARAM ;
     }
 
@@ -358,9 +362,9 @@ int afp_getappl(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t
     char               *p, *q;
     int                        cc; 
     size_t             buflen;
-    u_int16_t          vid, aindex, bitmap, len;
-    u_char             creator[ 4 ];
-    u_char             appltag[ 4 ];
+    uint16_t           vid, aindex, bitmap, len;
+    unsigned char              creator[ 4 ];
+    unsigned char              appltag[ 4 ];
     char                *buf, *cbuf;
     struct path         *path;
     
@@ -479,8 +483,8 @@ int afp_getappl(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t
         return( AFPERR_NOITEM );
     }
     buflen = *rbuflen - sizeof( bitmap ) - sizeof( appltag );
-    if ( getfilparams(vol, bitmap, path, curdir, rbuf + sizeof( bitmap ) +
-                      sizeof( appltag ), &buflen ) != AFP_OK ) {
+    if ( getfilparams(obj, vol, bitmap, path, curdir, rbuf + sizeof( bitmap ) +
+                      sizeof( appltag ), &buflen, 0) != AFP_OK ) {
         *rbuflen = 0;
         return( AFPERR_BITMAP );
     }