This file is indexed.

/usr/sbin/blend-role is in blends-common 0.6.92.2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
#
# $Id$

usage () {
   echo "Usage:  `basename $0` <action> <Blend> [<role>]"
   echo "action: add|del"
   echo "Blend:  `getBlendList|tr ' ' '|'`"
   echo "role:   `getBlendList|tr ' ' '|'` (default: Blend name)"
}


# the base dir for Blend conffiles, where script expects to find dirs named like
# each registered Blend 
CONFBASE=${CONFBASE:-/etc/blends}

. ${CONFBASE}/blends.conf

# Check consistency of passed arguments
if [ $# -eq 0 ]; then
   usage
   exit 67 # EX_USAGE
fi
if [ "`toLower $1`" != "add" -a "`toLower $1`" != "del" ] ; then
   echo "Missing or wrong action name."
   echo
   usage
   exit 67 # EX_USAGE
fi
if [ -z "$2" ] ; then
   echo "Missing Blend name."
   echo
   usage
   exit 67 # EX_USAGE
fi


ACTION=`toLower $1`
BLEND=$2
ROLE=${3:-${BLEND}}

# Now that we know the selected Blend, we can check if there is a local
# configuration for it (ie differnt backend from the default one)
test -n "${BLEND}" -a  -f ${CONFBASE}/${BLEND}/${BLEND}.conf &&
	. ${CONFBASE}/${BLEND}/${BLEND}.conf


if [ -n "${DBBACKEND}" ]; then
	set -e
	checkBlend ${BLEND} || blendFail $? "Debian Pure Blend ${BLEND} does not exist"

	if [ "${ACTION}" = "add" ]; then
		checkBlend ${BLEND} || blendFail $? "Blend ${BLEND} does not exist"
		checkRole ${ROLE} && blendFail $? "Role ${ROLE} currently exist"
		checkRoleInBlend ${BLEND} ${ROLE} || \
			blendFail $? "Blend (${BLEND}) and Role (${ROLE}) are not correct or incompatible with the selected backend"

		addRole ${BLEND} ${ROLE} || \
			blendFail $? "Failed to add role ${ROLE}"
	elif [ "${ACTION}" = "del" ]; then
		checkBlend ${BLEND} || blendFail $? "Blend ${BLEND} doesn't exist"
		checkRole ${ROLE} || blendFail $? "Role ${ROLE} doesn't exist"
		checkRoleInBlend ${BLEND} ${ROLE} || \
			blendFail $? "Blend (${BLEND} and Role (${ROLE}) are not correct"

		delRole ${BLEND} ${ROLE} || \
			blendFail $? "Failed to remove role ${ROLE}"
		blendLog Role ${ROLE} successfully registered in Blend ${BLEND}
	fi
	set +e

else
	# EX_USAGE
	blendFail 67 "You chose to not use Roles"
fi