-($Id: ChangeLog,v 1.48 2001-06-18 13:50:06 rufustfirefly Exp $)
+($Id: ChangeLog,v 1.49 2001-06-19 18:04:39 rufustfirefly Exp $)
+
+2001-06-19 jeff b <jeff@univrel.pr.uconn.edu>
+ * etc/afpd/file.c, etc/afpd/parse_mtab.c, etc/afpd/parse_mtab.h,
+ etc/atalkd/route.h, etc/atalkd/rtmp.c, etc/papd/headers.c,
+ etc/papd/magics.c, libatalk/asp/asp_tickle.c: patch for
+ fixed DID calculation in etc/afpd/file.c, FreeBSD errors and
+ other miscellany (Joe Clarke)
+
+ * minor patches and fixes to the aforementioned files, warning
+ fixes with GCC, etc (Jeff)
2001-06-18 jeff b <jeff@univrel.pr.uconn.edu>
* configure.in, etc/uams/Makefile.am,
-dnl $Id: configure.in,v 1.89 2001-06-19 17:03:26 srittau Exp $
+dnl $Id: configure.in,v 1.90 2001-06-19 18:04:39 rufustfirefly Exp $
dnl configure.in for netatalk
AC_INIT(bin/adv1tov2/adv1tov2.c)
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h limits.h stdint.h strings.h sys/fcntl.h sys/file.h sys/ioctl.h sys/time.h sys/mnttab.h sys/statvfs.h sys/stat.h sys/vfs.h mntent.h syslog.h unistd.h termios.h sys/termios.h netdb.h sgtty.h ufs/quota.h mount.h sys/mount.h statfs.h)
+AC_CHECK_HEADERS(fcntl.h limits.h stdint.h strings.h sys/fcntl.h sys/file.h sys/ioctl.h sys/time.h sys/mnttab.h sys/statvfs.h sys/stat.h sys/vfs.h mntent.h syslog.h unistd.h termios.h sys/termios.h netdb.h sgtty.h ufs/quota.h mount.h sys/mount.h statfs.h sys/types.h)
AC_CHECK_HEADER(sys/cdefs.h,,
AC_MSG_RESULT([enabling generic cdefs.h from tree])
CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
LIBS="$LIBS -lpam"
compile_pam=yes
)
-AM_CONDITIONAL(BUILD_PAM, test x$compile_pam = xyes)
AC_ARG_WITH(pam,
- [ --with-pam enable password authentication modules support],
- if test "x$compile_pam" = "xyes"; then
- use_pam_so=yes
- AC_MSG_RESULT([enabling pam modules support])
- else
- AC_MSG_RESULT([pam libraries not found. Disabling pam modules support])
- fi
+ [ --without-pam disable password authentication modules support],
+ compile_pam=no
+ use_pam_so=no
+ AC_DEFINE(USE_PAM, 0)
+ AC_MSG_RESULT([Disabling pam modules support])
)
+if test "x$compile_pam" = "xyes"; then
+ use_pam_so=yes
+ AC_MSG_RESULT([Enabling pam modules support])
+fi
shadowpw=no
AC_ARG_WITH(shadow,
dnl ----- Set -shared flag
LDSHAREDFLAGS="-shared"
+ AC_DEFINE(NO_CRYPT_H, 1)
fi
dnl ----- HP-UX 11 specific -----
AM_CONDITIONAL(USE_KERBEROS, test x$compile_kerberos = xyes)
AM_CONDITIONAL(USE_PAM_SO, test x$use_pam_so = xyes)
AM_CONDITIONAL(USE_PAM, test x$compile_pam = xyes)
+AM_CONDITIONAL(BUILD_PAM, test x$compile_pam = xyes)
AM_CONDITIONAL(USE_PGP, test x$compile_pgp = xyes)
AM_CONDITIONAL(USE_COBALT, test x$sysv_style = xcobalt)
AM_CONDITIONAL(USE_REDHAT, test x$sysv_style = xredhat)
/*
- * $Id: file.c,v 1.20 2001-05-31 18:48:32 srittau Exp $
+ * $Id: file.c,v 1.21 2001-06-19 18:04:39 rufustfirefly Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
+#endif /* HAVE_CONFIG_H */
#include <stdio.h>
#include <stdlib.h>
#include "filedir.h"
#include "globals.h"
+/* check for mtab DID code */
+#ifdef DID_MTAB
+#include "parse_mtab.h"
+#endif /* DID_MTAB */
+
#ifdef FORCE_UIDGID
#include "uid.h"
#endif /* FORCE_UIDGID */
char *buf;
int *buflen;
{
+#ifndef USE_LASTDID
struct stat hst, lst, *lstp;
+#else /* USE_LASTDID */
+ struct stat hst;
+#endif /* USE_LASTDID */
struct adouble ad, *adp;
struct ofork *of;
struct extmap *em;
#ifdef DEBUG
syslog(LOG_INFO, "begin getfilparams:");
-#endif DEBUG
+#endif /* DEBUG */
upath = mtoupath(vol, path);
if ((of = of_findname(vol, curdir, path))) {
if (!(aint = cnid_add(vol->v_db, st, dir->d_did, upath,
strlen(upath), aint))) {
-#endif
+#endif /* AD_VERSION > AD_VERSION1 */
/*
* What a fucking mess. First thing: DID and FNUMs are
* in the same space for purposes of enumerate (and several
*
* it should be okay to use lstat to deal with symlinks.
*/
- lstp = (lstat(upath, &lst) < 0) ? st : &lst;
+#ifdef USE_LASTDID
+ aint = htonl(( st->st_dev << 16 ) | (st->st_ino & 0x0000ffff));
+#else /* USE_LASTDID */
+ lstp = lstat(upath, &lst) < 0 ? st : &lst;
+#ifdef DID_MTAB
+ aint = htonl( afpd_st_cnid ( lstp ) );
+#else /* DID_MTAB */
aint = htonl(CNID(lstp, 1));
+#endif /* DID_MTAB */
+#endif /* USE_LASTDID */
+
#if AD_VERSION > AD_VERSION1
}
-#endif
+#endif /* AD_VERSION > AD_VERSION1 */
memcpy(data, &aint, sizeof( aint ));
data += sizeof( aint );
break;
#ifdef DEBUG
syslog(LOG_INFO, "end getfilparams:");
-#endif DEBUG
+#endif /* DEBUG */
return( AFP_OK );
}
u_int16_t vid;
#ifdef FORCE_UIDGID
uidgidset *uidgid;
-#endif FORCE_UIDGID
+#endif /* FORCE_UIDGID */
#ifdef DEBUG
syslog(LOG_INFO, "begin afp_createfile:");
-#endif DEBUG
+#endif /* DEBUG */
*rbuflen = 0;
ibuf++;
/* perform all switching of users */
set_uidgid ( vol );
-#endif FORCE_UIDGID
+#endif /* FORCE_UIDGID */
if ( ad_open( upath, vol_noadouble(vol)|ADFLAGS_DF|ADFLAGS_HF,
openf, 0666, adp) < 0 ) {
#ifdef FORCE_UIDGID
/* bring everything back to old euid, egid */
restore_uidgid ( uidgid );
-#endif FORCE_UIDGID
+#endif /* FORCE_UIDGID */
return( AFPERR_EXIST );
case EACCES :
#ifdef FORCE_UIDGID
/* bring everything back to old euid, egid */
restore_uidgid ( uidgid );
-#endif FORCE_UIDGID
+#endif /* FORCE_UIDGID */
return( AFPERR_ACCESS );
case ENOENT:
/* on noadouble volumes, just creating the data fork is ok */
#ifdef FORCE_UIDGID
/* bring everything back to old euid, egid */
restore_uidgid ( uidgid );
-#endif FORCE_UIDGID
+#endif /* FORCE_UIDGID */
return( AFPERR_PARAM );
}
}
#ifdef DROPKLUDGE
if (vol->v_flags & AFPVOL_DROPBOX) {
- retvalue=matchfile2dirperms(upath, vol, did);
+ retvalue = matchfile2dirperms(upath, vol, did);
}
-#endif DROPKLUDGE
+#endif /* DROPKLUDGE */
setvoltime(obj, vol );
#ifdef DEBUG
syslog(LOG_INFO, "end afp_createfile");
-#endif DEBUG
+#endif /* DEBUG */
#ifdef FORCE_UIDGID
/* bring everything back to old euid, egid */
restore_uidgid ( uidgid );
-#endif FORCE_UIDGID
+#endif /* FORCE_UIDGID */
return (retvalue);
}
#ifdef DEBUG
syslog(LOG_INFO, "begin afp_setfilparams:");
-#endif DEBUG
+#endif /* DEBUG */
*rbuflen = 0;
ibuf += 2;
#ifdef DEBUG
syslog(LOG_INFO, "end afp_setfilparams:");
-#endif DEBUG
+#endif /* DEBUG */
return( rc );
}
#ifdef FORCE_UIDGID
uidgidset *uidgid;
-#endif FORCE_UIDGID
+#endif /* FORCE_UIDGID */
#ifdef DEBUG
syslog(LOG_INFO, "begin setfilparams:");
-#endif DEBUG
+#endif /* DEBUG */
upath = mtoupath(vol, path);
if ((of = of_findname(vol, curdir, path))) {
#ifdef FORCE_UIDGID
save_uidgid ( uidgid );
set_uidgid ( vol );
-#endif FORCE_UIDGID
+#endif /* FORCE_UIDGID */
if (ad_open( upath, vol_noadouble(vol) | ADFLAGS_HF,
O_RDWR|O_CREAT, 0666, adp) < 0) {
if (bitmap & ~(1<<FILPBIT_MDATE)) {
#ifdef FORCE_UIDGID
restore_uidgid ( uidgid );
-#endif FORCE_UIDGID
+#endif /* FORCE_UIDGID */
return vol_noadouble(vol) ? AFP_OK : AFPERR_ACCESS;
}
isad = 0;
#ifdef FORCE_UIDGID
restore_uidgid ( uidgid );
-#endif FORCE_UIDGID
+#endif /* FORCE_UIDGID */
}
#ifdef DEBUG
syslog(LOG_INFO, "end setfilparams:");
-#endif DEBUG
+#endif /* DEBUG */
return err;
}
#ifdef DEBUG
syslog (LOG_INFO, "begin renamefile:");
-#endif DEBUG
+#endif /* DEBUG */
if ( rename( src, dst ) < 0 ) {
switch ( errno ) {
#ifdef DEBUG
syslog (LOG_INFO, "end renamefile:");
-#endif DEBUG
+#endif /* DEBUG */
return( AFP_OK );
}
#ifdef DEBUG
syslog (LOG_INFO, "begin afp_copyfile:");
-#endif DEBUG
+#endif /* DEBUG */
*rbuflen = 0;
ibuf += 2;
if (vol->v_flags & AFPVOL_DROPBOX) {
retvalue=matchfile2dirperms(newname, vol, sdid);
}
-#endif DROPKLUDGE
+#endif /* DROPKLUDGE */
#ifdef DEBUG
syslog (LOG_INFO, "end afp_copyfile:");
-#endif DEBUG
+#endif /* DEBUG */
return( retvalue );
}
#ifdef DEBUG
syslog(LOG_INFO, "begin copy_all:");
-#endif DEBUG
+#endif /* DEBUG */
while (buflen > 0) {
if ((cc = write(dfd, buf, buflen)) < 0) {
#ifdef DEBUG
syslog(LOG_INFO, "end copy_all:");
-#endif DEBUG
+#endif /* DEBUG */
return AFP_OK;
}
#ifdef DEBUG
syslog(LOG_INFO, "begin copyfile:");
-#endif DEBUG
+#endif /* DEBUG */
if (newname) {
if ((sfd = open( ad_path( src, ADFLAGS_HF ), O_RDONLY, 0 )) < 0 ) {
}
goto copyheader_done;
}
-#endif
+#endif /* SENDFILE_FLAVOR_LINUX */
while (1) {
if ((cc = read(sfd, filebuf, sizeof(filebuf))) < 0) {
if (errno == EINTR)
}
goto copydata_done;
}
-#endif
+#endif /* SENDFILE_FLAVOR_LINUX */
while (1) {
if ((cc = read( sfd, filebuf, sizeof( filebuf ))) < 0) {
#ifdef DEBUG
syslog(LOG_INFO, "end copyfile:");
-#endif DEBUG
+#endif /* DEBUG */
return( AFP_OK );
}
#ifdef DEBUG
syslog(LOG_INFO, "begin deletefile:");
-#endif DEBUG
+#endif /* DEBUG */
while(1) {
/*
#ifdef DEBUG
syslog(LOG_INFO, "end deletefile:");
-#endif DEBUG
+#endif /* DEBUG */
return err;
}
#ifdef DEBUG
syslog(LOG_INFO, "begin afp_createid:");
-#endif DEBUG
+#endif /* DEBUG */
*rbuflen = 0;
ibuf += 2;
#ifdef DEBUG
syslog(LOG_INFO, "ending afp_createid...:");
-#endif DEBUG
+#endif /* DEBUG */
switch (errno) {
case EROFS:
#ifdef DEBUG
syslog(LOG_INFO, "begin afp_resolveid:");
-#endif DEBUG
+#endif /* DEBUG */
*rbuflen = 0;
ibuf += 2;
#ifdef DEBUG
syslog(LOG_INFO, "end afp_resolveid:");
-#endif DEBUG
+#endif /* DEBUG */
return AFP_OK;
}
#ifdef DEBUG
syslog(LOG_INFO, "begin afp_deleteid:");
-#endif DEBUG
+#endif /* DEBUG */
*rbuflen = 0;
ibuf += 2;
#ifdef DEBUG
syslog(LOG_INFO, "end afp_deleteid:");
-#endif DEBUG
+#endif /* DEBUG */
return err;
}
-#endif
+#endif /* AD_VERSION > AD_VERSION1 */
#define APPLETEMP ".AppleTempXXXXXX"
+
int afp_exchangefiles(obj, ibuf, ibuflen, rbuf, rbuflen )
AFPObj *obj;
char *ibuf, *rbuf;
int err;
#if AD_VERSION > AD_VERSION1
int slen, dlen;
-#endif
+#endif /* AD_VERSION > AD_VERSION1 */
cnid_t sid, did;
u_int16_t vid;
#ifdef DEBUG
syslog(LOG_INFO, "begin afp_exchangefiles:");
-#endif DEBUG
+#endif /* DEBUG */
*rbuflen = 0;
ibuf += 2;
#if AD_VERSION > AD_VERSION1
sid = cnid_lookup(vol->v_db, &srcst, sdir->d_did, supath,
slen = strlen(supath));
-#endif
+#endif /* AD_VERSION > AD_VERSION1 */
if (( dir = dirsearch( vol, did )) == NULL ) {
return( AFPERR_PARAM );
/* look for destination id. */
did = cnid_lookup(vol->v_db, &destst, curdir->d_did, upath,
dlen = strlen(upath));
-#endif
+#endif /* AD_VERSION > AD_VERSION1 */
/* construct a temp name.
* NOTE: the temp file will be in the dest file's directory. it
cnid_update(vol->v_db, sid, &srcst, sdir->d_did, supath, slen);
goto err_temp_to_dest;
}
-#endif
+#endif /* AD_VERSION > AD_VERSION1 */
#ifdef DEBUG
syslog(LOG_INFO, "ending afp_exchangefiles:");
-#endif DEBUG
+#endif /* DEBUG */
return AFP_OK;
/*
- * $Id: parse_mtab.c,v 1.2 2001-06-10 20:15:00 srittau Exp $
+ * $Id: parse_mtab.c,v 1.3 2001-06-19 18:04:39 rufustfirefly Exp $
*
* afpd_mtab_parse & support. -- rgr, 9-Apr-01.
*/
(lval) = malloc(1+strlen(str)), strcpy((lval), (str))
#endif /* COPY_STRING */
-/* global mount table; afpd_st_cnid uses this to lookup the right entry. */
-static struct afpd_mount_table *afpd_mount_table = NULL;
-
static int
ceil_log_2 __P((int n))
/* Return the number of bits required to represent n. Only works for
/*
- * $Id: parse_mtab.h,v 1.2 2001-06-06 13:36:36 rufustfirefly Exp $
+ * $Id: parse_mtab.h,v 1.3 2001-06-19 18:04:39 rufustfirefly Exp $
*
* header for afpd_mtab_parse, afpd_st_cnid
*/
entries may be null */
};
+/* global mount table; afpd_st_cnid uses this to lookup the right entry. */
+static struct afpd_mount_table *afpd_mount_table = NULL;
+
extern
unsigned int
afpd_st_cnid __P((struct stat *st));
+/*
+ * $Id: route.h,v 1.2 2001-06-19 18:04:39 rufustfirefly Exp $
+ */
+
#ifndef ATALKD_ROUTE_H
#define ATALKD_ROUTE_H 1
#include <sys/cdefs.h>
+#ifndef BSD4_4
int route __P(( int, struct sockaddr *, struct sockaddr *, int ));
+#else /* BSD4_4 */
+int route __P(( int, struct sockaddr_at *, struct sockaddr_at *, int));
+#endif /* BSD4_4 */
#endif /* ATALKD_ROUTE_H */
/*
+ * $Id: rtmp.c,v 1.5 2001-06-19 18:04:39 rufustfirefly Exp $
+ *
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
+#endif /* HAVE_CONFIG_H */
#include <stdlib.h>
#include <string.h>
#ifdef __svr4__
#include <sys/sockio.h>
-#endif __svr4__
+#endif /* __svr4__ */
#include <atalk/ddp.h>
#include <atalk/atp.h>
return 1;
}
*/
-#else PHASE1NET
+#else /* PHASE1NET */
syslog( LOG_INFO, "rtmp_packet bad first tuple" );
return 1;
-#endif PHASE1NET
+#endif /* PHASE1NET */
}
/*
printf( "rtmp_packet rdr (%d) from %u.%u\n",
*data, ntohs( from->sat_addr.s_net ),
from->sat_addr.s_node );
-#endif DEBUG
+#endif /* DEBUG */
} else {
syslog( LOG_INFO, "rtmp_packet unknown request from %u.%u\n",
ntohs( from->sat_addr.s_net ), from->sat_addr.s_node );
memset( &sat, 0, sizeof( struct sockaddr_at ));
#ifdef BSD4_4
sat.sat_len = sizeof( struct sockaddr_at );
-#endif BSD4_4
+#endif /* BSD4_4 */
sat.sat_family = AF_APPLETALK;
sat.sat_addr.s_net = iface->i_addr.sat_addr.s_net;
sat.sat_addr.s_node = ATADDR_BCAST;
memset( &dst, 0, sizeof( struct sockaddr_at ));
#ifdef BSD4_4
dst.sat_len = sizeof( struct sockaddr_at );
-#endif BSD4_4
+#endif /* BSD4_4 */
dst.sat_family = AF_APPLETALK;
dst.sat_addr.s_net = iface->i_addr.sat_addr.s_net;
dst.sat_addr.s_node = iface->i_addr.sat_addr.s_node;
memset( &loop, 0, sizeof( struct sockaddr_at ));
#ifdef BSD4_4
loop.sat_len = sizeof( struct sockaddr_at );
-#endif BSD4_4
+#endif /* BSD4_4 */
loop.sat_family = AF_APPLETALK;
loop.sat_addr.s_net = htons( ATADDR_ANYNET );
loop.sat_addr.s_node = ATADDR_ANYNODE;
+#ifndef BSD4_4
if ( route( cmd,
(struct sockaddr *) &dst,
(struct sockaddr *) &loop,
RTF_UP | RTF_HOST ) ) {
return( 1 );
}
+#else /* BSD4_4 */
+ if ( route( cmd,
+ (struct sockaddr_at *) &dst,
+ (struct sockaddr_at *) &loop,
+ RTF_UP | RTF_HOST ) ) {
+ return ( 1);
+ }
+#endif /* BSD4_4 */
if ( cmd == RTMP_ADD ) {
iface->i_flags |= IFACE_LOOP;
}
memset( &gate, 0, sizeof( struct sockaddr_at ));
#ifdef BSD4_4
gate.sat_len = sizeof( struct sockaddr_at );
-#endif BSD4_4
+#endif /* BSD4_4 */
gate.sat_family = AF_APPLETALK;
gate.sat_addr.s_net = rtmp->rt_gate->g_sat.sat_addr.s_net;
gate.sat_addr.s_node = rtmp->rt_gate->g_sat.sat_addr.s_node;
memset( &dst, 0, sizeof( struct sockaddr_at ));
#ifdef BSD4_4
dst.sat_len = sizeof( struct sockaddr_at );
-#endif BSD4_4
+#endif /* BSD4_4 */
dst.sat_family = AF_APPLETALK;
dst.sat_addr.s_node = ATADDR_ANYNODE;
do {
dst.sat_addr.s_net = htons( net );
+#ifndef BSD4_4
if ( route( command,
(struct sockaddr *) &dst,
(struct sockaddr *) &gate,
ntohs( gate.sat_addr.s_net ), gate.sat_addr.s_node );
continue;
}
+#else /* BSD4_4 */
+ if ( route( command,
+ (struct sockaddr_at *) &dst,
+ (struct sockaddr_at *) &gate,
+ RTF_UP | RTF_GATEWAY )) {
+ syslog( LOG_ERR, "route: %u -> %u.%u: %m", net,
+ ntohs( gate.sat_addr.s_net ), gate.sat_addr.s_node );
+ continue;
+ }
+#endif /* BSD4_4 */
} while ( net++ < ntohs( rtmp->rt_lastnet ));
if ( command == RTMP_ADD ) {
/*
+ * $Id: headers.c,v 1.7 2001-06-19 18:04:40 rufustfirefly Exp $
+ *
* Copyright (c) 1990,1994 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
+#endif /* HAVE_CONFIG_H */
#include <sys/syslog.h>
#include <sys/param.h>
#include <stdio.h>
+#include <netatalk/at.h>
+
#include "file.h"
#include "comment.h"
#include "lp.h"
/*
+ * $Id: magics.c,v 1.7 2001-06-19 18:04:40 rufustfirefly Exp $
+ *
* Copyright (c) 1990,1994 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
+#endif /* HAVE_CONFIG_H */
#include <sys/syslog.h>
#include <sys/param.h>
#include <string.h>
#include <stdlib.h>
+#include <netatalk/at.h>
+
#include "file.h"
#include "comment.h"
#include "lp.h"
+/*
+ * $Id: asp_tickle.c,v 1.4 2001-06-19 18:04:40 rufustfirefly Exp $
+ */
+
#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
+#endif /* HAVE_CONFIG_H */
#include <syslog.h>
-#include <sys/socket.h>
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif /* HAVE_SYS_TYPES_H */
+#include <sys/socket.h>
#include <atalk/atp.h>
#include <atalk/asp.h>