summary refs log tree commit diff
path: root/pkgs/os-specific/linux/shadow
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2018-04-07 15:14:47 +0200
committeraszlig <aszlig@nix.build>2018-04-08 12:51:33 +0200
commit99ba1cb4245694874d63e84994f32d58d726ed21 (patch)
treeeb333efc5a8f298f72971ec39df427bc9482826b /pkgs/os-specific/linux/shadow
parent857bf71655823b1e5140e11d1046afa89eca1634 (diff)
downloadnixpkgs-99ba1cb4245694874d63e84994f32d58d726ed21.tar
nixpkgs-99ba1cb4245694874d63e84994f32d58d726ed21.tar.gz
nixpkgs-99ba1cb4245694874d63e84994f32d58d726ed21.tar.bz2
nixpkgs-99ba1cb4245694874d63e84994f32d58d726ed21.tar.lz
nixpkgs-99ba1cb4245694874d63e84994f32d58d726ed21.tar.xz
nixpkgs-99ba1cb4245694874d63e84994f32d58d726ed21.tar.zst
nixpkgs-99ba1cb4245694874d63e84994f32d58d726ed21.zip
Increase max group name length to 32 characters
With #36556, a check was introduced to make sure the user and group
names do not exceed their respective maximum length. This is in part
because systemd also enforces that length, but only at runtime.

So in general it's a good idea to catch as much as we can during
evaluation time, however the maximum length of the group name was set to
16 characters according groupadd(8).

The maximum length of the group names however is a compile-time option
and even systemd allows more than 16 characters. In the mentioned pull
request (#36556) there was already a report that this has broken
evaluation for people out there.

I have also checked what other distributions are doing and they set the
length to either 31 characters or 32 characters, the latter being more
common.

Unfortunately there is a difference between the maximum length enforced
by the shadow package and systemd, both for user name lengths and group
name lengths. However, systemd enforces both length to have a maximum of
31 characters and I'm not sure if this is intended or just a off-by-one
error in systemd.

Nevertheless, I choose 32 characters simply to bring it in par with the
maximum user name length.

For the NixOS assertion however, I use a maximum length of 31 to make
sure that nobody accidentally creates services that contain group names
that systemd considers invalid because of a length of 32 characters.

Signed-off-by: aszlig <aszlig@nix.build>
Closes: #38548
Cc: @vcunat, @fpletz, @qknight
Diffstat (limited to 'pkgs/os-specific/linux/shadow')
-rw-r--r--pkgs/os-specific/linux/shadow/default.nix6
1 files changed, 4 insertions, 2 deletions
diff --git a/pkgs/os-specific/linux/shadow/default.nix b/pkgs/os-specific/linux/shadow/default.nix
index ca15571d1ed..3a76450a830 100644
--- a/pkgs/os-specific/linux/shadow/default.nix
+++ b/pkgs/os-specific/linux/shadow/default.nix
@@ -60,8 +60,10 @@ stdenv.mkDerivation rec {
     configureFlags="$configureFlags --with-xml-catalog=$PWD/xmlcatalog ";
   '';
 
-  configureFlags = " --enable-man "
-    + stdenv.lib.optionalString (hostPlatform.libc != "glibc") " --disable-nscd ";
+  configureFlags = [
+    "--enable-man"
+    "--with-group-name-max-length=32"
+  ] ++ stdenv.lib.optional (hostPlatform.libc != "glibc") "--disable-nscd";
 
   preBuild = stdenv.lib.optionalString (hostPlatform.libc == "glibc")
     ''