svn commit: samba r4250 - in trunk/source/modules: .

vlendec at samba.org vlendec at samba.org
Fri Dec 17 09:05:27 GMT 2004


Author: vlendec
Date: 2004-12-17 09:05:27 +0000 (Fri, 17 Dec 2004)
New Revision: 4250

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4250

Log:
AFS does not cope with spaces in file names. Implement a stupid mapping that
maps the space to another character choosable by afsacl:space.

Volker

P.S: Who is "OH"? ;-)

Modified:
   trunk/source/modules/vfs_afsacl.c


Changeset:
Modified: trunk/source/modules/vfs_afsacl.c
===================================================================
--- trunk/source/modules/vfs_afsacl.c	2004-12-17 08:52:36 UTC (rev 4249)
+++ trunk/source/modules/vfs_afsacl.c	2004-12-17 09:05:27 UTC (rev 4250)
@@ -37,6 +37,8 @@
 extern DOM_SID global_sid_Authenticated_Users;
 extern DOM_SID global_sid_NULL;
 
+static char space_replacement = '%';
+
 extern int afs_syscall(int, char *, int, char *, int);
 
 struct afs_ace {
@@ -260,10 +262,12 @@
 	for (aces = nplus+nminus; aces > 0; aces--)
 	{
 
-		const char *name;
+		const char *namep;
+		fstring name;
 		uint32 rights;
+		char *space;
 
-		name = p;
+		namep = p;
 
 		if ((p = strchr(p, '\t')) == NULL)
 			return False;
@@ -277,6 +281,11 @@
 			return False;
 		p += 1;
 
+		fstrcpy(name, namep);
+
+		while ((space = strchr_m(name, space_replacement)) != NULL)
+			*space = ' ';
+
 		add_afs_ace(acl, nplus>0, name, rights);
 
 		nplus -= 1;
@@ -709,6 +718,7 @@
 		fstring dom_name;
 		fstring name;
 		enum SID_NAME_USE name_type;
+		char *p;
 
 		if (ace->type != SEC_ACE_TYPE_ACCESS_ALLOWED) {
 			/* First cut: Only positive ACEs */
@@ -763,6 +773,9 @@
 			}
 		}
 
+		while ((p = strchr_m(name, ' ')) != NULL)
+			*p = space_replacement;
+
 		add_afs_ace(afs_acl, True, name,
 			    nt_to_afs_rights(filename, ace));
 	}
@@ -982,9 +995,26 @@
 	return afs_set_nt_acl(handle, fsp, security_info_sent, psd);
 }
 
+static int afsacl_connect(vfs_handle_struct *handle, 
+			  connection_struct *conn, 
+			  const char *service, 
+			  const char *user)
+{
+	char *spc;
+
+	spc = lp_parm_const_string(SNUM(handle->conn), "afsacl", "space", "%");
+
+	if (spc != NULL)
+		space_replacement = spc[0];
+	
+	return SMB_VFS_NEXT_CONNECT(handle, conn, service, user);
+}
+
 /* VFS operations structure */
 
 static vfs_op_tuple afsacl_ops[] = {	
+	{SMB_VFS_OP(afsacl_connect), SMB_VFS_OP_CONNECT,
+	 SMB_VFS_LAYER_TRANSPARENT},
 	{SMB_VFS_OP(afsacl_fget_nt_acl), SMB_VFS_OP_FGET_NT_ACL,
 	 SMB_VFS_LAYER_TRANSPARENT},
 	{SMB_VFS_OP(afsacl_get_nt_acl), SMB_VFS_OP_GET_NT_ACL,



More information about the samba-cvs mailing list