/*
+ * $Id: afp_asp.c,v 1.6 2001-07-31 19:50:14 srittau Exp $
+ *
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
* modified from main.c. this handles afp over asp.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
#ifndef NO_DDP
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <syslog.h>
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
+#endif /* HAVE_SYS_TIME_H */
+#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
+#endif /* HAVE_SYS_STAT_H */
#include <netatalk/endian.h>
#include <atalk/atp.h>
extern struct oforks *writtenfork;
-/* for CAP style authenticated printing */
-#ifdef CAPDIR
-extern int addr_net, addr_node, addr_uid;
-#endif /* CAPDIR */
-
static AFPObj *child;
static __inline__ void afp_asp_close(AFPObj *obj)
struct sigaction action;
int func, ccnt = 0, reply = 0;
-#ifdef CAPDIR
- char addr_filename[256];
- struct stat cap_st;
-#endif /* CAPDIR */
-
obj->exit = afp_asp_die;
obj->reply = (int (*)()) asp_cmdreply;
obj->attention = (int (*)(void *, AFPUserBytes)) asp_attention;
afp_asp_die(1);
}
-#ifdef CAPDIR
- addr_net = ntohs( asp->asp_sat.sat_addr.s_net );
- addr_node = asp->asp_sat.sat_addr.s_node;
-#endif /* CAPDIR */
-
syslog( LOG_INFO, "session from %u.%u:%u on %u.%u:%u",
ntohs( asp->asp_sat.sat_addr.s_net ),
asp->asp_sat.sat_addr.s_node, asp->asp_sat.sat_port,
while ((reply = asp_getrequest(asp))) {
switch (reply) {
case ASPFUNC_CLOSE :
- afp_asp_close(obj);
- syslog( LOG_INFO, "done" );
+ if (obj->options.authprintdir) {
+ char addr_filename[256];
+ struct stat cap_st;
-#ifdef CAPDIR
- sprintf(addr_filename, "%s/net%d.%dnode%d", CAPDIR, addr_net/256, addr_net%256, addr_node);
- if(stat(addr_filename, &cap_st) == 0) {
+ sprintf(addr_filename, "%s/net%d.%dnode%d", obj->options.authprintdir,
+ ntohs( asp->asp_sat.sat_addr.s_net )/256,
+ ntohs( asp->asp_sat.sat_addr.s_net )%256,
+ asp->asp_sat.sat_addr.s_node );
+
+ if(stat(addr_filename, &cap_st) == 0) {
if(unlink(addr_filename) == 0) {
syslog(LOG_INFO, "removed %s", addr_filename);
} else {
syslog(LOG_INFO, "error removing %s: %m", addr_filename);
}
- } else {
+ } else {
syslog(LOG_INFO, "error stat'ing %s: %m", addr_filename);
+ }
}
-#endif /* CAPDIR */
+
+ afp_asp_close(obj);
+ syslog( LOG_INFO, "done" );
if ( obj->options.flags & OPTION_DEBUG ) {
printf( "done\n" );
}
writtenfork = NULL;
}
-#endif AFS
+#endif /* AFS */
func = (u_char) asp->commands[0];
if ( obj->options.flags & OPTION_DEBUG ) {
printf( "command: %d\n", func );
if ( obj->options.flags & OPTION_DEBUG ) {
#ifdef notdef
pdesc( stdout );
-#endif notdef
+#endif /* notdef */
of_pforkdesc( stdout );
fflush( stdout );
}