This file is indexed.

/usr/sbin/drbl-userdel is in drbl 2.6.15-1.

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
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#!/bin/bash
# Author: Blake, Kuo-Lien Huang
# License: GPL
# Description:
#   * creat and delete accounts for DRBL, actually it for NIS (YP).
#
# Modified by Steven Shiau <steven@nchc.org.tw> to used in DRBL for Redhat

# Load DRBL setting and functions
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"

. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions


# 
check_if_root

# Parse command-line options
while [ $# -gt 0 ]; do
  case "$1" in
    -s|--single)
		format="single"
		shift; username=$1
		shift; groupname=$1
		shift;;
    -r|--range)
		format="range"
		shift; prefix=$1
		shift; start=$1
		shift; end=$1
		shift; groupname=$1
		shift ;;
    -f|--file)  
		format="file"
		shift; filename=$1
		shift ;;
    -l|--list)  
		format="list"
		shift; filename=$1
		shift ;;
    -g|--group)  
		format="group"
		shift; group2del=$1
		shift ;;
    -*)		echo "${0}: ${1}: invalid option" >&2
		echo $USAGE >& 2
		exit 2 ;;
    *)		break ;;
  esac
done

case "$format" in
  single)
        [ -z "$username" ] && echo "No username! Program terminated!" && exit 1
        ;;
  range)
        [ -z "$prefix" ] && echo "No prefix! Program terminated!" && exit 1
        [ -z "$start" ] && echo "No start! Program terminated!" && exit 1
        [ -z "$end" ] && echo "No end! Program terminated!" && exit 1
        ;;
  file)
        [ -z "$filename" ] && echo "No filename! Program terminated!" && exit 1
        ;;
  list)
        [ -z "$filename" ] && echo "No filename! Program terminated!" && exit 1
        ;;
  group)
        [ -z "$group2del" ] && echo "No groupname to delete! Program terminated!" && exit 1
        ;;
  *)
        echo "Usage: "
	echo "Option 1:"
        echo "$0 [-s|--single] <username> <groupname>"
        echo "  delete a single user <username> with group <groupname>"
        echo
        echo "$0 [-r|--range] <prefix> <start> <end> <groupname>"
        echo "  delete a range of users from <prefix><start> to <prefix><end> with group <groupname>,"
	echo "Option 2:"
        echo "$0 [-f|--file] <filename>"
        echo "  delete users that are listed in <filename>."
        echo "  the username/password pairs are listed in $useradd_gen"
        echo 
        echo "  the format of the file <filename>: PREFIX START END GROUPNAME"
        echo "  for example: "
        echo "  # account for student"
        echo "  s		89101	89129  g3c9"
        echo "  # account for teacher"
        echo "  tckps	01	99   teacher"
	echo "Option 3:"
        echo "$0 [-l|--list] <filename>"
        echo "  delete users that are listed in <filename>."
        echo "  the username/password pairs are listed in $useradd_gen"
        echo 
        echo "  the format of the file <filename>: ID GROUPNAME"
        echo "  for example: "
        echo "  # account for student001"
        echo "  student001 g3c9"
        echo "  # account for student002"
        echo "  student002 g3c9"
	echo "Option 4:"
        echo "$0 [-g|--group] <group>"
        echo "  delete users that are in the group."
        exit 1
        ;;
         
esac

# check the necessary files
file_to_be_checked="$useradd_range_exec_file $userdel_range_exec_file $useradd_file_exec_file $userdel_file_exec_file $useradd_list_exec_file $userdel_list_exec_file" 

for ifile in $file_to_be_checked; do 
  if ! type "$ifile" &>/dev/null; then
    echo "No $ifile file!"
    exit 1
  fi
done

userdel_gen_tmp=`mktemp /tmp/userdel.XXXXXX`

# file to store the username and password, clean it first.
[ -f "$userdel_gen" ] && rm -f $userdel_gen

# add/delete single user
case "$format" in
   single)
      # delete single users
         echo -n "Do you also want to clean user's home directory [y/N] ? "
         read clean_home
         case "$clean_home" in
            y|Y|[yY][eE][sS]) 
               echo "Warning! The user's home directory will be deleted! Are you sure ?"
               echo -n "[y/N] "
               read clean_home_confirm
               case "$clean_home_confirm" in
                  y|Y) 
                     RM_HOME_OPT="-r"
                     ;;
                  *)
                     RM_HOME_OPT=""
               esac
               ;;
            *)
               RM_HOME_OPT=""
         esac
         
         if grep "^$username:" /etc/passwd >/dev/null; then
           echo -n "Deleting account $username..."
           /usr/sbin/userdel $RM_HOME_OPT $username
           echo "done!"
         fi
         ;;
      
      range)
         # del a range of users
         echo "Setuping..."
         run_cmd="$userdel_range_exec_file $prefix $start $end $groupname"
         eval "$run_cmd | tee -a $userdel_gen_tmp"
         ;;
      
      file)
         # del users which are listed in file
         echo "Setuping..."
         run_cmd="$userdel_file_exec_file $filename"
         eval "$run_cmd | tee -a $userdel_gen_tmp"
         ;;

      list)
         # del users which are listed line by line in file
         echo "Setuping..."
         run_cmd="$userdel_list_exec_file $filename"
         eval "$run_cmd | tee -a $userdel_gen_tmp"
         ;;

      group)
         # del the users in a group
	 # check if the group2del exist ?
	 user2del=`grep "^$group2del:" /etc/group | awk -F':' '{print $4}' | sed -e "s/,/ /g" `
	 if ! grep "^$group2del:" /etc/group > /dev/null; then
	    echo "The group \"$group2del\" to be killed does not exist!!! Program terminated!"
	    exit 1
         else
	    echo "The usernames for the group \"$group2del\" to be killed are: $user2del, are you sure want to continue ?"
	    echo "[y/N] "
	    read kill_group_confirm
            case "$kill_group_confirm" in
               y|Y|[yY][eE][sS]) 
	          continue
                  ;;
               *)
                  echo "Ok, exit now!"
		  exit 0
            esac
	    
	 fi

         echo -n "Do you also want to clean user's home directory [y/N] ? "
         read clean_home
         case "$clean_home" in
            y|Y|[yY][eE][sS]) 
               echo "Warning! The user's home directory will be deleted! Are you sure ?"
               echo -n "[y/N] "
               read clean_home_confirm
               case "$clean_home_confirm" in
                  y|Y) 
                     RM_HOME_OPT="-r"
                     ;;
                  *)
                     RM_HOME_OPT=""
               esac
               ;;
            *)
               RM_HOME_OPT=""
         esac
         echo -n "Do you also want to clean group [Y/n] ? "
         read clean_group
         case "$clean_group" in
            n|N|[nN][oO]) 
               RM_GROUP_OPT=""
               ;;
            *)
               RM_GROUP_OPT="yes"
         esac
         echo "Setuping..."
	 for iuser in $user2del; do
           echo -n "Deleting account $iuser..."
           /usr/sbin/userdel $RM_HOME_OPT $iuser
           echo "done!"
	 done

         if [ "$RM_GROUP_OPT" = "yes" ]; then
           if grep "^$group2del:" /etc/group >/dev/null; then
             echo -n "Deleting group $group2del..."
             /usr/sbin/groupdel $group2del
             echo "done!"
           fi
         fi
         ;;

esac

#
echo "Now update the NIS data in /var/yp ..."
make -C /var/yp/
echo

#
[ -f "$userdel_gen_tmp" ]  && rm -f $userdel_gen_tmp

echo "Done."
exit 0