Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
truenas-rk3588
truenas
Commits
c568ed50
Commit
c568ed50
authored
10 years ago
by
John Hixson
Browse files
Options
Download
Email Patches
Plain Diff
Don't map groups that have the same name as a username
parent
29c5c9cf
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
nanobsd/Files/etc/ix.rc.d/ix-passwd
+12
-2
nanobsd/Files/etc/ix.rc.d/ix-passwd
nanobsd/Files/usr/local/libexec/nas/generate_smb4_conf.py
+14
-1
nanobsd/Files/usr/local/libexec/nas/generate_smb4_conf.py
with
26 additions
and
3 deletions
+26
-3
nanobsd/Files/etc/ix.rc.d/ix-passwd
View file @
c568ed50
...
...
@@ -59,13 +59,23 @@ group_membership()
samba_groupmap
()
{
local
group
=
"
${
1
}
"
local
net
=
"/usr/local/bin/net"
net groupmap list
ntgroup
=
"
${
group
}
"
>
/dev/null 2>&1
#
# Don't map groups with a name the same as the username,
# it really pisses windows off.
#
/usr/bin/getent passwd
"
${
group
}
"
>
/dev/null 2>&1
if
[
"
$?
"
=
"0"
]
;
then
return
fi
/usr/local/bin/net groupmap add
type
=
"local"
\
${
net
}
groupmap list
ntgroup
=
"
${
group
}
"
>
/dev/null 2>&1
if
[
"
$?
"
=
"0"
]
;
then
return
fi
${
net
}
groupmap add
type
=
"local"
\
unixgroup
=
"
${
group
}
"
ntgroup
=
"
${
group
}
"
>
/dev/null 2>&1
}
...
...
This diff is collapsed.
Click to expand it.
nanobsd/Files/usr/local/libexec/nas/generate_smb4_conf.py
View file @
c568ed50
...
...
@@ -771,13 +771,26 @@ def smb4_group_mapped(groupmap, group):
return
False
# Windows no likey
def
smb4_groupname_is_username
(
group
):
cmd
=
"/usr/bin/getent passwd '%s'"
%
group
p
=
pipeopen
(
cmd
)
p
.
communicate
()
if
p
.
returncode
==
0
:
return
True
return
False
def
smb4_map_groups
():
cmd
=
"/usr/local/bin/net groupmap add type=local unixgroup='%s' ntgroup='%s'"
groupmap
=
smb4_get_groupmap
()
groups
=
get_groups
()
for
g
in
groups
:
if
not
smb4_group_mapped
(
groupmap
,
g
):
if
not
smb4_group_mapped
(
groupmap
,
g
)
and
\
not
smb4_groupname_is_username
(
g
):
pipeopen
(
cmd
%
(
g
,
g
)).
communicate
()
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help