Esempio n. 1
0
int main(int argc, char **argv)
{
	GtkWidget *window;
	char *cmd;

	gtk_init(&argc, &argv);
	gtk_window_set_default_icon_from_file(
		DATA_DIR "/pixmaps/stoken-gui.png", NULL);

	cmd = parse_cmdline(argc, argv, IS_GUI);

	/* check for a couple of error conditions */

	if (common_init(cmd))
		error_dialog("Application error",
			"Unable to initialize crypto library.");

	if (!current_token)
		error_dialog("Missing token",
			"Please use 'stoken import' to add a new seed.");

	if (securid_devid_required(current_token))
		error_dialog("Unsupported token",
			"Please use 'stoken' to handle tokens encrypted with a device ID.");

	/* check for token expiration */
	token_days_left = securid_check_exp(current_token, time(NULL));
	if (!opt_force && !opt_small) {
		if (token_days_left < 0)
			error_dialog("Token expired",
				"Please obtain a new token from your administrator.");

		if (token_days_left < EXP_WARN_DAYS) {
			char msg[BUFLEN];

			sprintf(msg, "This token will expire in %d day%s.",
				token_days_left,
				token_days_left == 1 ? "" : "s");
			warning_dialog(NULL, "Expiration warning", msg);
		}
	}

	/* request password / PIN, if missing */
	if (request_credentials(current_token) != ERR_NONE)
		return 1;

	token_interval = securid_token_interval(current_token);
	token_uses_pin = securid_pin_required(current_token);

	window = opt_small ? create_small_app_window() : create_app_window();

	update_tokencode(NULL);
	gtk_widget_show_all(window);

	g_timeout_add(250, update_tokencode, NULL);
	gtk_main();

	return 0;
}
Esempio n. 2
0
FTK_HIDE int FTK_MAIN(int argc, char* argv[])
{
	FTK_INIT(argc, argv);
	
	create_app_window();

	FTK_RUN();

	return 0;
}
Esempio n. 3
0
static Ret button_open_clicked(void* ctx, void* obj)
{
	create_app_window();

	return RET_OK;
}