[Nut-upsuser] Formal definition of a UPS name

Jim Klimov jimklimov+nut at gmail.com
Tue Apr 5 16:00:44 BST 2022


Did not find a definition in the docs quickly...

I think Arnaud mentioned that there was (planned to be?) some constraint,
but looking at the parsing code it seems that de-facto we check for (and
strip away) the opening and closing brackets in the first token after
`parseconf` separated the lines into those, and take octets between the
brackets.

So at least parseconf rules out whitespace and some punctuation... unless
someone double-quotes a section line/content?.. :)

Device section names are also used as socket filenames (so no slash).

Empty is probably also bad, though does not seem immediately invalid in the
parser.

Most of the processing then deals with C string equality.

The nut-driver-enumerator and upsdrvsvcctl scripts in new release also
check if the device name contains valid characters for a nut-driver service
instance name (different charsets and lengths for systemd, SMF) but work
around by hashing it if not.

Similar logic applies for user names (as sections in upsd.users), it seems.

Jim


On Tue, Apr 5, 2022, 16:32 Roger Price <roger at rogerprice.org> wrote:

> On Tue, 5 Apr 2022, Roger Price wrote:
>
> >> Do we have a formal definition of a UPS name?
>
> Should a system administrator be able to name a UPS "Bébé" or "罗杰-1" ?
>
> Roger_______________________________________________
> Nut-upsuser mailing list
> Nut-upsuser at alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20220405/aa69b1a6/attachment.htm>


More information about the Nut-upsuser mailing list