The current code supports <name>@<digit> only, but we also need
<name>@<digit>.<digit>[. ...]
RFC5424: 7.2.2 enterpriseId:
In general, only the IANA-assigned private enterprise number is
needed (a single number). An enterprise might decide to use
sub-identifiers below its private enterprise number. If sub-
identifiers are used, they MUST be separated by periods and be
represented as decimal numbers. An example for that would be
"32473.1.2".
Addresses: https://github.com/karelzak/util-linux/issues/406
Signed-off-by: Karel Zak <kzak@redhat.com>
if (!at || at == str || !*(at + 1))
return 0;
- if (!isdigit_string(at + 1))
- return 0;
+
+ /* <digits> or <digits>.<digits>[...] */
+ for (p = at + 1; p && *p; p++) {
+ const char *end;
+
+ if (isdigit_strend(p, &end))
+ break; /* only digits in the string */
+
+ if (end == NULL || end == p ||
+ *end != '.' || *(end + 1) == '\0')
+ return 0;
+ p = end;
+ }
/* check for forbidden chars in the <name> */
for (p = str; p < at; p++) {