From 4432b476d08c812e9ee6221049c9ee7095143512 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 15 Mar 2011 23:26:24 +0100 Subject: [PATCH] __user: only set password if it changed Signed-off-by: Steven Armstrong --- conf/type/__user/explorer/shadow | 27 +++++++++++++++++++++++++++ conf/type/__user/gencode | 4 ++++ 2 files changed, 31 insertions(+) create mode 100755 conf/type/__user/explorer/shadow diff --git a/conf/type/__user/explorer/shadow b/conf/type/__user/explorer/shadow new file mode 100755 index 00000000..eab6b2b8 --- /dev/null +++ b/conf/type/__user/explorer/shadow @@ -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 . +# +# +# Get an existing users shadow entry. +# + +name=$__object_id + +grep "^$name" /etc/shadow || true + diff --git a/conf/type/__user/gencode b/conf/type/__user/gencode index ca31f7d3..5990ac92 100755 --- a/conf/type/__user/gencode +++ b/conf/type/__user/gencode @@ -37,6 +37,10 @@ get_current_value() { local key="$1" local index case "$key" in + password) + cut -d':' -f 2 "$__object/explorer/shadow" + break + ;; uid) index=3;; gid) index=4;; comment) index=5;;