2014-09-15 20:22:02 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2013 Bryan Christ <bryan.christ@mediafire.com>
|
2014-09-16 12:40:52 +02:00
|
|
|
* 2014 Johannes Schauer <j.schauer@email.de>
|
2014-09-15 20:22:02 +02:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
|
* under the terms of the GNU General Public License version 2, as published by
|
|
|
|
|
* the Free Software Foundation.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
|
* more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc., 51
|
|
|
|
|
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2014-09-18 09:11:00 +02:00
|
|
|
#include <inttypes.h>
|
2014-09-20 09:40:59 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <stdio.h>
|
2014-09-18 09:11:00 +02:00
|
|
|
|
|
|
|
|
#include "../mfshell.h"
|
2014-09-20 09:40:59 +02:00
|
|
|
#include "../../mfapi/mfconn.h"
|
2014-09-20 10:59:54 +02:00
|
|
|
#include "../commands.h" // IWYU pragma: keep
|
2014-09-15 20:00:05 +02:00
|
|
|
|
2014-09-20 10:59:54 +02:00
|
|
|
int mfshell_cmd_debug(mfshell * mfshell, int argc, char **argv)
|
2014-09-15 20:00:05 +02:00
|
|
|
{
|
2014-09-19 09:21:28 +02:00
|
|
|
(void)argv;
|
2014-09-16 12:40:52 +02:00
|
|
|
if (argc != 1) {
|
|
|
|
|
fprintf(stderr, "Invalid number of arguments\n");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-20 10:59:54 +02:00
|
|
|
printf(" %-15.15s %s\n\r", "server:", mfshell->server);
|
2014-09-15 20:00:05 +02:00
|
|
|
|
2014-09-20 10:59:54 +02:00
|
|
|
const char *session_token = mfconn_get_session_token(mfshell->conn);
|
|
|
|
|
const char *secret_time = mfconn_get_secret_time(mfshell->conn);
|
|
|
|
|
uint32_t secret_key = mfconn_get_secret_key(mfshell->conn);
|
2014-09-15 20:00:05 +02:00
|
|
|
|
2014-09-20 10:59:54 +02:00
|
|
|
if (session_token != NULL && secret_time != NULL) {
|
|
|
|
|
printf(" %-15.15s %" PRIu32 "\n\r", "secret key:", secret_key);
|
2014-09-15 20:00:05 +02:00
|
|
|
|
2014-09-20 10:59:54 +02:00
|
|
|
printf(" %-15.15s %s\n\r", "secret time:", secret_time);
|
|
|
|
|
|
|
|
|
|
printf(" %-15.15s %s\n\r", "status:", "Authenticated");
|
|
|
|
|
} else {
|
|
|
|
|
printf(" %-15.15s %s\n\r", "status:", "Not authenticated");
|
2014-09-15 20:00:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|