This file is indexed.

config is in ejabberd 16.01-2.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

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
#!/bin/sh

set -e

get_passwd()
{
  db_input medium ejabberd/password || true
  db_input medium ejabberd/verify || true
  db_go || true
  db_get ejabberd/password
  PASSWORD="$RET"
  db_get ejabberd/verify
  VERIFY="$RET"
  if [ "$PASSWORD" != "$VERIFY" ]; then
    db_input medium ejabberd/nomatch || true
    db_go || true
    get_passwd
  fi
}

get_credentials()
{
  db_get ejabberd/user
  USER=${RET:-admin}
  db_subst ejabberd/user user "$USER"
  db_get ejabberd/hostname
  HOST=${RET:-hostname}
  db_subst ejabberd/user hostname "$HOST"
  db_input medium ejabberd/user || true
  db_go || true
  db_get ejabberd/user
  if [ -n "$RET" ]; then
    NEWUSER="$RET"

    # Strip the ejabberd hostname
    STRIPDOMAIN=$(echo "$NEWUSER" | awk -v host="@$HOST" 'host{ print $0 }')
    if [ -n "$STRIPDOMAIN" ]; then
      NEWUSER=$(echo "$NEWUSER" | awk -v host="@$HOST" '{ sub(host, ""); print}')
      db_set ejabberd/user "$NEWUSER"
    fi

    # Check for invalid characters
    INVALID=$(echo "$NEWUSER" | awk '/[[:cntrl:]]|[[:space:]]|@|<|>|:|\/|&|\"|\x27/{ print $0 }')
    if [ -n "$INVALID" ]; then
      db_input medium ejabberd/invaliduser || true
      db_go || true
      get_credentials
    else
      get_passwd
    fi
  fi
}

# Source debconf library.
. /usr/share/debconf/confmodule

db_input medium ejabberd/hostname || true
db_go || true

FLAG="/var/lib/ejabberd/.admin_registered"
if [ ! -f $FLAG ]; then
  get_credentials
fi

exit 0