This file is indexed.

/usr/include/usbauth/generic.h is in libusbauth-configparser-dev 1.0~git20180214-1.

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

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
/*
 * Copyright (c) 2015 SUSE LLC. All Rights Reserved.
 * Author: Stefan Koch <skoch@suse.de>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of version 2.1 of the GNU Lesser General
 * Public License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, contact SUSE LLC.
 *
 * To contact SUSE about this file by physical or electronic mail,
 * you may find current contact information at www.suse.com
 */

/*
 * Description : Generic Header File for usbauth components
 */

#ifndef GENERIC_H_
#define GENERIC_H_


#include <inttypes.h>
#include <stdint.h>
#include <stdbool.h>

enum Parameter {
	INVALID, busnum, devpath, idVendor, idProduct, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bConfigurationValue, bNumInterfaces, bInterfaceNumber, bInterfaceClass, bInterfaceSubClass, bInterfaceProtocol, bNumEndpoints, bcdDevice, speed, devnum, serial, manufacturer, product, connectType, intfcount, devcount, PARAM_NUM_ITEMS
};

enum Operator { eq, neq, lt, gt, l, g, OP_NUM_ITEMS };

// structure for parameters, example bInterfaceNumber==01
struct Data {
	bool anyChild; // if true parse parameter for the devices interfaces, too. example match bInterfaceProtocol==1 for all devices interfaces (the parameter is only at intf 0, so it would returned at intf 1 as well)
	enum Parameter param;
	enum Operator op;
	const char* val;
};

enum Type { COMMENT, DENY, ALLOW, COND };

// structure for an rule or condition
struct Auth {
	enum Type type;
	unsigned devcount; // counts how much devices affected by rule/cond
	unsigned intfcount; // counts how much interfaces affected by rule/cond
	unsigned attr_len;
	struct Data *attr_array; // used for rules and the case section of conditions
	unsigned cond_len;
	struct Data *cond_array; // used for conditions
	const char *comment;
};

// used as return structure to check if attr or conds matched
struct match_ret {
	bool match_attrs:1;
	bool match_conds:1;
	bool match_attrs_nocnts:1;
};

// used as return structure to check if rule/cond matches and the device should allowed or denied
struct auth_ret {
	bool match:1;
	bool allowed:1;
};

#endif /* GENERIC_H_ */