diff options
author | ivan <ivan> | 2010-12-10 22:08:36 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-12-10 22:08:36 +0000 |
commit | 1318909d7eb16d736cbfb9f641eecccb00d4636c (patch) | |
tree | 24eb3ede37c104ea8b4e799013ae2d2d136eb207 /FS/FS/part_export/cardfortress.pm | |
parent | 457da870c23db87fbbc29d7c667a73f41422dd71 (diff) |
cardfortress backend support
Diffstat (limited to 'FS/FS/part_export/cardfortress.pm')
-rw-r--r-- | FS/FS/part_export/cardfortress.pm | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/FS/FS/part_export/cardfortress.pm b/FS/FS/part_export/cardfortress.pm new file mode 100644 index 0000000..4916a6e --- /dev/null +++ b/FS/FS/part_export/cardfortress.pm @@ -0,0 +1,64 @@ +package FS::part_export::cardfortress; + +use strict; +use base 'FS::part_export'; +use vars qw( %info ); +use String::ShellQuote; + +#tie my %options, 'Tie::IxHash'; +#; + +%info = ( + 'svc' => 'svc_acct', + 'desc' => 'CardFortress', + 'options' => {}, #\%options, + 'nodomain' => 'Y', + 'notes' => '', +); + +sub rebless { shift; } + +sub _export_insert { + my($self, $svc_acct) = (shift, shift); + + eval "use Net::OpenSSH;"; + return $@ if $@; + + open my $def_in, '<', '/dev/null' or die "unable to open /dev/null"; + my $ssh = Net::OpenSSH->new( $self->machine, + default_stdin_fh => $def_in ); + + my $private_key = $ssh->capture( + { 'stdin_data' => $svc_acct->_password. "\n" }, + '/usr/local/bin/merchant_create', map $svc_acct->$_, qw( username finger ) + ); + return $ssh->error if $ssh->error; + + $svc_acct->cf_privatekey($private_key); + + $svc_acct->replace; + +} + +sub _export_replace { + my( $self, $new, $old ) = (shift, shift, shift); + + return 'username changes not yet supported' + if $old->username ne $new->username; + + return 'password changes not yet supported' + if $old->_password ne $new->_password; + + return 'Real name changes not yet supported' + if $old->finger ne $new->finger; + + ''; +} + +sub _export_delete { + #my( $self, $svc_x ) = (shift, shift); + + return 'deletion not yet supproted'; +} + +1; |