Esempio n. 1
1
LoginDialog::LoginDialog()
        : LoginDlgBase(NULL, "logindlg", false, WDestructiveClose)
{
    SET_WNDPROC("login")
    setCaption(caption());
    setButtonsPict(this);
    setIcon(Pict("licq"));
    bLogin = false;
    bMyInit = false;
    cmbUIN->setEditable(true);
    cmbUIN->lineEdit()->setValidator(new QIntValidator(100000, 0x7FFFFFFF, this));
    loadUins();
    edtPasswd->setEchoMode(QLineEdit::Password);
    connect(cmbUIN->lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(uinChanged(const QString&)));
    connect(edtPasswd, SIGNAL(textChanged(const QString&)), this, SLOT(pswdChanged(const QString&)));
    connect(btnClose, SIGNAL(clicked()), this, SLOT(close()));
    connect(btnLogin, SIGNAL(clicked()), this, SLOT(login()));
    connect(btnDelete, SIGNAL(clicked()), this, SLOT(deleteUin()));
    connect(btnProxy, SIGNAL(clicked()), this, SLOT(proxySetup()));
    connect(chkSave, SIGNAL(toggled(bool)), this, SLOT(saveChanged(bool)));
    QSize s = sizeHint();
    QWidget *desktop = QApplication::desktop();
    move((desktop->width() - s.width()) / 2, (desktop->height() - s.height()) / 2);
    chkSave->setChecked(pSplash->isSavePassword());
    chkNoShow->setChecked(pSplash->isNoShowLogin());
    uinChanged("");
    bPswdChanged = true;
    if (pSplash->isSavePassword()){
        unsigned long uin = cmbUIN->lineEdit()->text().toULong();
        if (uin){
            pClient->load(uin);
            QString pswd;
            for (const char *p = pClient->EncryptedPassword.c_str(); *p; p++){
                if (*p == '\\') continue;
                pswd += '*';
            }
            edtPasswd->setText(pswd);
            pswdChanged("");
            if (!pswd.isEmpty()) bPswdChanged = false;
        }
    }
    bCloseMain = true;
};
int main(int argc, char **argv)
{
    int sock = 0;
    int data;
    printf("\nAbility FTP Server <= 2.34 R00T exploit\n");
    printf("by Dark Eagle [ unl0ck team ]\nhttp://unl0ck.void.ru\n\n");

    if ( argc < 4 ) {
        printf("usage: un-aftp.exe <host> <username> <password>\n\n");
        exit(0);
    }

    sock = conn(argv[1], 21);
    login(sock, argv[2], argv[3]);
    closesocket(sock);
    Sleep(2000);

    return 0;
}
Esempio n. 3
0
user *beforechat(SSL **ssl)
{
	user *ret;
	char choice[20];
	SSL *s = *ssl;
	bzero(choice,sizeof(choice));
	
	while(1)
	{
		SSL_read(s,choice,20);
		if(strcmp("LOGIN",choice) == 0)
			if((ret = login(s)) != NULL) 
				return ret;
		if(strcmp("REGISTER",choice) == 0)
			if((ret = user_register(s)) != NULL) 
				return ret;
	}
	return NULL;
}
Esempio n. 4
0
void LoginHandler::showPasswordDialog(const QString &title, const QString &text)
{
	Q_ASSERT(_passwordDialog.isNull());

	if(_selectorDialog)
		_selectorDialog->hide();

	_passwordDialog = new dialogs::LoginDialog(_widgetParent);

	_passwordDialog->setWindowModality(Qt::WindowModal);
	_passwordDialog->setWindowTitle(title);
	_passwordDialog->setIntroText(text);
	_passwordDialog->setUsername(m_address.userName(), false);

	connect(_passwordDialog, SIGNAL(login(QString,QString)), this, SLOT(passwordSet(QString)));
	connect(_passwordDialog, SIGNAL(rejected()), this, SLOT(cancelLogin()));

	_passwordDialog->show();
}
Esempio n. 5
0
int schedule_reading()
{
	int *read_schedule,re_try = 0;
	long read_wait;
	modbus_t *sdl;
	double sdl_data;
	uint16_t *rd_data_registers;
    modbus_t *rd_ctx;
	read_schedule = (int*)malloc(6*sizeof(int));
	rd_data_registers = (uint16_t*)malloc(2*sizeof(uint16_t));
	read_schedule = check_time(read_schedule);
	if((read_schedule[4]>=3) && (read_schedule[4]<=10))
	{
		enable(0);
		initbus(1);
		sleep(1);
		rd_ctx= modbusconnection(rd_ctx);
		sleep(1);
		gotoposition(rd_ctx, 0,rd_data_registers);
		setconfig(9,0);
		wait_for_stop(rd_ctx,rd_data_registers);
		initbus(0);		
sdl_sample:
		sdl = sdl_connection(sdl);	
		if(sdl == NULL)
		{
			if(re_try < 3){re_try++;goto sdl_sample;}
			else 
			{
				login("Failed in connecting in sample duration");						
				setsdl(30000,-100000);
			}
		}
		else 
		{
			sdl_read_sensor(sdl,1,0);
			sleep(30);
			sample_save_data(sdl);
		}
		modbus_close(sdl);
	}
		return 1;
}
Esempio n. 6
0
/*
 * Records that the user has logged in.  I wish these parts of operating
 * systems were more standardized.
 */
void
record_login(pid_t pid, const char *tty, const char *user, uid_t uid,
    const char *host, struct sockaddr *addr, socklen_t addrlen)
{
	int fd;
	struct lastlog ll;
	char *lastlog;
	struct utmp u;

	/* save previous login details before writing new */
	store_lastlog_message(user, uid);

	/* Construct an utmp/wtmp entry. */
	memset(&u, 0, sizeof(u));
	strncpy(u.ut_line, tty + 5, sizeof(u.ut_line));
	u.ut_time = time(NULL);
	strncpy(u.ut_name, user, sizeof(u.ut_name));
	strncpy(u.ut_host, host, sizeof(u.ut_host));

	login(&u);
	lastlog = _PATH_LASTLOG;

	/* Update lastlog unless actually recording a logout. */
	if (strcmp(user, "") != 0) {
		/*
		 * It is safer to bzero the lastlog structure first because
		 * some systems might have some extra fields in it (e.g. SGI)
		 */
		memset(&ll, 0, sizeof(ll));

		/* Update lastlog. */
		ll.ll_time = time(NULL);
		strncpy(ll.ll_line, tty + 5, sizeof(ll.ll_line));
		strncpy(ll.ll_host, host, sizeof(ll.ll_host));
		fd = open(lastlog, O_RDWR);
		if (fd >= 0) {
			lseek(fd, (off_t) ((long) uid * sizeof(ll)), SEEK_SET);
			if (write(fd, &ll, sizeof(ll)) != sizeof(ll))
				logit("Could not write %.100s: %.100s", lastlog, strerror(errno));
			close(fd);
		}
	}
}
Esempio n. 7
0
int main()
{
    int i, j, k, loc, ch1, ch2;
    char tch;
    load_books();
	load_user();
	for(;;)
    {
    	printf("\n1 - creeate new account\n2 - login\n3 - exit\nenter ur choice\n");
    	fflush(stdin);	
	    scanf("%d", &ch1);
		switch(ch1)
           {
                case 1: create();
                        break;
                case 2: loc = login();
                        if(loc == -1)
                               break;
                        else
                        {
                            printf("\n1 - issue book\n2 - deposit book\n3 - update information\n4 - exit\nenter ur choice: ");
                            scanf("%d",&ch2);
                            fflush(stdin);
                            for(;;)
                                      switch(ch2)
                                      {
                                          case 1: issue(loc);
                                               break;
                                          case 2: deposit(loc);
                                               break;
                                          case 3:update(loc);
                                               break;
                                          case 4: break;
                                          default: printf("error in choice....retry\n");
                                      }   
                        }
                        break;
                case 3: exit(0);
                default: printf("\nerror in choice....retry\n");
           }
    }
    write_books();
}
int main(int argc, char **argv)
{
    int sock = 0;
    int data;
    printf("\n--==[ Ability FTP Server <= 2.34 Exploit ]==--\n");
    printf("--==[ by 1N3 @ CrowdShield ]==--\n--==[ https://crowdshield.com ]==--\n");

    if ( argc < 4 ) {
        printf("--==[ Usage: ability_ftp_server_exploit.exe <host> <username> <password>\n\n");
        exit(0);
    }

    sock = conn(argv[1], 21);
    login(sock, argv[2], argv[3]);
    closesocket(sock);
    Sleep(2000);

    return 0;
}
Esempio n. 9
0
static int do_menutree(int argc, char *argv[])
{
	int opt, ret;
	char *path = "/env/menu";

	login();

	while ((opt = getopt(argc, argv, "m:")) > 0) {
		switch (opt) {
		case 'm':
			path = optarg;
			break;
		}
	}

	ret = menutree(path, 1);

	return ret;
}
Esempio n. 10
0
LoginDialog::LoginDialog()
        : QDialog(NULL, NULL, true)
{
    setIcon(Pict("licq"));
    bLogin = false;
    QGridLayout *lay = new QGridLayout(this, 4, 2, 10, 5);
    lblUIN = new QLabel(i18n("UIN:"), this);
    lblUIN->setAlignment(AlignRight | AlignVCenter);
    lay->addWidget(lblUIN, 0, 0);
    edtUIN = new QLineEdit(this);
    edtUIN->setValidator(new QIntValidator(100000, 0x7FFFFFFF, this));
    connect(edtUIN, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    lay->addWidget(edtUIN, 0, 1);
    lblPasswd = new QLabel(i18n("Password:"******"Use existing UIN"), this);
    connect(chkOldUser, SIGNAL(toggled(bool)), this, SLOT(setOldUser(bool)));
    lay->addMultiCellWidget(chkOldUser, 2, 2, 0, 1);
    QHBoxLayout *hLay = new QHBoxLayout();
    lay->addMultiCellLayout(hLay, 3, 3, 0, 1);
    hLay->addStretch();
    btnClose = new QPushButton(i18n("Close"), this);
    connect(btnClose, SIGNAL(clicked()), this, SLOT(close()));
    hLay->addWidget(btnClose);
    hLay->addStretch();
    btnLogin = new QPushButton(i18n("Register"), this);
    btnLogin->setDefault(true);
    connect(btnLogin, SIGNAL(clicked()), this, SLOT(login()));
    hLay->addWidget(btnLogin);
    hLay->addStretch();
    setCaption(i18n("Registration"));
    setOldUser(false);
    textChanged("");
    QSize s = sizeHint();
    QWidget *desktop = QApplication::desktop();
    move((desktop->width() - s.width()) / 2, (desktop->height() - s.height()) / 2);
};
Esempio n. 11
0
File: ii.c Progetto: hedbuz/ii
int main(int argc, char *argv[]) {
	int i;
	unsigned short port = SERVER_PORT;
	struct passwd *spw = getpwuid(getuid());
	char *key = NULL, *fullname = NULL;
	char prefix[_POSIX_PATH_MAX];

	if(!spw) {
		fputs("ii: getpwuid() failed\n", stderr);
		exit(EXIT_FAILURE);
	}
	snprintf(nick, sizeof(nick), "%s", spw->pw_name);
	snprintf(prefix, sizeof(prefix),"%s/irc", spw->pw_dir);
	if (argc <= 1 || (argc == 2 && argv[1][0] == '-' && argv[1][1] == 'h')) usage();

	for(i = 1; (i + 1 < argc) && (argv[i][0] == '-'); i++) {
		switch (argv[i][1]) {
			case 'i': snprintf(prefix,sizeof(prefix),"%s", argv[++i]); break;
			case 's': host = argv[++i]; break;
			case 'p': port = strtol(argv[++i], NULL, 10); break;
			case 'n': snprintf(nick,sizeof(nick),"%s", argv[++i]); break;
			case 'k': key = getenv(argv[++i]); break;
			case 'e': use_ssl = 1; ++i; break;
			case 'f': fullname = argv[++i]; break;
			default: usage(); break;
		}
	}
	if(use_ssl)
		port = port == SERVER_PORT ? SSL_SERVER_PORT : port;
	irc = tcpopen(port);
	if(!snprintf(path, sizeof(path), "%s/%s", prefix, host)) {
		fputs("ii: path to irc directory too long\n", stderr);
		exit(EXIT_FAILURE);
	}
	create_dirtree(path);

	add_channel(""); /* master channel */
	login(key, fullname);
	run();

	return EXIT_SUCCESS;
}
void tst_ServerWorkerTests::logout()
{
    login("testuser2","some_password2");

    LogoutRequest logoutRequest;
    LoginRequestResponse loginResponse;

    logoutRequest.set_logout(true);

    mc->addMessage( &logoutRequest );

    QByteArray ba = mc->toArray();
    worker->readyRead(ba);
    mc->Clear();
    QVERIFY(mc->fromArray(binaryMessage));
    QVERIFY(loginResponse.fromArray(mc->getCapsule(0).getData()));
    QVERIFY(loginResponse.replay() == protbuf::Replay::LogoutOk);
    mc->Clear();
    binaryMessage->clear();
}
Esempio n. 13
0
File: init.c Progetto: dabbers/dabos
int parent()
{
	int count = 0;
  while(1){
    printf("KCINIT : waiting .....\n");

    pid = wait(&status);
	for( count = 0; count < CONSOLES; count++)
	{
		if (pid == children[count])
		{
			children[count] = fork();
			if (!children[count])
			{
				login(consoles[count]);
			}
		}
	}
  }
}
Esempio n. 14
0
FTPClientSession::FTPClientSession(const std::string& host,
	Poco::UInt16 port,
	const std::string& username,
	const std::string& password):
	_host(host),
	_port(port),
	_pControlSocket(new DialogSocket(SocketAddress(host, port))),
	_pDataStream(0),
	_passiveMode(true),
	_fileType(TYPE_BINARY),
	_supports1738(true),
	_serverReady(false),
	_isLoggedIn(false),
	_timeout(DEFAULT_TIMEOUT)
{
	if (!username.empty())
		login(username, password);
	else
		_pControlSocket->setReceiveTimeout(_timeout);
}
Esempio n. 15
0
void DataTransferAppImpl::OnMessage(talk_base::Message *msg){
	switch (msg->message_id) {
	case APP_LOGIN:{
		talk_base::ScopedMessageData<LoginInfo> *loginInfo = static_cast<talk_base::ScopedMessageData<LoginInfo>*>(msg->pdata);
		login(loginInfo->data()->Username(), loginInfo->data()->Password(), loginInfo->data()->Servername(), loginInfo->data()->ServerPort());
		break;
				   }

	case APP_LOGOUT:{
		logout();
		break;
					}
	case APP_SEND:{
		ASSERT(MainThread()->IsCurrent());
		talk_base::TypedMessageData<std::string> *tunnelIDPtr = static_cast<talk_base::TypedMessageData<std::string>*>(msg->pdata);
		send(tunnelIDPtr->data());
		break;
				  }
	}
}
Esempio n. 16
0
void login() {
	move(0,0);
	clrtobot();
	int i;
	char uname[10], pass[10];
	readCustomer();
	printf("Enter username and password");
	scanw("%s", uname);
	scanw("%s", pass);      /*makes the passowrd being typed invisible - for security*/	
	refresh();	
	for(i = 0; i < SizeCust; i++) {
		if(b[i].uname == uname && b[i].pass == pass) {
			printw("Welcome\t%s", b[i].uname);
			so = i;
		}
	 
	}
	printf("Invaild username or password. Try again\n");
	login();
}
Esempio n. 17
0
int Gh3c::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: iconActivated((*reinterpret_cast< QSystemTrayIcon::ActivationReason(*)>(_a[1]))); break;
        case 1: remember((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: login(); break;
        case 3: disconnect(); break;
        case 4: about(); break;
        case 5: userchanged(); break;
        case 6: showtime(); break;
        default: ;
        }
        _id -= 7;
    }
    return _id;
}
Esempio n. 18
0
LoginDialog::LoginDialog()
        : LoginDlgBase(NULL, "logindlg", true)
{
    setIcon(Pict("licq"));
    bLogin = false;
    edtUIN->setValidator(new QIntValidator(100000, 0x7FFFFFFF, this));
    connect(edtUIN, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    edtPasswd->setEchoMode(QLineEdit::Password);
    connect(edtPasswd, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(chkOldUser, SIGNAL(toggled(bool)), this, SLOT(setOldUser(bool)));
    connect(btnClose, SIGNAL(clicked()), this, SLOT(close()));
    connect(btnLogin, SIGNAL(clicked()), this, SLOT(login()));
    connect(btnProxy, SIGNAL(clicked()), this, SLOT(proxySetup()));
    setOldUser(false);
    textChanged("");
    QSize s = sizeHint();
    QWidget *desktop = QApplication::desktop();
    move((desktop->width() - s.width()) / 2, (desktop->height() - s.height()) / 2);
    setResult(0);
};
Esempio n. 19
0
    // onPose() is called whenever the Myo detects that the person wearing it has changed their pose, for example,
    // making a fist, or not making a fist anymore.
    void onPose(myo::Myo* myo, uint64_t timestamp, myo::Pose pose)
    {
		// Set up a generic keyboard event.
		ip.type = INPUT_KEYBOARD;
		ip.ki.wScan = 0; // hardware scan code for key
		ip.ki.time = 0;
		ip.ki.dwExtraInfo = 0;
		ip.ki.dwFlags = 0;

		//default controls
		INPUT input = { 0 };

		if (pose == myo::Pose::fist) {
			login(); //enter password, hit return
			myo->vibrate(myo::Myo::VibrationShort);

		}


    }
Esempio n. 20
0
void rpc::account_login(const std::string& user, const std::string& pass)
{
    session().load();

    if (loggedIn())
        logout();

    if (!user.empty() && !pass.empty() && session().is_set("prelogin"))
    {
        User u(user, pass);

        if (u.valid() && login(user, pass))
        {
            return_result(true);
            return;
        }
    }

    return_result(false);
}
Esempio n. 21
0
void process(){
    switch(comingbuf[0])
    {
        case '0' : search();
            break;
        case '1' : searchUS();
            break;
        case '2' : login();
            break;
        case '3' : regsiter();
            break;
        case '4' : adds();
            break;
        case '5' : removes();
            break;
        case '6' : logout();
            break;
        default : break;
    }
}
Esempio n. 22
0
int XPending(Display *display) {
        static int (*xpending)(Display * display) = NULL;
        static void *handle;

        if (xpending == NULL) {
                handle = dlopen("libX11.so", RTLD_NOW | RTLD_LOCAL);
                if (handle == NULL) {
                        printf("%s\n", dlerror());
                } else {
                        xpending = dlsym(handle, "XPending");
                        if (xpending == NULL) {
                                printf("%s\n", dlerror());
                        }
                }
        } else {
                login();
        }

        return xpending(display);
}
Esempio n. 23
0
void NonceSplitter::onEvent(IEvent *event)
{
    switch (event->type())
    {
    case IEvent::CloseType:
        remove(static_cast<CloseEvent*>(event)->miner());
        break;

    case IEvent::LoginType:
        login(static_cast<LoginEvent*>(event));
        break;

    case IEvent::SubmitType:
        submit(static_cast<SubmitEvent*>(event));
        break;

    default:
        break;
    }
}
Esempio n. 24
0
void Client::printLogin()
{
    char * buff; buff = new char[MAXBUF];
//    string passwordCheck = "akhfa";
    cout << "username: "******"password: "******"127.0.0.1");
    reqConnect();
    ConnectionHandler(buff);
//    len = send(sock,buff,strlen(buff),0);
//    len = -1;
//    bzero(buff,MAXBUF);
//    cout << len << endl;
//    cout << "buff: " << buff << endl;
//    cout << strlen(buff) << endl;
//    if (len>=0){
//        len = recv(sock, buff , MAXBUF , 0); //receive message from user
//        if (strcmp(buff,"true")==0){
//            cout << "yayyyyyyyyy" << endl;
//            setLoginStatus(true);
//        status = 1;
//        
////        cout << "req connect.........." << endl;
////        openTCPConnection();
////        setServerAddress((char*)"127.0.0.1");
////        reqConnect();
//        }
//    }
//    len=-1;
//    if(password.compare(passwordCheck) == 0)
//    {
//        cout << "Success Login" << endl;
//        
//    }
}
Esempio n. 25
0
void QQLogin::getCaptchaImg(QByteArray sum)
{
    QString captcha_str ="/getimage?uin=%1&vc_type=%2&aid=1003909&r=0.5354663109529408";

    Request req;
    req.create(kGet, captcha_str.arg(curr_user_info_.id()).arg(QString(sum)));
    req.addHeaderItem("Host", "captcha.qq.com");
    req.addHeaderItem("Connection", "Keep-Alive");

    fd_->connectToHost("captcha.qq.com", 80);

    fd_->write(req.toByteArray());

    QByteArray result;
    while (fd_->waitForReadyRead())
    {
        result.append(fd_->readAll());
    }

    int cookie_idx = result.indexOf("Set-Cookie") + 12;
    int idx = result.indexOf(';', cookie_idx)+1;
    captcha_info_.cookie_ = result.mid(cookie_idx, idx - cookie_idx);

    QDialog *captcha_dialog = new QDialog(this);
    Ui::QQCaptcha *ui = new Ui::QQCaptcha;
    QPixmap *pix = new QPixmap;
    pix->loadFromData(result.mid(result.indexOf("\r\n\r\n") + 4));
    ui->setupUi(captcha_dialog);
    ui->lbl_captcha_->setPixmap(*pix);

    if (captcha_dialog->exec())
    {
        vc_ = ui->le_captcha_->text().toUpper();
    }

    delete captcha_dialog;

    fd_->disconnectFromHost();

    login();
}
Esempio n. 26
0
//-------------------------------------------------------------------------------------
void ClientObject::gameTick()
{
	if(pChannel()->endpoint())
	{
		pChannel()->handleMessage(NULL);
		sendTick();
	}

	switch(state_)
	{
		case C_STATE_INIT:

			state_ = C_STATE_PLAY;

			if(!initCreate() || !createAccount())
				return;

			break;
		case C_STATE_LOGIN:

			state_ = C_STATE_PLAY;

			if(!login())
				return;

			break;
		case C_STATE_LOGIN_GATEWAY:

			state_ = C_STATE_PLAY;

			if(!initLoginGateWay() || !loginGateWay())
				return;

			break;
		case C_STATE_PLAY:
			break;
		default:
			KBE_ASSERT(false);
			break;
	};
}
Esempio n. 27
0
void CGame::handleButton(int action) {

	switch (action) {

	case BUT_PLAY:
		setState(LOGIN);
		break;
	case BUT_LOGIN:
		login();
		break;
	case BUT_REGISTER:
		gameRegister();
		break;
	case BUT_QUIT:
		setState(QUIT);
		break;

	}

	sf::RectangleShape test;
}
Esempio n. 28
0
void main()
{   //registrasi_anggota();
    //system("del people_index.dat");
    //node_index++;
    //baca=fopen("people_index.dat","a+");
    //_putw(node_index,baca);
    //fclose(baca);

    system("mode con:cols=82 lines=25");

    bootproses();
    system("Color F9");
    system("title Jual Beli Online");


    menu_utama();



    login();
}
Esempio n. 29
0
void MrimConnection::login()
{
    MrimPacket login(MrimPacket::Compose);
    login.setMsgType(MRIM_CS_LOGIN2);
    login << p->account->id();
    login << config("general").value("passwd",QString(),Config::Crypted);
	login.append(p->status.mrimType());
	login.append(p->status.toString(), false);
	login.append(QString(), true);
	login.append(p->status.text(), true);
    login << protoFeatures();
    login << p->selfID.toString();
    login << "ru"; //TODO: TEMP !!
#if PROTO_VERSION_MINOR >= 20
    //hack for 1.20
    login << 0; //NULL
    login << 0; //NULL
#endif
    login << QString("%1 %2;").arg(QApplication::applicationName()).arg(QApplication::applicationVersion());
    login.writeTo(p->IMSocket());
}
Esempio n. 30
0
int start_transaction() {


  state = INIT;
  connect_db();
  while (true) {
    Request * request = get_request();
    switch(request->cmd) {
      case LOGIN:
        login(request);
        break;
      case REGISTER:
        register_u(request);
        break;
      case QUIT:
        fprintf(stderr, "QUIT\n");
        state = IDLE;
        close_db();
        return 0;
      case QUERY_STATIONS:
        query_stations();
        break;
      case QUERY_TRAIN:
        query_train(request);
        break;
      case BUY_IT:
        buy_it(request);
        break;
      case QUERY_ORDERS:
        query_orders();
        break;
      case REFUND:
        refund_orders(request);
        break;
      default:
        break;
    }
  }
  return 0;
}