mirror of https://github.com/fairyglade/ly.git
authenticate and run on current virtual terminal
This commit is contained in:
parent
6d3808553e
commit
ab462e91c2
|
|
@ -6,6 +6,10 @@ pub const termbox = @cImport({
|
||||||
@cInclude("termbox.h");
|
@cInclude("termbox.h");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
pub const vt = @cImport({
|
||||||
|
@cInclude("linux/vt.h");
|
||||||
|
});
|
||||||
|
|
||||||
pub const pam = @cImport({
|
pub const pam = @cImport({
|
||||||
@cInclude("security/pam_appl.h");
|
@cInclude("security/pam_appl.h");
|
||||||
});
|
});
|
||||||
|
|
@ -44,6 +48,7 @@ pub const passwd = extern struct {
|
||||||
pw_shell: [*:0]u8,
|
pw_shell: [*:0]u8,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pub const VT_GETSTATE: c_int = 0x5603;
|
||||||
pub const VT_ACTIVATE: c_int = 0x5606;
|
pub const VT_ACTIVATE: c_int = 0x5606;
|
||||||
pub const VT_WAITACTIVE: c_int = 0x5607;
|
pub const VT_WAITACTIVE: c_int = 0x5607;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -526,6 +526,11 @@ pub fn main() !void {
|
||||||
defer shared_err.deinit();
|
defer shared_err.deinit();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
// This will set the current active VT as our TTY.
|
||||||
|
var vtstat: interop.vt.vt_stat = undefined;
|
||||||
|
_ = std.c.ioctl(std.c.STDIN_FILENO, interop.VT_GETSTATE, &vtstat);
|
||||||
|
config.tty = @intCast(vtstat.v_active);
|
||||||
|
|
||||||
const login_text = try allocator.dupeZ(u8, login.text.items);
|
const login_text = try allocator.dupeZ(u8, login.text.items);
|
||||||
defer allocator.free(login_text);
|
defer allocator.free(login_text);
|
||||||
const password_text = try allocator.dupeZ(u8, password.text.items);
|
const password_text = try allocator.dupeZ(u8, password.text.items);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue