mblaze: remove contrib

Use upstream version instead.
This commit is contained in:
Lucas 2021-01-16 18:54:30 +00:00
parent 2c86e788e9
commit febb52129e
5 changed files with 2 additions and 111 deletions

View File

@ -15,22 +15,20 @@
PREFIX = ${HOME}/.mblaze PREFIX = ${HOME}/.mblaze
BIN = m mless mrm BIN = m mless mrm
CONTRIB = contrib/mencrypt contrib/mgpg contrib/msign contrib/mverify
all: ${BIN} all: ${BIN}
clean: clean:
rm -f ${BIN} rm -f ${BIN}
install: all env mlesskey mless-key-handler ${CONTRIB} install: all env mlesskey mless-key-handler
mkdir -pm 700 ${PREFIX} mkdir -pm 700 ${PREFIX}
lesskey -o ${PREFIX}/mless mlesskey lesskey -o ${PREFIX}/mless mlesskey
cp -f env mless-key-handler ${PREFIX} cp -f env mless-key-handler ${PREFIX}
mkdir -p ${PREFIX}/bin mkdir -p ${PREFIX}/bin
cp -f ${BIN} ${PREFIX}/bin cp -f ${BIN} ${PREFIX}/bin
cp -f ${CONTRIB} ${PREFIX}/bin
cd ${PREFIX}/bin && chmod 555 ${BIN} cd ${PREFIX}/bin && chmod 555 ${BIN}
uninstall: uninstall:
cd ${PREFIX}/bin && rm -f ${BIN} ${CONTRIB} cd ${PREFIX}/bin && rm -f ${BIN}
rm -f ${PREFIX}/env ${PREFIX}/mless ${PREFIX}/mless-key-handler rm -f ${PREFIX}/env ${PREFIX}/mless ${PREFIX}/mless-key-handler

View File

@ -1,28 +0,0 @@
#!/bin/sh
# mencrypt PLAINMSG - generate a PGP/MIME signed and encrypted message
[ -f "$1" ] || exit 1
IFS='
'
FLAGS=$(maddr -a -h from:to:cc:bcc: "$1" |sort -u |sed 's/^/--recipient=/')
FROM=$(maddr -a -h from "$1" | sed 1q)
[ "$FROM" ] && key="--default-key=$FROM"
TMPD=$(mktemp -d -t mencrypt.XXXXXX)
trap "rm -rf '$TMPD'" INT TERM EXIT
awk '/^$/,0' "$1" |
mmime |
gpg2 "$key" --armor --encrypt --sign $FLAGS -o "$TMPD/msg.asc" ||
exit $?
printf 'Version: 1\n' >"$TMPD/version"
{
sed '/^$/q' "$1"
printf '#application/pgp-encrypted %s/version\n' "$TMPD"
printf '#application/octet-stream %s/msg.asc\n' "$TMPD"
} |
mmime -t 'multipart/encrypted; protocol="application/pgp-encrypted"'

View File

@ -1,20 +0,0 @@
#!/bin/sh -e
tmp=$(mktemp -t mgpg.XXXXXX)
trap "rm -f '$tmp'" INT TERM EXIT
{
echo "Content-Type: $PIPE_CONTENTTYPE"
echo
cat
} > "$tmp"
n=$(mshow -t "$tmp" | awk -F: '
/: application\/pgp-encrypted/ {supported = 1}
/: application\/octet-stream/ {if (supported) print $1}')
if [ "$n" ]; then
mshow -O "$tmp" "$n" | gpg2 -d 2>&1 || exit 0
exit 64
fi
exit 63

View File

@ -1,25 +0,0 @@
#!/bin/sh
# msign PLAINMSG - generate a PGP/MIME signed message
[ -f "$1" ] || exit 1
IFS='
'
TMPD=$(mktemp -d -t msign.XXXXXX)
trap "rm -rf '$TMPD'" INT TERM EXIT
FROM=$(maddr -a -h from "$1" | sed 1q)
[ "$FROM" ] && key="--default-key=$FROM"
awk '/^$/,0' "$1" | mmime | sed 's/$/ /' >"$TMPD"/content
gpg2 $key --armor --detach-sign -o "$TMPD"/signature.asc "$TMPD"/content ||
exit $?
{
sed '/^$/q' "$1"
printf '#mblaze/raw %s/content\n' "$TMPD"
printf '#application/pgp-signature %s/signature.asc\n' "$TMPD"
} |
mmime -t 'multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"'

View File

@ -1,34 +0,0 @@
#!/bin/sh
# mverify MSG - verify a OpenPGP or SMIME message
# Needs gpg2 (for OpenPGP) and openssl (for SMIME).
[ "$#" -eq 0 ] && set -- .
mshow -t "$1" | DOS2UNIX='/ $/!s/$/ /' awk -v "msg=$1" '
{ match($0, "^ *"); indent = RLENGTH }
$2 == "text/plain" { plain++ }
$2 == "multipart/signed" { signed = 0+$1; si = indent; next }
signed && !content && indent == si+2 { content = 0+$1; next }
signed && content && !signature && indent == si+2 { signature = 0+$1; type = $2 }
function q(a) { gsub("\\47", "\47\\\47\47", a); return "\47"a"\47" }
END {
if (type == "" && plain) { // guess plain text armored signature
exit(system("mshow -r " q(msg) " | gpg2 --verify"));
} else if (type == "") {
print("No signature found.")
exit(100)
} else if (type == "application/pgp-signature") {
exit(system("mshow -r -O " q(msg) " " q(content) \
" | sed $DOS2UNIX | " \
" { mshow -O " q(msg) " " q(signature) \
" | gpg2 --verify - /dev/fd/3; } 3<&0"))
} else if (type == "application/pkcs7-signature") {
exit(system("mshow -r -O " q(msg) " " q(signed) \
" | openssl smime -verify"))
} else {
print("Cannot verify signatures of type " type ".")
exit(2)
}
}
'