summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/dns-forwarding/vyatta-dns-forwarding.pl2
-rwxr-xr-xscripts/system/vyatta_update_resolv.pl1
-rwxr-xr-xscripts/vyatta-passwd-sync67
3 files changed, 10 insertions, 60 deletions
diff --git a/scripts/dns-forwarding/vyatta-dns-forwarding.pl b/scripts/dns-forwarding/vyatta-dns-forwarding.pl
index 4334eaaa..60abc53f 100644
--- a/scripts/dns-forwarding/vyatta-dns-forwarding.pl
+++ b/scripts/dns-forwarding/vyatta-dns-forwarding.pl
@@ -68,7 +68,6 @@ sub dnsforwarding_get_values {
$config->setLevel("service dns forwarding");
if ($outside_cli == 1){
- $config->{_active_dir_base} = "/opt/vyatta/config/active/";
@listen_interfaces = $config->returnOrigValues("listen-on");
$cache_size = $config->returnOrigValue("cache-size");
@use_nameservers = $config->returnOrigValues("name-server");
@@ -106,7 +105,6 @@ sub dnsforwarding_get_values {
$sys_config->setLevel("system");
my @system_nameservers;
if ($outside_cli == 1){
- $sys_config->{_active_dir_base} = "/opt/vyatta/config/active/";
@system_nameservers = $sys_config->returnOrigValues("name-server");
} else {
@system_nameservers = $sys_config->returnValues("name-server");
diff --git a/scripts/system/vyatta_update_resolv.pl b/scripts/system/vyatta_update_resolv.pl
index f39dd3e7..041292be 100755
--- a/scripts/system/vyatta_update_resolv.pl
+++ b/scripts/system/vyatta_update_resolv.pl
@@ -39,7 +39,6 @@ my @domains;
my $domain_name = undef;
if ($dhclient_script == 1) {
- $vc->{_active_dir_base} = "/opt/vyatta/config/active/";
@domains = $vc->returnOrigValues('domain-search domain');
$domain_name = $vc->returnOrigValue('domain-name');
} else {
diff --git a/scripts/vyatta-passwd-sync b/scripts/vyatta-passwd-sync
index f8c07a8f..2ad6bd2a 100755
--- a/scripts/vyatta-passwd-sync
+++ b/scripts/vyatta-passwd-sync
@@ -28,64 +28,17 @@ GetOptions(
"check" => \$check,
);
-#
-# These should move to Vyatta::Config.pm??
-#
-
-sub add_node {
- my ( $config, $level ) = @_;
- $level =~ s/\//%2F/g;
- $level =~ s/\s+/\//g;
-
- my $path =
- $config->{_new_config_dir_base}
- . $config->{_current_dir_level} . '/'
- . $level;
- if ( !-d $path ) {
- mkdir $path or die "Can't make directory $path : $!\n";
- }
-}
-
-sub set_node {
- my ( $config, $level, $val ) = @_;
- $level =~ s/\//%2F/g;
- $level =~ s/\s+/\//g;
- my $path =
- $config->{_new_config_dir_base}
- . $config->{_current_dir_level} . '/'
- . $level;
-
- if ( !-d $path ) {
- system("mkdir -p $path");
- }
-
- my $fname = $path . '/node.val';
-
- open my $output, '>', $fname
- or die "Can't open $fname: $!\n";
- print $output "$val\n";
- close $output;
-}
-
-sub delete_node {
- my ( $config, $level ) = @_;
- $level =~ s/\//%2F/g;
- $level =~ s/\s+/\//g;
- my $path =
- $config->{_new_config_dir_base}
- . $config->{_current_dir_level} . '/'
- . $level;
- if ( -d $path ) {
- system("rm -fr $path");
- }
+sub set_user_attr {
+ my $user = shift;
+ system('/opt/vyatta/sbin/my_set', 'system', 'login', 'user', $user, @_);
}
my $members;
( undef, undef, undef, $members ) = getgrnam('operator');
-my @operators = split( / /, $members );
+my @operators = split(/ /, $members );
( undef, undef, undef, $members ) = getgrnam('vyattacfg');
-my @admins = split( / /, $members );
+my @admins = split(/ /, $members );
sub get_user_level {
my $name = shift;
@@ -231,7 +184,7 @@ sub resync_config {
if ( !defined $existing ) {
if ($force) {
print "Adding $user\n" if ($verbose);
- add_node( $config, $user );
+ # user will be added in later "set" operations.
}
else {
print "user: $user does not exist in vyatta config\n";
@@ -253,12 +206,12 @@ sub resync_config {
}
if ( $comment ne '' ) {
- set_node( $config, "$user full-name", $comment );
+ set_user_attr($user, 'full-name', $comment);
}
- set_node( $config, "$user authentication encrypted-password", $passwd );
- set_node( $config, "$user level", $level );
- set_node( $config, "$user home-directory", $home );
+ set_user_attr($user, 'authentication', 'encrypted-password', $passwd);
+ set_user_attr($user, 'level', $level);
+ set_user_attr($user, 'home-directory', $home);
}
}