From c49d6aadd7f28cf24be01ab03b1780b55a2e2f42 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 6 Apr 2012 10:59:49 +0200 Subject: [PATCH] Handle deploiement password change --- ipasserelle-gp.spec | 2 +- root/etc/e-smith/events/actions/wpkg-init | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ipasserelle-gp.spec b/ipasserelle-gp.spec index e7ae537..c8b924c 100644 --- a/ipasserelle-gp.spec +++ b/ipasserelle-gp.spec @@ -1,5 +1,5 @@ %define version 0.0.1 -%define release 1.beta13 +%define release 1.beta14 %define name ipasserelle-gp diff --git a/root/etc/e-smith/events/actions/wpkg-init b/root/etc/e-smith/events/actions/wpkg-init index eb618b2..7da9d97 100644 --- a/root/etc/e-smith/events/actions/wpkg-init +++ b/root/etc/e-smith/events/actions/wpkg-init @@ -52,16 +52,32 @@ if (!$dep){ City => 'Martillac', Dept => 'Administration', Removable => 'no', - PasswordSet => 'yes', + PasswordSet => 'no', }); unless ( system("/sbin/e-smith/signal-event", "user-create", "deploiement") == 0 ){ die "Failed to create user account deploiement\n"; } esmith::util::setUserPassword ("deploiement", "$pass"); + $a->set_prop('deploiement', 'PasswordSet', 'yes'); unless ( system("/sbin/e-smith/signal-event", "password-modify", "deploiement") == 0 ){ die "Failed to set password for user deploiement\n"; } + $a->set_prop('deploiement', 'Password', "$pass"); +} +else{ + my $wpkg = $c->get('wpkg') || die "Couldn't find wpkg service\n"; + my $new = $wpkg->prop('UserPassword') || ''; + my $old = $dep->prop('Password') || ''; + my $set = $dep->prop('PasswordSet') || 'no'; + if (($old ne $new) || ($set ne 'yes')){ + esmith::util::setUserPassword ("deploiement", "$new"); + $a->set_prop('deploiement', 'PasswordSet', 'yes'); + unless ( system("/sbin/e-smith/signal-event", "password-modify", "deploiement") == 0 ){ + die "Failed to set password for user deploiement\n"; + } + $a->set_prop('deploiement', 'Password', "$new"); + } } # sharedfolder wpkg