Exemple #1
0
/*
 * verify_directories()
 *
 * does all the hectic work of verifying directories and executables
 * of old and new server.
 *
 * NOTE: May update the values of all parameters
 */
void
verify_directories(void)
{

	prep_status("Checking current, bin, and data directories");

	if (access(".", R_OK | W_OK
#ifndef WIN32

	/*
	 * Do a directory execute check only on Unix because execute permission on
	 * NTFS means "can execute scripts", which we don't care about. Also, X_OK
	 * is not defined in the Windows API.
	 */
			   | X_OK
#endif
			   ) != 0)
		pg_log(PG_FATAL,
		  "You must have read and write access in the current directory.\n");

	check_bin_dir(&old_cluster);
	check_data_dir(old_cluster.pgdata);
	check_bin_dir(&new_cluster);
	check_data_dir(new_cluster.pgdata);
	check_ok();
}
Exemple #2
0
/*
 * verify_directories()
 *
 * does all the hectic work of verifying directories and executables
 * of old and new server.
 *
 * NOTE: May update the values of all parameters
 */
void
verify_directories(void)
{
#ifndef WIN32
	if (access(".", R_OK | W_OK | X_OK) != 0)
#else
	if (win32_check_directory_write_permissions() != 0)
#endif
		pg_fatal("You must have read and write access in the current directory.\n");

	check_bin_dir(&old_cluster);
	check_data_dir(old_cluster.pgdata);
	check_bin_dir(&new_cluster);
	check_data_dir(new_cluster.pgdata);
}
Exemple #3
0
int settings::slogin()
{
	if( is_logged ) return 0;
	QString prev_user = value("previous_user", "").toString();
	login ulogin(main_win_parent, prev_user);
	QString hash, tmp_dir, user, pass;
	int u_num, ret;
	user_info try_user;
	//	login while not logged
	while ( !is_logged )
	{
		ret = ulogin.exec();
		if( ret == QDialog::Accepted )
		{
			ulogin.get_user_pass(user, pass);
			hash = get_hash(user, pass);
			u_num = get_user_by_name( user );
			if( u_num == -1 )
			{	//	no such user
				QMessageBox::information(main_win_parent, QString("Login"), QString("Involid username or password.\nTry again."));
				continue;
			}

			try_user = (*users_info)[u_num];

			if( get_hash(user, pass) != try_user.hash)
			{	//	login failed
				QMessageBox::information(main_win_parent, QString("Login"), QString("Involid username or password.\nTry again.."));
				continue;
			}

			//	login success
			//	check avalible of data dir
			tmp_dir = value("users/"+user+"/dir", "").toString();
			if( check_data_dir( tmp_dir ) )
			{
				remove("users/"+user);
				load_users();
				QMessageBox::information(main_win_parent, QString("Login"), QString("Involid data dir in your account.\nTry again."));
				continue;
			}

			user_dir.setPath( tmp_dir );
			is_logged = 1;
			username = user;
			setValue("previous_user", user);
			return 0;
		}
		else
		{
			//	not accepted -> exit
			ret = QMessageBox::question(main_win_parent, QString("Login"), QString("You discard login, application will be closed.\nQuit?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
			if( ret == QMessageBox::Yes ) exit(0);
		}
	}

	return 10;
}
Exemple #4
0
/*
 * verify_directories()
 *
 * does all the hectic work of verifying directories and executables
 * of old and new server.
 *
 * NOTE: May update the values of all parameters
 */
void
verify_directories(void)
{

	prep_status("Checking current, bin, and data directories");

#ifndef WIN32
	if (access(".", R_OK | W_OK | X_OK) != 0)
#else
	if (win32_check_directory_write_permissions() != 0)
#endif
		pg_log(PG_FATAL,
		  "You must have read and write access in the current directory.\n");

	check_bin_dir(&old_cluster);
	check_data_dir(old_cluster.pgdata);
	check_bin_dir(&new_cluster);
	check_data_dir(new_cluster.pgdata);
	check_ok();
}
Exemple #5
0
/*
 * verify_directories()
 *
 * does all the hectic work of verifying directories and executables
 * of old and new server.
 *
 * NOTE: May update the values of all parameters
 */
void
verify_directories(void)
{

	if (access(".", R_OK | W_OK | X_OK) != 0)
		pg_log(PG_FATAL,
		"You must have read and write access in the current directory.\n");

	prep_status("Checking old data directory (%s)", old_cluster.pgdata);
	check_data_dir(old_cluster.pgdata);
	check_ok();

	prep_status("Checking old bin directory (%s)", old_cluster.bindir);
	check_bin_dir(&old_cluster);
	check_ok();

	prep_status("Checking new data directory (%s)", new_cluster.pgdata);
	check_data_dir(new_cluster.pgdata);
	check_ok();

	prep_status("Checking new bin directory (%s)", new_cluster.bindir);
	check_bin_dir(&new_cluster);
	check_ok();
}