patches from Ian McWilliam <I.McWilliam@cit.nepean.uws.edu.au>
Ian says: Sometime around January 1999 2.4-current sources broke the handling of afpd group access. Now fixed. Various fixes and updates to afpd.
This commit is contained in:
parent
ca2ac7161b
commit
c720e8585f
@ -1,29 +1,159 @@
|
||||
--- etc/afpd/unix.c.orig Fri Mar 27 00:00:03 1998
|
||||
+++ etc/afpd/unix.c Fri Mar 27 00:14:18 1998
|
||||
@@ -37,14 +37,14 @@
|
||||
--- etc/afpd/unix.c.orig Wed Oct 2 05:26:52 1996
|
||||
+++ etc/afpd/unix.c Tue Aug 19 11:32:59 1997
|
||||
@@ -37,14 +37,15 @@
|
||||
#include <sys/mnttab.h>
|
||||
#endif __svr4__
|
||||
|
||||
-#ifdef __FreeBSD__
|
||||
+#if defined( __FreeBSD__ ) || defined( __OpenBSD__ )
|
||||
+#ifdef BSD4_4
|
||||
#include <ufs/ufs/quota.h>
|
||||
#include <sys/mount.h>
|
||||
#define dqb_btimelimit dqb_btime
|
||||
-#endif __FreeBSD__
|
||||
+#endif __FreeBSD__ __OpenBSD__
|
||||
+#include <stdlib.h>
|
||||
+#endif BSD4_4
|
||||
|
||||
#if !defined( linux ) && !defined( ultrix ) && !defined( __svr4__ ) && \
|
||||
- !defined( __FreeBSD__ )
|
||||
+ !defined( __FreeBSD__ ) && !defined( __OpenBSD__ )
|
||||
+ !defined( BSD4_4 )
|
||||
#include <ufs/quota.h>
|
||||
#include <mntent.h>
|
||||
#endif linux ultrix __svr4__
|
||||
@@ -169,7 +169,7 @@
|
||||
@@ -77,24 +78,37 @@
|
||||
#else ultrix
|
||||
struct statfs sfs;
|
||||
#endif ultrix
|
||||
+ u_long multi;
|
||||
|
||||
if ( statfs( vol->v_path, &sfs ) < 0 ) {
|
||||
return( AFPERR_PARAM );
|
||||
}
|
||||
-
|
||||
#ifdef ultrix
|
||||
- *bfree = sfs.fd_req.bfreen * 1024;
|
||||
+ multi = 1024;
|
||||
+ *bfree = sfs.fd_req.bfreen;
|
||||
#else
|
||||
- *bfree = sfs.f_bavail * sfs.f_frsize;
|
||||
+ multi = sfs.f_frsize;
|
||||
+ *bfree = sfs.f_bavail;
|
||||
#endif ultrix
|
||||
|
||||
+ if ( *bfree > 0x7fffffff / multi ) {
|
||||
+ *bfree = 0x7fffffff;
|
||||
+ } else {
|
||||
+ *bfree *= multi;
|
||||
+ }
|
||||
+
|
||||
#ifdef ultrix
|
||||
- *btotal = ( sfs.fd_req.btot - ( sfs.fd_req.bfree - sfs.fd_req.bfreen )) *
|
||||
- 1024;
|
||||
+ *btotal = sfs.fd_req.btot - ( sfs.fd_req.bfree - sfs.fd_req.bfreen );
|
||||
#else ultrix
|
||||
- *btotal = ( sfs.f_blocks - ( sfs.f_bfree - sfs.f_bavail )) * sfs.f_frsize;
|
||||
+ *btotal = sfs.f_blocks - ( sfs.f_bfree - sfs.f_bavail );
|
||||
#endif ultrix
|
||||
|
||||
+ if ( *btotal > 0x7fffffff / multi ) {
|
||||
+ *btotal = 0x7fffffff;
|
||||
+ } else {
|
||||
+ *btotal *= multi;
|
||||
+ }
|
||||
+
|
||||
return( AFP_OK );
|
||||
}
|
||||
|
||||
@@ -156,7 +170,8 @@
|
||||
}
|
||||
|
||||
#else ultrix
|
||||
-#ifdef __FreeBSD__
|
||||
+#if defined ( __FreeBSD__ ) || ( __OpenBSD__ )
|
||||
+
|
||||
+#ifdef BSD4_4
|
||||
|
||||
char *
|
||||
special( file )
|
||||
@@ -170,7 +185,7 @@
|
||||
return( sfs.f_mntfromname );
|
||||
}
|
||||
|
||||
-#else __FreeBSD__
|
||||
+#else BSD4_4
|
||||
|
||||
char *
|
||||
special( file )
|
||||
@@ -201,7 +216,7 @@
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
-#endif __FreeBSD__
|
||||
+#endif BSD4_4
|
||||
#endif ultrix
|
||||
#endif __svr4__
|
||||
|
||||
@@ -253,15 +268,15 @@
|
||||
return( AFPERR_PARAM );
|
||||
}
|
||||
#else ultrix
|
||||
-#ifdef __FreeBSD__
|
||||
+#ifdef BSD4_4
|
||||
if ( quotactl( vol->v_gvs, Q_GETQUOTA, uuid, (char *)dq ) != 0 ) {
|
||||
return( AFPERR_PARAM );
|
||||
}
|
||||
-#else __FreeBSD__
|
||||
+#else BSD4_4
|
||||
if ( quotactl( Q_GETQUOTA, vol->v_gvs, uuid, dq ) != 0 ) {
|
||||
return( AFPERR_PARAM );
|
||||
}
|
||||
-#endif __FreeBSD__
|
||||
+#endif BSD4_4
|
||||
#endif ultrix
|
||||
#endif __svr4__
|
||||
|
||||
@@ -306,10 +321,16 @@
|
||||
syslog( LOG_ERR, "overquota: gettimeofday: %m" );
|
||||
return( AFPERR_PARAM );
|
||||
}
|
||||
+#if defined (__NetBSD__)
|
||||
+ if ( !dqblk->dqb_btime || dqblk->dqb_btime > tv.tv_sec ) {
|
||||
+ return( 0 );
|
||||
+ }
|
||||
+#else
|
||||
if ( !dqblk->dqb_btimelimit || dqblk->dqb_btimelimit > tv.tv_sec ) {
|
||||
return( 0 );
|
||||
}
|
||||
-#endif ultrix
|
||||
+#endif /* __NetBSD__ */
|
||||
+#endif /* ultrix */
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
@@ -633,21 +654,25 @@
|
||||
closedir( dir );
|
||||
|
||||
/*
|
||||
- * We cheat: we know that chown doesn't do anything.
|
||||
+ * We cheat when we know that chown doesn't do anything.
|
||||
+ * Ignore these errors, there are cases where the Mac tries to
|
||||
+ * set the group and it's just not possible.
|
||||
*/
|
||||
if ( stat( ".AppleDouble", &st ) < 0 ) {
|
||||
syslog( LOG_ERR, "setdirowner: stat .AppleDouble: %m" );
|
||||
return( -1 );
|
||||
}
|
||||
if ( gid && gid != st.st_gid && chown( ".AppleDouble", uid, gid ) < 0 ) {
|
||||
- return( -1 );
|
||||
+ syslog( LOG_DEBUG, "setdirowner: chown %d/%d %s: %m",
|
||||
+ uid, gid, ".AppleDouble" );
|
||||
}
|
||||
|
||||
if ( stat( ".", &st ) < 0 ) {
|
||||
return( -1 );
|
||||
}
|
||||
if ( gid && gid != st.st_gid && chown( ".", uid, gid ) < 0 ) {
|
||||
- return( -1 );
|
||||
+ syslog( LOG_DEBUG, "setdirowner: chown %d/%d %s: %m",
|
||||
+ uid, gid, "." );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
|
@ -1,66 +1,11 @@
|
||||
*** etc/afpd/unix.c- Tue Oct 1 15:26:52 1996
|
||||
--- etc/afpd/unix.c Mon Aug 18 21:32:59 1997
|
||||
***************
|
||||
*** 77,100 ****
|
||||
#else ultrix
|
||||
struct statfs sfs;
|
||||
#endif ultrix
|
||||
|
||||
if ( statfs( vol->v_path, &sfs ) < 0 ) {
|
||||
return( AFPERR_PARAM );
|
||||
}
|
||||
-
|
||||
#ifdef ultrix
|
||||
! *bfree = sfs.fd_req.bfreen * 1024;
|
||||
#else
|
||||
! *bfree = sfs.f_bavail * sfs.f_frsize;
|
||||
#endif ultrix
|
||||
|
||||
#ifdef ultrix
|
||||
! *btotal = ( sfs.fd_req.btot - ( sfs.fd_req.bfree - sfs.fd_req.bfreen )) *
|
||||
! 1024;
|
||||
#else ultrix
|
||||
! *btotal = ( sfs.f_blocks - ( sfs.f_bfree - sfs.f_bavail )) * sfs.f_frsize;
|
||||
#endif ultrix
|
||||
|
||||
return( AFP_OK );
|
||||
}
|
||||
|
||||
--- 78,114 ----
|
||||
#else ultrix
|
||||
struct statfs sfs;
|
||||
#endif ultrix
|
||||
+ u_long multi;
|
||||
|
||||
if ( statfs( vol->v_path, &sfs ) < 0 ) {
|
||||
return( AFPERR_PARAM );
|
||||
}
|
||||
#ifdef ultrix
|
||||
! multi = 1024;
|
||||
! *bfree = sfs.fd_req.bfreen;
|
||||
#else
|
||||
! multi = sfs.f_frsize;
|
||||
! *bfree = sfs.f_bavail;
|
||||
#endif ultrix
|
||||
|
||||
+ if ( *bfree > 0x7fffffff / multi ) {
|
||||
+ *bfree = 0x7fffffff;
|
||||
+ } else {
|
||||
+ *bfree *= multi;
|
||||
+ }
|
||||
+
|
||||
#ifdef ultrix
|
||||
! *btotal = sfs.fd_req.btot - ( sfs.fd_req.bfree - sfs.fd_req.bfreen );
|
||||
#else ultrix
|
||||
! *btotal = sfs.f_blocks - ( sfs.f_bfree - sfs.f_bavail );
|
||||
#endif ultrix
|
||||
|
||||
+ if ( *btotal > 0x7fffffff / multi ) {
|
||||
+ *btotal = 0x7fffffff;
|
||||
+ } else {
|
||||
+ *btotal *= multi;
|
||||
+ }
|
||||
+
|
||||
return( AFP_OK );
|
||||
}
|
||||
|
||||
--- etc/afpd/Makefile.orig Fri Jan 8 19:06:13 1999
|
||||
+++ etc/afpd/Makefile Fri Jan 8 19:06:31 1999
|
||||
@@ -21,7 +21,7 @@
|
||||
if [ x"${KRBDIR}" != x ]; then \
|
||||
KRBLIBS="-lkrb -ldes"; \
|
||||
KRBLIBDIRS="-L${KRBDIR}/lib"; \
|
||||
- KRBINCPATH="-I${KRBDIR}/include"; \
|
||||
+ KRBINCPATH="-I${KRBDIR}/include/kerberosIV"; \
|
||||
KRBDEFS="-DKRB"; \
|
||||
fi; \
|
||||
if [ x"${AFSDIR}" != x ]; then \
|
||||
|
@ -1,175 +1,11 @@
|
||||
*** etc/afpd/file.c- 1997/08/17 00:01:46
|
||||
--- etc/afpd/file.c 1997/08/20 22:39:08
|
||||
***************
|
||||
*** 125,139 ****
|
||||
break;
|
||||
|
||||
case FILPBIT_FINFO :
|
||||
! if ( !isad ||
|
||||
! bcmp( ad_entry( &ad, ADEID_FINDERI ), ufinderi, 8 ) == 0 ) {
|
||||
bcopy( ufinderi, data, 32 );
|
||||
- if (( em = getextmap( path )) != NULL ) {
|
||||
- bcopy( em->em_type, data, sizeof( em->em_type ));
|
||||
- bcopy( em->em_creator, data + 4, sizeof( em->em_creator ));
|
||||
- }
|
||||
} else {
|
||||
bcopy( ad_entry( &ad, ADEID_FINDERI ), data, 32 );
|
||||
}
|
||||
data += 32;
|
||||
break;
|
||||
--- 125,139 ----
|
||||
break;
|
||||
|
||||
case FILPBIT_FINFO :
|
||||
! if ( !isad ) {
|
||||
bcopy( ufinderi, data, 32 );
|
||||
} else {
|
||||
bcopy( ad_entry( &ad, ADEID_FINDERI ), data, 32 );
|
||||
+ }
|
||||
+ if ( bcmp( data, ufinderi, 8 ) == 0 &&
|
||||
+ ( em = getextmap( path )) != NULL ) {
|
||||
+ bcopy( em->em_type, data, sizeof( em->em_type ));
|
||||
+ bcopy( em->em_creator, data + 4, sizeof( em->em_creator ));
|
||||
}
|
||||
data += 32;
|
||||
break;
|
||||
*** etc/afpd/fork.c- 1997/08/17 00:01:46
|
||||
--- etc/afpd/fork.c 1997/08/26 03:50:24
|
||||
***************
|
||||
*** 95,108 ****
|
||||
|
||||
if ( ad_open( mtoupath( path ), adflags, oflags, 0,
|
||||
&ofork->of_ad ) < 0 ) {
|
||||
! if ( errno == ENOENT && adflags != ADFLAGS_HF ) {
|
||||
ad_close( &ofork->of_ad, adflags );
|
||||
! if ( ad_open( mtoupath( path ), ADFLAGS_DF, oflags, 0,
|
||||
! &ofork->of_ad ) < 0 ) {
|
||||
! ad_close( &ofork->of_ad, ADFLAGS_DF );
|
||||
! of_dealloc( ofork );
|
||||
! *rbuflen = 0;
|
||||
! return( AFPERR_NOOBJ );
|
||||
}
|
||||
} else {
|
||||
of_dealloc( ofork );
|
||||
--- 95,110 ----
|
||||
|
||||
if ( ad_open( mtoupath( path ), adflags, oflags, 0,
|
||||
&ofork->of_ad ) < 0 ) {
|
||||
! if ( errno == ENOENT ) {
|
||||
ad_close( &ofork->of_ad, adflags );
|
||||
! if ( adflags != ADFLAGS_HF ) {
|
||||
! if ( ad_open( mtoupath( path ), ADFLAGS_DF, oflags, 0,
|
||||
! &ofork->of_ad ) < 0 ) {
|
||||
! ad_close( &ofork->of_ad, ADFLAGS_DF );
|
||||
! of_dealloc( ofork );
|
||||
! *rbuflen = 0;
|
||||
! return( AFPERR_NOOBJ );
|
||||
! }
|
||||
}
|
||||
} else {
|
||||
of_dealloc( ofork );
|
||||
***************
|
||||
*** 171,176 ****
|
||||
--- 173,181 ----
|
||||
lockfd = ad_dfileno( &ofork->of_ad );
|
||||
} else {
|
||||
lockfd = ad_hfileno( &ofork->of_ad );
|
||||
+ if ( lockfd == -1 ) {
|
||||
+ lockop = 0;
|
||||
+ }
|
||||
}
|
||||
if ( lockop && flock( lockfd, lockop|LOCK_NB ) < 0 ) {
|
||||
ret = errno;
|
||||
***************
|
||||
*** 318,325 ****
|
||||
|
||||
if ( ad_dfileno( &ofork->of_ad ) != -1 ) {
|
||||
eid = ADEID_DFORK;
|
||||
! } else {
|
||||
eid = ADEID_RFORK;
|
||||
}
|
||||
|
||||
if ( reqcount < 0 ) {
|
||||
--- 323,333 ----
|
||||
|
||||
if ( ad_dfileno( &ofork->of_ad ) != -1 ) {
|
||||
eid = ADEID_DFORK;
|
||||
! } else if ( ad_hfileno( &ofork->of_ad ) != -1 ) {
|
||||
eid = ADEID_RFORK;
|
||||
+ } else {
|
||||
+ *rbuflen = 0;
|
||||
+ return( AFPERR_EOF );
|
||||
}
|
||||
|
||||
if ( reqcount < 0 ) {
|
||||
***************
|
||||
*** 548,555 ****
|
||||
*rbuflen = 0;
|
||||
return( AFPERR_DFULL );
|
||||
default :
|
||||
- syslog( LOG_ERR, "afp_write: ad_write: %m" );
|
||||
*rbuflen = 0;
|
||||
return( AFPERR_PARAM );
|
||||
}
|
||||
}
|
||||
--- 556,563 ----
|
||||
*rbuflen = 0;
|
||||
return( AFPERR_DFULL );
|
||||
default :
|
||||
*rbuflen = 0;
|
||||
+ syslog( LOG_ERR, "afp_write: ad_write: %m" );
|
||||
return( AFPERR_PARAM );
|
||||
}
|
||||
}
|
||||
***************
|
||||
*** 642,649 ****
|
||||
}
|
||||
if ( bitmap & ( 1<<FILPBIT_DFLEN | 1<<FILPBIT_FNUM )) {
|
||||
if ( ad_dfileno( &ofork->of_ad ) == -1 ) {
|
||||
! if ( fstat( ad_hfileno( &ofork->of_ad ), &st ) < 0 ) {
|
||||
! return( AFPERR_BITMAP );
|
||||
}
|
||||
} else {
|
||||
if ( fstat( ad_dfileno( &ofork->of_ad ), &st ) < 0 ) {
|
||||
--- 650,657 ----
|
||||
}
|
||||
if ( bitmap & ( 1<<FILPBIT_DFLEN | 1<<FILPBIT_FNUM )) {
|
||||
if ( ad_dfileno( &ofork->of_ad ) == -1 ) {
|
||||
! if ( stat( mtoupath( ofork->of_name ), &st ) < 0 ) {
|
||||
! return( AFPERR_NOOBJ );
|
||||
}
|
||||
} else {
|
||||
if ( fstat( ad_dfileno( &ofork->of_ad ), &st ) < 0 ) {
|
||||
***************
|
||||
*** 710,724 ****
|
||||
break;
|
||||
|
||||
case FILPBIT_FINFO :
|
||||
! if ( !isad || bcmp( ad_entry( &ofork->of_ad, ADEID_FINDERI ),
|
||||
! ufinderi, 8 ) == 0 ) {
|
||||
bcopy( ufinderi, data, 32 );
|
||||
- if (( em = getextmap( ofork->of_name )) != NULL ) {
|
||||
- bcopy( em->em_type, data, sizeof( em->em_type ));
|
||||
- bcopy( em->em_creator, data + 4, sizeof( em->em_creator ));
|
||||
- }
|
||||
} else {
|
||||
bcopy( ad_entry( &ofork->of_ad, ADEID_FINDERI ), data, 32 );
|
||||
}
|
||||
data += 32;
|
||||
break;
|
||||
--- 718,732 ----
|
||||
break;
|
||||
|
||||
case FILPBIT_FINFO :
|
||||
! if ( !isad ) {
|
||||
bcopy( ufinderi, data, 32 );
|
||||
} else {
|
||||
bcopy( ad_entry( &ofork->of_ad, ADEID_FINDERI ), data, 32 );
|
||||
+ }
|
||||
+ if ( bcmp( data, ufinderi, 8 ) == 0 &&
|
||||
+ ( em = getextmap( ofork->of_name )) != NULL ) {
|
||||
+ bcopy( em->em_type, data, sizeof( em->em_type ));
|
||||
+ bcopy( em->em_creator, data + 4, sizeof( em->em_creator ));
|
||||
}
|
||||
data += 32;
|
||||
break;
|
||||
--- etc/papd/Makefile.orig Fri Jan 8 19:13:41 1999
|
||||
+++ etc/papd/Makefile Fri Jan 8 19:13:57 1999
|
||||
@@ -15,7 +15,7 @@
|
||||
if [ x"${KRBDIR}" != x ]; then \
|
||||
KRBLIBS="-lkrb -ldes"; \
|
||||
KRBLIBDIRS="-L${KRBDIR}/lib"; \
|
||||
- KRBINCPATH="-I${KRBDIR}/include"; \
|
||||
+ KRBINCPATH="-I${KRBDIR}/include/kerberosIV"; \
|
||||
KRBDEFS="-DKRB"; \
|
||||
fi; \
|
||||
${MAKE} ${MFLAGS} CC="${CC}" ADDLIBS="${ADDLIBS}" DEFS="${DEFS}" \
|
||||
|
@ -1,11 +1,53 @@
|
||||
--- etc/afpd/Makefile.orig Fri Jan 8 19:06:13 1999
|
||||
+++ etc/afpd/Makefile Fri Jan 8 19:06:31 1999
|
||||
@@ -21,7 +21,7 @@
|
||||
if [ x"${KRBDIR}" != x ]; then \
|
||||
KRBLIBS="-lkrb -ldes"; \
|
||||
KRBLIBDIRS="-L${KRBDIR}/lib"; \
|
||||
- KRBINCPATH="-I${KRBDIR}/include"; \
|
||||
+ KRBINCPATH="-I${KRBDIR}/include/kerberosIV"; \
|
||||
KRBDEFS="-DKRB"; \
|
||||
fi; \
|
||||
if [ x"${AFSDIR}" != x ]; then \
|
||||
--- etc/afpd/file.c.orig Sat Oct 19 06:33:04 1996
|
||||
+++ etc/afpd/file.c Tue Mar 31 02:24:45 1998
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "directory.h"
|
||||
+#include "desktop.h"
|
||||
#include "volume.h"
|
||||
#include "file.h"
|
||||
#include "globals.h"
|
||||
@@ -124,16 +125,16 @@
|
||||
break;
|
||||
|
||||
case FILPBIT_FINFO :
|
||||
- if ( !isad ||
|
||||
- bcmp( ad_entry( &ad, ADEID_FINDERI ), ufinderi, 8 ) == 0 ) {
|
||||
+ if ( !isad ) {
|
||||
bcopy( ufinderi, data, 32 );
|
||||
- if (( em = getextmap( path )) != NULL ) {
|
||||
- bcopy( em->em_type, data, sizeof( em->em_type ));
|
||||
- bcopy( em->em_creator, data + 4, sizeof( em->em_creator ));
|
||||
- }
|
||||
} else {
|
||||
bcopy( ad_entry( &ad, ADEID_FINDERI ), data, 32 );
|
||||
}
|
||||
+ if ( bcmp( data, ufinderi, 8 ) == 0 &&
|
||||
+ ( em = getextmap( path )) != NULL ) {
|
||||
+ bcopy( em->em_type, data, sizeof( em->em_type ));
|
||||
+ bcopy( em->em_creator, data + 4, sizeof( em->em_creator ));
|
||||
+ }
|
||||
data += 32;
|
||||
break;
|
||||
|
||||
@@ -317,7 +318,7 @@
|
||||
return( AFPERR_NOOBJ );
|
||||
}
|
||||
|
||||
- if ((int)ibuf & 1 ) {
|
||||
+ if ((long)ibuf & 1 ) {
|
||||
ibuf++;
|
||||
}
|
||||
|
||||
@@ -666,6 +667,10 @@
|
||||
{
|
||||
struct adouble ad;
|
||||
int adflags;
|
||||
+
|
||||
+ if ( of_findfile( curdir, utompath( file )) != NULL ) {
|
||||
+ return( AFPERR_BUSY );
|
||||
+ }
|
||||
|
||||
adflags = ADFLAGS_DF|ADFLAGS_HF;
|
||||
if ( ad_open( file, adflags, O_RDWR, 0, &ad ) < 0 ) {
|
||||
|
@ -1,11 +1,205 @@
|
||||
--- etc/papd/Makefile.orig Fri Jan 8 19:13:41 1999
|
||||
+++ etc/papd/Makefile Fri Jan 8 19:13:57 1999
|
||||
@@ -15,7 +15,7 @@
|
||||
if [ x"${KRBDIR}" != x ]; then \
|
||||
KRBLIBS="-lkrb -ldes"; \
|
||||
KRBLIBDIRS="-L${KRBDIR}/lib"; \
|
||||
- KRBINCPATH="-I${KRBDIR}/include"; \
|
||||
+ KRBINCPATH="-I${KRBDIR}/include/kerberosIV"; \
|
||||
KRBDEFS="-DKRB"; \
|
||||
fi; \
|
||||
${MAKE} ${MFLAGS} CC="${CC}" ADDLIBS="${ADDLIBS}" DEFS="${DEFS}" \
|
||||
--- etc/afpd/auth.c.orig Tue Sep 17 04:33:55 1996
|
||||
+++ etc/afpd/auth.c Tue Mar 16 18:25:36 1999
|
||||
@@ -37,9 +37,15 @@
|
||||
#endif KRB AFS UAM_AFSKRB
|
||||
|
||||
#if defined( KRB ) || defined( UAM_AFSKRB )
|
||||
+#ifdef SOLARIS
|
||||
+#include <kerberos/krb.h>
|
||||
+#include <kerberos/des.h>
|
||||
+#include <kerberos/prot.h>
|
||||
+#else SOLARIS
|
||||
#include <krb.h>
|
||||
#include <des.h>
|
||||
#include <prot.h>
|
||||
+#endif SOLARIS
|
||||
|
||||
C_Block seskey;
|
||||
Key_schedule seskeysched;
|
||||
@@ -101,7 +107,9 @@
|
||||
#ifdef KRB
|
||||
{ "Kerberos IV", krb4_login, krb4_logincont, 0 },
|
||||
#endif KRB
|
||||
+#ifndef AFS
|
||||
{ "Cleartxt Passwrd", clrtxt_login, NULL, 0 },
|
||||
+#endif AFS
|
||||
#ifdef UAM_AFSKRB
|
||||
{ "AFS Kerberos", afskrb_login, afskrb_logincont, 0 },
|
||||
#endif UAM_AFSKRB
|
||||
@@ -277,15 +285,15 @@
|
||||
return( AFPERR_NOTAUTH );
|
||||
}
|
||||
|
||||
- syslog( LOG_INFO, "login %s (uid %d, gid %d)", name, uid, gid );
|
||||
- if ( initgroups( name, gid ) < 0 || setgid( gid ) < 0 ||
|
||||
- setuid( uid ) < 0 ) {
|
||||
- syslog( LOG_ERR, "login: %m" );
|
||||
- return( AFPERR_BADUAM );
|
||||
+ if (( ngroups = getgroups( NGROUPS, groups )) < 0 ) {
|
||||
+ syslog( LOG_ERR, "login: getgroups: %m" );
|
||||
+ return( AFPERR_BADUAM );
|
||||
}
|
||||
|
||||
- if (( ngroups = getgroups( NGROUPS, groups )) < 0 ) {
|
||||
- syslog( LOG_ERR, "login: getgroups: %m" );
|
||||
+ syslog( LOG_INFO, "login %s (uid %d, gid %d)", name, uid, gid );
|
||||
+ if ( initgroups( name, gid ) < 0 || setgroups(ngroups, groups) < 0 ||
|
||||
+ setgid( gid ) < 0 || setuid( uid ) < 0 ) {
|
||||
+ syslog( LOG_ERR, "login: %m" );
|
||||
return( AFPERR_BADUAM );
|
||||
}
|
||||
uuid = uid;
|
||||
@@ -448,7 +456,7 @@
|
||||
bcopy( p, &cr, len );
|
||||
|
||||
pcbc_encrypt((C_Block *)&cr, (C_Block *)&cr, len, seskeysched,
|
||||
- seskey, DES_DECRYPT );
|
||||
+ seskey, DECRYPT );
|
||||
|
||||
p = buf;
|
||||
cr.ticket_st.length = ntohl( cr.ticket_st.length );
|
||||
@@ -512,7 +520,7 @@
|
||||
|
||||
extern char *crypt();
|
||||
|
||||
-static char clrtxtname[ 31 ];
|
||||
+static char clrtxtname[ 32 ];
|
||||
|
||||
clrtxt_login( ibuf, ibuflen, rbuf, rbuflen )
|
||||
char *ibuf, *rbuf;
|
||||
@@ -527,13 +535,16 @@
|
||||
|
||||
*rbuflen = 0;
|
||||
|
||||
- len = *ibuf++;
|
||||
+ len = *(unsigned char *)ibuf++;
|
||||
if ( len > 31 ) {
|
||||
return( AFPERR_PARAM );
|
||||
}
|
||||
bcopy( ibuf, clrtxtname, len );
|
||||
ibuf += len;
|
||||
clrtxtname[ len ] = '\0';
|
||||
+ while ( len-- ) {
|
||||
+ clrtxtname[ len ] = tolower( clrtxtname[ len ] );
|
||||
+ }
|
||||
username = clrtxtname;
|
||||
if (( pwd = getpwnam( clrtxtname )) == NULL ) {
|
||||
return( AFPERR_NOTAUTH );
|
||||
@@ -566,11 +577,6 @@
|
||||
++ibuf;
|
||||
}
|
||||
ibuf[ 8 ] = '\0';
|
||||
-#ifdef AFS
|
||||
- if ( kcheckuser( pwd, ibuf ) == 0 ) {
|
||||
- return( login( pwd->pw_name, pwd->pw_uid, pwd->pw_gid ));
|
||||
- }
|
||||
-#endif AFS
|
||||
p = crypt( ibuf, pwd->pw_passwd );
|
||||
if ( strcmp( p, pwd->pw_passwd ) == 0 ) {
|
||||
return( login( pwd->pw_name, pwd->pw_uid, pwd->pw_gid ));
|
||||
@@ -579,96 +585,6 @@
|
||||
return( AFPERR_NOTAUTH );
|
||||
}
|
||||
|
||||
-#ifdef AFS
|
||||
-#include <rx/rxkad.h>
|
||||
-#include <afs/afsint.h>
|
||||
-
|
||||
-char *ka_LocalCell();
|
||||
-
|
||||
-void
|
||||
-addrealm(realm,cells)
|
||||
- char *realm;
|
||||
- char ***cells;
|
||||
-{
|
||||
- char **ptr;
|
||||
- int temp;
|
||||
-
|
||||
- ptr= *cells;
|
||||
-
|
||||
- for(;*ptr != 0 ;ptr++)
|
||||
- if(!strcmp(realm,*ptr))
|
||||
- return;
|
||||
-
|
||||
- temp=ptr- *cells;
|
||||
- *cells=(char**)realloc(*cells,((2+temp)*sizeof(char*)));
|
||||
- ptr= *cells+temp;
|
||||
-
|
||||
- *ptr=(char*)malloc(strlen(realm)+1);
|
||||
- strcpy(*ptr++,realm);
|
||||
- *ptr=0;
|
||||
- return;
|
||||
-}
|
||||
-
|
||||
-int kcheckuser(pwd,passwd)
|
||||
- struct passwd *pwd;
|
||||
- char *passwd;
|
||||
-{
|
||||
- long code;
|
||||
- char *instance="";
|
||||
- char realm[MAXKTCREALMLEN];
|
||||
- char lorealm[MAXKTCREALMLEN];
|
||||
- char *cell;
|
||||
- Date lifetime=MAXKTCTICKETLIFETIME;
|
||||
- int rval;
|
||||
- char **cells=(char **)malloc(sizeof(char*));
|
||||
- char *temp;
|
||||
- int rc,cellNum;
|
||||
- struct ktc_principal serviceName;
|
||||
-
|
||||
- *cells=0;
|
||||
-
|
||||
- code = ka_Init(0);
|
||||
-
|
||||
- {
|
||||
- char *temp,*temp1;
|
||||
- temp=(char*)malloc(strlen(pwd->pw_dir)+1);
|
||||
- strcpy(temp,pwd->pw_dir);
|
||||
- temp1=temp;
|
||||
- temp=strtok(temp,"/");
|
||||
- temp=strtok('\0',"/");
|
||||
- ka_CellToRealm(temp,realm,0);
|
||||
- addrealm(realm,&cells);
|
||||
- free(temp1);
|
||||
- }
|
||||
-
|
||||
- setpag();
|
||||
- authenticate(cells,pwd->pw_name,passwd);
|
||||
- cellNum=0;
|
||||
- rc=ktc_ListTokens(cellNum,&cellNum,&serviceName);
|
||||
- if(rc)
|
||||
- rval=1;
|
||||
- else{
|
||||
- rval=0;
|
||||
- }
|
||||
-
|
||||
- return(rval);
|
||||
-}
|
||||
-
|
||||
-authenticate(cells,name,passwd)
|
||||
- char **cells;
|
||||
- char *name;
|
||||
- char *passwd;
|
||||
-{
|
||||
- char **ptr=cells;
|
||||
- char *errorstring;
|
||||
-
|
||||
- while(*ptr){
|
||||
- ka_UserAuthenticate(name,/*instance*/"",/*cell*/*ptr++,
|
||||
- passwd,/*setpag*/0,&errorstring);
|
||||
- }
|
||||
-}
|
||||
-#endif AFS
|
||||
-
|
||||
#if defined( UAM_AFSKRB ) && defined( AFS )
|
||||
afskrb_login( ibuf, ibuflen, rbuf, rbuflen )
|
||||
char *ibuf, *rbuf;
|
||||
@@ -793,7 +709,7 @@
|
||||
ibuf += sizeof( short );
|
||||
|
||||
pcbc_encrypt((C_Block *)ibuf, (C_Block *)ibuf,
|
||||
- clen, seskeysched, seskey, DES_DECRYPT );
|
||||
+ clen, seskeysched, seskey, DECRYPT );
|
||||
if ( kuam_set_in_tkt( name, instance, realm, TICKET_GRANTING_TICKET,
|
||||
realm, ibuf ) != INTK_OK ) {
|
||||
return( AFPERR_PARAM );
|
||||
|
@ -1,11 +1,447 @@
|
||||
--- etc/afpd/auth.c.orig Sun Jan 10 21:57:06 1999
|
||||
+++ etc/afpd/auth.c Sun Jan 10 22:00:21 1999
|
||||
@@ -39,7 +39,7 @@
|
||||
#if defined( KRB ) || defined( UAM_AFSKRB )
|
||||
#include <krb.h>
|
||||
#include <des.h>
|
||||
-#include <prot.h>
|
||||
+
|
||||
--- etc/afpd/desktop.c.orig Sat Jul 20 05:22:43 1996
|
||||
+++ etc/afpd/desktop.c Sun Aug 17 12:00:44 1997
|
||||
@@ -283,6 +283,7 @@
|
||||
return( AFPERR_NOITEM );
|
||||
}
|
||||
bcopy( ih + 10, &bsize, sizeof( u_short ));
|
||||
+ bsize = ntohs( bsize );
|
||||
if ( lseek( si.sdt_fd, (long)bsize, SEEK_CUR ) < 0 ) {
|
||||
syslog( LOG_ERR, "afp_iconinfo: lseek: %m" );
|
||||
return( AFPERR_PARAM );
|
||||
@@ -553,7 +554,7 @@
|
||||
return( AFPERR_NOOBJ );
|
||||
}
|
||||
|
||||
C_Block seskey;
|
||||
Key_schedule seskeysched;
|
||||
- if ((int)ibuf & 1 ) {
|
||||
+ if ((long)ibuf & 1 ) {
|
||||
ibuf++;
|
||||
}
|
||||
|
||||
--- etc/afpd/directory.c.orig Fri Jul 26 06:13:44 1996
|
||||
+++ etc/afpd/directory.c Sun Aug 17 09:20:04 1997
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <atalk/adouble.h>
|
||||
#include <atalk/afp.h>
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <strings.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <grp.h>
|
||||
@@ -477,7 +479,7 @@
|
||||
/*
|
||||
* If ibuf is odd, make it even.
|
||||
*/
|
||||
- if ((int)ibuf & 1 ) {
|
||||
+ if ((long)ibuf & 1) {
|
||||
ibuf++;
|
||||
}
|
||||
|
||||
@@ -917,12 +919,16 @@
|
||||
{
|
||||
struct passwd *pw;
|
||||
struct group *gr;
|
||||
- int len, sfunc, id;
|
||||
+ int len, ibl, sfunc, id;
|
||||
|
||||
ibuf++;
|
||||
- sfunc = *ibuf++;
|
||||
- len = *ibuf++;
|
||||
+ sfunc = *(unsigned char *)ibuf++;
|
||||
+ len = *(unsigned char *)ibuf++;
|
||||
ibuf[ len ] = '\0';
|
||||
+ ibl = len;
|
||||
+ while ( ibl-- ) {
|
||||
+ ibuf[ ibl ] = tolower( ibuf[ ibl ] );
|
||||
+ }
|
||||
|
||||
if ( len != 0 ) {
|
||||
switch ( sfunc ) {
|
||||
|
||||
--- etc/afpd/enumerate.c.orig Sat Jul 20 05:24:53 1996
|
||||
+++ etc/afpd/enumerate.c Sun Aug 17 09:20:06 1997
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <atalk/afp.h>
|
||||
#include <atalk/adouble.h>
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <strings.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "desktop.h"
|
||||
--- etc/afpd/filedir.c.orig Mon Sep 23 04:06:34 1996
|
||||
+++ etc/afpd/filedir.c Sun Aug 17 09:20:09 1997
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <atalk/adouble.h>
|
||||
#include <atalk/afp.h>
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <strings.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
|
||||
@@ -141,7 +143,7 @@
|
||||
/*
|
||||
* If ibuf is odd, make it even.
|
||||
*/
|
||||
- if ((int)ibuf & 1 ) {
|
||||
+ if ((long)ibuf & 1 ) {
|
||||
ibuf++;
|
||||
}
|
||||
|
||||
--- etc/afpd/fork.c.orig Wed Sep 25 01:20:25 1996
|
||||
+++ etc/afpd/fork.c Fri Oct 3 11:14:45 1997
|
||||
@@ -21,11 +21,13 @@
|
||||
#include <atalk/asp.h>
|
||||
#include <atalk/adouble.h>
|
||||
#include <stdio.h>
|
||||
+#include <strings.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "fork.h"
|
||||
#include "file.h"
|
||||
+#include "desktop.h"
|
||||
#include "globals.h"
|
||||
#include "directory.h"
|
||||
#include "volume.h"
|
||||
@@ -94,14 +96,16 @@
|
||||
|
||||
if ( ad_open( mtoupath( path ), adflags, oflags, 0,
|
||||
&ofork->of_ad ) < 0 ) {
|
||||
- if ( errno == ENOENT && adflags != ADFLAGS_HF ) {
|
||||
+ if ( errno == ENOENT ) {
|
||||
ad_close( &ofork->of_ad, adflags );
|
||||
- if ( ad_open( mtoupath( path ), ADFLAGS_DF, oflags, 0,
|
||||
- &ofork->of_ad ) < 0 ) {
|
||||
- ad_close( &ofork->of_ad, ADFLAGS_DF );
|
||||
- of_dealloc( ofork );
|
||||
- *rbuflen = 0;
|
||||
- return( AFPERR_NOOBJ );
|
||||
+ if ( adflags != ADFLAGS_HF ) {
|
||||
+ if ( ad_open( mtoupath( path ), ADFLAGS_DF, oflags, 0,
|
||||
+ &ofork->of_ad ) < 0 ) {
|
||||
+ ad_close( &ofork->of_ad, ADFLAGS_DF );
|
||||
+ of_dealloc( ofork );
|
||||
+ *rbuflen = 0;
|
||||
+ return( AFPERR_NOOBJ );
|
||||
+ }
|
||||
}
|
||||
} else {
|
||||
of_dealloc( ofork );
|
||||
@@ -170,6 +174,9 @@
|
||||
lockfd = ad_dfileno( &ofork->of_ad );
|
||||
} else {
|
||||
lockfd = ad_hfileno( &ofork->of_ad );
|
||||
+ if ( lockfd == -1 ) {
|
||||
+ lockop = 0;
|
||||
+ }
|
||||
}
|
||||
if ( lockop && flock( lockfd, lockop|LOCK_NB ) < 0 ) {
|
||||
ret = errno;
|
||||
@@ -317,8 +324,11 @@
|
||||
|
||||
if ( ad_dfileno( &ofork->of_ad ) != -1 ) {
|
||||
eid = ADEID_DFORK;
|
||||
- } else {
|
||||
+ } else if ( ad_hfileno( &ofork->of_ad ) != -1 ) {
|
||||
eid = ADEID_RFORK;
|
||||
+ } else {
|
||||
+ *rbuflen = 0;
|
||||
+ return( AFPERR_EOF );
|
||||
}
|
||||
|
||||
if ( reqcount < 0 ) {
|
||||
@@ -547,8 +557,8 @@
|
||||
*rbuflen = 0;
|
||||
return( AFPERR_DFULL );
|
||||
default :
|
||||
- syslog( LOG_ERR, "afp_write: ad_write: %m" );
|
||||
*rbuflen = 0;
|
||||
+ syslog( LOG_ERR, "afp_write: ad_write: %m" );
|
||||
return( AFPERR_PARAM );
|
||||
}
|
||||
}
|
||||
@@ -641,8 +651,8 @@
|
||||
}
|
||||
if ( bitmap & ( 1<<FILPBIT_DFLEN | 1<<FILPBIT_FNUM )) {
|
||||
if ( ad_dfileno( &ofork->of_ad ) == -1 ) {
|
||||
- if ( fstat( ad_hfileno( &ofork->of_ad ), &st ) < 0 ) {
|
||||
- return( AFPERR_BITMAP );
|
||||
+ if ( stat( mtoupath( ofork->of_name ), &st ) < 0 ) {
|
||||
+ return( AFPERR_NOOBJ );
|
||||
}
|
||||
} else {
|
||||
if ( fstat( ad_dfileno( &ofork->of_ad ), &st ) < 0 ) {
|
||||
@@ -709,15 +719,15 @@
|
||||
break;
|
||||
|
||||
case FILPBIT_FINFO :
|
||||
- if ( !isad || bcmp( ad_entry( &ofork->of_ad, ADEID_FINDERI ),
|
||||
- ufinderi, 8 ) == 0 ) {
|
||||
+ if ( !isad ) {
|
||||
bcopy( ufinderi, data, 32 );
|
||||
- if (( em = getextmap( ofork->of_name )) != NULL ) {
|
||||
- bcopy( em->em_type, data, sizeof( em->em_type ));
|
||||
- bcopy( em->em_creator, data + 4, sizeof( em->em_creator ));
|
||||
- }
|
||||
} else {
|
||||
bcopy( ad_entry( &ofork->of_ad, ADEID_FINDERI ), data, 32 );
|
||||
+ }
|
||||
+ if ( bcmp( data, ufinderi, 8 ) == 0 &&
|
||||
+ ( em = getextmap( ofork->of_name )) != NULL ) {
|
||||
+ bcopy( em->em_type, data, sizeof( em->em_type ));
|
||||
+ bcopy( em->em_creator, data + 4, sizeof( em->em_creator ));
|
||||
}
|
||||
data += 32;
|
||||
break;
|
||||
--- etc/afpd/fork.h.orig Sat Apr 20 05:18:08 1996
|
||||
+++ etc/afpd/fork.h Tue Mar 31 02:21:14 1998
|
||||
@@ -23,3 +23,4 @@
|
||||
|
||||
struct ofork *of_alloc();
|
||||
struct ofork *of_find();
|
||||
+struct ofork *of_findfile();
|
||||
--- etc/afpd/main.c.orig Tue Oct 22 08:44:48 1996
|
||||
+++ etc/afpd/main.c Sun Oct 5 04:26:10 1997
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <termios.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <netdb.h>
|
||||
#include <unistd.h>
|
||||
@@ -265,22 +266,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
+#ifdef ultrix
|
||||
+ openlog( p, LOG_PID );
|
||||
+#else ultrix
|
||||
+ openlog( p, LOG_NDELAY|LOG_PID, LOG_DAEMON );
|
||||
+#endif ultrix
|
||||
+
|
||||
if ( pidfile ) {
|
||||
FILE *pf;
|
||||
|
||||
if (( pf = fdopen( pidfd, "w" )) == NULL ) {
|
||||
- fprintf( stderr, "Can't fdopen pidfile!\n" );
|
||||
+ syslog( LOG_ERR, "can't fdopen pidfile!" );
|
||||
exit( 1 );
|
||||
}
|
||||
fprintf( pf, "%d\n", getpid());
|
||||
fflush( pf );
|
||||
}
|
||||
|
||||
-#ifdef ultrix
|
||||
- openlog( p, LOG_PID );
|
||||
-#else ultrix
|
||||
- openlog( p, LOG_NDELAY|LOG_PID, LOG_DAEMON );
|
||||
-#endif ultrix
|
||||
+ of_init();
|
||||
|
||||
if (( status = (char *)malloc( ATP_MAXDATA )) == NULL ) {
|
||||
syslog( LOG_ERR, "main: malloc: %m" );
|
||||
@@ -526,28 +529,3 @@
|
||||
status->as_flags |= AFPSRVRINFO_FASTBOZO;
|
||||
status->as_flags = htons( status->as_flags );
|
||||
}
|
||||
-
|
||||
-#ifdef notdef
|
||||
-pdesc( f )
|
||||
- FILE *f;
|
||||
-{
|
||||
- int i, o, d;
|
||||
- extern int errno;
|
||||
-
|
||||
- d = getdtablesize();
|
||||
-
|
||||
- for ( i = 0; i < d; i++ ) {
|
||||
- if ( ioctl( i, FIOGETOWN, &o ) < 0 ) {
|
||||
- if ( errno == EBADF ) {
|
||||
- fputs( "0", f );
|
||||
- } else {
|
||||
- fputs( "1", f );
|
||||
- }
|
||||
- } else {
|
||||
- fputs( "1", f );
|
||||
- }
|
||||
- }
|
||||
- fputs( "\n", f );
|
||||
- fflush( f );
|
||||
-}
|
||||
-#endif notdef
|
||||
--- etc/afpd/ofork.c.orig Sun Apr 21 00:26:36 1996
|
||||
+++ etc/afpd/ofork.c Fri Apr 17 14:01:42 1998
|
||||
@@ -1,10 +1,14 @@
|
||||
/*
|
||||
- * Copyright (c) 1996 Regents of The University of Michigan.
|
||||
+ * Copyright (c) 1996,1997 Regents of The University of Michigan.
|
||||
* All Rights Reserved. See COPYRIGHT.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
+#include <sys/time.h>
|
||||
+#include <sys/resource.h>
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <strings.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <atalk/adouble.h>
|
||||
@@ -12,8 +16,8 @@
|
||||
#include "directory.h"
|
||||
#include "fork.h"
|
||||
|
||||
-static struct ofork *oforks[ ( NOFILE - 10 ) / 2 ];
|
||||
-int nforks = sizeof( oforks ) / sizeof( oforks[ 0 ] );
|
||||
+static struct ofork **oforks;
|
||||
+static int nforks;
|
||||
static u_short lastrefnum = 0;
|
||||
|
||||
pforkdesc( f )
|
||||
@@ -21,14 +25,39 @@
|
||||
{
|
||||
u_short ofrefnum;
|
||||
|
||||
- for ( ofrefnum = 0; ofrefnum < sizeof( oforks ) / sizeof( oforks[ 0 ] );
|
||||
- ofrefnum++ ) {
|
||||
+ for ( ofrefnum = 0; ofrefnum < nforks; ofrefnum++ ) {
|
||||
if ( oforks[ ofrefnum ] != NULL ) {
|
||||
fprintf( f, "%hu <%s>\n", ofrefnum, oforks[ ofrefnum ]->of_name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+of_init()
|
||||
+{
|
||||
+ struct rlimit rl;
|
||||
+
|
||||
+ if ( getrlimit( RLIMIT_NOFILE, &rl ) < 0 ) {
|
||||
+ syslog( LOG_ERR, "of_init: getrlimit: %m" );
|
||||
+ exit( 1 );
|
||||
+ }
|
||||
+ if ( rl.rlim_cur < rl.rlim_max ) {
|
||||
+ rl.rlim_cur = rl.rlim_max;
|
||||
+ if ( setrlimit( RLIMIT_NOFILE, &rl ) < 0 ) {
|
||||
+ syslog( LOG_ERR, "of_init: setrlimit: %m" );
|
||||
+ exit( 1 );
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ nforks = ( rl.rlim_cur - 10 ) / 2;
|
||||
+ if (( oforks = (struct ofork **)calloc( nforks, sizeof( struct ofork ))) ==
|
||||
+ NULL ) {
|
||||
+ syslog( LOG_ERR, "of_init: malloc: %m" );
|
||||
+ exit( 1 );
|
||||
+ }
|
||||
+
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
of_flush()
|
||||
{
|
||||
u_short refnum;
|
||||
@@ -102,4 +131,24 @@
|
||||
free( of->of_name );
|
||||
oforks[ refnum ] = NULL;
|
||||
return;
|
||||
+}
|
||||
+
|
||||
+ struct ofork *
|
||||
+of_findfile( dir, path )
|
||||
+ struct dir *dir;
|
||||
+ char *path;
|
||||
+{
|
||||
+ u_short refnum;
|
||||
+ int i;
|
||||
+
|
||||
+ for ( i = 0; i < nforks; i++ ) {
|
||||
+ if ( oforks[ i ] != NULL && oforks[ i ]->of_dir == dir &&
|
||||
+ strcmp( oforks[ i ]->of_name, path ) == 0 ) {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if ( i == nforks ) {
|
||||
+ return( NULL );
|
||||
+ }
|
||||
+ return( oforks[ i ] );
|
||||
}
|
||||
--- etc/afpd/volume.c.orig Wed Oct 23 06:29:04 1996
|
||||
+++ etc/afpd/volume.c Tue Mar 31 02:57:11 1998
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <strings.h>
|
||||
#include <pwd.h>
|
||||
@@ -29,16 +30,9 @@
|
||||
char *Trash = "\02\024Network Trash Folder";
|
||||
struct extmap *extmap = NULL, *defextmap = NULL;
|
||||
|
||||
-afp_getsrvrparms( ibuf, ibuflen, rbuf, rbuflen )
|
||||
- char *ibuf, *rbuf;
|
||||
- int ibuflen, *rbuflen;
|
||||
+initvolumes()
|
||||
{
|
||||
- struct timeval tv;
|
||||
- struct stat st;
|
||||
- struct vol *volume;
|
||||
struct passwd *pwent;
|
||||
- char *data;
|
||||
- int vcnt, len;
|
||||
|
||||
if ( !uservolfirst ) {
|
||||
readvolfile( systemvol, NULL, 0 );
|
||||
@@ -72,6 +66,22 @@
|
||||
readvolfile( systemvol, NULL, 0 );
|
||||
}
|
||||
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+afp_getsrvrparms( ibuf, ibuflen, rbuf, rbuflen )
|
||||
+ char *ibuf, *rbuf;
|
||||
+ int ibuflen, *rbuflen;
|
||||
+{
|
||||
+ struct timeval tv;
|
||||
+ struct stat st;
|
||||
+ struct vol *volume;
|
||||
+ struct passwd *pwent;
|
||||
+ char *data;
|
||||
+ int vcnt, len;
|
||||
+
|
||||
+ initvolumes();
|
||||
+
|
||||
data = rbuf + 5;
|
||||
for ( vcnt = 0, volume = volumes; volume; volume = volume->v_next ) {
|
||||
if ( stat( volume->v_path, &st ) < 0 ) {
|
||||
@@ -359,6 +369,8 @@
|
||||
bcopy( ibuf, volname, len );
|
||||
volname[ len ] = '\0';
|
||||
|
||||
+ initvolumes();
|
||||
+
|
||||
for ( volume = volumes; volume; volume = volume->v_next ) {
|
||||
if ( strcasecmp( volname, volume->v_name ) == 0 ) {
|
||||
break;
|
||||
@@ -701,9 +713,12 @@
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
- if ( gettimeofday( &tv, 0 ) < 0 ) {
|
||||
- syslog( LOG_ERR, "setvoltime: gettimeofday: %m" );
|
||||
- exit( 1 );
|
||||
+ /* utime() suggested by Roland Schulz */
|
||||
+ if ( utime( vol->v_path, NULL ) < 0 ) {
|
||||
+ if ( gettimeofday( &tv, 0 ) < 0 ) {
|
||||
+ syslog( LOG_ERR, "setvoltime: gettimeofday: %m" );
|
||||
+ exit( 1 );
|
||||
+ }
|
||||
+ vol->v_time = tv.tv_sec;
|
||||
}
|
||||
- vol->v_time = tv.tv_sec;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user