mirror of
https://codeberg.org/fairyglade/ly.git
synced 2026-08-09 15:19:13 +02:00
feat: added username to default config, and changed loop to always add
root even if not in whitelist
This commit is contained in:
parent
3777d0801c
commit
7b4ef7e2af
2 changed files with 11 additions and 6 deletions
|
|
@ -200,7 +200,7 @@ fg = 0x00FFFFFF
|
|||
# TB_WHITE 0x0008
|
||||
# If full color is off, the styling options still work. The colors are
|
||||
# always 32-bit values with the styling in the most significant byte.
|
||||
# Note: If using the dur_file animation option and the dur file's color range
|
||||
# Note: If using the dur_file animation option and the dur file's color range
|
||||
# is saved as 256 with this option disabled, the file will not be drawn.
|
||||
full_color = true
|
||||
|
||||
|
|
@ -365,3 +365,6 @@ xinitrc = ~/.xinitrc
|
|||
# You can specify multiple directories,
|
||||
# e.g. $PREFIX_DIRECTORY/share/xsessions:$PREFIX_DIRECTORY/local/share/xsessions
|
||||
xsessions = $PREFIX_DIRECTORY/share/xsessions
|
||||
|
||||
# Whitelist certain usernames
|
||||
# username_whitelist = linus,richard
|
||||
|
|
|
|||
12
src/main.zig
12
src/main.zig
|
|
@ -224,6 +224,8 @@ pub fn main() !void {
|
|||
|
||||
var maybe_uid_range_error: ?anyerror = null;
|
||||
var usernames = try getAllUsernames(allocator, config.login_defs_path, config.username_whitelist, &maybe_uid_range_error);
|
||||
|
||||
|
||||
defer {
|
||||
for (usernames.items) |username| allocator.free(username);
|
||||
usernames.deinit(allocator);
|
||||
|
|
@ -1335,9 +1337,8 @@ fn getAllUsernames(allocator: std.mem.Allocator, login_defs_path: []const u8, us
|
|||
|
||||
while (maybe_entry) |entry| {
|
||||
var valid: bool = true;
|
||||
// Check if not in valid UID range and not o
|
||||
// because we always want to add root as a username (even if you can't log into it)
|
||||
if ((entry.uid < uid_range.uid_min or entry.uid > uid_range.uid_max) and entry.uid != 0) {
|
||||
// Check if not in valid UID range
|
||||
if ((entry.uid < uid_range.uid_min or entry.uid > uid_range.uid_max)) {
|
||||
valid = false;
|
||||
}
|
||||
|
||||
|
|
@ -1346,8 +1347,9 @@ fn getAllUsernames(allocator: std.mem.Allocator, login_defs_path: []const u8, us
|
|||
valid = false;
|
||||
}
|
||||
|
||||
// Valid and not null, add
|
||||
if (valid and entry.username != null) {
|
||||
// Add username if valid or root
|
||||
// We always want to add root (even if you can't log into it)
|
||||
if ((valid or entry.uid == 0) and entry.username != null) {
|
||||
const username = try allocator.dupe(u8, entry.username.?);
|
||||
try usernames.append(allocator, username);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue