]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/afp_asp.c
Warning fixes.
[netatalk.git] / etc / afpd / afp_asp.c
index 73f46e8a42460d37d971c531c853e5448250c0e5..89641691cfaf181778e2358f70834f0f8d925eb8 100644 (file)
@@ -1,4 +1,6 @@
 /* 
+ * $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.
@@ -6,6 +8,10 @@
  * 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>
@@ -127,8 +137,29 @@ void afp_over_asp(AFPObj *obj)
     while ((reply = asp_getrequest(asp))) {
       switch (reply) {
       case ASPFUNC_CLOSE :
+       if (obj->options.authprintdir) {
+         char addr_filename[256];
+         struct stat cap_st;
+
+         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 {
+               syslog(LOG_INFO, "error stat'ing %s: %m", addr_filename);
+         }
+       }
+
        afp_asp_close(obj);
        syslog( LOG_INFO, "done" );
+
        if ( obj->options.flags & OPTION_DEBUG ) {
          printf( "done\n" );
        }
@@ -143,7 +174,7 @@ void afp_over_asp(AFPObj *obj)
          }
          writtenfork = NULL;
        }
-#endif AFS
+#endif /* AFS */
        func = (u_char) asp->commands[0];
        if ( obj->options.flags & OPTION_DEBUG ) {
          printf( "command: %d\n", func );
@@ -213,7 +244,7 @@ void afp_over_asp(AFPObj *obj)
       if ( obj->options.flags & OPTION_DEBUG ) {
 #ifdef notdef
        pdesc( stdout );
-#endif notdef
+#endif /* notdef */
        of_pforkdesc( stdout );
        fflush( stdout );
       }