]> arthur.barton.de Git - netatalk.git/commitdiff
Add support for quoting in '[in]valid users' option
authorRalph Boehme <sloowfranklin@gmail.com>
Thu, 6 Dec 2012 12:06:14 +0000 (13:06 +0100)
committerFrank Lahm <franklahm@googlemail.com>
Thu, 6 Dec 2012 12:55:01 +0000 (13:55 +0100)
As the option should allow spaces in names, but we use comma and
space as field delimiter, add support for quoting names.
Fixes bug #472.

NEWS
libatalk/util/netatalk_conf.c
man/man5/afp.conf.5.tmpl

diff --git a/NEWS b/NEWS
index cb28553ff631848f09443884d7d5504379c75e0d..9ae8ad59b8dce2ef453dc037e9baf264d3d90b75 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,8 @@ Changes in 3.0.2
 * FIX: Fix an error where catalog search gave incomplete results.
        Fixes bug #479.
 * REM: Remove TimeMachine volume used size FCE event.
+* UPD: Add quoting support to '[in]valid users' option.
+       Fixes bug #472.
 
 Changes in 3.0.1
 ================
index 338394e176b0358cc9165dac68e00642b2278c68..01c6cb9740eb11b5baa161466b64a0b4293626e5 100644 (file)
@@ -401,8 +401,11 @@ static char *volxlate(const AFPObj *obj,
 /*!
  * check access list
  *
- * this function wants something of the following form:
- * "@group,name,name2,@group2,name3" or "@group name name2 @group2 name3"
+ * this function wants a string consisting of names seperated by comma
+ * or space. Names may be quoted within a pair of quotes. Groups are
+ * denoted by a leading @ symbol.
+ * Example:
+ * user1 user2, user3, @group1 @group2, @group3 "user name1", "@group name1"
  * A NULL argument allows everybody to have access.
  * We return three things:
  *     -1: no list
@@ -420,7 +423,7 @@ static int accessvol(const AFPObj *obj, const char *args, const char *name)
 
     EC_NULL_LOG( names = strdup(args) );
 
-    if ((p = strtok(names, ", ")) == NULL) /* nothing, return okay */
+    if ((p = strtok_quote(names, ", ")) == NULL) /* nothing, return okay */
         EC_EXIT_STATUS(-1);
 
     while (p) {
@@ -429,7 +432,7 @@ static int accessvol(const AFPObj *obj, const char *args, const char *name)
                 EC_EXIT_STATUS(1);
         } else if (strcasecmp(p, name) == 0) /* it's a user name */
             EC_EXIT_STATUS(1);
-        p = strtok(NULL, ", ");
+        p = strtok_quote(NULL, ", ");
     }
 
 EC_CLEANUP:
index e0ba264978a4e94053cdc729b5627d7b4cc7e9ce..d2bbf43a3a74b6cc12e88cd04c53b124dceb485a 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: afp.conf
 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
 .\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\"      Date: 22 Nov 2012
+.\"      Date: 06 Dez 2012
 .\"    Manual: Netatalk 3.0
 .\"    Source: Netatalk 3.0
 .\"  Language: English
 .\"
-.TH "AFP\&.CONF" "5" "22 Nov 2012" "Netatalk 3.0" "Netatalk 3.0"
+.TH "AFP\&.CONF" "5" "06 Dez 2012" "Netatalk 3.0" "Netatalk 3.0"
 .\" -----------------------------------------------------------------
 .\" * set default formatting
 .\" -----------------------------------------------------------------
@@ -699,7 +699,6 @@ sasl
 .RS 4
 SASL\&. Not yet supported !
 .RE
-.sp
 .RE
 .PP
 ldap auth dn = \fIdn\fR \fB(G)\fR
@@ -775,7 +774,6 @@ ms\-guid
 .RS 4
 Binary objectGUID from Active Directory
 .RE
-.sp
 .RE
 .PP
 ldap group attr = \fIdn\fR \fB(G)\fR
@@ -811,9 +809,19 @@ Useful for Time Machine: limits the reported volume size, thus preventing Time M
 This is an approimated calculation taking into accout the contents of Time Machine sparsebundle images\&. Therefor you MUST NOT use this volume to store other content when using this option, because it would NOT be accounted\&. The calculation works by reading the band size from the Info\&.plist XML file of the sparsebundle, reading the bands/ directory counting the number of band files, and then multiplying one with the other\&.
 .RE
 .PP
-valid users = \fIusers/groups\fR \fB(V)\fR
+valid users = \fIuser @group\fR \fB(V)\fR
 .RS 4
-The allow option allows the users and groups that access a share to be specified\&. Users and groups are specified, delimited by spaces or commas\&. Groups are designated by a @ prefix\&. Example: "valid users = user1 user2 @group"
+The allow option allows the users and groups that access a share to be specified\&. Users and groups are specified, delimited by spaces or commas\&. Groups are designated by a @ prefix\&. Names may be quoted in order to allow for spaces in names\&. Example:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+valid users = user "user 2" @group \(lq@group 2"
+.fi
+.if n \{\
+.RE
+.\}
 .RE
 .PP
 invalid users = \fIusers/groups\fR \fB(V)\fR
@@ -914,7 +922,6 @@ is for files only,
 is for directories only\&. Don\'t use with "\fBunix priv = no\fR"\&.
 .PP
 \fBExample.\ \&Volume for a collaborative workgroup\fR
-
 .sp
 .if n \{\
 .RS 4
@@ -926,7 +933,6 @@ file perm = 0660 directory perm =
 .if n \{\
 .RE
 .\}
-.sp
 
 .RE
 .PP
@@ -1111,7 +1117,7 @@ The
 option will allow you to select another volume encoding\&. E\&.g\&. for western users another useful setting could be vol charset ISO\-8859\-15\&.
 \fBafpd\fR
 will accept any
-\fB iconv \fR(1)
+\fBiconv\fR(1)
 provided charset\&. If a character cannot be converted from the
 \fBmac charset\fR
 to the selected