summaryrefslogtreecommitdiff
path: root/src/systemd/src/basic/socket-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemd/src/basic/socket-util.c')
-rw-r--r--src/systemd/src/basic/socket-util.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/systemd/src/basic/socket-util.c b/src/systemd/src/basic/socket-util.c
index 17e90a8994..e5847dce00 100644
--- a/src/systemd/src/basic/socket-util.c
+++ b/src/systemd/src/basic/socket-util.c
@@ -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;