summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/acf-core/0001-acfpasswd-new-tool-to-set-passwords-from-comman-line.patch99
-rw-r--r--main/acf-core/APKBUILD17
2 files changed, 113 insertions, 3 deletions
diff --git a/main/acf-core/0001-acfpasswd-new-tool-to-set-passwords-from-comman-line.patch b/main/acf-core/0001-acfpasswd-new-tool-to-set-passwords-from-comman-line.patch
new file mode 100644
index 000000000..405ff0c66
--- /dev/null
+++ b/main/acf-core/0001-acfpasswd-new-tool-to-set-passwords-from-comman-line.patch
@@ -0,0 +1,99 @@
+From a55d954939799cd35efffa896cebaa17d7393e7f Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 12 Jan 2012 11:21:20 +0100
+Subject: [PATCH] acfpasswd: new tool to set passwords from comman line
+
+This tool allows users to set/reset an ACF password from command line.
+
+It also allows user to syncronize the ACF password with the system
+password so the ACF password becomes same as shell login password. This
+requires that the username exists in both /etc/acf/passwd and /etc/shadow
+
+diff --git a/bin/acfpasswd b/bin/acfpasswd
+new file mode 100644
+index 0000000..e25b966
+--- /dev/null
++++ b/bin/acfpasswd
+@@ -0,0 +1,79 @@
++#!/bin/sh
++
++# tool for managing the ACF passwords
++
++passwdfile=${ACFPASSWD:-/etc/acf/passwd}
++shadow=${SHADOW:-/etc/shadow}
++
++usage() {
++ echo "usage: acfpasswd [-s] USER"
++ echo ""
++ exit 1
++}
++
++die() {
++ echo "$@" >&2
++ exit 1
++}
++
++find_user_or_die() {
++ local user="$1"
++ grep -q "^${user}:" "$passwdfile" \
++ || die "user '$user' was not found in $passwdfile"
++}
++
++set_pw_hash() {
++ local user="$1"
++ local pwhash="$2"
++ # use : as sed separator since its guaranteed to no be valid in shadow
++ sed -i -e "s:^${user}\:[^\:]*\::${user}\:${pwhash}\::" "$passwdfile"
++}
++
++syncpasswd() {
++ local user="$1"
++ local pwhash=$(awk -F: -v user="$user" '$1 == user { print $2 }' \
++ $shadow) || exit
++ find_user_or_die "$user"
++ [ -z "$pwhash" ] && die "user '$user' was not found in $shadow"
++ set_pw_hash "$user" "$pwhash"
++ exit
++}
++
++sync_with_system=
++while getopts "hs" opt; do
++ case "$opt" in
++ h) usage;;
++ s) sync_with_system=yes;;
++ esac
++done
++
++shift $(($OPTIND - 1))
++
++user="$1"
++[ -z "$user" ] && usage
++
++[ -n "$sync_with_system" ] && syncpasswd "$user"
++
++# set password for given user
++find_user_or_die "$user"
++tries=0
++while true; do
++ echo -n "Enter new ACF password for $user (will not echo): "
++ hash=$(mkpasswd -m sha | tail -n1)
++ salt=$(echo "$hash" | cut -d$ -f3)
++ echo ""
++ echo -n "Re-enter the ACF password (will not echo): "
++ hash2=$(mkpasswd -S "$salt" -m sha | tail -n1)
++ echo ""
++ [ "$hash" = "$hash2" ] && break
++ echo -n "The entered passwords does not match. "
++ tries=$(( $tries + 1))
++ if [ $tries -gt 3 ]; then
++ die "ACF password was NOT changed"
++ else
++ echo "Please try again."
++ fi
++done
++
++set_pw_hash "$user" "$hash" && echo "ACF password for $user was changed."
++
+--
+1.7.8.2
+
diff --git a/main/acf-core/APKBUILD b/main/acf-core/APKBUILD
index ff39b82a5..69dd1718d 100644
--- a/main/acf-core/APKBUILD
+++ b/main/acf-core/APKBUILD
@@ -2,17 +2,28 @@
# Maintainer: Ted Trask <ttrask01@yahoo.com>
pkgname=acf-core
pkgver=0.14.0
-pkgrel=0
+pkgrel=1
pkgdesc="A web-based system administration interface framework"
url="http://git.alpinelinux.org/cgit/acf-core"
arch="noarch"
license="GPL-2"
install="$pkgname.post-upgrade"
depends="acf-jquery acf-lib acf-skins haserl lua lua-posix lua-md5"
-source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2"
+source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2
+ 0001-acfpasswd-new-tool-to-set-passwords-from-comman-line.patch
+ "
+prepare() {
+ cd "$srcdir/$pkgname-$pkgver"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
package() {
cd "$srcdir/$pkgname-$pkgver"
make DESTDIR="$pkgdir" install
}
-md5sums="50ceb0f38330de37ec5d5a1d4cc28706 acf-core-0.14.0.tar.bz2"
+md5sums="50ceb0f38330de37ec5d5a1d4cc28706 acf-core-0.14.0.tar.bz2
+186de27cd4bf66454ede177ae723c321 0001-acfpasswd-new-tool-to-set-passwords-from-comman-line.patch"