Ejemplo n.º 1
0
main()
{
	gfarm_error_t e;

	e = gfarm_set_local_user_for_this_local_account();
	if (e) {
		fprintf(stderr,
			"gfarm_set_local_user_for_this_local_account(): %s\n",
			e);
		exit(1);
	}
	e = gfarm_config_read();
	if (e) {
		fprintf(stderr, "gfarm_config_read(): %s\n", e);
		exit(1);
	}
	printf("gfarm_spool_root = <%s>\n", gfarm_spool_root);
	printf("gfarm_spool_server_port = <%d>\n", gfarm_spool_server_port);
	printf("gfarm_metadb_server_name = <%s>\n", gfarm_metadb_server_name);
	printf("gfarm_metadb_server_port = <%d>\n", gfarm_metadb_server_name);

	printf("gfarm_ldap_server_name = <%s>\n", gfarm_ldap_server_name);
	printf("gfarm_ldap_server_port = <%s>\n", gfarm_ldap_server_port);
	printf("gfarm_ldap_base_dn = <%s>\n", gfarm_ldap_base_dn);
	return (0);
}
Ejemplo n.º 2
0
int
gfsk_gfarm_init(uid_t uid)
{
	gfarm_error_t e;

	e = gfarm_context_init();
	if (e != GFARM_ERR_NO_ERROR) {
		gflog_error(GFARM_MSG_UNFIXED,
			"gfarm_context_init failed: %s",
			gfarm_error_string(e));
		goto out;
	}
	e = gfarm_set_local_user_for_this_uid(uid);
	if (e != GFARM_ERR_NO_ERROR) {
		gflog_error(GFARM_MSG_UNFIXED,
			"gfarm_set_local_user_for_this_uid failed: %s",
			gfarm_error_string(e));
		goto out;
	}
	gflog_initialize();
	e = gfarm_config_read();
	if (e != GFARM_ERR_NO_ERROR) {
		gflog_error(GFARM_MSG_UNFIXED,
		    "gfarm_config_read() failed: %s", gfarm_error_string(e));
		goto out;
	}
out:
	return (-gfarm_error_to_errno(e));
}
Ejemplo n.º 3
0
/*
 * the following function is for client,
 * server/daemon process shouldn't call it.
 * Because this function may read incorrect setting from user specified
 * $USER or $HOME.
 */
gfarm_error_t
gfarm_initialize(int *argcp, char ***argvp)
{
	gfarm_error_t e;
	enum gfarm_auth_method auth_method;
#ifdef HAVE_GSI
	int saved_auth_verb;
#endif

	e = gfarm_set_local_user_for_this_local_account();
	if (e != GFARM_ERR_NO_ERROR)
		return (e);
	e = gfarm_config_read();
	if (e != GFARM_ERR_NO_ERROR)
		return (e);
#ifdef HAVE_GSI
	/*
	 * Suppress verbose error messages.  The message will be
	 * displayed later in gfarm_auth_request_gsi().
	 */
	saved_auth_verb = gflog_auth_set_verbose(0);

	(void)gfarm_gsi_client_initialize();

	(void)gflog_auth_set_verbose(saved_auth_verb);
#endif
	/*
	 * In sharedsecret authentication, a global user name is
	 * required to be set to access a metadata server.
	 */
	e = gfarm_set_global_user_for_sharedsecret();
	if (e != GFARM_ERR_NO_ERROR)
		return (e);

	/*
	 * XXX FIXME this shouldn't be necessary here
	 * to support multiple metadata server
	 */
	e = gfm_client_connection_acquire(gfarm_metadb_server_name,
	    gfarm_metadb_server_port, &gfarm_metadb_server);
	if (e != GFARM_ERR_NO_ERROR) {
		fprintf(stderr, "connecting gfmd: %s\n",
		    gfarm_error_string(e));
		exit(1);
	}
	gfarm_metadb_set_server(gfarm_metadb_server);

	/* metadb access is required to obtain a global user name by GSI */
	auth_method = gfm_client_connection_auth_method(gfarm_metadb_server);
	if (GFARM_IS_AUTH_GSI(auth_method)) {
		e = gfarm_set_global_user_by_gsi();
		if (e != GFARM_ERR_NO_ERROR)
			return (e);
	}
	if (argvp != NULL) {
#if 0 /* not yet in gfarm v2 */
		if (getenv("DISPLAY") != NULL)
			gfarm_debug_initialize((*argvp)[0]);
		e = gfarm_parse_argv(argcp, argvp);
		if (e != GFARM_ERR_NO_ERROR)
			return (e);
#endif /* not yet in gfarm v2 */
	}

	gfarm_auth_random(gfarm_client_pid_key, gfarm_client_pid_key_len);
	e = gfm_client_process_alloc(gfarm_metadb_server,
	    gfarm_client_pid_key_type,
	    gfarm_client_pid_key, gfarm_client_pid_key_len, &gfarm_client_pid);
	if (e != GFARM_ERR_NO_ERROR)
		gflog_fatal("failed to allocate gfarm PID: %s",
		    gfarm_error_string(e));
			
#if 0 /* not yet in gfarm v2 */
	gfarm_initialized = 1;
#endif /* not yet in gfarm v2 */

	return (GFARM_ERR_NO_ERROR);
}