diff --git a/res/config.ini b/res/config.ini index 52fb15d..1441c2c 100644 --- a/res/config.ini +++ b/res/config.ini @@ -267,6 +267,11 @@ lang = en # You can also set environment variables in there, they'll persist until logout login_cmd = null +# SHELL to use when logging in +# If null, it will use the default login shell +# Important: it must be an absolute path! +login_shell = null + # Path for login.defs file (used for listing all local users on the system on # Linux) login_defs_path = /etc/login.defs diff --git a/src/auth.zig b/src/auth.zig index 8bd7621..1fedbf4 100644 --- a/src/auth.zig +++ b/src/auth.zig @@ -19,6 +19,7 @@ pub const AuthOptions = struct { xauth_cmd: []const u8, setup_cmd: []const u8, login_cmd: ?[]const u8, + login_shell: ?[]const u8, x_cmd: []const u8, session_pid: std.posix.pid_t, }; @@ -417,7 +418,7 @@ fn executeX11Cmd(log_file: *LogFile, allocator: std.mem.Allocator, shell: []cons var buf: [4]u8 = undefined; const display_name = try std.fmt.bufPrint(&buf, ":{d}", .{display_num}); - const shell_z = try allocator.dupeZ(u8, shell); + const shell_z = try allocator.dupeZ(u8, options.login_shell orelse shell); defer allocator.free(shell_z); try log_writer.writeAll("[x11] creating xauth file\n"); @@ -491,7 +492,7 @@ fn executeCmd(global_log_file: *LogFile, allocator: std.mem.Allocator, shell: [] } defer if (maybe_log_file) |log_file| log_file.close(); - const shell_z = try allocator.dupeZ(u8, shell); + const shell_z = try allocator.dupeZ(u8, options.login_shell orelse shell); defer allocator.free(shell_z); var cmd_buffer: [1024]u8 = undefined; diff --git a/src/config/Config.zig b/src/config/Config.zig index e9169bd..8d3a2dd 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -66,6 +66,7 @@ initial_info_text: ?[]const u8 = null, input_len: u8 = 34, lang: []const u8 = "en", login_cmd: ?[]const u8 = null, +login_shell: ?[]const u8 = null, login_defs_path: []const u8 = "/etc/login.defs", logout_cmd: ?[]const u8 = null, ly_log: []const u8 = "/var/log/ly.log", diff --git a/src/main.zig b/src/main.zig index 8565c9a..9b952e2 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1084,6 +1084,7 @@ pub fn main() !void { .xauth_cmd = config.xauth_cmd, .setup_cmd = config.setup_cmd, .login_cmd = config.login_cmd, + .login_shell = config.login_shell, .x_cmd = config.x_cmd, .session_pid = session_pid, };