]> arthur.barton.de Git - netatalk.git/commitdiff
maybe stupid but use the OS X numbering for volumes (1,2,3) rather than (0,
authordidg <didg>
Thu, 25 Sep 2003 12:23:53 +0000 (12:23 +0000)
committerdidg <didg>
Thu, 25 Sep 2003 12:23:53 +0000 (12:23 +0000)
256, 512) and use the same token len for session (8 rather than 4).

etc/afpd/auth.c
etc/afpd/volume.c

index 8fdf45e7737d704d374b6118a1fd055c2e7c062b..4560b6bc4f6ed0e20e2c599d4bb2b30ed16acb44 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: auth.c,v 1.44.2.3.2.2 2003-09-12 06:53:18 bfernhomberg Exp $
+ * $Id: auth.c,v 1.44.2.3.2.3 2003-09-25 12:23:53 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -359,7 +359,7 @@ unsigned int ibuflen, *rbuflen;
     u_int32_t           idlen = 0;
     u_int32_t          boottime;
 
-    u_int16_t           tklen; /* FIXME: spec  u_int32_t? */
+    u_int16_t           tklen, tp; /* FIXME: spec  u_int32_t? */
     pid_t               token;
     char               *p;
 
@@ -415,11 +415,18 @@ unsigned int ibuflen, *rbuflen;
     rbuf += sizeof(type);
 
     *rbuflen += sizeof(tklen);
-    tklen = htons(sizeof(pid_t));
-    memcpy(rbuf, &tklen, sizeof(tklen));
+
+    /* use at least 8 bytes for token as OSX, don't know if it helps */
+    tklen = sizeof(pid_t);
+    if (tklen < 8)
+        tklen = 8;
+
+    tp = htons(tklen);
+    memcpy(rbuf, &tp, sizeof(tklen));
     rbuf += sizeof(tklen);
-    
-    *rbuflen += sizeof(pid_t);
+
+    *rbuflen += tklen;
+    memset(rbuf, 0, tklen);
     token = getpid();
     memcpy(rbuf, &token, sizeof(pid_t));
     return AFP_OK;
index 32c0c31396a9c41e997fb04d2edd59ff3d736601..b5ee67b380a5c3593a0ea8eade41d76c138ab127 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.c,v 1.51.2.7.2.3 2003-09-21 09:25:17 didg Exp $
+ * $Id: volume.c,v 1.51.2.7.2.4 2003-09-25 12:23:53 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -78,7 +78,7 @@ extern int afprun(int root, char *cmd, int *outfd);
 #endif /* ! NO_LARGE_VOL_SUPPORT */
 
 static struct vol *Volumes = NULL;
-static int             lastvid = 0;
+static u_int16_t       lastvid = 0;
 static char            *Trash = "\02\024Network Trash Folder";
 
 static struct extmap   *Extmap = NULL, *Defextmap = NULL;
@@ -529,7 +529,9 @@ static int creatvol(AFPObj *obj, struct passwd *pwd,
 #ifdef __svr4__
     volume->v_qfd = -1;
 #endif /* __svr4__ */
-    volume->v_vid = lastvid++;
+    /* os X start at 1 and use network order ie. 1 2 3 */
+    volume->v_vid = ++lastvid;
+    volume->v_vid = htons(volume->v_vid);
 
     /* handle options */
     if (options) {