Ejemplo n.º 1
3
int main(int argc, char * argv[])
{
    test_case                           tests[] =
    {
        TEST_CASE(unpack_test),
        TEST_CASE(unpack_test_with_extensions),
        TEST_CASE(unpack_null_param_test),
        TEST_CASE(unpack_bad_message_test)
    };
    int                                 i;
    int                                 rc;
    int                                 not_ok = 0;

    printf("1..%d\n", ARRAY_LEN(tests));

    globus_module_activate(GLOBUS_GRAM_PROTOCOL_MODULE);
    for (i = 0; i < ARRAY_LEN(tests); i++)
    {
        rc = tests[i].test_function();

        if (rc != 0)
        {
            not_ok++;
            printf("not ok # %s\n", tests[i].name);
        }
        else
        {
            printf("ok\n");
        }
    }
    globus_module_deactivate(GLOBUS_GRAM_PROTOCOL_MODULE);

    return not_ok;
}
/******************************************************************************
Function: globus_l_gass_server_ez_activate()

Description: 

Parameters: 

Returns: 
******************************************************************************/
static int
globus_l_gass_server_ez_activate(void)
{
     int rc;
   
    rc = globus_module_activate(GLOBUS_COMMON_MODULE); 
    if(rc != GLOBUS_SUCCESS)
    {
        return rc;
    }
	
    rc = globus_module_activate(GLOBUS_GASS_TRANSFER_MODULE);
    if(rc != GLOBUS_SUCCESS)
    {
        return rc;
    }

    globus_mutex_init(&globus_l_gass_server_ez_mutex,
		      GLOBUS_NULL);

    globus_hashtable_init(&globus_l_gass_server_ez_listeners,
                          16,
                          globus_hashtable_int_hash,
                          globus_hashtable_int_keyeq);

    return GLOBUS_SUCCESS;
} /* globus_l_gass_server_ez_activate() */
static
int
globus_l_xio_net_manager_activate(void)
{
    int                                 rc;

    GlobusDebugInit(GLOBUS_XIO_NET_MANAGER, TRACE);

    rc = globus_module_activate(GLOBUS_XIO_MODULE);
    if(rc != GLOBUS_SUCCESS)
    {
        goto activate_xio_fail;
    }
    rc = globus_module_activate(GLOBUS_NET_MANAGER_MODULE);

    if(rc == GLOBUS_SUCCESS)
    {
        GlobusXIORegisterDriver(net_manager);
    }
    else
    {
        globus_module_deactivate(GLOBUS_XIO_MODULE);
    }

activate_xio_fail:
    return rc;
}
Ejemplo n.º 4
0
int main()
{
    OM_uint32                           minor_status;
    OM_uint32                           major_status;
    gss_cred_id_t                       cred;
    char *                              error_str;
    int                                 rc = EXIT_SUCCESS;

    printf("1..1\n");

    globus_module_activate(GLOBUS_GSI_GSS_ASSIST_MODULE);
    globus_module_activate(GLOBUS_GSI_GSSAPI_MODULE);
    
    major_status = gss_acquire_cred(
        &minor_status,
        NULL,
        GSS_C_INDEFINITE,
        GSS_C_NO_OID_SET,
        GSS_C_BOTH,
        &cred,
        NULL,
        NULL);
    
    if(GSS_ERROR(major_status))
    {
        globus_gss_assist_display_status_str(&error_str,
                                             NULL,
                                             major_status,
                                             minor_status,
                                             0);
        fprintf(stderr, "\nLINE %d ERROR: %s\n", __LINE__, error_str);
        free(error_str);
        rc = EXIT_FAILURE;
        goto fail;
    }
    
    major_status = gss_release_cred(
        &minor_status,
        &cred);
    
    if(GSS_ERROR(major_status))
    {
        globus_gss_assist_display_status_str(&error_str,
                                             NULL,
                                             major_status,
                                             minor_status,
                                             0);
        fprintf(stderr, "\nLINE %d ERROR: %s\n", __LINE__, error_str);
        free(error_str);
        rc = EXIT_FAILURE;
        goto fail;
    }
    
fail:
    printf("%s gssapi_acquire_test\n",
            (rc == EXIT_SUCCESS) ? "ok" : "not ok");
    globus_module_deactivate_all();
    
    return rc;
}
Ejemplo n.º 5
0
static
int
globus_l_ftp_control_activate(void)
{
    int                                rc;
    char *                              tmp_string;

    rc = globus_module_activate(GLOBUS_IO_MODULE);
    if(rc != GLOBUS_SUCCESS)
    {
        return rc;
    }
    
    tmp_string = globus_module_getenv("GLOBUS_FTP_CONTROL_DEBUG_LEVEL");
    if(tmp_string != GLOBUS_NULL)
    {
	globus_i_ftp_control_debug_level = atoi(tmp_string);

	if(globus_i_ftp_control_debug_level < 0)
	{
	    globus_i_ftp_control_debug_level = 0;
	}
    }
    
    globus_i_ftp_control_debug_printf(1,
        (stderr, "globus_l_ftp_control_activate() entering\n"));
        
    rc = globus_module_activate(GLOBUS_THREAD_MODULE);
    if(rc != GLOBUS_SUCCESS)
    {
        goto exit;
    }
    rc = globus_module_activate(GLOBUS_COMMON_MODULE);
    if(rc != GLOBUS_SUCCESS)
    {
        goto exit;
    }
    rc = globus_module_activate(GLOBUS_GSI_GSSAPI_MODULE);
    if(rc != GLOBUS_SUCCESS)
    {
        goto exit;
    }
    rc = (int)globus_i_ftp_control_server_activate();
    if(rc != GLOBUS_SUCCESS)
    {
        goto exit;
    }
    rc = (int)globus_i_ftp_control_client_activate();
    if(rc != GLOBUS_SUCCESS)
    {
        goto exit;
    }
    rc = (int)globus_i_ftp_control_data_activate();

exit:
    globus_i_ftp_control_debug_printf(1,
        (stderr, "globus_l_ftp_control_activate() exiting\n"));
    return rc;
}
int
main(
    int                                     argc,
    char **                                 argv)
{
    globus_xio_driver_t                     tcp_driver;
    globus_xio_driver_t                     ftp_driver;
    globus_xio_stack_t                      stack;
    globus_xio_handle_t                     xio_handle;
    char *                                  cs;
    globus_result_t                         res;
    char                                    line[LINE_LEN];
    globus_bool_t                           done = GLOBUS_FALSE;
    globus_size_t                           nbytes;
    globus_xio_server_t                     server_handle;

    globus_module_activate(GLOBUS_XIO_MODULE);
    globus_xio_stack_init(&stack, NULL);

    res = globus_xio_driver_load("tcp", &tcp_driver);
    test_res(res, __LINE__);
    res = globus_xio_stack_push_driver(stack, tcp_driver);
    test_res(res, __LINE__);
    res = globus_xio_driver_load("gssapi_ftp", &ftp_driver);
    test_res(res, __LINE__);
    res = globus_xio_stack_push_driver(stack, ftp_driver);
    test_res(res, __LINE__);

    globus_xio_server_create(&server_handle, NULL, stack);

    globus_xio_server_get_contact_string(server_handle, &cs);
    fprintf(stdout, "Contact: %s\n", cs);

    globus_xio_server_accept(&xio_handle, server_handle);

    res = globus_xio_open(xio_handle, NULL, NULL);
    test_res(res, __LINE__);
    res = globus_xio_write(xio_handle, "220 hello\r\n", strlen("220 hello\r\n"),
        strlen("220 hello\r\n"), &nbytes, NULL);
    test_res(res, __LINE__);

    while(!done)
    {
        res = globus_xio_read(
            xio_handle, line, LINE_LEN, 1, &nbytes, NULL);
        test_res(res, __LINE__);
        line[nbytes] = '\0';

        fprintf(stdout, "%s", line);
    }

    globus_xio_close(xio_handle, NULL);

    globus_module_activate(GLOBUS_XIO_MODULE);

    return 0;
}
/**
 * @brief Globus Gridmap Callout Function
 * @ingroup globus_gridmap_callout
 * @details
 * This function provides a gridmap lookup in callout form.
 *
 * @param ap
 *        This function, like all functions using the Globus Callout API, is
 *        passed parameter though the variable argument list facility. The
 *        actual arguments that are passed are:
 *
 *        - The GSS Security context established during service
 *          invocation. This parameter is of type gss_ctx_id_t.
 *        - The name of the service being invoced. This parameter should be
 *          passed as a NUL terminated string. If no service string is
 *          available a value of NULL should be passed in its stead. This
 *          parameter is of type char *
 *        - A NUL terminated string indicating the desired local identity. If
 *          no identity is desired NULL may be passed. In this case the first
 *          local identity that is found will be returned. This parameter is of
 *          type char *.
 *        - A pointer to a buffer. This buffer will contain the mapped (local)
 *          identity (NUL terminated string) upon successful return. This
 *          parameter is of type char *.
 *        - The length of the above mentioned buffer. This parameter is of type
 *          unsigned int.
 *
 * @return
 *        GLOBUS_SUCCESS upon success
 *        A globus result_t structure upon failure (needs to be defined better)
 */
globus_result_t
globus_gridmap_callout(
    va_list                             ap)
{
    gss_ctx_id_t                        context;
    char *                              service;
    char *                              desired_identity;
    char *                              identity_buffer;
    char *                              local_identity;
    unsigned int                        buffer_length;
    globus_result_t                     result = GLOBUS_SUCCESS;
    gss_name_t                          peer;
    gss_buffer_desc                     peer_name_buffer;
    OM_uint32                           major_status;
    OM_uint32                           minor_status;
    int                                 rc;
    int                                 initiator;
    FILE *                              debug_file;
    char *                              shared_user_buf;


    context = va_arg(ap, gss_ctx_id_t);
    service = va_arg(ap, char *);
    desired_identity = va_arg(ap, char *);
    identity_buffer = va_arg(ap, char *);
    buffer_length = va_arg(ap, unsigned int);

    rc = globus_module_activate(GLOBUS_GSI_GSS_ASSIST_MODULE);

    /* check rc */

    rc = globus_module_activate(GLOBUS_GSI_GSSAPI_MODULE);

    /* check rc */

    rc = globus_module_activate(GLOBUS_GRIDMAP_CALLOUT_ERROR_MODULE);

    /* check rc */


    if(strcmp(service, "sharing") == 0)
    {
        char *  subject;
        shared_user_buf = va_arg(ap, char *);

        result = globus_gsi_cred_read_cert_buffer(
                     shared_user_buf, NULL, NULL, NULL, &subject);
        if(result != GLOBUS_SUCCESS)
        {
            goto error;
        }
        peer_name_buffer.value = subject;
        peer_name_buffer.length = strlen(subject);
    }
static
int
globus_l_xio_pipe_activate(void)
{
    int                                 rc;
    
    GlobusXIOName(globus_l_xio_pipe_activate);
    
    GlobusDebugInit(GLOBUS_XIO_PIPE, TRACE INFO);
    
    GlobusXIOPipeDebugEnter();
    
    rc = globus_module_activate(GLOBUS_XIO_SYSTEM_MODULE);
    if(rc != GLOBUS_SUCCESS)
    {
        goto error_activate;
    }
#   ifdef _WIN32
    xio_l_pipe_attr_default.infd = GetStdHandle(STD_INPUT_HANDLE);
    xio_l_pipe_attr_default.outfd = GetStdHandle(STD_OUTPUT_HANDLE);
#   endif
    
    GlobusXIORegisterDriver(pipe);
    
    GlobusXIOPipeDebugExit();
    return GLOBUS_SUCCESS;

error_activate:
    GlobusXIOPipeDebugExitWithError();
    GlobusDebugDestroy(GLOBUS_XIO_PIPE);
    return rc;
}
static int s_error_cache_init (void)
{
    char *                              tmp_string;
  
  if(globus_module_activate(GLOBUS_OBJECT_MODULE) != GLOBUS_SUCCESS)
  {
    return GLOBUS_FAILURE;
  }
  globus_thread_key_create(&s_peek_key, s_key_destructor_func);
				   
  globus_object_cache_init (&s_result_to_object_mapper);
  local_mutex_init (&s_result_to_object_mutex, NULL);
  s_next_available_result_count = 1;
  s_error_cache_initialized = 1;
  
    tmp_string = globus_module_getenv("GLOBUS_ERROR_OUTPUT");
    if(tmp_string != GLOBUS_NULL)
    {
        globus_i_error_output = GLOBUS_TRUE;
    }
    
    tmp_string = globus_module_getenv("GLOBUS_ERROR_VERBOSE");
    if(tmp_string != GLOBUS_NULL)
    {
        globus_i_error_verbose = GLOBUS_TRUE;
    }
    
    globus_thread_key_create(&globus_i_error_verbose_key, GLOBUS_NULL);

  return GLOBUS_SUCCESS;
}
int main(int argc, char *argv[])
{
    globus_module_activate(GLOBUS_GRAM_CLIENT_MODULE);
    globus_module_deactivate(GLOBUS_GRAM_CLIENT_MODULE);

    return 0;
}
static
int
globus_l_xio_popen_activate(void)
{
    int                                 rc;
    
    GlobusXIOName(globus_l_xio_popen_activate);
    
    GlobusDebugInit(GLOBUS_XIO_POPEN, TRACE INFO);
    
    GlobusXIOPOpenDebugEnter();
    
    rc = globus_module_activate(GLOBUS_XIO_SYSTEM_MODULE);
    if(rc != GLOBUS_SUCCESS)
    {
        goto error_activate;
    }
    
    GlobusXIORegisterDriver(popen);
    
    GlobusXIOPOpenDebugExit();
    return GLOBUS_SUCCESS;

error_activate:
    GlobusXIOPOpenDebugExitWithError();
    GlobusDebugDestroy(GLOBUS_XIO_POPEN);
    return rc;
}
Ejemplo n.º 12
0
static bool
rsl_to_classad(globus_rsl_t * rsl, classad::ClassAd &ad)
{
    if (g_globus_activated)
    {
        globus_module_activate(GLOBUS_RSL_MODULE);
        g_globus_activated = true;
    }
    if (!rsl) { return true; }
    if (!globus_rsl_is_boolean(rsl)) { return false; }

    globus_list_t * ops = globus_rsl_boolean_get_operand_list(rsl);
    while (!globus_list_empty(ops))
    {
        globus_rsl_t *op_rsl = static_cast<globus_rsl_t*>(globus_list_first(ops));
        ops = globus_list_rest(ops);
        if (!op_rsl) { continue; }

        if (globus_rsl_is_relation(op_rsl))
        {
            char * attr = globus_rsl_relation_get_attribute(op_rsl);
            globus_rsl_value_t * value = globus_rsl_relation_get_value_sequence(op_rsl);
            if (!attr || !value) { continue; }
            globus_rsl_value_t * single_value = globus_rsl_relation_get_single_value(op_rsl);
            if (single_value) { value = single_value; }

            classad::ExprTree *expr = NULL;

            if (!value_to_expr(value, expr) || !expr) { continue; }

            ad.Insert(attr, expr);
        }
    }
    return true;
}
Ejemplo n.º 13
0
/*
 * globus_l_module_initialize()
 */
static void
globus_l_module_initialize()
{
    /*
     * Initialize the threads package (can't use the standard interface since
     * it depends on threads)
     */
    globus_i_thread_pre_activate();
    globus_i_memory_pre_activate();
    /*
     * Initialize the registered module table and list
     */
    globus_hashtable_init(&globus_l_module_table,
			  GLOBUS_L_MODULE_TABLE_SIZE,
			  globus_hashtable_voidp_hash,
			  globus_hashtable_voidp_keyeq);

    globus_l_module_list = GLOBUS_NULL;
    
    /*
     * Initialize the recursive mutex
     */
    globus_l_module_mutex_init(&globus_l_module_mutex);
    
    globus_thread_key_create(&globus_l_activate_parent_key, NULL);
    globus_thread_key_create(&globus_l_deactivate_parent_key, NULL);
    
    /*
     * Now finish initializing the threads package
     */
    globus_module_activate(GLOBUS_THREAD_MODULE);
}
Ejemplo n.º 14
0
int gw_em_mad_init( int max_job, char *info )
{
    int rc;

    rc = globus_module_activate(GLOBUS_GRAM_CLIENT_MODULE);

    if ( rc != GLOBUS_SUCCESS)
    {
        sprintf(info, "GRAM client module activation failed: %s (error %d)",
                globus_gram_client_error_string(rc), rc);
        return 1;
    }

    rc = globus_gram_client_callback_allow(gw_em_mad_state_callback, NULL,
                 &(mad.callback_contact));
                 
    if ( rc != GLOBUS_SUCCESS)
    {
        sprintf(info, "GRAM client callback allow failed: %s (error %d)",
                globus_gram_client_error_string(rc), rc);
        return 1;
    }

    init_job_pool(max_job);

    mad.initialized = 1;
    
    printf("INIT - SUCCESS -\n");

    return 0;
}
/**
 * Module activation
 */
static
int
globus_l_gsi_gss_assist_activate(void)
{
    int                                 result;
    char *                              tmp_string;
    static char *                       _function_name_ =
        "globus_l_gsi_gss_assist_activate";

    tmp_string = getenv("GLOBUS_GSI_GSS_ASSIST_DEBUG_LEVEL");
    if(tmp_string != GLOBUS_NULL)
    {
        globus_i_gsi_gss_assist_debug_level = atoi(tmp_string);
        if(globus_i_gsi_gss_assist_debug_level < 0)
        {
            globus_i_gsi_gss_assist_debug_level = 0;
        }
    }

    tmp_string = getenv("GLOBUS_GSI_GSS_ASSIST_DEBUG_FILE");
    if(tmp_string != GLOBUS_NULL)
    {
        globus_i_gsi_gss_assist_debug_fstream = fopen(tmp_string, "w");
        if(globus_i_gsi_gss_assist_debug_fstream == NULL)
        {
            result = GLOBUS_FAILURE;
            goto exit;
        }
    }
    else
    {
        globus_i_gsi_gss_assist_debug_fstream = stderr;
    }

    GLOBUS_I_GSI_GSS_ASSIST_DEBUG_ENTER;

    globus_module_activate(GLOBUS_COMMON_MODULE);
    globus_module_activate(GLOBUS_CALLOUT_MODULE);
    globus_module_activate(GLOBUS_GSI_SYSCONFIG_MODULE);
    globus_module_activate(GLOBUS_GSI_GSSAPI_MODULE);

    globus_mutex_init(&globus_i_gsi_gss_assist_mutex, NULL);

 exit:
    GLOBUS_I_GSI_GSS_ASSIST_DEBUG_EXIT;    
    return GLOBUS_SUCCESS;
}
static
int
globus_l_ftp_client_restart_marker_plugin_activate(void)
{
    int rc;

    rc = globus_module_activate(GLOBUS_FTP_CLIENT_MODULE);
    return rc;
}
static
int
globus_l_ftp_client_test_perf_plugin_activate(void)
{
    int rc;

    rc = globus_module_activate(GLOBUS_FTP_CLIENT_PERF_PLUGIN_MODULE);
    return rc;
}
Ejemplo n.º 18
0
/**
 * Module activation
 * @ingroup globus_callout_activation
 */
static
int
globus_l_callout_activate(void)
{
    int                                 result = (int) GLOBUS_SUCCESS;
    char *                              tmp_string;
    static char *                       _function_name_ =
        "globus_l_callout_activate";

    tmp_string = globus_module_getenv("GLOBUS_CALLOUT_DEBUG_LEVEL");
    if(tmp_string != GLOBUS_NULL)
    {
        globus_i_callout_debug_level = atoi(tmp_string);
        
        if(globus_i_callout_debug_level < 0)
        {
            globus_i_callout_debug_level = 0;
        }
    }

    tmp_string = globus_module_getenv("GLOBUS_CALLOUT_DEBUG_FILE");
    if(tmp_string != GLOBUS_NULL)
    {
        globus_i_callout_debug_fstream = fopen(tmp_string, "a");
        if(globus_i_callout_debug_fstream == NULL)
        {
            result = (int) GLOBUS_FAILURE;
            goto exit;
        }
    }
    else
    {
        globus_i_callout_debug_fstream = stderr;
    }

    GLOBUS_I_CALLOUT_DEBUG_ENTER;

    result = globus_module_activate(GLOBUS_COMMON_MODULE);

    if(result != GLOBUS_SUCCESS)
    {
        goto exit;
    }

#ifndef BUILD_STATIC_ONLY
    if((result = lt_dlinit()) != 0)
    {
        goto exit;
    }
#endif

    GLOBUS_I_CALLOUT_DEBUG_EXIT;

 exit:

    return result;
}
Ejemplo n.º 19
0
/*
 * Function:	main
 *
 * Description:	
 *		
 * Parameters:	
 *
 * Returns:	
 */
int
main(int argc, char **argv)
{
    int					rc;
    
    globus_module_activate(GLOBUS_COMMON_MODULE);
    globus_module_activate(GLOBUS_IO_MODULE);
    

#if 1
    test1();				/* connect, read, write, read */
    test2();				/* connect, read, writev, read */
    test3();				/* failed connect */
#endif
    test4(atoi(argv[1]));		/* connect to secure server*/
    globus_module_deactivate(GLOBUS_IO_MODULE);
    globus_module_deactivate(GLOBUS_COMMON_MODULE);
}
int main(int argc, char * argv[])
{
    globus_ftp_client_handle_t          handle;
    globus_ftp_client_operationattr_t       attr;
    globus_result_t             result;
    globus_ftp_client_handleattr_t      handle_attr;
    char *                  src;
    char *                  dst;

    globus_module_activate(GLOBUS_FTP_CLIENT_MODULE);
    globus_ftp_client_handleattr_init(&handle_attr);
    globus_ftp_client_operationattr_init(&attr);

    globus_mutex_init(&lock, GLOBUS_NULL);
    globus_cond_init(&cond, GLOBUS_NULL);

    test_parse_args(argc, 
            argv,
            &handle_attr,
            &attr,
            &src,
            &dst);

    globus_ftp_client_operationattr_set_type(&attr,
                                         GLOBUS_FTP_CONTROL_TYPE_ASCII);

    globus_ftp_client_handle_init(&handle,  &handle_attr);

    done = GLOBUS_FALSE;
    result = globus_ftp_client_symlink(&handle,
                    src,
                    dst,
                    &attr,
                    done_cb,
                    0);
    if(result != GLOBUS_SUCCESS)
    {
    done = GLOBUS_TRUE;
    }

    globus_mutex_lock(&lock);
    while(!done)
    {
    globus_cond_wait(&cond, &lock);
    }
    globus_mutex_unlock(&lock);

    globus_ftp_client_handle_destroy(&handle);
    globus_module_deactivate_all();

    if(test_abort_count && error)
    {
    return 0;
    }
    return error;
}
int main(int argc, char *argv[])
{
    int i;
    int failed;
    test_case_t tests[] =
    {
        TEST_CASE(test_stdio_update),
        {NULL, NULL}
    };

    LTDL_SET_PRELOADED_SYMBOLS();
    printf("1..%d\n", (int) (sizeof(tests)/sizeof(tests[0]) - 1));
    contact_string = getenv("CONTACT_STRING");
    if (argc == 2)
    {
        contact_string = argv[1];
    }
    if (contact_string == NULL)
    {
        fprintf(stderr, "Usage: %s CONTACT-STRING\n", argv[0]);
        exit(1);
    }

    globus_module_activate(GLOBUS_GRAM_CLIENT_MODULE);
    globus_module_activate(GLOBUS_GASS_TRANSFER_MODULE);

    for (i = 0, failed = 0; tests[i].test_name != NULL; i++)
    {
        int rc = tests[i].test_case();

        if (rc != 0)
        {
            printf("not ");
            failed++;
        }
        printf("ok  %s\n", tests[i].test_name);
    }
    globus_module_deactivate_all();

    return failed;
}
int
main(int argc, char *argv[])
{
    int					rc = 0;
    int					test_num = 0;
    int					not_ok = 0;

    LTDL_SET_PRELOADED_SYMBOLS();
    if(argc < 2)
    {
	fprintf(stderr, "Usage: %s resource-manager-contact [test number]\n",
		argv[0]);
	exit(1);
    }
    resource_manager_contact = argv[1];

    if(argc > 2)
    {
	test_num = atoi(argv[2]);
    }
    rc = globus_module_activate(GLOBUS_COMMON_MODULE);
    if(rc)
    {
	not_ok |= rc;
	goto end;
    }

    if(test_num == 0 || test_num == 1)
    {
	rc = test1();
	printf("%sok\n", rc ? "not " : "");
	not_ok |= rc;
    }

    if(test_num == 0 || test_num == 2)
    {
	rc = test2();
	printf("%sok\n", rc ? "not " : "");
	not_ok |= rc;
    }

    if(test_num == 0 || test_num == 3)
    {
	rc = test3();
	printf("%sok\n", rc ? "not " : "");
	not_ok |= rc;
    }


    globus_module_deactivate_all();
end:
    return not_ok;
}
Ejemplo n.º 23
0
static int auth_globus_assert(struct link *link, time_t stoptime)
{
	int rc;
	gss_cred_id_t credential = GSS_C_NO_CREDENTIAL;
	gss_ctx_id_t context = GSS_C_NO_CONTEXT;
	OM_uint32 major, minor, flags = 0;
	int token;
	char *reason = NULL;

	globus_module_activate(GLOBUS_GSI_GSS_ASSIST_MODULE);

	if(use_delegated_credential && delegated_credential != GSS_C_NO_CREDENTIAL) {
		debug(D_AUTH, "globus: using delegated credential");
		credential = delegated_credential;
		major = GSS_S_COMPLETE;
	} else {
		debug(D_AUTH, "globus: loading my credentials");
		major = globus_gss_assist_acquire_cred(&minor, GSS_C_INITIATE, &credential);
	}

	if(major == GSS_S_COMPLETE) {
		debug(D_AUTH, "globus: waiting for server to get ready");
		if(auth_barrier(link, "yes\n", stoptime) == 0) {
			debug(D_AUTH, "globus: authenticating with server");
			major = globus_gss_assist_init_sec_context(&minor, credential, &context, "GSI-NO-TARGET", 0, &flags, &token, read_token, link, write_token, link);
			if(major == GSS_S_COMPLETE) {
				debug(D_AUTH, "globus: credentials accepted!");
				gss_delete_sec_context(&minor, &context, GSS_C_NO_BUFFER);
			} else {
				globus_gss_assist_display_status_str(&reason, "", major, minor, token);
				debug(D_AUTH, "globus: credentials rejected: %s", reason ? reason : "unknown reason");
				THROW_QUIET(EACCES);
			}
		} else {
			debug(D_AUTH, "globus: server couldn't load credentials");
			THROW_QUIET(EACCES);
		}
	} else {
		debug(D_AUTH, "globus: couldn't load my credentials; did you grid-proxy-init?");
		auth_barrier(link, "no\n", stoptime);
		THROW_QUIET(EACCES);
	}

	rc = 0;
	goto out;
out:
	if(!use_delegated_credential) {
		gss_release_cred(&major, &credential);
	}
	globus_module_deactivate(GLOBUS_GSI_GSS_ASSIST_MODULE);
	free(reason);
	return RCUNIX(rc);
}
static
int
globus_l_net_manager_null_activate(void)
{
    int rc = globus_module_activate(GLOBUS_NET_MANAGER_MODULE);
    if (rc == 0)
    {
        rc = globus_net_manager_register(&globus_l_net_manager_null,
            GlobusExtensionMyModule(globus_net_manager_null));
    }
    return rc;
}
Ejemplo n.º 25
0
static
int
gfork_l_activate()
{
    int                                 rc;
    globus_result_t                     res;

    rc = globus_module_activate(GLOBUS_XIO_MODULE);
    if(rc != 0)
    {
        goto error_activate;
    }

    if(!gfork_l_globals_set)
    {
        GlobusDebugInit(GLOBUS_GFORK,
                        ERROR WARNING TRACE INTERNAL_TRACE INFO STATE INFO_VERBOSE);


        gfork_i_state_init();

        res = globus_xio_stack_init(&gfork_i_file_stack, NULL);
        if(res != GLOBUS_SUCCESS)
        {
            goto error_file_stack;
        }
        res = globus_xio_driver_load("file", &gfork_i_file_driver);
        if(res != GLOBUS_SUCCESS)
        {
            goto error_file_driver;
        }
        res = globus_xio_stack_push_driver(
                  gfork_i_file_stack, gfork_i_file_driver);
        if(res != GLOBUS_SUCCESS)
        {
            goto error_file_push;
        }
        globus_xio_attr_init(&gfork_i_file_attr);

    }
    gfork_l_globals_set = GLOBUS_TRUE;

    return 0;
error_file_push:
    globus_xio_driver_unload(gfork_i_file_driver);
error_file_driver:
    globus_xio_stack_destroy(gfork_i_file_stack);
error_file_stack:
    globus_module_deactivate(GLOBUS_XIO_MODULE);
error_activate:
    return 1;
}
int
main(
    int                                 argc, 
    char **                             argv)
{
    unsigned char                       buffer[LINE_LEN];
    globus_size_t                       nbytes;
    globus_result_t                     res;
    globus_xio_attr_t                   attr;
    char *                              opts = NULL;

    if(argc < 2)
    {
        fprintf(stderr, "usage: %s url\n", argv[0]);
        return -1;
    }
    if(argc > 2)
    {
        opts = argv[2];
    }
    globus_module_activate(GLOBUS_XIO_MODULE);

    globus_xio_attr_init(&attr);
    globus_xio_handle_t             myhandle;

    res = globus_xio_handle_create_from_url(
        &myhandle,
        argv[1],
        attr,
        opts);
    test_res(res, __LINE__);

    res = globus_xio_open(myhandle, argv[1], attr);
    test_res(res, __LINE__);
    while(res == GLOBUS_SUCCESS)
    {
        res = globus_xio_read(myhandle, buffer, LINE_LEN, 1, &nbytes, NULL);
        buffer[nbytes] = '\0';
        printf("%s", buffer);
    }
    if(!globus_xio_error_is_eof(res))
    {
        printf("Error before EOF\n");
        test_res(res, __LINE__);
    }
    globus_xio_close(myhandle, NULL);
    globus_xio_attr_destroy(attr);

    globus_module_deactivate(GLOBUS_XIO_MODULE);

    return 0;
}
Ejemplo n.º 27
0
int
globus_module_activate_compat(
    globus_module_descriptor_t *	module_descriptor)
{
    int rc;
    rc = globus_thread_set_model("pthread");

    if (rc != GLOBUS_SUCCESS)
    {
        WARNING_USING_MIXED_THREAD_MODELS = 1;
    }
    return globus_module_activate(module_descriptor);
}
Ejemplo n.º 28
0
static int
globus_l_xio_telnet_activate(void)
{
    int                                 rc;
    GlobusXIOName(globus_l_xio_telnet_activate);

    rc = globus_module_activate(GLOBUS_XIO_MODULE);
    if(rc == GLOBUS_SUCCESS)
    {
        GlobusXIORegisterDriver(telnet);
    }
    return rc;
}
GSI_SOCKET *
GSI_SOCKET_new(int sock)
{
    GSI_SOCKET *self = NULL;
    
    self = malloc(sizeof(GSI_SOCKET));
    
    if (self == NULL)
    {
	return NULL;
    }

    memset(self, 0, sizeof(GSI_SOCKET));
    
    self->gss_context = GSS_C_NO_CONTEXT;
    self->sock = sock;

    globus_module_activate(GLOBUS_GSI_GSS_ASSIST_MODULE);
    globus_module_activate(GLOBUS_GSI_SYSCONFIG_MODULE);

    return self;
}
Ejemplo n.º 30
0
static
int
globus_l_xio_null_activate(void)
{
    int                                 rc;

    rc = globus_module_activate(GLOBUS_XIO_MODULE);
    if(rc == GLOBUS_SUCCESS)
    {
        GlobusXIORegisterDriver(null);
    }
    return rc;
}