when closing an afp_dsi session, and to not return 0 for as an
OForkRefNum (per Apple spec).
- * $Id: afp_dsi.c,v 1.16 2002-01-04 04:45:47 sibaz Exp $
+ * $Id: afp_dsi.c,v 1.17 2002-01-17 16:13:34 jmarcus Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
if (obj->logout)
(*obj->logout)();
if (obj->logout)
(*obj->logout)();
/* UAM had syslog control; afpd needs to reassert itself */
set_processname("afpd");
syslog_setup(log_debug, logtype_default, logoption_ndelay | logoption_pid, logfacility_daemon);
LOG(log_info, logtype_default, "%.2fKB read, %.2fKB written",
dsi->read_count/1024.0, dsi->write_count/1024.0);
/* UAM had syslog control; afpd needs to reassert itself */
set_processname("afpd");
syslog_setup(log_debug, logtype_default, logoption_ndelay | logoption_pid, logfacility_daemon);
LOG(log_info, logtype_default, "%.2fKB read, %.2fKB written",
dsi->read_count/1024.0, dsi->write_count/1024.0);
}
/* a little bit of code duplication. */
}
/* a little bit of code duplication. */
- * $Id: ofork.c,v 1.8 2002-01-04 04:45:47 sibaz Exp $
+ * $Id: ofork.c,v 1.9 2002-01-17 16:13:34 jmarcus Exp $
*
* Copyright (c) 1996 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*
* Copyright (c) 1996 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
- for ( refnum = lastrefnum++, i = 0; i < nforks; i++, refnum++ ) {
+ for ( refnum = ++lastrefnum, i = 0; i < nforks; i++, refnum++ ) {
+ /* cf AFP3.0.pdf, File fork page 40 */
+ if (!refnum)
+ refnum++;
if ( oforks[ refnum % nforks ] == NULL ) {
break;
}
}
if ( oforks[ refnum % nforks ] == NULL ) {
break;
}
}
+ /* grr, Apple and their 'uniquely identifies'
+ the next line is a protection against
+ of_alloc()
+ refnum % nforks = 3
+ lastrefnum = 3
+ oforks[3] != NULL
+ refnum = 4
+ oforks[4] == NULL
+ return 4
+
+ close(oforks[4])
+
+ of_alloc()
+ refnum % nforks = 4
+ ...
+ return 4
+ same if lastrefnum++ rather than ++lastrefnum.
+ */
+ lastrefnum = refnum;
if ( i == nforks ) {
LOG(log_error, logtype_default, "of_alloc: maximum number of forks exceeded.");
return( NULL );
if ( i == nforks ) {
LOG(log_error, logtype_default, "of_alloc: maximum number of forks exceeded.");
return( NULL );