+
+ # Translate the given user/group name into ID values.
+ if (defined ($socket_owner)) {
+ # Splitt provided user/group into single arguments.
+ my ($username, $groupname) = split(/:/, $socket_owner);
+
+ # Get the ID for the given user name.
+ my $uid = getpwnam($username) or die "Could not get an UID for $username: $!";
+
+ # Get the ID for given group name.
+ my $gid = getgrnam($groupname) or die "Could not get a GID for $groupname: $!";
+
+ # Set new ownership for the socket file.
+ chown($uid, $gid, "$socketfile") or die "Could not change ownership to ($uid:$gid) for $socketfile: $!";
+ }
+