From: didg Date: Thu, 25 Sep 2003 12:23:53 +0000 (+0000) Subject: maybe stupid but use the OS X numbering for volumes (1,2,3) rather than (0, X-Git-Tag: netatalk-2-0-alpha1~132 X-Git-Url: https://arthur.barton.de/gitweb/?a=commitdiff_plain;h=d5e558b45e62cc5b174f8ca0ef0a7e23455e5f88;p=netatalk.git maybe stupid but use the OS X numbering for volumes (1,2,3) rather than (0, 256, 512) and use the same token len for session (8 rather than 4). --- diff --git a/etc/afpd/auth.c b/etc/afpd/auth.c index 8fdf45e7..4560b6bc 100644 --- a/etc/afpd/auth.c +++ b/etc/afpd/auth.c @@ -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; diff --git a/etc/afpd/volume.c b/etc/afpd/volume.c index 32c0c313..b5ee67b3 100644 --- a/etc/afpd/volume.c +++ b/etc/afpd/volume.c @@ -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) {