8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek/***
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek This file is part of systemd.
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek Copyright 2016 Zbigniew Jędrzejewski-Szmek
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek systemd is free software; you can redistribute it and/or modify it
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek under the terms of the GNU Lesser General Public License as published by
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek the Free Software Foundation; either version 2.1 of the License, or
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek (at your option) any later version.
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek systemd is distributed in the hope that it will be useful, but
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek WITHOUT ANY WARRANTY; without even the implied warranty of
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek Lesser General Public License for more details.
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek You should have received a copy of the GNU Lesser General Public License
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek along with systemd; If not, see <http://www.gnu.org/licenses/>.
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek***/
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek#include "alloc-util.h"
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek#include "ask-password-api.h"
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek#include "log.h"
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmekstatic void ask_password(void) {
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek int r;
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek _cleanup_free_ char *ret;
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek r = ask_password_tty("hello?", "da key", 0, 0, NULL, &ret);
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek assert(r >= 0);
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek log_info("Got %s", ret);
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek}
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmekint main(int argc, char **argv) {
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek log_parse_environment();
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek ask_password();
8a1baa3ad1b93165eac35abcb230d95c75a9bf06Zbigniew Jędrzejewski-Szmek}