From ed0131feddefa322f6b0a1f82cc7ce0ba3b1b948 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 17 Dec 2004 09:05:41 +0000 Subject: r4251: 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"? ;-) (This used to be commit e717ff70c6ce15bad7a792a592b42ecd057acc01) --- source3/modules/vfs_afsacl.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'source3/modules') diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c index f4b254a109..bb82801a00 100644 --- a/source3/modules/vfs_afsacl.c +++ b/source3/modules/vfs_afsacl.c @@ -37,6 +37,8 @@ extern DOM_SID global_sid_Builtin_Backup_Operators; 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 @@ static BOOL parse_afs_acl(struct afs_acl *acl, const char *acl_str) 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 @@ static BOOL parse_afs_acl(struct afs_acl *acl, const char *acl_str) 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 @@ static BOOL nt_to_afs_acl(const char *filename, 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 @@ static BOOL nt_to_afs_acl(const char *filename, } } + 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 @@ BOOL afsacl_set_nt_acl(vfs_handle_struct *handle, 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, -- cgit