This file is indexed.

/etc/ppp/ip-down.d/synce-bt-ipdown is in synce-hal-bluetooth 0.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
#!/usr/bin/env python

import sys
import subprocess
import logging, logging.handlers
import ConfigParser

# defaults
config_file = '/etc/synce-hal.conf'
log_level = logging.WARNING


def remove_device(device_ip, iface, device_file):

    udi = "synce_bluetooth_device_"+device_ip.replace(".","_")

    cmd_list = ["hal-device", "--remove", udi]

    logger.debug("removing bluetooth device from hal:")
    logger.debug(cmd_list)

    try:
        proc = subprocess.Popen(cmd_list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
        output_text = proc.communicate()[0]
    except Exception,e:
        logger.error("failure running hal-device: %s" % e)
        return False

    rc = proc.returncode

    # success returns 13
    if rc != 13:
        logger.error("failed to remove bluetooth device in hal, return code %d, %s", (rc, output_text))
        return False

    return True


def ProcessConfig():

    global log_level

    logger = logging.getLogger("synce-bt-ipdown")

    config = ConfigParser.ConfigParser()
    try:
        config.read(config_file)
    except Exception,e:
        logger.warning("failed to parse config file %s: %s" % (config_file, e))
        return False

    if config.has_option('general', 'loglevel'):
        loglevel_txt = config.get('general', 'loglevel').lower()
        if loglevel_txt == 'critical':
            log_level = logging.CRITICAL
        elif loglevel_txt == 'error':
            log_level = logging.ERROR
        elif loglevel_txt == 'warning':
            log_level = logging.WARNING
        elif loglevel_txt == 'info':
            log_level = logging.INFO
        elif loglevel_txt == 'debug':
            log_level = logging.DEBUG
        else:
            logger.warning("found invalid loglevel in config file %s: %s" % (config_file, loglevel_txt))

        logger.setLevel(log_level)

    return True


if __name__ == '__main__':

    log_facility = logging.handlers.SysLogHandler.LOG_DAEMON

    logging.basicConfig(level=logging.WARNING,
                        format='%(asctime)s %(name)s %(levelname)s : %(message)s')
    logger = logging.getLogger("synce-bt-ipdown")
    sys_log = logging.handlers.SysLogHandler("/dev/log", log_facility)
    syslog_form = logging.Formatter('%(name)s[%(process)d] %(levelname)s : %(message)s')
    sys_log.setFormatter(syslog_form)
    logger.addHandler(sys_log)

    iface = sys.argv[1]
    devfile = sys.argv[2]
    speed = sys.argv[3]
    local_ip = sys.argv[4]
    device_ip = sys.argv[5]
    ipparam = sys.argv[6]

    if ipparam != "synce-bt":
        sys.exit(0)

    ProcessConfig()

    if remove_device(device_ip, iface, devfile) == False:
        sys.exit(1)

    sys.exit(0)