__user: only set password if it changed

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-03-15 23:26:24 +01:00
parent 1518bf1935
commit 4432b476d0
2 changed files with 31 additions and 0 deletions

View file

@ -0,0 +1,27 @@
#!/bin/sh
#
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# Get an existing users shadow entry.
#
name=$__object_id
grep "^$name" /etc/shadow || true

View file

@ -37,6 +37,10 @@ get_current_value() {
local key="$1" local key="$1"
local index local index
case "$key" in case "$key" in
password)
cut -d':' -f 2 "$__object/explorer/shadow"
break
;;
uid) index=3;; uid) index=3;;
gid) index=4;; gid) index=4;;
comment) index=5;; comment) index=5;;