Masato Taruishi
taru****@users*****
2004年 9月 17日 (金) 20:26:25 JST
=================================================================== RCS file: ultrapossum/init.d/10config,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ultrapossum/init.d/10config 2004/09/17 10:55:57 1.4 +++ ultrapossum/init.d/10config 2004/09/17 11:26:25 1.5 @@ -40,23 +40,12 @@ else case "$ULTRAPOSSUM_CONFIG_BACKEND" in ldap) -v="dn: cn=$2,$ULTRAPOSSUM_CONFIG_BACKEND_LDAP_BASEDN -objectClass: device -cn: $2 -description: $3 -" - if echo "$v" | ldapadd -x -H "$ULTRAPOSSUM_CONFIG_BACKEND_LDAP_URI" -D "$ULTRAPOSSUM_CONFIG_BACKEND_LDAP_BINDDN" -w "$ULTRAPOSSUM_CONFIG_BACKEND_LDAP_BINDPW" > /dev/null 2>&1; then - : - else - if test "$?" = "68"; then ldapmodify -x -H "$ULTRAPOSSUM_CONFIG_BACKEND_LDAP_URI" -D "$ULTRAPOSSUM_CONFIG_BACKEND_LDAP_BINDDN" -w "$ULTRAPOSSUM_CONFIG_BACKEND_LDAP_BINDPW" > /dev/null <<EOF dn: cn=$2,$ULTRAPOSSUM_CONFIG_BACKEND_LDAP_BASEDN changetype: modify replace: description description: $3 EOF - fi - fi ;; *) if test "x$1" = "x."; then @@ -89,6 +78,42 @@ fi /bin/mv $tmpsetconf $config +} + +# ultrapossum_removeconf <category> <var> +ultrapossum_removeconf() { + case "$ULTRAPOSSUM_CONFIG_BACKEND" in + ldap) + ldapmodify -x -H "$ULTRAPOSSUM_CONFIG_BACKEND_LDAP_URI" -D "$ULTRAPOSSUM_CONFIG_BACKEND_LDAP_BINDDN" -w "$ULTRAPOSSUM_CONFIG_BACKEND_LDAP_BINDPW" > /dev/null <<EOF +dn: cn=$2,$ULTRAPOSSUM_CONFIG_BACKEND_LDAP_BASEDN +changetype: modify +delete: description +EOF + ;; + *) + ultrapossum_removeconf_shell "$1" "$2" + ;; + esac +} + +# ultrapossum_removeconf_shell <category> <var> +ultrapossum_removeconf_shell() { + if test "x$1" = "x."; then + config=$SYSCONFDIR/ultrapossum.cf + elif test "x$1" = "xsecret"; then + config=$SYSCONFDIR/secret.cf + elif test "x$1" = "x.status"; then + config=$localstatedir/lib/$PACKAGE/status + else + config=$SYSCONFDIR/module.d/$1.cf + fi + if test -f "$config"; then + removetmp=`tempfile` + /bin/cp -p $config $removetmp + egrep -v "^$2=" $config > $removetmp || true + /bin/cp -p $removetmp $config + /bin/rm -f $removetmp + fi } # ultrapossum_parse_config <config>