| 1 | package Mail::Vmailmgr; | ||||||||||
| 2 | |||||||||||
| 3 | ##Copyright (C) 2000 Martin Langhoff <martin@scim.net> | ||||||||||
| 4 | ## | ||||||||||
| 5 | ##Most of this code is based on a PHP version written by | ||||||||||
| 6 | ##Mike Bell <mike@mikebell.org> . This Perl Module is mostly | ||||||||||
| 7 | ##a quick translation of Mikes PHP code, so it doesn't look | ||||||||||
| 8 | ##nice, but we certainly hope it works. | ||||||||||
| 9 | ## | ||||||||||
| 10 | ##This program is free software; you can redistribute it and/or modify | ||||||||||
| 11 | ##it under the terms of the GNU General Public License as published by | ||||||||||
| 12 | ##the Free Software Foundation; either version 2 of the License, or | ||||||||||
| 13 | ##(at your option) any later version. | ||||||||||
| 14 | ## | ||||||||||
| 15 | ##This program is distributed in the hope that it will be useful, | ||||||||||
| 16 | ##but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||
| 17 | ##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||
| 18 | ##GNU General Public License for more details. | ||||||||||
| 19 | ## | ||||||||||
| 20 | ##You should have received a copy of the GNU General Public License | ||||||||||
| 21 | ##along with this program; if not, write to the Free Software | ||||||||||
| 22 | ##Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||||||||
| 23 | |||||||||||
| 24 | # define globals | ||||||||||
| 25 | 1 | my ($debug); | |||||||||
| 26 | |||||||||||
| 27 | 1 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | 1 | ▶ | use Exporter (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 30 | 1 | ▶ | use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 31 | |||||||||||
| 32 | 1 | $debug = 0; | |||||||||
| 33 | |||||||||||
| 34 | 1 | $VERSION = 0.4; | |||||||||
| 35 | |||||||||||
| 36 | 1 | @ISA = qw(Exporter); | |||||||||
| 37 | |||||||||||
| 38 | # symbols to export by default | ||||||||||
| 39 | 1 | @EXPORT = qw( | |||||||||
| 40 | &vlistdomain | ||||||||||
| 41 | &vlookup | ||||||||||
| 42 | &vadduser | ||||||||||
| 43 | &vaddalias | ||||||||||
| 44 | &vdeluser | ||||||||||
| 45 | &vchpass | ||||||||||
| 46 | &vchforward | ||||||||||
| 47 | &vchattr | ||||||||||
| 48 | &vwriteautoresponse | ||||||||||
| 49 | &vreadautoresponse | ||||||||||
| 50 | &vdisableautoresponse | ||||||||||
| 51 | &venableautoresponse | ||||||||||
| 52 | &vautoresponsestatus | ||||||||||
| 53 | ); | ||||||||||
| 54 | |||||||||||
| 55 | # symbols to export on request | ||||||||||
| 56 | #@EXPORT_OK = qw($Var1 %Hashit &func3); | ||||||||||
| 57 | |||||||||||
| 58 | # define names for sets of symbols | ||||||||||
| 59 | #%EXPORT_TAGS = ;# not used here, yet... | ||||||||||
| 60 | |||||||||||
| 61 | |||||||||||
| 62 | 1 | return 1; | |||||||||
| 63 | }; | ||||||||||
| 64 | |||||||||||
| 65 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 66 | 1 | ▶ | use IO::Socket; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 67 | #use Data::Dumper; | ||||||||||
| 68 | |||||||||||
| 69 | 0 | ▶ | sub vm_daemon_raw { | ||||||||
|
Subroutine
vm_daemon_raw: not called CC=14 SCAR=53.5
Pod
undocumented
| |||||||||||
| 70 | |||||||||||
| 71 | 0 | ▶ | $debug && warn "vm_daemon_raw called with params: \n " . Dumper(\@_); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 72 | |||||||||||
| 73 | 0 | my @arg = @_; | |||||||||
| 74 | 0 | my $vmailfile = "/tmp/.vmailmgrd"; | |||||||||
| 75 | 0 | my $socketfile = "/etc/vmailmgr/socket-file"; | |||||||||
| 76 | |||||||||||
| 77 | # override $vmailfile witth the contents of $socketfile, if it's there | ||||||||||
| 78 | 0 | ▶ | if (stat $socketfile){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 79 | 0 | ▶ | open SOCKETFILE, $socketfile or die "can't open $socketfile: $!"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 80 | 0 | my $socket = <SOCKETFILE>; | |||||||||
| 81 | 0 | chomp $socket; | |||||||||
| 82 | 0 | ▶ | if (stat $socket){ # the daemon seems to be running ok! | ||||||||
|
Branch: 1 branch
| |||||||||||
| 83 | 0 | $vmailfile = $socket; | |||||||||
| 84 | } | ||||||||||
| 85 | 0 | close SOCKETFILE; | |||||||||
| 86 | } | ||||||||||
| 87 | |||||||||||
| 88 | 0 | ▶ | $debug && warn "vm_daemon_raw ->about to connect to $vmailfile"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 89 | |||||||||||
| 90 | 0 | socket (DAEMON, PF_UNIX, SOCK_STREAM, 0); | |||||||||
| 91 | 0 | ▶ | connect(DAEMON, sockaddr_un($vmailfile)) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 92 | or die "Can't connect to $vmailfile : $! ... is the daemon running?"; | ||||||||||
| 93 | |||||||||||
| 94 | 0 | ▶ | $debug && warn "vm_daemon_raw ->connected!"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 95 | |||||||||||
| 96 | # parse @arg into a glob... I don't seem to understand Mike's code well | ||||||||||
| 97 | # hope bit-operators work similarly between perl and php... | ||||||||||
| 98 | 0 | my $command; | |||||||||
| 99 | 0 | ▶ | for (my $n=0; $n<@arg; $n++){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 100 | 0 | my $commandlength = length $arg[$n]; | |||||||||
| 101 | 0 | my $high = (($commandlength & (0xFF << 8)) >> 8); | |||||||||
| 102 | 0 | my $low = ($commandlength & 0xFF); | |||||||||
| 103 | 0 | $command .= sprintf('%c%c%s', $high, $low, $arg[$n]); | |||||||||
| 104 | } | ||||||||||
| 105 | |||||||||||
| 106 | # Create the header, which consists of another two byte length | ||||||||||
| 107 | # representation, the number of arguments being passed, and the | ||||||||||
| 108 | # command string created above. | ||||||||||
| 109 | 0 | my $commandlength = length $command; | |||||||||
| 110 | 0 | my $high = (($commandlength & (255 << 8)) >> 8); | |||||||||
| 111 | 0 | my $low = ($commandlength & 255); | |||||||||
| 112 | 0 | my $commandstr = sprintf("\002%c%c%c", $high, $low+1, scalar @arg -1) . $command; | |||||||||
| 113 | |||||||||||
| 114 | # pass it to the daemon | ||||||||||
| 115 | 0 | ▶ | $debug && warn "vm_daemon_raw ->sending command with length ". length $commandstr; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 116 | |||||||||||
| 117 | 0 | ▶ | send (DAEMON, $commandstr,0) == length($commandstr) or die "cant send!"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 118 | |||||||||||
| 119 | # | ||||||||||
| 120 | # now catch the answer | ||||||||||
| 121 | # | ||||||||||
| 122 | 0 | ▶ | $debug && warn "vm_daemon_raw ->reading answer"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 123 | |||||||||||
| 124 | # catch the 1 char $value | ||||||||||
| 125 | 0 | my $value; | |||||||||
| 126 | 0 | read(DAEMON, $value, 1); | |||||||||
| 127 | 0 | $value = ord $value; | |||||||||
| 128 | |||||||||||
| 129 | #catch the 2 char length ... | ||||||||||
| 130 | 0 | my $length; | |||||||||
| 131 | 0 | read(DAEMON, $length, 2); | |||||||||
| 132 | 0 | $length = "$length"; | |||||||||
| 133 | 0 | $length = ( ord(substr($length,0,1) ) << 8 + ord(substr($length,1,1))); | |||||||||
| 134 | |||||||||||
| 135 | ; | ||||||||||
| 136 | |||||||||||
| 137 | # now read the damned message! | ||||||||||
| 138 | 0 | my $message; | |||||||||
| 139 | 0 | ▶ | if ($value == 0){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 140 | 0 | my $buffer; | |||||||||
| 141 | 0 | ▶ | $message .= $buffer while read(DAEMON, $buffer, 65535); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 142 | # don't really know why .... | ||||||||||
| 143 | 0 | close DAEMON; | |||||||||
| 144 | 0 | return $message; | |||||||||
| 145 | } | ||||||||||
| 146 | |||||||||||
| 147 | 0 | read(DAEMON, $message, $length); | |||||||||
| 148 | |||||||||||
| 149 | # and close the socket | ||||||||||
| 150 | 0 | close DAEMON; | |||||||||
| 151 | |||||||||||
| 152 | |||||||||||
| 153 | 0 | return [$value, $message]; | |||||||||
| 154 | |||||||||||
| 155 | } | ||||||||||
| 156 | |||||||||||
| 157 | ##=for martin listdomain_parse_userdata($line, $username) | ||||||||||
| 158 | ## | ||||||||||
| 159 | ##Parses the lines from listdomain into fields. All fields after aliases are ignored, but this is easy to fix if anybody cared about them. | ||||||||||
| 160 | ## | ||||||||||
| 161 | ##=cut | ||||||||||
| 162 | |||||||||||
| 163 | 0 | ▶ | sub listdomain_parse_userdata { | ||||||||
|
Subroutine
listdomain_parse_userdata: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||
| 164 | |||||||||||
| 165 | 0 | ▶ | $debug && warn "listdomain_parse_userdata called with params: \n " . Dumper(\@_); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 166 | |||||||||||
| 167 | 0 | my $line = shift; | |||||||||
| 168 | 0 | my $username = shift; | |||||||||
| 169 | |||||||||||
| 170 | # grab the protocol version | ||||||||||
| 171 | 0 | my $ver = ord(substr($line,0,1)); | |||||||||
| 172 | 0 | ▶ | if ($ver ne "2") { die "Protocol version is $ver. This module expects protocol version 2."}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 173 | |||||||||||
| 174 | # chop off the version | ||||||||||
| 175 | 0 | $line = substr($line,1); | |||||||||
| 176 | |||||||||||
| 177 | |||||||||||
| 178 | # process flags (???) according to Mike's code, they seem to be pairs, | ||||||||||
| 179 | # but I don't quite get it | ||||||||||
| 180 | 0 | my @flags; | |||||||||
| 181 | { | ||||||||||
| 182 | # need to scope $n a bit farther | ||||||||||
| 183 | 0 | my $n; | |||||||||
| 184 | 0 | ▶ | for ($n=0; $n<length($line)-1; $n+=2){ # step 2 | ||||||||
|
Branch: 1 branch
| |||||||||||
| 185 | # flags come in pairs. and null is a valid value. | ||||||||||
| 186 | 0 | my $flagname = substr($line, $n,1); | |||||||||
| 187 | 0 | my $flagvalue = substr($line, $n+1,1); | |||||||||
| 188 | # according to mike, | ||||||||||
| 189 | # if the las flag name/identifier is a null (\0) | ||||||||||
| 190 | # then that means flags are over... | ||||||||||
| 191 | 0 | ▶ | last if $flagname =~ /\0/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 192 | 0 | $flags[ord($flagname)] = ord($flagvalue); | |||||||||
| 193 | } | ||||||||||
| 194 | #remove the already processed flags + the trailing \0... | ||||||||||
| 195 | 0 | $line = substr($line, $n+1); | |||||||||
| 196 | } | ||||||||||
| 197 | |||||||||||
| 198 | # split the fields on NULLS | ||||||||||
| 199 | 0 | my @fields = split(/\0/, $line); | |||||||||
| 200 | |||||||||||
| 201 | 0 | (my $password, my $mailbox, @fields) = @fields; | |||||||||
| 202 | |||||||||||
| 203 | #$password = 'Set' if $password ne '*' ; | ||||||||||
| 204 | |||||||||||
| 205 | 0 | my @aliases; | |||||||||
| 206 | 0 | ▶ | while($fields[0]){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 207 | 0 | push (@aliases, shift @fields); | |||||||||
| 208 | } | ||||||||||
| 209 | 0 | shift @fields; | |||||||||
| 210 | |||||||||||
| 211 | 0 | my ( $PersonalInfo, | |||||||||
| 212 | $HardQuota, | ||||||||||
| 213 | $SoftQuota, | ||||||||||
| 214 | $SizeLimit, | ||||||||||
| 215 | $CountLimit, | ||||||||||
| 216 | $CreationTime, | ||||||||||
| 217 | $ExpiryTime ) = @fields; | ||||||||||
| 218 | |||||||||||
| 219 | return [ | ||||||||||
| 220 | 0 | $username, $password, | |||||||||
| 221 | $mailbox, \@aliases, | ||||||||||
| 222 | $PersonalInfo, $HardQuota, | ||||||||||
| 223 | $SoftQuota, $SizeLimit, | ||||||||||
| 224 | $CountLimit, $CreationTime, | ||||||||||
| 225 | $ExpiryTime, \@flags]; | ||||||||||
| 226 | } | ||||||||||
| 227 | |||||||||||
| 228 | ##=for martin list_domain_parse_line($line) | ||||||||||
| 229 | ## | ||||||||||
| 230 | ##Parses the lines from listdomain into fields. | ||||||||||
| 231 | ## | ||||||||||
| 232 | ##=cut | ||||||||||
| 233 | 0 | ▶ | sub listdomain_parse_line { | ||||||||
|
Subroutine
listdomain_parse_line: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 234 | |||||||||||
| 235 | 0 | ▶ | $debug && warn "listdomain_parse_line called with param of " . length $_[0] . 'length'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 236 | |||||||||||
| 237 | 0 | my $line = shift; | |||||||||
| 238 | |||||||||||
| 239 | # find the first null. | ||||||||||
| 240 | 0 | ▶ | $line =~ m/\0/ or warn "no nulls in string??"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 241 | |||||||||||
| 242 | # grab the user data | ||||||||||
| 243 | 0 | my $username= $`; | |||||||||
| 244 | 0 | ▶ | $debug && warn "user found->$username"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 245 | |||||||||||
| 246 | # Send that user's data to be parsed. | ||||||||||
| 247 | 0 | return &listdomain_parse_userdata( $', $username); | |||||||||
| 248 | } | ||||||||||
| 249 | |||||||||||
| 250 | ##=for martin listdomain_parse($output) | ||||||||||
| 251 | ## | ||||||||||
| 252 | ##Does the ugly stuff for listdomain, and calls listdomain_parse_line once | ||||||||||
| 253 | ##for each user | ||||||||||
| 254 | ## | ||||||||||
| 255 | ##=cut | ||||||||||
| 256 | |||||||||||
| 257 | 0 | ▶ | sub listdomain_parse { | ||||||||
|
Subroutine
listdomain_parse: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 258 | |||||||||||
| 259 | 0 | ▶ | $debug && warn "listdomain_parse called with param of " . length $_[0]. " chars"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 260 | |||||||||||
| 261 | 0 | my $output = shift; | |||||||||
| 262 | 0 | my @array; | |||||||||
| 263 | 0 | my $cur=1; | |||||||||
| 264 | 0 | while (1){ | |||||||||
| 265 | 0 | my $linelength=(ord(substr($output, $cur++, 1)) << 8 ) + ord(substr($output, $cur++, 1)); | |||||||||
| 266 | 0 | ▶ | last unless $linelength; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 267 | 0 | push @array, listdomain_parse_line(substr($output, $cur, $linelength)); | |||||||||
| 268 | 0 | $cur += $linelength + 1; | |||||||||
| 269 | } ; | ||||||||||
| 270 | |||||||||||
| 271 | 0 | return \@array; | |||||||||
| 272 | } | ||||||||||
| 273 | |||||||||||
| 274 | 0 | ▶ | sub vlistdomain{ | ||||||||
|
Subroutine
vlistdomain: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||
| 275 | |||||||||||
| 276 | 0 | ▶ | $debug && warn "listdomain called with params: \n " . Dumper(\@_); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 277 | |||||||||||
| 278 | 0 | my ($domain, $password) = @_; | |||||||||
| 279 | |||||||||||
| 280 | 0 | ▶ | return [1, "Empty domain"] unless $domain; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 281 | 0 | ▶ | return [1, "Empty domain password"] unless $password; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 282 | |||||||||||
| 283 | |||||||||||
| 284 | 0 | my $temp = vm_daemon_raw("listdomain", $domain, $password); | |||||||||
| 285 | |||||||||||
| 286 | 0 | ▶ | if (ref($temp) eq 'ARRAY') {return $temp}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 287 | 0 | return listdomain_parse($temp); | |||||||||
| 288 | } | ||||||||||
| 289 | |||||||||||
| 290 | 0 | ▶ | sub vlookup { | ||||||||
|
Subroutine
vlookup: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 291 | 0 | my ($domain, $user, $password) = @_; | |||||||||
| 292 | 0 | my $tmp = vm_daemon_raw("lookup", $domain, $user, $password); | |||||||||
| 293 | |||||||||||
| 294 | 0 | ▶ | if (ref $tmp eq 'ARRAY'){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 295 | |||||||||||
| 296 | 0 | return $tmp; | |||||||||
| 297 | } else { | ||||||||||
| 298 | 0 | return listdomain_parse_userdata($tmp, $user); | |||||||||
| 299 | } | ||||||||||
| 300 | } | ||||||||||
| 301 | |||||||||||
| 302 | 0 | ▶ | sub vadduser { | ||||||||
|
Subroutine
vadduser: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||
| 303 | 0 | my ($domain, $password, $username, $userpass, @forwards) = @_; | |||||||||
| 304 | |||||||||||
| 305 | 0 | ▶ | return [1, "Empty domain"] unless $domain; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 306 | 0 | ▶ | return [1, "Empty domain password"] unless $password; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 307 | 0 | ▶ | return [1, "Empty username"] unless $username; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 308 | 0 | ▶ | return [1, "No user password supplied"] unless $userpass; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 309 | |||||||||||
| 310 | 0 | my @command = ("adduser2", $domain, $username, $password, | |||||||||
| 311 | $userpass, $username); | ||||||||||
| 312 | 0 | foreach my $fw (@forwards){ | |||||||||
| 313 | 0 | ▶ | push (@command, $fw) if $fw; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 314 | } | ||||||||||
| 315 | 0 | return vm_daemon_raw(@command); | |||||||||
| 316 | } | ||||||||||
| 317 | |||||||||||
| 318 | 0 | ▶ | sub vaddalias { | ||||||||
|
Subroutine
vaddalias: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||
| 319 | 0 | my ($domain, $password, $username, $userpass, @forwards) = @_; | |||||||||
| 320 | |||||||||||
| 321 | 0 | ▶ | return [1, "Empty domain"] unless $domain; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 322 | 0 | ▶ | return [1, "Empty domain password"] unless $password; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 323 | 0 | ▶ | return [1, "Empty username"] unless $username; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 324 | |||||||||||
| 325 | 0 | my @command = ("adduser2", $domain, $username, $password, | |||||||||
| 326 | $userpass, ""); | ||||||||||
| 327 | |||||||||||
| 328 | 0 | foreach my $fw (@forwards){ | |||||||||
| 329 | 0 | ▶ | push (@command, $fw) if $fw; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 330 | } | ||||||||||
| 331 | |||||||||||
| 332 | 0 | return vm_daemon_raw(@command); | |||||||||
| 333 | } | ||||||||||
| 334 | |||||||||||
| 335 | 0 | ▶ | sub vdeluser { | ||||||||
|
Subroutine
vdeluser: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 336 | 0 | my ($domain, $password, $username) = @_; | |||||||||
| 337 | |||||||||||
| 338 | 0 | ▶ | return [1, "Empty domain"] unless $domain; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 339 | 0 | ▶ | return [1, "Empty domain password"] unless $password; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 340 | 0 | ▶ | return [1, "Empty username"] unless $username; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 341 | |||||||||||
| 342 | 0 | my @command=("deluser", $domain, $username,$password, ); | |||||||||
| 343 | 0 | return vm_daemon_raw(@command); | |||||||||
| 344 | } | ||||||||||
| 345 | |||||||||||
| 346 | 0 | ▶ | sub vchpass { | ||||||||
|
Subroutine
vchpass: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||
| 347 | 0 | my ($domain, $password, $username, $newpass) = @_; | |||||||||
| 348 | |||||||||||
| 349 | 0 | ▶ | return [1, "Empty domain"] unless $domain; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 350 | 0 | ▶ | return [1, "Empty domain password"] unless $password; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 351 | 0 | ▶ | return [1, "Empty username"] unless $username; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 352 | 0 | ▶ | return [1, "No new password supplied"] unless $newpass; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 353 | |||||||||||
| 354 | 0 | my @command=("chattr", $domain, $username, $password, "1", $newpass); | |||||||||
| 355 | 0 | return vm_daemon_raw(@command); | |||||||||
| 356 | |||||||||||
| 357 | } | ||||||||||
| 358 | |||||||||||
| 359 | 0 | ▶ | sub vchforward { | ||||||||
|
Subroutine
vchforward: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||
| 360 | 0 | my ($domain, $password, $username, @forwards) = @_; | |||||||||
| 361 | |||||||||||
| 362 | 0 | ▶ | return [1, "Empty domain"] unless $domain; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 363 | 0 | ▶ | return [1, "Empty domain password"] unless $password; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 364 | 0 | ▶ | return [1, "Empty username"] unless $username; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 365 | |||||||||||
| 366 | 0 | my @command=("chattr", $domain, $username, $password, "2"); | |||||||||
| 367 | 0 | foreach my $fw (@forwards){ | |||||||||
| 368 | 0 | ▶ | push (@command, $fw) if $fw; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 369 | } | ||||||||||
| 370 | 0 | ▶ | push (@command, "") unless @forwards; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 371 | |||||||||||
| 372 | 0 | return vm_daemon_raw(@command); | |||||||||
| 373 | } | ||||||||||
| 374 | |||||||||||
| 375 | 0 | ▶ | sub vchattr { | ||||||||
|
Subroutine
vchattr: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 376 | 0 | my ($domain, $password, $username, $attr, $value) = @_; | |||||||||
| 377 | 0 | my %ATTR = ( | |||||||||
| 378 | "PASS" => "1", | ||||||||||
| 379 | "DEST" => "2", | ||||||||||
| 380 | "HARDQUOTA" => "3", | ||||||||||
| 381 | "SOFTQUOTA" => "4", | ||||||||||
| 382 | "MSGSIZE" => "5", | ||||||||||
| 383 | "MSGCOUNT" => "6", | ||||||||||
| 384 | "EXPIRY" => "7", | ||||||||||
| 385 | "MAILBOX_ENABLED" => "8", | ||||||||||
| 386 | "PERSONAL" => "9", | ||||||||||
| 387 | ); | ||||||||||
| 388 | 0 | my @command = ("chattr", $domain, $username, $password, $ATTR{$attr}, $value); | |||||||||
| 389 | |||||||||||
| 390 | 0 | return vm_daemon_raw(@command); | |||||||||
| 391 | } | ||||||||||
| 392 | |||||||||||
| 393 | 0 | ▶ | sub vwriteautoresponse { | ||||||||
|
Subroutine
vwriteautoresponse: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 394 | 0 | my ($domain, $password, $username, $message) = @_; | |||||||||
| 395 | 0 | my @command = ("autoresponse", $domain, $username, $password, "write", $message); | |||||||||
| 396 | 0 | return vm_daemon_raw(@command); | |||||||||
| 397 | } | ||||||||||
| 398 | |||||||||||
| 399 | 0 | ▶ | sub vreadautoresponse{ | ||||||||
|
Subroutine
vreadautoresponse: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 400 | 0 | my ($domain, $password, $username) = @_; | |||||||||
| 401 | 0 | my @command = ("autoresponse", $domain, $username, $password, "read"); | |||||||||
| 402 | 0 | return vm_daemon_raw(@command); | |||||||||
| 403 | } | ||||||||||
| 404 | |||||||||||
| 405 | 0 | ▶ | sub vdisableautoresponse{ | ||||||||
|
Subroutine
vdisableautoresponse: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 406 | 0 | my ($domain, $password, $username) = @_; | |||||||||
| 407 | 0 | my @command = ("autoresponse", $domain, $username, $password, "disable"); | |||||||||
| 408 | 0 | return vm_daemon_raw(@command); | |||||||||
| 409 | } | ||||||||||
| 410 | |||||||||||
| 411 | 0 | ▶ | sub venableautoresponse{ | ||||||||
|
Subroutine
venableautoresponse: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 412 | 0 | my ($domain, $password, $username) = @_; | |||||||||
| 413 | 0 | my @command = ("autoresponse", $domain, $username, $password, "enable"); | |||||||||
| 414 | 0 | return vm_daemon_raw(@command); | |||||||||
| 415 | } | ||||||||||
| 416 | |||||||||||
| 417 | 0 | ▶ | sub vautoresponsestatus{ | ||||||||
|
Subroutine
vautoresponsestatus: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 418 | 0 | my ($domain, $password, $username) = @_; | |||||||||
| 419 | 0 | my @command = ("autoresponse", $domain, $username, $password, "status"); | |||||||||
| 420 | 0 | return vm_daemon_raw(@command); | |||||||||
| 421 | } | ||||||||||
| 422 | |||||||||||
| 423 | 1 | 1; # yes, we compiled gracefully. | |||||||||
| 424 | |||||||||||
| 425 | __END__ | ||||||||||