]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/afp_dsi.c
Allow opening symlinks r/w, but don't actually allow writing. Fixes test426
[netatalk.git] / etc / afpd / afp_dsi.c
index d0eec32ec55475bd10c02188bfe1f37236c77ab2..a3d40ded6ec3d8969d21d9706df1b9b29d0a6c09 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_dsi.c,v 1.50 2010-02-08 13:39:56 franklahm Exp $
+ * $Id: afp_dsi.c,v 1.53 2010-03-30 12:55:26 franklahm Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
 #define CHILD_SLEEPING    (1 << 2)
 #define CHILD_DATA        (1 << 3)
 
+/* 
+ * We generally pass this from afp_over_dsi to all afp_* funcs, so it should already be
+ * available everywhere. Unfortunately some funcs (eg acltoownermode) need acces to it
+ * but are deeply nested in the function chain with the caller already without acces to it.
+ * Changing this would require adding a reference to the caller which itself might be
+ * called in many places (eg acltoownermode is called from accessmode).
+ * The only sane way out is providing a copy of it here:
+ */
+AFPObj *AFPobj = NULL;
+
 static struct {
     AFPObj *obj;
     unsigned char flags;
@@ -173,7 +183,7 @@ static void afp_dsi_reload(int sig _U_)
 /* ---------------------------------
  * SIGINT: enable max_debug LOGging
  */
-volatile static sig_atomic_t debug_request = 0;
+static volatile sig_atomic_t debug_request = 0;
 
 static void afp_dsi_debug(int sig _U_)
 {
@@ -260,6 +270,7 @@ void afp_over_dsi(AFPObj *obj)
     u_int8_t function;
     struct sigaction action;
 
+    AFPobj = obj;
     obj->exit = afp_dsi_die;
     obj->reply = (int (*)()) dsi_cmdreply;
     obj->attention = (int (*)(void *, AFPUserBytes)) dsi_attention;
@@ -460,9 +471,16 @@ void afp_over_dsi(AFPObj *obj)
             if ( afp_switch[ function ] != NULL ) {
                 dsi->datalen = DSI_DATASIZ;
                 child.flags |= CHILD_RUNNING;
+
+                LOG(log_debug, logtype_afpd, "<== Start AFP command: %s", AfpNum2name(function));
+
                 err = (*afp_switch[function])(obj,
                                               (char *)&dsi->commands, dsi->cmdlen,
                                               (char *)&dsi->data, &dsi->datalen);
+
+                LOG(log_debug, logtype_afpd, "==> Finished AFP command: %s -> %s",
+                    AfpNum2name(function), AfpErr2name(err));
+
                 child.flags &= ~CHILD_RUNNING;
 #ifdef FORCE_UIDGID
                /* bring everything back to old euid, egid */