]> arthur.barton.de Git - netatalk.git/commitdiff
Merge remote-tracking branch 'origin/branch-netatalk-3-0' into develop
authorRalph Boehme <sloowfranklin@gmail.com>
Mon, 14 Oct 2013 08:49:05 +0000 (10:49 +0200)
committerRalph Boehme <sloowfranklin@gmail.com>
Mon, 14 Oct 2013 08:49:05 +0000 (10:49 +0200)
1  2 
NEWS
doc/manpages/man5/afp.conf.5.xml
etc/afpd/afp_dsi.c
etc/afpd/auth.c
etc/uams/uams_dhx2_pam.c
include/atalk/globals.h
libatalk/util/netatalk_conf.c
man/man5/afp.conf.5.in

diff --combined NEWS
index 9fe7aef13eb8258ddd227bedbfcda515fb94f499,cbf24f7f5fdd34a275d49f39121329fd2b4fbd60..7b9fc6b682326abed1993bca7bd5d326a53c0285
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -1,14 -1,3 +1,14 @@@
 +Changes in 3.1.0
 +================
 +* NEW: AFP Spotlight support with Gnome Tracker
 +* NEW: New option "spotlight" (G/V)
 +* NEW: Configure option --with-tracker-pkgconfig-version
 +* NEW: Configure option --with-tracker-prefix
 +* NEW: If Spotlight is enabled, launch our own dbus instance
 +* NEW: New option "dbus daemon" (G)
 +* UPD: Add configure option --with-afpstats for overriding the
 +       result of autodetecting dbus-glib presence
 +
  Changes in 3.0.6
  ================
  * FIX: charset conversion failed when copying from Mac OS 9. Bug #523.
  * NEW: Add support for ZFS ACLs on FreeBSD with libsunacl. From FR#83.
  * FIX: Active Directory LDAP queries for ACL support with new options
         "ldap user filter" and "ldap group filter". Bug #526.
+ * NEW: Option "vol dbnest", when set to true, the CNID database for
+        a volume is stored in the volume root of a share in a directory
+        .AppleDB like in Netatalk 2. Defaults to false. From FR#84.
+ * FIX: Small fix in the DSI tickle handling. Bug #528.
+ * UPD: Enhance handling of connection attempts when hitting the
+        connection limit. Bug #529.
+ * FIX: Saving from Word to a folder that is a symlink to a folder on
+        another filesystem results in a crash of the afpd process and
+        the save to fail. This happens only if the option
+        "follow symlinks" is enabled. Bug #532.
+ * FIX: Disable Kerberos UAM if AFP service principal name can't be
+        evaluated. Fixes bug #531.
  
  Changes in 3.0.5
  ================
index 4b1b14d6fab43cd9b191b1fd3caebc233809664f,026fef0fef30658df7711e00a812a1a24283eebd..150459cd50a5fe66df7addd3cd485a3bc5d5cbb1
  
            <listitem>
              <para>Speficy a set of file and directory attributes that shall
 -            be ignored by the server, <attribute>all</attribute> includes all
 +            be ignored by the server, <option>all</option> includes all
              the other options.</para>
              <para>In OS X when the Finder sets a lock on a file/directory or you
              set the BSD uchg flag in the Terminal, all three attributes are
            </listitem>
          </varlistentry>
  
 +        <varlistentry>
 +          <term>spotlight =
 +          <replaceable>BOOLEAN</replaceable> (default:
 +          <emphasis>no</emphasis>) <type>(G)/(V)</type></term>
 +
 +          <listitem>
 +            <para>Whether to enable Spotlight searches. Note: once the global
 +            option is enabled, any volume that is not enabled won't be
 +            searchable at all.</para>
 +          </listitem>
 +        </varlistentry>
 +
          <varlistentry>
            <term>veto message = <replaceable>BOOLEAN</replaceable> (default:
            <emphasis>no</emphasis>) <type>(G)</type></term>
            </listitem>
          </varlistentry>
  
+         <varlistentry>
+           <term>vol dbnest = <replaceable>BOOLEAN</replaceable> (default:
+           <emphasis>no</emphasis>) <type>(G)</type></term>
+           <listitem>
+             <para>Setting this option to true brings back Netatalk 2
+             behaviour of storing the CNID database in a folder called
+             .AppleDB inside the volume root of each share.</para>
+           </listitem>
+         </varlistentry>
          <varlistentry>
            <term>volnamelen = <replaceable>number</replaceable>
            <type>(G)</type></term>
        mode. You can adjust this behaviour with the configuration option
        <option>mac acls</option>:</para>
  
 -      <variablelist id="mac_acls">
 +      <variablelist id="map_acls">
          <varlistentry>
            <term>map acls = <parameter>none|rights|mode</parameter>
            <type>(G)</type></term>
              Setting the option to true causes afpd to follow symlinks on the
              server. symlinks may point outside of the AFP volume, currently
              afpd doesn't do any checks for "wide symlinks".</para>
+             <note>
+               <para>This option will subtly break when the symlinks point
+               across filesystem boundaries.</para>
+             </note>
            </listitem>
          </varlistentry>
  
diff --combined etc/afpd/afp_dsi.c
index 63d2f286499db68372e57bfa1e285e7fa9273b06,e68b63a47e9386162c881ba8b8071b16bedec9db..b64d49140f402fc1ddb0f1f0205263563e9808d1
@@@ -39,7 -39,6 +39,7 @@@
  #include <atalk/fce_api.h>
  #include <atalk/globals.h>
  #include <atalk/netatalk_conf.h>
 +#include <atalk/spotlight.h>
  
  #include "switch.h"
  #include "auth.h"
@@@ -322,9 -321,10 +322,10 @@@ static void alarm_handler(int sig _U_
          return;
      }
  
-     if ((err = pollvoltime(AFPobj)) == 0)
+     if ((err = pollvoltime(AFPobj)) == 0) {
          LOG(log_debug, logtype_afpd, "afp_alarm: sending DSI tickle");
          err = dsi_tickle(AFPobj->dsi);
+     }
      if (err <= 0) {
          if (geteuid() == 0) {
              LOG(log_note, logtype_afpd, "afp_alarm: unauthenticated user, connection problem");
@@@ -474,10 -474,6 +475,10 @@@ void afp_over_dsi(AFPObj *obj
      int flag = 1;
      setsockopt(dsi->socket, SOL_TCP, TCP_NODELAY, &flag, sizeof(flag));
  
 +    /* Initialize Spotlight */
 +    if ((obj->options.flags & OPTION_SPOTLIGHT) && (obj->options.slmod_path))
 +        sl_mod_load(obj->options.slmod_path);
 +
      ipc_child_state(obj, DSI_RUNNING);
  
      /* get stuck here until the end */
diff --combined etc/afpd/auth.c
index dcb36a2ce4701f260273cafeab5a859fd9ab664a,27e678c23b65097371046530bde03174c78c4e29..f04404edd2f469af47152fccf96db6ccae7d23e8
@@@ -39,7 -39,6 +39,7 @@@ extern void afp_get_cmdline( int *ac, c
  #include <atalk/server_ipc.h>
  #include <atalk/uuid.h>
  #include <atalk/globals.h>
 +#include <atalk/spotlight.h>
  #include <atalk/unix.h>
  
  #include "auth.h"
@@@ -185,7 -184,7 +185,7 @@@ static int set_auth_switch(const AFPOb
          case 31:
              uam_afpserver_action(AFP_SYNCDIR, UAM_AFPSERVER_POSTAUTH, afp_syncdir, NULL);
              uam_afpserver_action(AFP_SYNCFORK, UAM_AFPSERVER_POSTAUTH, afp_syncfork, NULL);
 -            uam_afpserver_action(AFP_SPOTLIGHT_PRIVATE, UAM_AFPSERVER_POSTAUTH, afp_null_nolog, NULL);
 +            uam_afpserver_action(AFP_SPOTLIGHT_PRIVATE, UAM_AFPSERVER_POSTAUTH, afp_spotlight_rpc, NULL);
              uam_afpserver_action(AFP_ENUMERATE_EXT2, UAM_AFPSERVER_POSTAUTH, afp_enumerate_ext2, NULL);
  
          case 30:
@@@ -223,6 -222,11 +223,11 @@@ static int login(AFPObj *obj, struct pa
          return AFPERR_NOTAUTH;
      }
  
+     if (obj->cnx_cnt > obj->cnx_max) {
+         LOG(log_error, logtype_dsi, "login: too many connections, limit: %d", obj->cnx_max);
+         return AFPERR_MAXSESS;
+     }
      LOG(log_note, logtype_afpd, "%s Login by %s",
          afp_versions[afp_version_index].av_name, pwd->pw_name);
  
@@@ -1013,7 -1017,7 +1018,7 @@@ int auth_register(const int type, struc
  }
  
  /* load all of the modules */
- int auth_load(const char *path, const char *list)
+ int auth_load(AFPObj *obj, const char *path, const char *list)
  {
      char name[MAXPATHLEN + 1], buf[MAXPATHLEN + 1], *p;
      struct uam_mod *mod;
            if ((stat(name, &st) == 0) && (mod = uam_load(name, p))) {
          */
          if (stat(name, &st) == 0) {
-             if ((mod = uam_load(name, p))) {
+             if ((mod = uam_load(obj, name, p))) {
                  uam_attach(&uam_modules, mod);
                  LOG(log_debug, logtype_afpd, "uam: %s loaded", p);
              } else {
diff --combined etc/uams/uams_dhx2_pam.c
index 5229d372433603b810ece221f427e92ed71079ee,8857759d2f41b12c1e345b5d060d0db16515655e..8e79b450d4c802e9e6e516c598c2ced645270476
@@@ -923,7 -923,7 +923,7 @@@ static int dhx2_changepw(void *obj _U_
      return ret;
  }
  
- static int uam_setup(const char *path)
+ static int uam_setup(void *obj, const char *path)
  {
      if (uam_register(UAM_SERVER_LOGIN_EXT, path, "DHX2", pam_login,
                       pam_logincont, pam_logout, pam_login_ext) < 0)
@@@ -952,6 -952,7 +952,6 @@@ static void uam_cleanup(void
      gcry_mpi_release(g);
  }
  
 -
  UAM_MODULE_EXPORT struct uam_export uams_dhx2 = {
      UAM_MODULE_SERVER,
      UAM_MODULE_VERSION,
diff --combined include/atalk/globals.h
index 11a35867b5c160eb1d8cab5f8eba601b597c85e6,9095e2e309b39dca6afa0a1fc23b9e8d6ec35edd..b876280860ce015a4f8b703a7269816f61cd6201
@@@ -57,8 -57,6 +57,8 @@@
  #define OPTION_ACL2MODE      (1 << 10)
  #define OPTION_SHARE_RESERV  (1 << 11) /* whether to use Solaris fcntl F_SHARE locks */
  #define OPTION_DBUS_AFPSTATS (1 << 12) /* whether to run dbus thread for afpstats */
 +#define OPTION_SPOTLIGHT     (1 << 13) /* whether to initialize Spotlight support */
 +#define OPTION_SPOTLIGHT_VOL (1 << 14) /* whether spotlight shall be enabled by default for volumes */
  
  #define PASSWD_NONE     0
  #define PASSWD_SET     (1 << 0)
@@@ -107,6 -105,8 +107,8 @@@ struct afp_options 
      char *signatureopt;
      unsigned char signature[16];
      char *k5service, *k5realm, *k5keytab;
+     size_t k5principal_buflen;
+     char *k5principal;
      char *unixcodepage, *maccodepage, *volcodepage;
      charset_t maccharset, unixcharset; 
      mode_t umask;
      char *mimicmodel;
      char *adminauthuser;
      char *ignored_attr;
 +    char *slmod_path;
      struct afp_volume_name volfile;
  };
  
@@@ -141,6 -140,7 +143,7 @@@ typedef struct AFPObj 
      gid_t *groups;
      int ngroups;
      int afp_version;
+     int cnx_cnt, cnx_max;
      /* Functions */
      void (*logout)(void);
      void (*exit)(int);
index d6fb4a17c03a8a681e3644a558bc8b687cd18dac,9ed1c776d845097939cfd3fd689d41d534a00679..5ad325693c1ccd46668cee3c560318fb21696920
@@@ -667,11 -667,16 +667,16 @@@ static struct vol *creatvol(AFPObj *obj
      for(i = 0; i < vlen; i++)
          if(tmpname[i] == '/') tmpname[i] = ':';
  
-     bstring dbpath;
-     EC_NULL( val = atalk_iniparser_getstring(obj->iniconfig, INISEC_GLOBAL, "vol dbpath", _PATH_STATEDIR "CNID/") );
-     EC_NULL( dbpath = bformat("%s/%s/", val, tmpname) );
-     EC_NULL( volume->v_dbpath = strdup(cfrombstr(dbpath)) );
-     bdestroy(dbpath);
+     if (!atalk_iniparser_getboolean(obj->iniconfig, INISEC_GLOBAL, "vol dbnest", 0)) {
+         bstring dbpath;
+         EC_NULL( val = atalk_iniparser_getstring(obj->iniconfig, INISEC_GLOBAL, "vol dbpath", _PATH_STATEDIR "CNID/") );
+         EC_NULL( dbpath = bformat("%s/%s/", val, tmpname) );
+         EC_NULL( volume->v_dbpath = strdup(cfrombstr(dbpath)) );
+         bdestroy(dbpath);
+     } else {
+         EC_NULL( volume->v_dbpath = strdup(path) );
+     }
  
      if ((val = getoption(obj->iniconfig, section, "cnid scheme", preset, NULL)))
          EC_NULL( volume->v_cnidscheme = strdup(val) );
          volume->v_flags |= AFPVOL_NOV2TOEACONV;
      if (getoption_bool(obj->iniconfig, section, "follow symlinks", preset, 0))
          volume->v_flags |= AFPVOL_FOLLOWSYM;
 +    if (getoption_bool(obj->iniconfig, section, "spotlight", preset, obj->options.flags & OPTION_SPOTLIGHT_VOL)) {
 +        volume->v_flags |= AFPVOL_SPOTLIGHT;
 +        obj->options.flags |= OPTION_SPOTLIGHT;
 +    }
      if (getoption_bool(obj->iniconfig, section, "delete veto files", preset, 0))
          volume->v_flags |= AFPVOL_DELVETO;
  
      initvol_vfs(volume);
  
      /* get/store uuid from file in afpd master*/
 -    if (!(pwd) && (volume->v_flags & AFPVOL_TM)) {
 -        char *uuid = get_vol_uuid(obj, volume->v_localname);
 -        if (!uuid) {
 -            LOG(log_error, logtype_afpd, "Volume '%s': couldn't get UUID",
 -                volume->v_localname);
 -        } else {
 -            volume->v_uuid = uuid;
 -            LOG(log_debug, logtype_afpd, "Volume '%s': UUID '%s'",
 -                volume->v_localname, volume->v_uuid);
 -        }
 +    become_root();
 +    char *uuid = get_vol_uuid(obj, volume->v_localname);
 +    unbecome_root();
 +    if (!uuid) {
 +        LOG(log_error, logtype_afpd, "Volume '%s': couldn't get UUID",
 +            volume->v_localname);
 +    } else {
 +        volume->v_uuid = uuid;
 +        LOG(log_debug, logtype_afpd, "Volume '%s': UUID '%s'",
 +            volume->v_localname, volume->v_uuid);
      }
  
      /* no errors shall happen beyond this point because the cleanup would mess the volume chain up */
@@@ -1733,9 -1734,6 +1738,9 @@@ int afp_config_parse(AFPObj *AFPObj, ch
      options->configfile  = AFPObj->cmdlineconfigfile ? strdup(AFPObj->cmdlineconfigfile) : strdup(_PATH_CONFDIR "afp.conf");
      options->sigconffile = strdup(_PATH_STATEDIR "afp_signature.conf");
      options->uuidconf    = strdup(_PATH_STATEDIR "afp_voluuid.conf");
 +#ifdef HAVE_TRACKER_SPARQL
 +    options->slmod_path  = strdup(_PATH_AFPDUAMPATH "slmod_sparql.so");
 +#endif
      options->flags       = OPTION_UUID | AFPObj->cmdlineflags;
      
      if ((config = atalk_iniparser_load(AFPObj->options.configfile)) == NULL)
          options->flags |= OPTION_DBUS_AFPSTATS;
      if (atalk_iniparser_getboolean(config, INISEC_GLOBAL, "afp read locks", 0))
          options->flags |= OPTION_AFP_READ_LOCK;
 +    if (atalk_iniparser_getboolean(config, INISEC_GLOBAL, "spotlight", 0))
 +        options->flags |= OPTION_SPOTLIGHT_VOL;
      if (atalk_iniparser_getboolean(config, INISEC_GLOBAL, "veto message", 0))
          options->flags |= OPTION_VETOMSG;
      if (!atalk_iniparser_getboolean(config, INISEC_GLOBAL, "save password", 1))
@@@ -1987,6 -1983,8 +1992,8 @@@ void afp_config_free(AFPObj *obj
          CONFIG_ARG_FREE(obj->options.k5service);
      if (obj->options.k5realm)
          CONFIG_ARG_FREE(obj->options.k5realm);
+     if (obj->options.k5principal)
+         CONFIG_ARG_FREE(obj->options.k5principal);
      if (obj->options.listen)
          CONFIG_ARG_FREE(obj->options.listen);
      if (obj->options.interfaces)
          CONFIG_ARG_FREE(obj->options.fqdn);
      if (obj->options.ignored_attr)
          CONFIG_ARG_FREE(obj->options.ignored_attr);
 +    if (obj->options.slmod_path)
 +        CONFIG_ARG_FREE(obj->options.slmod_path);
  
      if (obj->options.unixcodepage)
          CONFIG_ARG_FREE(obj->options.unixcodepage);
diff --combined man/man5/afp.conf.5.in
index 2cac69d423e9eb0ecc96d254e5ad015c5f26f4fa,462670d64d2632b0d64de3d383ecee592c1c605e..74d7a609a0c13f28708c4d7581e2acedd7550c93
@@@ -571,7 -571,7 +571,7 @@@ and should be quoted\&. Extended charac
  ignored attributes = \fIall | nowrite | nodelete | norename\fR \fB(G)/(V)\fR
  .RS 4
  Speficy a set of file and directory attributes that shall be ignored by the server,
 -<attribute>all</attribute>
 +\fBall\fR
  includes all the other options\&.
  .sp
  In OS X when the Finder sets a lock on a file/directory or you set the BSD uchg flag in the Terminal, all three attributes are used\&. Thus in order to ignore the Finder lock/BSD uchg flag, add set
@@@ -595,11 -595,6 +595,11 @@@ solaris share reservations = \fIBOOLEAN
  Use share reservations on Solaris\&. Solaris CIFS server uses this too, so this makes a lock coherent multi protocol server\&.
  .RE
  .PP
 +spotlight = \fIBOOLEAN\fR (default: \fIno\fR) \fB(G)/(V)\fR
 +.RS 4
 +Whether to enable Spotlight searches\&. Note: once the global option is enabled, any volume that is not enabled won\*(Aqt be searchable at all\&.
 +.RE
 +.PP
  veto message = \fIBOOLEAN\fR (default: \fIno\fR) \fB(G)\fR
  .RS 4
  Send optional AFP messages for vetoed files\&. Then whenever a client tries to access any file or directory with a vetoed name, it will be sent an AFP message indicating the name and the directory\&.
@@@ -611,6 -606,11 +611,11 @@@ Sets the database information to be sto
  @localstatedir@/netatalk/CNID/\&.
  .RE
  .PP
+ vol dbnest = \fIBOOLEAN\fR (default: \fIno\fR) \fB(G)\fR
+ .RS 4
+ Setting this option to true brings back Netatalk 2 behaviour of storing the CNID database in a folder called \&.AppleDB inside the volume root of each share\&.
+ .RE
+ .PP
  volnamelen = \fInumber\fR \fB(G)\fR
  .RS 4
  Max length of UTF8\-MAC volume name for Mac OS X\&. Note that Hangul is especially sensitive to this\&.
@@@ -1097,6 -1097,21 +1102,21 @@@ If this option is set to yes, then Neta
  follow symlinks = \fIBOOLEAN\fR (default: \fIno\fR) \fB(V)\fR
  .RS 4
  The default setting is false thus symlinks are not followed on the server\&. This is the same behaviour as OS X\*(Aqs AFP server\&. Setting the option to true causes afpd to follow symlinks on the server\&. symlinks may point outside of the AFP volume, currently afpd doesn\*(Aqt do any checks for "wide symlinks"\&.
+ .if n \{\
+ .sp
+ .\}
+ .RS 4
+ .it 1 an-trap
+ .nr an-no-space-flag 1
+ .nr an-break-flag 1
+ .br
+ .ps +1
+ \fBNote\fR
+ .ps -1
+ .br
+ This option will subtly break when the symlinks point across filesystem boundaries\&.
+ .sp .5v
+ .RE
  .RE
  .PP
  invisible dots = \fIBOOLEAN\fR (default: \fIno\fR) \fB(V)\fR