Subject: | Support for UNIX domain sockets |
Hello,
the cyrus imap server supports connections via UNIX domain sockets. We
have a setup where the "superadmin" user is only allowed to connect via
those. Attached patch adds unix domain sockets support to IMAP-Admin if
the server variable begins with a "/".
Cheers,
Thomas
Subject: | IMAP-Admin-unix_socket.patch |
diff -u -r IMAP-Admin-1.6.4/Admin.pm IMAP-Admin.unix_socket/Admin.pm
--- IMAP-Admin-1.6.4/Admin.pm Wed Feb 16 14:43:04 2005
+++ IMAP-Admin.unix_socket/Admin.pm Fri Aug 22 10:09:40 2008
@@ -91,19 +91,30 @@
return;
}
} else {
- if (!eval {
- $self->{'Socket'} =
- IO::Socket::INET->new(PeerAddr => $self->{'Server'},
- PeerPort => $self->{'Port'},
- Proto => 'tcp',
- Reuse => 1,
- Timeout => 5); })
- {
- delete $self->{'Socket'};
- $self->_error("initialize", "couldn't establish connection to",
- $self->{'Server'});
- return;
-
+ if ($self->{'Server'} =~ /^\//) {
+ if (!eval {
+ $self->{'Socket'} =
+ IO::Socket::UNIX->new(Peer => $self->{'Server'}); })
+ {
+ delete $self->{'Socket'};
+ $self->_error("initialize", "couldn't establish connection to",
+ $self->{'Server'});
+ return;
+ }
+ } else {
+ if (!eval {
+ $self->{'Socket'} =
+ IO::Socket::INET->new(PeerAddr => $self->{'Server'},
+ PeerPort => $self->{'Port'},
+ Proto => 'tcp',
+ Reuse => 1,
+ Timeout => 5); })
+ {
+ delete $self->{'Socket'};
+ $self->_error("initialize", "couldn't establish connection to",
+ $self->{'Server'});
+ return;
+ }
}
}
my $fh = $self->{'Socket'};