X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FRecord.pm;h=d27a6145f90b57c857e4d0affd32d87d3f444a7e;hb=92d2bdca43914e34555385b0326780e0462dcbc3;hp=e324f15c8b2bd9e72a988f7568e186bb197c0b37;hpb=146fe88cea912f90629950876863ae95faa7600f;p=freeside.git diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index e324f15c8..d27a6145f 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -65,9 +65,9 @@ FS::UID->install_callback( sub { die $@ if $@; $conf = FS::Conf->new; $conf_encryption = $conf->exists('encryption'); - $conf_encryptionmodule = $conf->exists('encryptionmodule'); - $conf_encryptionpublickey = $conf->exists('encryptionpublickey'); - $conf_encryptionprivatekey = $conf->exists('encryptionprivatekey'); + $conf_encryptionmodule = $conf->config('encryptionmodule'); + $conf_encryptionpublickey = join("\n",$conf->config('encryptionpublickey')); + $conf_encryptionprivatekey = join("\n",$conf->config('encryptionprivatekey')); $money_char = $conf->config('money_char') || '$'; my $nw_coords = $conf->exists('geocode-require_nw_coordinates'); $lat_lower = $nw_coords ? 1 : -90; @@ -527,6 +527,7 @@ sub qsearch { # Check for encrypted fields and decrypt them. ## only in the local copy, not the cached object + no warnings 'deprecated'; # XXX silence the warning for now if ( $conf_encryption && eval '@FS::'. $table . '::encrypted_fields' ) { foreach my $record (@return) { @@ -1299,8 +1300,7 @@ sub insert { my $table = $self->table; # Encrypt before the database - if ( defined(eval '@FS::'. $table . '::encrypted_fields') - && scalar( eval '@FS::'. $table . '::encrypted_fields') + if ( scalar( eval '@FS::'. $table . '::encrypted_fields') && $conf_encryption ) { foreach my $field (eval '@FS::'. $table . '::encrypted_fields') { @@ -1542,9 +1542,8 @@ sub replace { # Encrypt for replace my $saved = {}; - if ( $conf_encryption - && defined(eval '@FS::'. $new->table . '::encrypted_fields') - && scalar( eval '@FS::'. $new->table . '::encrypted_fields') + if ( scalar( eval '@FS::'. $new->table . '::encrypted_fields') + && $conf_encryption ) { foreach my $field (eval '@FS::'. $new->table . '::encrypted_fields') { next if $field eq 'payinfo' @@ -2976,7 +2975,6 @@ May not be null. sub ut_name { my( $self, $field ) = @_; -# warn "ut_name allowed alphanumerics: +(sort grep /\w/, map { chr() } 0..255), "\n"; $self->getfield($field) =~ /^([\p{Word} \,\.\-\']+)$/ or return gettext('illegal_name'). " $field: ". $self->getfield($field); my $name = $1; @@ -3293,14 +3291,12 @@ sub loadRSA { } # Initialize Encryption if ($conf_encryptionpublickey && $conf_encryptionpublickey ne '') { - my $public_key = join("\n",$conf_encryptionpublickey); - $rsa_encrypt = $rsa_module->new_public_key($public_key); + $rsa_encrypt = $rsa_module->new_public_key($conf_encryptionpublickey); } # Intitalize Decryption if ($conf_encryptionprivatekey && $conf_encryptionprivatekey ne '') { - my $private_key = join("\n",$conf_encryptionprivatekey); - $rsa_decrypt = $rsa_module->new_private_key($private_key); + $rsa_decrypt = $rsa_module->new_private_key($conf_encryptionprivatekey); } }