mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
socket-util: introduce address_label_valid
This commit is contained in:
parent
ccdda9556e
commit
2680894816
@ -900,6 +900,26 @@ bool ifname_valid(const char *p) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool address_label_valid(const char *p) {
|
||||
|
||||
if (isempty(p))
|
||||
return false;
|
||||
|
||||
if (strlen(p) >= IFNAMSIZ)
|
||||
return false;
|
||||
|
||||
while (*p) {
|
||||
if ((uint8_t) *p >= 127U)
|
||||
return false;
|
||||
|
||||
if ((uint8_t) *p <= 31U)
|
||||
return false;
|
||||
p++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int getpeercred(int fd, struct ucred *ucred) {
|
||||
socklen_t n = sizeof(struct ucred);
|
||||
struct ucred u;
|
||||
|
@ -126,6 +126,7 @@ int ip_tos_to_string_alloc(int i, char **s);
|
||||
int ip_tos_from_string(const char *s);
|
||||
|
||||
bool ifname_valid(const char *p);
|
||||
bool address_label_valid(const char *p);
|
||||
|
||||
int getpeercred(int fd, struct ucred *ucred);
|
||||
int getpeersec(int fd, char **ret);
|
||||
|
Loading…
Reference in New Issue
Block a user