Skip to content

Commit 74395c8

Browse files
Attila LakatosCropi
authored andcommitted
style: apply astyle formatting to all project source files
Fix 17 files that diverged from the astyle configuration in src/astylerc. Excludes ThirdParty, protobuf-generated, and build-config.h as the check-driver.sh test does. Signed-off-by: Attila Lakatos <atttila.lakatos@gmail.com>
1 parent 8d4ebe9 commit 74395c8

17 files changed

Lines changed: 90 additions & 90 deletions

src/Common/Utility.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -564,18 +564,18 @@ namespace usbguard
564564

565565
if (('\0' == *s) ||
566566
!((('a' <= *s) && ('z' >= *s)) ||
567-
(('A' <= *s) && ('Z' >= *s)) ||
568-
('_' == *s))) {
567+
(('A' <= *s) && ('Z' >= *s)) ||
568+
('_' == *s))) {
569569
return false;
570570
}
571571

572572
while ('\0' != *++s) {
573573
if (!((('a' <= *s) && ('z' >= *s)) ||
574-
(('A' <= *s) && ('Z' >= *s)) ||
575-
(('0' <= *s) && ('9' >= *s)) ||
576-
('_' == *s) ||
577-
('-' == *s) ||
578-
(('$' == *s) && ('\0' == *(s + 1))))) {
574+
(('A' <= *s) && ('Z' >= *s)) ||
575+
(('0' <= *s) && ('9' >= *s)) ||
576+
('_' == *s) ||
577+
('-' == *s) ||
578+
(('$' == *s) && ('\0' == *(s + 1))))) {
579579
return false;
580580
}
581581
}

src/DBus/DBusBridge.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ namespace usbguard
261261
gboolean permanent = false;
262262
g_variant_get(parameters, "(uub)", &device_id, &target_integer, &permanent);
263263
USBGUARD_LOG(Debug) << "DBus: applyDevicePolicy: Parsed device_id: " << device_id << " target_integer: " << target_integer <<
264-
" and permanent: " << permanent;
264+
" and permanent: " << permanent;
265265
const Rule::Target target = Rule::targetFromInteger(target_integer);
266266
const uint32_t rule_id = applyDevicePolicy(device_id, target, permanent);
267267
g_dbus_method_invocation_return_value(invocation, g_variant_new("(u)", rule_id));
@@ -298,11 +298,11 @@ namespace usbguard
298298
g_dbus_connection_emit_signal(p_gdbus_connection, nullptr,
299299
DBUS_DEVICES_PATH, DBUS_DEVICES_INTERFACE, "DevicePresenceChanged",
300300
g_variant_new("(uuusa{ss})",
301-
id,
302-
DeviceManager::eventTypeToInteger(event),
303-
Rule::targetToInteger(target),
304-
device_rule.c_str(),
305-
gv_builder_attributes),
301+
id,
302+
DeviceManager::eventTypeToInteger(event),
303+
Rule::targetToInteger(target),
304+
device_rule.c_str(),
305+
gv_builder_attributes),
306306
nullptr);
307307

308308
if (gv_builder_attributes != nullptr) {
@@ -320,12 +320,12 @@ namespace usbguard
320320
g_dbus_connection_emit_signal(p_gdbus_connection, nullptr,
321321
DBUS_DEVICES_PATH, DBUS_DEVICES_INTERFACE, "DevicePolicyChanged",
322322
g_variant_new("(uuusua{ss})",
323-
id,
324-
Rule::targetToInteger(target_old),
325-
Rule::targetToInteger(target_new),
326-
device_rule.c_str(),
327-
rule_id,
328-
gv_builder_attributes),
323+
id,
324+
Rule::targetToInteger(target_old),
325+
Rule::targetToInteger(target_new),
326+
device_rule.c_str(),
327+
rule_id,
328+
gv_builder_attributes),
329329
nullptr);
330330

331331
if (gv_builder_attributes != nullptr) {
@@ -342,11 +342,11 @@ namespace usbguard
342342
g_dbus_connection_emit_signal(p_gdbus_connection, nullptr,
343343
DBUS_DEVICES_PATH, DBUS_DEVICES_INTERFACE, "DevicePolicyApplied",
344344
g_variant_new("(uusua{ss})",
345-
id,
346-
Rule::targetToInteger(target_new),
347-
device_rule.c_str(),
348-
rule_id,
349-
gv_builder_attributes),
345+
id,
346+
Rule::targetToInteger(target_new),
347+
device_rule.c_str(),
348+
rule_id,
349+
gv_builder_attributes),
350350
nullptr);
351351

352352
if (gv_builder_attributes != nullptr) {
@@ -361,9 +361,9 @@ namespace usbguard
361361
g_dbus_connection_emit_signal(p_gdbus_connection, nullptr,
362362
DBUS_ROOT_PATH, DBUS_ROOT_INTERFACE, "PropertyParameterChanged",
363363
g_variant_new("(sss)",
364-
name.c_str(),
365-
value_old.c_str(),
366-
value_new.c_str()),
364+
name.c_str(),
365+
value_old.c_str(),
366+
value_new.c_str()),
367367
nullptr);
368368
}
369369

@@ -374,9 +374,9 @@ namespace usbguard
374374
g_dbus_connection_emit_signal(p_gdbus_connection, nullptr,
375375
DBUS_ROOT_PATH, DBUS_ROOT_INTERFACE, "ExceptionMessage",
376376
g_variant_new("(sss)",
377-
context.c_str(),
378-
object.c_str(),
379-
reason.c_str()),
377+
context.c_str(),
378+
object.c_str(),
379+
reason.c_str()),
380380
nullptr);
381381
}
382382

@@ -519,7 +519,7 @@ namespace usbguard
519519
USBGUARD_LOG(Trace) << "Checking authorization of action \"" << action_id.str() << "\" with Polkit ...";
520520
GDBusMessage* const message = g_dbus_method_invocation_get_message (invocation);
521521
const PolkitCheckAuthorizationFlags flags = (g_dbus_message_get_flags (message) &
522-
G_DBUS_MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION)
522+
G_DBUS_MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION)
523523
? POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION
524524
: POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE;
525525
PolkitAuthorizationResult* const result = polkit_authority_check_authorization_sync

src/Daemon/Daemon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ namespace usbguard
865865
const Rule::Target target_old = device->getTarget();
866866
std::shared_ptr<Device> device_post = \
867867
_dm->applyDevicePolicy(device->getID(),
868-
matched_rule->getTarget());
868+
matched_rule->getTarget());
869869
const bool target_changed = target_old != device_post->getTarget();
870870
std::shared_ptr<const Rule> device_rule = \
871871
device_post->getDeviceRule(/*with_port=*/true,

src/Daemon/LDAPHandler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ namespace usbguard
8787
passwd.bv_val = strdup(_parsedOptions["ROOTPW"].c_str());
8888
passwd.bv_len = _parsedOptions["ROOTPW"].length();
8989
rc = ldap_sasl_bind_s(_ldap_ptr.get(), _parsedOptions["ROOTDN"].c_str(), LDAP_SASL_SIMPLE,
90-
&passwd, nullptr, nullptr, nullptr);
90+
&passwd, nullptr, nullptr, nullptr);
9191
free(passwd.bv_val);
9292

9393
if (rc != LDAP_SUCCESS) {
@@ -116,8 +116,8 @@ namespace usbguard
116116
USBGUARD_LOG(Debug) << "Trying to fetch LDAP data, query: " << filter;
117117
LDAPMessage* res = nullptr;
118118
int rc = ldap_search_ext_s(_ldap_ptr.get(), _parsedOptions["USBGUARDBASE"].c_str(),
119-
LDAP_SCOPE_SUBTREE, filter.c_str(), nullptr, false,
120-
nullptr, nullptr, nullptr, 0, &res);
119+
LDAP_SCOPE_SUBTREE, filter.c_str(), nullptr, false,
120+
nullptr, nullptr, nullptr, 0, &res);
121121

122122
if (rc != LDAP_SUCCESS) {
123123
ldap_msgfree(res);

src/Daemon/Seccomp.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ bool setupSeccompWhitelist(void)
7171
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(mmap), 0);
7272
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(munmap), 0);
7373
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(mprotect), 1,
74-
SCMP_A2(SCMP_CMP_EQ, PROT_NONE));
74+
SCMP_A2(SCMP_CMP_EQ, PROT_NONE));
7575
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(mprotect), 1,
76-
SCMP_A2(SCMP_CMP_EQ, PROT_READ));
76+
SCMP_A2(SCMP_CMP_EQ, PROT_READ));
7777
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(mprotect), 1,
78-
SCMP_A2(SCMP_CMP_EQ, PROT_WRITE));
78+
SCMP_A2(SCMP_CMP_EQ, PROT_WRITE));
7979
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(mprotect), 1,
80-
SCMP_A2(SCMP_CMP_EQ, PROT_READ|PROT_WRITE));
80+
SCMP_A2(SCMP_CMP_EQ, PROT_READ|PROT_WRITE));
8181
/* clock */
8282
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(clock_gettime), 0);
8383
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(clock_getres), 0);
@@ -99,22 +99,22 @@ bool setupSeccompWhitelist(void)
9999
* getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=4*1024}) = 0
100100
*/
101101
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(getrlimit), 1,
102-
SCMP_A0(SCMP_CMP_EQ, RLIMIT_NOFILE));
102+
SCMP_A0(SCMP_CMP_EQ, RLIMIT_NOFILE));
103103
/* pipes, eventfd */
104104
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(pipe), 0);
105105
/* STRACE:
106106
* eventfd2(0, 0)
107107
*/
108108
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(eventfd2), 2,
109-
SCMP_A0(SCMP_CMP_EQ, 0),
110-
SCMP_A1(SCMP_CMP_EQ, 0));
109+
SCMP_A0(SCMP_CMP_EQ, 0),
110+
SCMP_A1(SCMP_CMP_EQ, 0));
111111
/* socket */
112112
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(socket), 1,
113-
SCMP_A0(SCMP_CMP_EQ, PF_LOCAL),
114-
SCMP_A1(SCMP_CMP_MASKED_EQ, SOCK_STREAM, SOCK_STREAM));
113+
SCMP_A0(SCMP_CMP_EQ, PF_LOCAL),
114+
SCMP_A1(SCMP_CMP_MASKED_EQ, SOCK_STREAM, SOCK_STREAM));
115115
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(socket), 1,
116-
SCMP_A0(SCMP_CMP_EQ, PF_NETLINK),
117-
SCMP_A2(SCMP_CMP_EQ, NETLINK_KOBJECT_UEVENT));
116+
SCMP_A0(SCMP_CMP_EQ, PF_NETLINK),
117+
SCMP_A2(SCMP_CMP_EQ, NETLINK_KOBJECT_UEVENT));
118118
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(bind), 0);
119119
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(accept), 0);
120120
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(listen), 0);
@@ -132,7 +132,7 @@ bool setupSeccompWhitelist(void)
132132
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(capset), 0);
133133
/* allow to drop capabilities using prctl */
134134
ret |= seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(prctl), 1,
135-
SCMP_A0(SCMP_CMP_EQ, PR_CAPBSET_DROP));
135+
SCMP_A0(SCMP_CMP_EQ, PR_CAPBSET_DROP));
136136
#endif /* HAVE_LIBCAPNG */
137137

138138
/* before main() only */

src/Daemon/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ int main(int argc, char* argv[])
147147
/* Initialize logging */
148148
try {
149149
USBGUARD_LOGGER.setEnabled(true, (debug_mode ?
150-
LogStream::Level::Trace
151-
:
152-
LogStream::Level::Warning));
150+
LogStream::Level::Trace
151+
:
152+
LogStream::Level::Warning));
153153
USBGUARD_LOGGER.setOutputConsole(log_console);
154154
USBGUARD_LOGGER.setOutputSyslog(log_syslog, "usbguard-daemon");
155155
USBGUARD_LOGGER.setOutputFile(log_file, log_file_path);

src/Library/IPCClientPrivate.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,10 @@ namespace usbguard
453453
message_out.mutable_request()->set_gid(getgid());
454454
message_out.mutable_request()->set_section(
455455
IPCServer::AccessControl::sectionToString(section)
456-
);
456+
);
457457
message_out.mutable_request()->set_privilege(
458458
IPCServer::AccessControl::privilegeToString(privilege)
459-
);
459+
);
460460
auto message_in = qbIPCSendRecvMessage(message_out);
461461
return message_in->response().permit();
462462
}

src/Library/IPCPrivate.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ namespace usbguard
8787
const IPC::Exception* const exception_message = \
8888
reinterpret_cast<const IPC::Exception*>(message.get());
8989
return IPCException(exception_message->context(),
90-
exception_message->object(),
91-
exception_message->reason(),
92-
exception_message->request_id());
90+
exception_message->object(),
91+
exception_message->reason(),
92+
exception_message->request_id());
9393
}
9494

9595
bool IPC::isExceptionMessage(const MessagePointer& message)

src/Library/IPCServerPrivate.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,9 @@ namespace usbguard
283283
bool IPCServerPrivate::hasACLEntries() const
284284
{
285285
return (!_allowed_uids.empty() \
286-
|| !_allowed_gids.empty() \
287-
|| !_allowed_usernames.empty() \
288-
|| !_allowed_groupnames.empty());
286+
|| !_allowed_gids.empty() \
287+
|| !_allowed_usernames.empty() \
288+
|| !_allowed_groupnames.empty());
289289
}
290290

291291
bool IPCServerPrivate::qbIPCConnectionAllowed(uid_t uid, gid_t gid, IPCServer::AccessControl* const ac_ptr) const
@@ -339,7 +339,7 @@ namespace usbguard
339339

340340
if (rc < 0) {
341341
USBGUARD_LOG(Error) << "An error ocured while sending IPC message to pid=" << qbIPCConnectionClientPID(
342-
qb_conn) << " errno=" << -rc;
342+
qb_conn) << " errno=" << -rc;
343343
/* FALLTHROUGH */
344344
}
345345
else if ((size_t)rc != total_size) {
@@ -499,7 +499,7 @@ namespace usbguard
499499

500500
if (rc < 0) {
501501
USBGUARD_LOG(Error) << "An error ocured while sending IPC message to pid=" << qbIPCConnectionClientPID(
502-
qb_conn) << " errno=" << -rc;
502+
qb_conn) << " errno=" << -rc;
503503
}
504504
else if ((size_t)rc != total_size) {
505505
USBGUARD_LOG(Error) << "Unable to sent complete IPC message to pid=" << qbIPCConnectionClientPID(qb_conn)

src/Library/UEventDeviceManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ namespace usbguard
402402
{
403403
USBGUARD_LOG(Trace);
404404
return loadFiles(SysFSDevice::getSysfsRoot() + "/bus/usb/devices",
405-
UEventDeviceManager::ueventEnumerateFilterDevice,
405+
UEventDeviceManager::ueventEnumerateFilterDevice,
406406
[this](const std::string& devpath, const std::string& buspath) {
407407
return ueventEnumerateTriggerDevice(devpath, buspath);
408408
},

0 commit comments

Comments
 (0)