From 4cf7d3a218c6693c9c4c7fcfdb403fe6c532b237 Mon Sep 17 00:00:00 2001 From: marc Date: Wed, 31 Mar 1999 22:51:00 +0000 Subject: [PATCH] netatalk update from ianm@cit.nepean.uws.edu.au; Ian says: This update implements changes to afpd (appletalk filing protocol daemon) so that it handles users groups correctly for acess and handles the effictive user and group of the parent process correctly under OpenBSD 2.5-beta. Previous fix didn't work quite as expected. --- net/netatalk/Makefile | 11 +++- net/netatalk/patches/patch-ai | 70 ----------------------- net/netatalk/patches/patch-ak | 102 ++++++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+), 73 deletions(-) create mode 100644 net/netatalk/patches/patch-ak diff --git a/net/netatalk/Makefile b/net/netatalk/Makefile index 511924b112d..ed90ed17338 100644 --- a/net/netatalk/Makefile +++ b/net/netatalk/Makefile @@ -3,7 +3,7 @@ # Version required: 1.4b2 # Date created: 8th January 1999 # -# $OpenBSD: Makefile,v 1.1.1.1 1999/01/19 04:40:13 marc Exp $ +# $OpenBSD: Makefile,v 1.2 1999/03/31 22:51:00 marc Exp $ DISTNAME= netatalk-1.4b2 CATEGORIES= net print @@ -32,8 +32,13 @@ pre-configure: @rm -f ${WRKSRC}/sys/netatalk/*.h post-install: - @cp ${WRKSRC}/config/AppleVolumes.system /etc/netatalk - @cp ${WRKSRC}/config/AppleVolumes.default /etc/netatalk + +@if [ ! -a X"/etc/netatalk/AppleVolumes.system" ]; then \ + @cp ${WRKSRC}/config/AppleVolumes.system /etc/netatalk; \ +fi +@if [ ! -a X"/etc/netatalk/Applevolumes.default" ]; then \ + @cp ${WRKSRC}/config/AppleVolumes.default /etc/netatalk;\ +fi @chmod 750 /etc/netatalk .include diff --git a/net/netatalk/patches/patch-ai b/net/netatalk/patches/patch-ai index 992566d6071..557ce7eb12c 100644 --- a/net/netatalk/patches/patch-ai +++ b/net/netatalk/patches/patch-ai @@ -202,76 +202,6 @@ 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 - #include - #include -+#include - #include - #include - #include -@@ -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 @@ diff --git a/net/netatalk/patches/patch-ak b/net/netatalk/patches/patch-ak new file mode 100644 index 00000000000..4765a8e08c0 --- /dev/null +++ b/net/netatalk/patches/patch-ak @@ -0,0 +1,102 @@ +--- etc/afpd/main.c.orig Tue Oct 22 08:44:48 1996 ++++ etc/afpd/main.c Mon Mar 29 17:05:56 1999 +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -53,6 +54,8 @@ + char *Obj, *Type = "AFPServer", *Zone = "*"; + char *version = VERSION; + ASP child; ++static int initial_uid; ++static int initial_gid; + + extern struct oforks *writtenfork; + +@@ -148,6 +151,10 @@ + extern int optind; + + umask( 0 ); /* so inherited file permissions work right */ ++ ++ initial_uid = geteuid(); ++ initial_gid = getegid(); ++ + if ( gethostname( hostname, sizeof( hostname )) < 0 ) { + perror( "gethostname" ); + exit( 1 ); +@@ -265,22 +272,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" ); +@@ -360,7 +369,10 @@ + exit( 1 ); + } + +- syslog( LOG_INFO, "session from %u.%u:%u on %u.%u:%u", ++ setuid(initial_uid); /* become our origional uid && gid again */ ++ setgid(initial_uid); ++ ++ syslog( LOG_INFO, "session from %u.%u:%u on %u.%u:%u", + ntohs( child->asp_sat.sat_addr.s_net ), + child->asp_sat.sat_addr.s_node, child->asp_sat.sat_port, + ntohs( atp_sockaddr( child->asp_atp )->sat_addr.s_net ), +@@ -526,28 +538,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