Commit d1568ea6 authored by Johannes Schilling's avatar Johannes Schilling
Browse files

first rust lang tests, does pam auth already

parent c90b7a44
This diff is collapsed.
[package]
name = "cip-displaymanager"
version = "0.1.0"
authors = ["Johannes Schilling <of82ecuq@cip.cs.fau.de>"]
[dependencies]
pam-auth = "0.2.0"
##rust-ini = "*"
## for testing the latest feature/bugfix
rust-ini = { git = "https://github.com/zonyitoo/rust-ini.git" }
glob = "*"
## all these are conrod dependencies
conrod = "*"
bitflags = "*"
clock_ticks = "0.0.6"
elmesque = "0.9.0"
json_io = "0.1.2"
petgraph = "0.1.10"
pistoncore-input = "0.8.0"
piston2d-graphics = "0.10.0"
num = "*"
rand = "*"
rustc-serialize = "*"
vecmath = "0.2.0"
piston = "0.13.0"
## das hier sollte eig.
## [dev-dependencies]
## sein, dann geht's aber kaputt und findet's nicht, nicht ganz sicher was der
## unterschied is, und warum's zwei dinge gibt
find_folder = "0.2.0"
gfx = "0.7.1"
gfx_device_gl = "0.5.0"
piston-viewport = "0.2.0"
piston_window = "0.23.0"
piston2d-gfx_graphics = "0.10.0"
piston2d-opengl_graphics = "0.14.0"
pistoncore-glutin_window = "0.15.0"
use std::io::{self, Read, Write};
use std::env;
extern crate pam_auth;
extern crate piston;
#[macro_use] extern crate conrod;
extern crate find_folder;
extern crate graphics;
extern crate opengl_graphics;
extern crate glutin_window;
extern crate vecmath;
use opengl_graphics::{GlGraphics, OpenGL};
use glutin_window::GlutinWindow;
use piston::window::{WindowSettings, Size};
use piston::event_loop::{Events, EventLoop};
extern crate ini;
use ini::Ini;
extern crate glob;
pub fn main() {
// load Xsessions
for p in glob::glob("/usr/share/xsessions/*.desktop").unwrap() {
if let Ok(path) = p {
let conf = Ini::load_from_file(path.to_str().unwrap());
match conf {
Ok(c) => {
println!("ok for file {}", path.to_str().unwrap());
for (sec, prop) in c.iter() {
println!("Section: {:?}", sec);
for (key, value) in prop.iter() {
println!("{:?}:{:?}", key, value);
}
}
println!("\n\n");
}
Err(e) => {
println!("error in file {}: {}", path.to_str().unwrap(), e);
}
}
}
}
return;
// init gui
// from conrod examples
let opengl = OpenGL::V3_2;
let window: GlutinWindow =
WindowSettings::new(
"Hello Conrod".to_string(),
Size { width: 1100, height: 550 }
)
.opengl(opengl)
.exit_on_esc(true)
.samples(4)
.build()
.unwrap();
let event_iter = window.events().ups(60).max_fps(60);
let mut gl = GlGraphics::new(opengl);
// end conrod examples
// do pam auth
let service = "cip-displaymanager";
let user = "of82ecuq";
print!("> ");
io::stdout().flush();
let mut pwbuffer : String = String::new();
io::stdin().read_line(&mut pwbuffer);
let mut auth = pam_auth::Authenticator::new(service).unwrap();
auth.set_credentials(user, pwbuffer.trim());
if auth.authenticate().is_ok() && auth.open_session().is_ok() {
println!("Successfully opened a session!");
}
else {
println!("Authentication failed =/");
}
// now do actual stuff
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment