]> arthur.barton.de Git - netatalk.git/commitdiff
acltoownermode: check if UUID support is on
authorfranklahm <franklahm>
Mon, 8 Mar 2010 19:49:59 +0000 (19:49 +0000)
committerfranklahm <franklahm>
Mon, 8 Mar 2010 19:49:59 +0000 (19:49 +0000)
etc/afpd/acls.c
etc/afpd/afp_dsi.c
etc/afpd/globals.h

index f5d3eaab1bebf841d01caefef0ef823b29ea4513..fd6f3ab4cea3f1114a9061668f4636dccad255df 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  $Id: acls.c,v 1.8 2010-02-10 14:05:37 franklahm Exp $
+  $Id: acls.c,v 1.9 2010-03-08 19:49:59 franklahm Exp $
   Copyright (c) 2008,2009 Frank Lahm <franklahm@gmail.com>
 
   This program is free software; you can redistribute it and/or modify
@@ -961,6 +961,11 @@ void acltoownermode(char *path, struct stat *st, uid_t uid, struct maccess *ma)
     uuid_t uuid;
     int dir, r_ok, w_ok, x_ok;
 
+    if ( ! (AFPobj->options.flags & OPTION_UUID))
+        return;
+
+    LOG(log_maxdebug, logtype_afpd, "acltoownermode('%s')", path);
+
     if ((pw = getpwuid(uid)) == NULL) {
         LOG(log_error, logtype_afpd, "acltoownermode: %s", strerror(errno));
         return;
index a58e6c874bf96722989ac449490ff7d504cd163f..7edb2e98740e650438f0132ba2e05c140940a6de 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_dsi.c,v 1.51 2010-02-16 02:37:38 didg Exp $
+ * $Id: afp_dsi.c,v 1.52 2010-03-08 19:49:59 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;
@@ -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;
index a88adab9d99a379135ff51f72a0d58822ed6c411..f5be0bc358004c1369f4dc728238c4439071ce4e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: globals.h,v 1.31 2010-01-18 12:55:28 franklahm Exp $
+ * $Id: globals.h,v 1.32 2010-03-08 19:49:59 franklahm Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -112,6 +112,9 @@ typedef struct _AFPObj {
 /* typedef for AFP functions handlers */
 typedef int (*AFPCmd)(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
 
+/* afp_dsi.c */
+extern AFPObj *AFPobj;
+
 extern int             afp_version;
 extern int             afp_errno;
 extern unsigned char   nologin;