diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-09-26 22:57:07 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-09-26 22:57:07 -0400 |
commit | 6a87c26b84e5cab7f4a8ead8abd62e58b7ec7f6c (patch) | |
tree | 48ed64f8684891542feb17f0e79f127252a79f7e /rebuildpkgs | |
parent | 67bcecbbe42c727936d825363fbd1e2173bab574 (diff) | |
download | devtools32-6a87c26b84e5cab7f4a8ead8abd62e58b7ec7f6c.tar.xz |
arch-nspawn: limit the machine_name length to ${HOST_NAME_MAX:-64} chars.
The criteria for a valid name are:
- is made of of alphanumerics, "_", ".", and "-"
- is not emtpy
- cannot end with "."
- cannot contain ".."
- the maximum length is HOST_NAME_MAX, as defined in <limits.h>
The existing code takes care of all but the last of these. So, added code
after the existing code to check the length of the string, and grab the
longest possible substring from the end.
I hard-coded our interpretation of HOST_NAME_MAX as 64--on Linux that has
been the value since version 1.0 of the kernel... I don't think it will be
changing any time soon, and since systemd is Linux-only, we don't have to
worry about other kernels.
But, just in case, I included a commented out version that uses cpp to get
the value.
Diffstat (limited to 'rebuildpkgs')
0 files changed, 0 insertions, 0 deletions