[cwscore-commit] CVS update: MODIFIED: source, globus_c_wsrf_client_tools_programs_branch

Joe Bester commit at globus.org
Fri May 19 15:55:07 CDT 2006


, Makefile.am ...

  User: bester  
  Date: 06/05/19 15:55:07

  Modified:    c/core/tools/source Tag:
                        globus_c_wsrf_client_tools_programs_branch
                        Makefile.am configure.in
  Added:       c/core/tools/source Tag:
                        globus_c_wsrf_client_tools_programs_branch
                        globus_i_wsrf_options.c globus_i_wsrf_options.h
                        globus_wsrf_options.c globus_wsrf_options.h
  Log:
  Initial version of globus-wsrf-* tools (command line clients for WSRF core
      port types). Pending in branch until globus_options changes are sorted out
      and doc is written
  Initial version of globus_wsrf_options.h (standard option handling for WSRF
      clients)
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.94.1  +7 -3      wsrf/c/core/tools/source/Makefile.am
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Makefile.am
  ===================================================================
  RCS file: /home/globdev/CVS/globus-packages/wsrf/c/core/tools/source/Makefile.am,v
  retrieving revision 1.1
  retrieving revision 1.1.94.1
  diff -u -b -r1.1 -r1.1.94.1
  --- Makefile.am	23 Sep 2004 14:01:03 -0000	1.1
  +++ Makefile.am	19 May 2006 20:55:07 -0000	1.1.94.1
  @@ -1,14 +1,15 @@
   include $(top_srcdir)/globus_automake_pre
   include $(top_srcdir)/globus_automake_pre_top
   
  -SUBDIRS= doxygen pkgdata 
  +SUBDIRS= . programs doxygen pkgdata 
   
   EXTRA_DIST=dirt.sh version.h.in
   
   INCLUDES=-I$(GLOBUS_LOCATION)/include/$(GLOBUS_FLAVOR_NAME)/wsrf/services
   
   flavorinclude_HEADERS = \
  -	globus_wsrf_core_tools.h
  +	globus_wsrf_core_tools.h \
  +	globus_wsrf_options.h
   
   # lib_LTLIBRARIES is an automake macro which contains
   # a list of libtool libraries that are to be installed in $prefix/lib
  @@ -16,7 +17,10 @@
   
   libglobus_wsrf_core_tools___GLOBUS_FLAVOR_NAME__la_SOURCES = \
   	globus_wsrf_core_tools.c \
  -	globus_i_wsrf_core_tools.h
  +	globus_i_wsrf_core_tools.h \
  +	globus_wsrf_options.c \
  +	globus_i_wsrf_options.h \
  +	globus_i_wsrf_options.c
   
   libglobus_wsrf_core_tools___GLOBUS_FLAVOR_NAME__la_LDFLAGS = $(GPT_LDFLAGS)
   libglobus_wsrf_core_tools___GLOBUS_FLAVOR_NAME__la_LIBADD = $(GPT_LIB_LINKS)
  
  
  
  1.1.94.1  +2 -1      wsrf/c/core/tools/source/configure.in
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: configure.in
  ===================================================================
  RCS file: /home/globdev/CVS/globus-packages/wsrf/c/core/tools/source/configure.in,v
  retrieving revision 1.1
  retrieving revision 1.1.94.1
  diff -u -b -r1.1 -r1.1.94.1
  --- configure.in	23 Sep 2004 14:01:03 -0000	1.1
  +++ configure.in	19 May 2006 20:55:07 -0000	1.1.94.1
  @@ -1,4 +1,4 @@
  -AC_REVISION($Revision: 1.1 $)
  +AC_REVISION($Revision: 1.1.94.1 $)
   AC_INIT(Makefile.am)
   
   GLOBUS_INIT
  @@ -16,6 +16,7 @@
   
   AC_OUTPUT(
   	Makefile
  +        programs/Makefile
   	pkgdata/Makefile
   	pkgdata/pkg_data_src.gpt
   	doxygen/Makefile
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +984 -0    wsrf/c/core/tools/source/Attic/globus_i_wsrf_options.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: globus_i_wsrf_options.c
  ===================================================================
  RCS file: globus_i_wsrf_options.c
  diff -N globus_i_wsrf_options.c
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ globus_i_wsrf_options.c	19 May 2006 20:55:07 -0000	1.1.2.1
  @@ -0,0 +1,984 @@
  +#include "globus_common.h"
  +#include "globus_i_wsrf_options.h"
  +#include "globus_wsrf_core_tools.h"
  +#include "gssapi.h"
  +#include "globus_error_gssapi.h"
  +#include "version.h"
  +
  +#ifndef GSS_IMPEXP_MECH_SPECIFIC
  +#define GSS_IMPEXP_MECH_SPECIFIC 1
  +#endif
  +#ifndef GSS_IMPEXP_OPAQUE_FORM
  +#define GSS_IMPEXP_OPAQUE_FORM 0
  +#endif
  +
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_anonymous(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    globus_result_t                     result;
  +    globus_i_wsrf_options_handle_t *    options = arg;
  +
  +    result = globus_soap_message_attr_set(
  +            options->attr,
  +            GLOBUS_SOAP_MESSAGE_AUTH_ANONYMOUS_KEY,
  +            NULL,
  +            NULL,
  +            (void *) 1);
  +    
  +    return result;
  +}
  +/* globus_l_wsrf_options_set_anonymous() */
  +
  +#if 0
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_server_certificate(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    return GLOBUS_FAILURE;
  +}
  +/* globus_l_wsrf_options_set_server_certificate() */
  +#endif
  +
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_debug(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    globus_i_wsrf_options_handle_t *    options = arg;
  +
  +    options->debug = GLOBUS_TRUE;
  +    globus_i_GLOBUS_SOAP_MESSAGE_debug_handle.levels |= GLOBUS_SOAP_MESSAGE_DEBUG_MESSAGES;
  +
  +    return GLOBUS_SUCCESS;
  +}
  +/* globus_l_wsrf_options_set_debug() */
  +
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_epr(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    globus_i_wsrf_options_handle_t *    options = arg;
  +    globus_result_t                     result;
  +
  +    if (options->epr)
  +    {
  +        wsa_EndpointReferenceType_destroy(options->epr);
  +    }
  +    result = globus_wsrf_core_import_endpoint_reference(
  +            param[0],
  +            &options->epr,
  +            NULL);
  +
  +    return result;
  +}
  +/* globus_l_wsrf_options_set_epr() */
  +
  +#if 0
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_descriptor(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    return GLOBUS_FAILURE;
  +}
  +/* globus_l_wsrf_options_set_descriptor() */
  +#endif
  +
  +#if 0
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_delegation(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    return GLOBUS_FAILURE;
  +}
  +/* globus_l_wsrf_options_set_delegation() */
  +#endif
  +
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_help(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    globus_i_wsrf_options_handle_t *    options = arg;
  +    const char *                        tmp;
  +
  +    if (options->application_name)
  +    {
  +        tmp = strrchr(options->application_name, '/');
  +        tmp = tmp ? tmp+1 : options->application_name;
  +    }
  +    else
  +    {
  +        tmp = "globus_wsrf_core_tools";
  +    }
  +    if (options->usage)
  +    {
  +        printf("Usage: %s %s\nOptions:\n", tmp, options->usage);
  +    }
  +    globus_options_help(opts_handle);
  +
  +    if (options->post_banner)
  +    {
  +        printf("\n%s\n", options->post_banner);
  +    }
  +    return globus_error_put(globus_error_construct_error(
  +        NULL,
  +        NULL,
  +        GLOBUS_OPTIONS_HELP,
  +        __FILE__,
  +        "globus_l_wsrf_options_help",
  +        __LINE__,
  +        "Help"));
  +}
  +/* globus_l_wsrf_options_set_help() */
  +
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_usage(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    globus_i_wsrf_options_handle_t *    options = arg;
  +    const char *                        tmp;
  +
  +    if (options->application_name)
  +    {
  +        tmp = strrchr(options->application_name, '/');
  +        tmp = tmp ? tmp+1 : options->application_name;
  +    }
  +    else
  +    {
  +        tmp = "globus_wsrf_core_tools";
  +    }
  +    if (options->usage)
  +    {
  +        printf("Usage: %s %s\n", tmp, options->usage);
  +    }
  +    return globus_error_put(globus_error_construct_error(
  +        NULL,
  +        NULL,
  +        GLOBUS_OPTIONS_HELP,
  +        __FILE__,
  +        "globus_l_wsrf_options_usage",
  +        __LINE__,
  +        "usage"));
  +}
  +/* globus_l_wsrf_options_set_usage() */
  +
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_key(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    globus_i_wsrf_options_handle_t *    options = arg;
  +    char *                              tmp;
  +    globus_result_t                     result;
  +    char *                              key = param[0];
  +    xsd_any *                           any;
  +
  +    if (options->epr && options->epr->ReferenceProperties)
  +    {
  +        wsa_ReferencePropertiesType_destroy(options->epr->ReferenceProperties);
  +    }
  +    else if (!options->epr)
  +    {
  +        result = wsa_EndpointReferenceType_init(&options->epr);
  +
  +        if (result != GLOBUS_SUCCESS)
  +        {
  +            goto out;
  +        }
  +    }
  +    result = wsa_ReferencePropertiesType_init(&options->epr->ReferenceProperties);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        goto out;
  +    }
  +
  +    any = xsd_any_array_push(&options->epr->ReferenceProperties->any);
  +
  +    if (!any)
  +    {
  +        result = GlobusSoapMessageErrorOutOfMemory;
  +
  +        goto out;
  +    }
  +
  +    result = xsd_QName_init(&any->element);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        goto out;
  +    }
  +
  +    if (key[0] == '{' && ((tmp = strchr(key, '}')) != NULL))
  +    {
  +        /* key is a QName in {Namespace}local form */
  +        any->element->Namespace = globus_libc_strdup(key+1);
  +        if (any->element->Namespace == NULL)
  +        {
  +            result = GlobusSoapMessageErrorOutOfMemory;
  +
  +            goto out;
  +        }
  +        *tmp = '\0';
  +
  +        any->element->local = globus_libc_strdup(tmp+1);
  +        if (any->element->local == NULL)
  +        {
  +            result = GlobusSoapMessageErrorOutOfMemory;
  +
  +            goto out;
  +        }
  +    }
  +    else
  +    {
  +        any->element->Namespace = NULL;
  +        any->element->local = globus_libc_strdup(key);;
  +        if (any->element->local == NULL)
  +        {
  +            result = GlobusSoapMessageErrorOutOfMemory;
  +
  +            goto out;
  +        }
  +    }
  +    any->any_info = &xsd_string_info;
  +    any->value = globus_libc_strdup(param[1]);
  +
  +out:
  +    return result;
  +}
  +/* globus_l_wsrf_options_set_key() */
  +
  +#if 0
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_context_lifetime(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    return GLOBUS_FAILURE;
  +}
  +/* globus_l_wsrf_options_set_context_lifetime() */
  +#endif
  +
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_security_mech(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    globus_i_wsrf_options_handle_t *    options = arg;
  +    globus_result_t                     result;
  +
  +    if (strcmp(param[0], "msg") == 0)
  +    {
  +        result = globus_soap_message_attr_set(
  +                options->attr,
  +                GLOBUS_SOAP_MESSAGE_AUTHENTICATION_METHOD_KEY,
  +                NULL,
  +                NULL,
  +                (void *) GLOBUS_SOAP_MESSAGE_AUTH_SECURE_MESSAGE);
  +    }
  +    else if (strcmp(param[0], "conv") == 0)
  +    {
  +        result = globus_soap_message_attr_set(
  +                options->attr,
  +                GLOBUS_SOAP_MESSAGE_AUTH_PROTECTION_KEY,
  +                NULL,
  +                NULL,
  +                (void *) GLOBUS_SOAP_MESSAGE_AUTH_SECURE_CONVERSATION);
  +    }
  +    else
  +    {
  +        return GLOBUS_FAILURE;
  +    }
  +    return GLOBUS_SUCCESS;
  +}
  +/* globus_l_wsrf_options_set_security_mech() */
  +
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_protection(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    globus_i_wsrf_options_handle_t *    options = arg;
  +    globus_result_t                     result;
  +
  +    if (strcmp(param[0], "sig") == 0)
  +    {
  +        result = globus_soap_message_attr_set(
  +                options->attr,
  +                GLOBUS_SOAP_MESSAGE_AUTH_PROTECTION_KEY,
  +                NULL,
  +                NULL,
  +                (void *) GLOBUS_SOAP_MESSAGE_AUTH_PROTECTION_INTEGRITY);
  +    }
  +    else if (strcmp(param[0], "enc") == 0)
  +    {
  +        result = globus_soap_message_attr_set(
  +                options->attr,
  +                GLOBUS_SOAP_MESSAGE_AUTH_PROTECTION_KEY,
  +                NULL,
  +                NULL,
  +                (void *) GLOBUS_SOAP_MESSAGE_AUTH_PROTECTION_PRIVACY);
  +    }
  +    else
  +    {
  +        return GLOBUS_FAILURE;
  +    }
  +    return GLOBUS_SUCCESS;
  +}
  +/* globus_l_wsrf_options_set_protection() */
  +
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_service(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    globus_i_wsrf_options_handle_t *    options = arg;
  +    globus_result_t                     result;
  +
  +    if (options->epr && options->epr->Address.base_value)
  +    {
  +        wsa_AttributedURI_destroy(&options->epr->Address);
  +    }
  +    result = xsd_anyURI_copy_contents(
  +            &options->epr->Address.base_value,
  +            param);
  +
  +    return result;
  +}
  +/* globus_l_wsrf_options_set_service() */
  +
  +static
  +globus_result_t
  +globus_l_reltime_copy(
  +    void **                             new_attr,
  +    const void *                        attr)
  +{
  +    *new_attr = malloc(sizeof(globus_reltime_t));
  +
  +    memcpy(*new_attr, attr, sizeof(globus_reltime_t));
  +
  +    return GLOBUS_SUCCESS;
  +}
  +/* globus_l_reltime_copy() */
  +
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_timeout(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    globus_i_wsrf_options_handle_t *    options = arg;
  +    globus_reltime_t                    timeout;
  +    globus_result_t                     result;
  +
  +    timeout.tv_sec = atoi(param[0]);
  +    timeout.tv_usec = 0;
  +
  +    result = globus_soap_message_attr_set(
  +            options->attr,
  +            GLOBUS_SOAP_MESSAGE_TIMEOUT_KEY,
  +            globus_l_reltime_copy,
  +            free,
  +            &timeout);
  +
  +    return result;
  +}
  +/* globus_l_wsrf_options_set_timeout() */
  +
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_cert_key_files(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    globus_i_wsrf_options_handle_t *    options = arg;
  +    char *                              b;
  +    FILE *                              cert_in;
  +    FILE *                              key_in;
  +    size_t                              cert_size;
  +    size_t                              key_size;
  +    int                                 rc;
  +    globus_result_t                     result;
  +    gss_cred_id_t                       cred;
  +    OM_uint32                           maj_stat;
  +    OM_uint32                           min_stat;
  +    gss_buffer_desc                     import_buffer;
  +
  +    cert_in = fopen(param[0], "r");
  +    if (cert_in == NULL)
  +    {
  +        result = globus_error_put(globus_error_construct_error(
  +            NULL,
  +            NULL,
  +            GLOBUS_OPTIONS_INVALID_PARAMETER,
  +            __FILE__,
  +            "globus_l_wsrf_options_set_cert_key_files",
  +            __LINE__,
  +            "Unable to open cert file %s for reading.",
  +            param[0]));
  +
  +        goto out;
  +    }
  +
  +    if (fseek(cert_in, 0, SEEK_END) != 0)
  +    {
  +        result = globus_error_put(globus_error_construct_error(
  +            NULL,
  +            NULL,
  +            GLOBUS_OPTIONS_INVALID_PARAMETER,
  +            __FILE__,
  +            "globus_l_wsrf_options_set_cert_key_files",
  +            __LINE__,
  +            "Unable to seek cert file %s.",
  +            param[0]));
  +        goto close_cert_out;
  +    }
  +    cert_size = ftell(cert_in);
  +    rewind(cert_in);
  +
  +    key_in = fopen(param[1], "r");
  +    if (key_in == NULL)
  +    {
  +        result = globus_error_put(globus_error_construct_error(
  +            NULL,
  +            NULL,
  +            GLOBUS_OPTIONS_INVALID_PARAMETER,
  +            __FILE__,
  +            "globus_l_wsrf_options_set_cert_key_files",
  +            __LINE__,
  +            "Unable to open key file %s for reading.",
  +            param[1]));
  +        goto close_cert_out;
  +    }
  +
  +    if (fseek(key_in, 0, SEEK_END) != 0)
  +    {
  +        result = globus_error_put(globus_error_construct_error(
  +            NULL,
  +            NULL,
  +            GLOBUS_OPTIONS_INVALID_PARAMETER,
  +            __FILE__,
  +            "globus_l_wsrf_options_set_cert_key_files",
  +            __LINE__,
  +            "Unable to seek key file %s.",
  +            param[1]));
  +
  +        goto close_key_file_out;
  +    }
  +    key_size = ftell(key_in);
  +    rewind(key_in);
  +
  +    b = malloc(cert_size+key_size+2);
  +    if (!b)
  +    {
  +        result = GlobusSoapMessageErrorOutOfMemory;
  +
  +        goto close_key_file_out;
  +    }
  +    rc = fread(b, 1, cert_size, cert_in);
  +    b[rc++] = '\n';
  +    rc += fread(b+rc, 1, key_size, key_in);
  +    b[rc++] = '\0';
  +
  +    import_buffer.value = b;
  +
  +    import_buffer.length = strlen(b);
  +
  +    maj_stat = gss_import_cred(
  +            &min_stat,
  +            &cred,
  +            GSS_C_NO_OID,
  +            GSS_IMPEXP_OPAQUE_FORM,
  +            &import_buffer,
  +            0,
  +            NULL);
  +    if (maj_stat != GSS_S_COMPLETE)
  +    {
  +        result = globus_error_put(
  +                globus_error_construct_gssapi_error(NULL, NULL, maj_stat, min_stat));
  +        goto free_import_buffer_out;
  +
  +    }
  +
  +    /* This will leak the cred because there is no cred copy function */
  +    result = globus_soap_message_attr_set(
  +            options->attr,
  +            GLOBUS_SOAP_MESSAGE_USER_CREDENTIAL_KEY,
  +            NULL,
  +            NULL,
  +            cred);
  +
  +free_import_buffer_out:
  +    free(import_buffer.value);
  +close_key_file_out:
  +    fclose(key_in);
  +close_cert_out:
  +    fclose(cert_in);
  +out:
  +    return result;
  +}
  +/* globus_l_wsrf_options_set_cert_key_files() */
  +
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_proxy_file_name(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    globus_i_wsrf_options_handle_t *    options = arg;
  +    globus_result_t                     result;
  +    gss_cred_id_t                       cred;
  +    OM_uint32                           maj_stat;
  +    OM_uint32                           min_stat;
  +    gss_buffer_desc                     import_buffer;
  +
  +    import_buffer.value = globus_common_create_string(
  +            "X509_USER_PROXY=%s",
  +            param[0]);
  +    if (import_buffer.value == NULL)
  +    {
  +        result = GlobusSoapMessageErrorOutOfMemory;
  +
  +        goto out;
  +    }
  +    import_buffer.length = strlen(import_buffer.value);
  +
  +    maj_stat = gss_import_cred(
  +            &min_stat,
  +            &cred,
  +            GSS_C_NO_OID,
  +            GSS_IMPEXP_MECH_SPECIFIC,
  +            &import_buffer,
  +            0,
  +            NULL);
  +    if (maj_stat != GSS_S_COMPLETE)
  +    {
  +        result = globus_error_put(
  +                globus_error_construct_gssapi_error(NULL, NULL, maj_stat, min_stat));
  +        goto free_import_buffer_out;
  +
  +    }
  +
  +    /* This will leak the cred because there is no cred copy function */
  +    result = globus_soap_message_attr_set(
  +            options->attr,
  +            GLOBUS_SOAP_MESSAGE_USER_CREDENTIAL_KEY,
  +            NULL,
  +            NULL,
  +            cred);
  +
  +free_import_buffer_out:
  +    free(import_buffer.value);
  +out:
  +    return result;
  +}
  +/* globus_l_wsrf_options_set_proxy_file_name() */
  +
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_authorization(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    globus_i_wsrf_options_handle_t *    options = arg;
  +    globus_result_t                     result;
  +
  +    if (strcmp(param[0], "self") == 0)
  +    {
  +        result = globus_soap_message_attr_set(
  +                options->attr,
  +                GLOBUS_SOAP_MESSAGE_AUTHZ_METHOD_KEY,
  +                NULL,
  +                NULL,
  +                (void *) GLOBUS_SOAP_MESSAGE_AUTHZ_SELF);
  +    }
  +    else if (strcmp(param[0], "host") == 0)
  +    {
  +        result = globus_soap_message_attr_set(
  +                options->attr,
  +                GLOBUS_SOAP_MESSAGE_AUTHZ_METHOD_KEY,
  +                NULL,
  +                NULL,
  +                (void *) GLOBUS_SOAP_MESSAGE_AUTHZ_HOST);
  +    }
  +    else if (strcmp(param[0], "none") == 0)
  +    {
  +        result = globus_soap_message_attr_set(
  +                options->attr,
  +                GLOBUS_SOAP_MESSAGE_AUTHZ_METHOD_KEY,
  +                NULL,
  +                NULL,
  +                (void *) GLOBUS_SOAP_MESSAGE_AUTHZ_NONE);
  +    }
  +    else
  +    {
  +        gss_buffer_desc buff;
  +        gss_name_t name;
  +        OM_uint32 min_stat;
  +        OM_uint32 maj_stat;
  +
  +        /* Subject */
  +        result = globus_soap_message_attr_set(
  +                options->attr,
  +                GLOBUS_SOAP_MESSAGE_AUTHZ_METHOD_KEY,
  +                NULL,
  +                NULL,
  +                (void *) GLOBUS_SOAP_MESSAGE_AUTHZ_IDENTITY);
  +
  +        buff.value = param;
  +        buff.length = strlen(buff.value);
  +
  +        maj_stat = gss_import_name(
  +                &min_stat,
  +                &buff,
  +                GSS_C_NO_OID,
  +                &name);
  +
  +        result = globus_soap_message_attr_set(
  +                options->attr,
  +                GLOBUS_SOAP_MESSAGE_AUTHZ_TARGET_NAME_KEY,
  +                NULL,
  +                NULL,
  +                name);
  +
  +    }
  +
  +    return GLOBUS_SUCCESS;
  +}
  +/* globus_l_wsrf_options_set_authorization() */
  +
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_version(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    globus_i_wsrf_options_handle_t *    options = arg;
  +    const char *                        tmp;
  +    const globus_version_t *            version;
  +
  +    if (options->application_name)
  +    {
  +        tmp = strrchr(options->application_name,'/');
  +        tmp = tmp ? tmp+1 : options->application_name;
  +    }
  +    else
  +    {
  +        tmp = "globus_wsrf_core_tools";
  +    }
  +
  +    if (options->application_version)
  +    {
  +        version = options->application_version;
  +    }
  +    else
  +    {
  +        version = &local_version;
  +    }
  +
  +    globus_version_print(
  +            tmp,
  +            version,
  +            stdout,
  +            1);
  +
  +    return globus_error_put(globus_error_construct_error(
  +        NULL,
  +        NULL,
  +        GLOBUS_OPTIONS_HELP,
  +        __FILE__,
  +        "globus_l_wsrf_options_set_version",
  +        __LINE__,
  +        "Program versions"));
  +}
  +/* globus_l_wsrf_options_set_version() */
  +
  +static
  +globus_result_t
  +globus_l_wsrf_options_set_versions(
  +    globus_options_handle_t             opts_handle,
  +    char *                              cmd,
  +    char *                              param[],
  +    void *                              arg,
  +    int *                               out_params_used)
  +{
  +    globus_module_print_activated_versions(
  +            stdout,
  +            1);
  +
  +    return globus_error_put(globus_error_construct_error(
  +        NULL,
  +        NULL,
  +        GLOBUS_OPTIONS_HELP,
  +        __FILE__,
  +        "globus_l_wsrf_options_set_versions",
  +        __LINE__,
  +        "Program versions"));
  +
  +}
  +/* globus_l_wsrf_options_set_versions() */
  +
  +globus_options_entry_t
  +globus_i_wsrf_common_options_table[] =
  +{
  +    {
  +        "anonymous",
  +        "a",
  +        NULL,
  +        NULL,
  +        "Use anonymous authentication. Requires either -m 'conv' or transport (https) "
  +            "security.",
  +        0,
  +        globus_l_wsrf_options_set_anonymous
  +    },
  +#if 0
  +    {
  +        "serviceCertificate",
  +        "c",
  +        NULL,
  +        "FILENAME",
  +        "Use server's certificate located in FILENAME for encryption with GSI Secure "
  +            "Message",
  +        1,
  +        globus_l_wsrf_options_set_server_certificate
  +    },
  +#endif
  +    {
  +        "debug",
  +        "d",
  +        NULL,
  +        NULL,
  +        "Enable debug mode",
  +        0,
  +        globus_l_wsrf_options_set_debug
  +    },
  +    {
  +        "eprFile",
  +        "e",
  +        NULL,
  +        "FILENAME",
  +        "Load service EPR from FILENAME",
  +        1,
  +        globus_l_wsrf_options_set_epr
  +    },
  +#if 0
  +    {
  +        "descriptor",
  +        "f",
  +        NULL,
  +        "FILENAME,
  +        "Read client security descriptor from FILENAME",
  +        1,
  +        globus_l_wsrf_options_set_descriptor
  +    },
  +#endif
  +#if 0
  +    {
  +        "delegation",
  +        "g",
  +        NULL,
  +        "MODE",
  +        "Delegate credentials to service. MODE can be either 'limited' or 'full'. "
  +        "Requires -m 'conv' option.",
  +        1,
  +        globus_l_wsrf_options_set_delegation
  +    },
  +#endif
  +    {
  +        "help",
  +        "h",
  +        NULL,
  +        NULL,
  +        "Print this help message.",
  +        0,
  +        globus_l_wsrf_options_set_help
  +    },
  +    {
  +        "usage",
  +        "u",
  +        NULL,
  +        NULL,
  +        "Print short usage message.",
  +        0,
  +        globus_l_wsrf_options_set_usage
  +    },
  +    {
  +        "key",
  +        "k",
  +        NULL,
  +        "KEYNAME VALUE",
  +        "Set resource key in service EPR to be named KEYNAME with VALUE as its value.",
  +        2,
  +        globus_l_wsrf_options_set_key
  +    },
  +#if 0
  +    {
  +        "contextLifetime",
  +        "l",
  +        NULL,
  +        "SECONDS?",
  +        "Set lifetime of GSI security context.",
  +        1,
  +        globus_l_wsrf_options_set_context_lifetime
  +    },
  +#endif
  +    {
  +        "securityMech",
  +        "m",
  +        NULL,
  +        "TYPE",
  +        "Set authentication mechanism. TYPE is one of 'msg' for WS-SecureMessage or "
  +        "'conv' for WS-SecureConversation.",
  +        1,
  +        globus_l_wsrf_options_set_security_mech
  +    },
  +    {
  +        "protection",
  +        "p",
  +        NULL,
  +        "LEVEL",
  +        "Set message protection level. LEVEL is one of 'sig' for digital signature or "
  +        "'enc' for encryption.",
  +        1,
  +        globus_l_wsrf_options_set_protection
  +    },
  +    {
  +        "service",
  +        "s",
  +        NULL,
  +        "ENDPOINT",
  +        "Set ENDPOINT the service URL to use.",
  +        1,
  +        globus_l_wsrf_options_set_service
  +    },
  +    {
  +        "timeout",
  +        "t",
  +        NULL,
  +        "SECONDS",
  +        "Set client timeout to SECONDS.",
  +        1,
  +        globus_l_wsrf_options_set_timeout
  +    },
  +    {
  +        "certKeyFiles",
  +        "v",
  +        NULL,
  +        "CERTIFICATE-FILENAME KEY-FILENAME",
  +        "Use credentials located in CERTIFICATE-FILENAME and KEY-FILENAME. The key file "
  +        "must be unencrypted.",
  +        2,
  +        globus_l_wsrf_options_set_cert_key_files
  +    },
  +    {
  +        "proxyFilename",
  +        "x",
  +        NULL,
  +        "FILENAME",
  +        "Use proxy credentials located in FILENAME",
  +        1,
  +        globus_l_wsrf_options_set_proxy_file_name
  +    },
  +    {
  +        "authorization",
  +        "z",
  +        NULL,
  +        "TYPE",
  +        "Set authorization mode. TYPE can be 'self', 'host', 'none', or a string "
  +        "specifying the identity of the remote party.",
  +        1,
  +        globus_l_wsrf_options_set_authorization
  +    },
  +    {
  +        "version",
  +        "V",
  +        NULL,
  +        NULL,
  +        "Show version information and exit.",
  +        0,
  +        globus_l_wsrf_options_set_version
  +    },
  +    {
  +        "versions",
  +        NULL,
  +        NULL,
  +        NULL,
  +        "Show version information for all loaded modules and exit.",
  +        0,
  +        globus_l_wsrf_options_set_versions
  +    },
  +    GLOBUS_OPTIONS_END
  +};
  
  
  
  1.1.2.1   +21 -0     wsrf/c/core/tools/source/Attic/globus_i_wsrf_options.h
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: globus_i_wsrf_options.h
  ===================================================================
  RCS file: globus_i_wsrf_options.h
  diff -N globus_i_wsrf_options.h
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ globus_i_wsrf_options.h	19 May 2006 20:55:07 -0000	1.1.2.1
  @@ -0,0 +1,21 @@
  +#ifndef GLOBUS_I_WSRF_OPTIONS_H
  +#define GLOBUS_I_WSRF_OPTIONS_H
  +
  +#include "globus_wsrf_core_tools.h"
  +#include "globus_wsrf_options.h"
  +
  +typedef struct globus_i_wsrf_options_handle_s
  +{
  +    const char *                        application_name;
  +    const char *                        usage;
  +    const char *                        post_banner;
  +    const globus_version_t *            application_version;
  +    wsa_EndpointReferenceType *         epr;
  +    globus_bool_t                       debug;
  +    globus_soap_message_attr_t          attr;
  +}
  +globus_i_wsrf_options_handle_t;
  +
  +extern globus_options_entry_t globus_i_wsrf_common_options_table[];
  +
  +#endif /* GLOBUS_I_WSRF_OPTIONS_H */
  
  
  
  1.1.2.1   +217 -0    wsrf/c/core/tools/source/Attic/globus_wsrf_options.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: globus_wsrf_options.c
  ===================================================================
  RCS file: globus_wsrf_options.c
  diff -N globus_wsrf_options.c
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ globus_wsrf_options.c	19 May 2006 20:55:07 -0000	1.1.2.1
  @@ -0,0 +1,217 @@
  +#include "globus_wsrf_options.h"
  +#include "globus_wsrf_core_tools.h"
  +#include "globus_i_wsrf_options.h"
  +
  +/**
  + * Initialize a WSRF options parsing handle
  + * @ingroup globus_wsrf_options
  + * 
  + *
  + * @param handle
  + *     Handle to be initialized.
  + * @param application_name
  + *     Name of application (for --help message)
  + * @param application_version
  + *     Version information about the application (for --version and --versions)
  + */
  +extern
  +globus_result_t
  +globus_wsrf_options_handle_init(
  +    globus_wsrf_options_handle_t *      handle,
  +    const char *                        application_name,
  +    globus_version_t *                  application_version,
  +    const char *                        usage,
  +    const char *                        post_help_banner)
  +{
  +    globus_result_t                     result = GLOBUS_SUCCESS;
  +    globus_i_wsrf_options_handle_t *    new_handle;
  +    GlobusFuncName(globus_wsrf_options_handle_init);
  +
  +    if (handle == NULL)
  +    {
  +        result = GlobusSoapMessageErrorNullParam;
  +
  +        goto out;
  +    }
  +
  +    new_handle = malloc(sizeof(globus_i_wsrf_options_handle_t));
  +
  +    if (new_handle == NULL)
  +    {
  +        result = GlobusSoapMessageErrorOutOfMemory;
  +        goto out;
  +    }
  +    new_handle->application_name = application_name;
  +    new_handle->application_version = application_version;
  +    new_handle->epr = NULL;
  +    new_handle->debug = GLOBUS_FALSE;
  +    new_handle->usage = usage;
  +    new_handle->post_banner = post_help_banner;
  +
  +    result = globus_soap_message_attr_init(&new_handle->attr);
  +
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        free(new_handle);
  +        new_handle = NULL;
  +    }
  +    *handle = new_handle;
  +out:
  +    return result;
  +}
  +/* globus_wsrf_options_handle_init() */
  +
  +/**
  + * Free a WSRF options parsing handle
  + * @ingroup globus_wsrf_options
  + * 
  + * @param handle
  + *     Handle to be freed.
  + */
  +extern
  +void
  +globus_wsrf_options_handle_destroy(
  +    globus_wsrf_options_handle_t        handle)
  +{
  +    if (handle)
  +    {
  +        globus_soap_message_attr_destroy(handle->attr);
  +        free(handle);
  +    }
  +}
  +/* globus_wsrf_options_handle_destroy() */
  +
  +/**
  + * Get the service EPR specified on the command line.
  + * @ingroup globus_wsrf_options
  + *
  + * @param handle
  + *     Handle to query.
  + * @param epr
  + *     Pointer to an EndpointReferenceType which will be set to
  + *     contain the new parsed value. Caller must free the contents of this
  + *     EPr.
  + */
  +extern
  +globus_result_t
  +globus_wsrf_options_handle_get_epr(
  +    globus_wsrf_options_handle_t        handle,
  +    wsa_EndpointReferenceType *         epr)
  +{
  +    globus_result_t                     result = GLOBUS_SUCCESS;
  +    GlobusFuncName(globus_wsrf_options_handle_get_epr);
  +    if (handle == NULL || epr == NULL || handle->epr == NULL)
  +    {
  +        result = GlobusSoapMessageErrorNullParam;
  +        goto out;
  +    }
  +    result = wsa_EndpointReferenceType_init_contents(epr);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        goto out;
  +    }
  +    result = wsa_EndpointReferenceType_copy_contents(epr, handle->epr);
  +    if (result != GLOBUS_SUCCESS)
  +    {
  +        wsa_EndpointReferenceType_destroy_contents(epr);
  +    }
  +out:
  +    return result;
  +}
  +/* globus_wsrf_options_handle_get_epr() */
  +
  +/**
  + * Get the debug option.
  + * @ingroup globus_wsrf_options
  + *
  + * @param handle
  + *     Handle to query.
  + * @param debug
  + *     Pointer to a globus_bool_t which will be set to GLOBUS_TRUE if the debug
  + *     option was passed on the command line, GLOBUS_FALSE otherwise.
  + */
  +extern
  +globus_result_t
  +globus_wsrf_options_handle_get_debug(
  +    globus_wsrf_options_handle_t        handle,
  +    globus_bool_t *                     debug)
  +{
  +    globus_result_t                     result = GLOBUS_SUCCESS;
  +    GlobusFuncName(globus_wsrf_options_handle_get_debug);
  +
  +    if (handle == NULL || debug == NULL)
  +    {
  +        result = GlobusSoapMessageErrorNullParam;
  +    }
  +    else
  +    {
  +        *debug = handle->debug;
  +    }
  +
  +    return result;
  +}
  +/* globus_wsrf_options_handle_get_debug() */
  +
  +/**
  + * Get the SOAP message attrs set by command line options.
  + * @ingroup globus_wsrf_options
  + *
  + * @param handle
  + *     Handle to query.
  + * @param attr
  + *     Pointer to a globus_soap_message_attr_t which will be set to a copy
  + *     of the attributes which were set by the command-line option processing.
  + *     Caller must destroy this attribute set.
  + */
  +extern
  +globus_result_t
  +globus_wsrf_options_handle_get_attr(
  +    globus_wsrf_options_handle_t        handle,
  +    globus_soap_message_attr_t *        attr)
  +{
  +    globus_result_t                     result = GLOBUS_SUCCESS;
  +    GlobusFuncName(globus_wsrf_options_handle_get_attr);
  +
  +    if (handle == NULL || attr == NULL)
  +    {
  +        result = GlobusSoapMessageErrorNullParam;
  +    }
  +    else
  +    {
  +        result = globus_soap_message_attr_copy(attr, handle->attr);
  +    }
  +    return result;
  +}
  +/* globus_wsrf_options_handle_get_attr() */
  +
  +/**
  + * Add wsrf common arg parsing options to an options handle
  + *
  + * @param handle
  + *     WSRF common options handle to add to wsrf table.
  + * @param options_handle
  + *     Options processing handle.
  + */
  +extern
  +globus_result_t
  +globus_wsrf_options_handle_add_to_table(
  +    globus_wsrf_options_handle_t        handle,
  +    globus_options_handle_t             options_handle)
  +{
  +    globus_result_t                     result = GLOBUS_SUCCESS;
  +    GlobusFuncName(globus_wsrf_options_handle_add_to_table);
  +
  +    if (handle == NULL || options_handle == NULL)
  +    {
  +        result = GlobusSoapMessageErrorNullParam;
  +    }
  +    else
  +    {
  +        result = globus_options_add_table(
  +                options_handle,
  +                globus_i_wsrf_common_options_table,
  +                handle);
  +    }
  +    return result;
  +}
  +/* globus_wsrf_options_handle_add_to_table() */
  
  
  
  1.1.2.1   +61 -0     wsrf/c/core/tools/source/Attic/globus_wsrf_options.h
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: globus_wsrf_options.h
  ===================================================================
  RCS file: globus_wsrf_options.h
  diff -N globus_wsrf_options.h
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ globus_wsrf_options.h	19 May 2006 20:55:07 -0000	1.1.2.1
  @@ -0,0 +1,61 @@
  +#ifndef GLOBUS_WSRF_OPTIONS_H
  +#define GLOBUS_WSRF_OPTIONS_H
  +
  +#include "globus_common.h"
  +#include "globus_wsrf_core_tools.h"
  +
  +/**
  + * @defgroup globus_wsrf_options WSRF Application Common Command-Line Option handling
  + *
  + * Applications which implement WSRF clients can use this library to implement
  + * common arguments to initialize WSRF attributes for such things as the EPR contact
  + * of a service to contact, security attributes, and debugging information. This
  + * API uses the globus_options API to handle general WSRF options.
  + *
  + */
  +
  +/**
  + * WSRF Options processing handle
  + * @ingroup globus_wsrf_options
  + */
  +typedef struct globus_i_wsrf_options_handle_s * globus_wsrf_options_handle_t;
  +
  +extern
  +globus_result_t
  +globus_wsrf_options_handle_init(
  +    globus_wsrf_options_handle_t *      handle,
  +    const char *                        application_name,
  +    globus_version_t *                  application_version,
  +    const char *                        usage,
  +    const char *                        post_help_banner);
  +
  +extern
  +void
  +globus_wsrf_options_handle_destroy(
  +    globus_wsrf_options_handle_t        handle);
  +
  +extern
  +globus_result_t
  +globus_wsrf_options_handle_get_epr(
  +    globus_wsrf_options_handle_t        handle,
  +    wsa_EndpointReferenceType *         epr);
  +
  +extern
  +globus_result_t
  +globus_wsrf_options_handle_get_debug(
  +    globus_wsrf_options_handle_t        handle,
  +    globus_bool_t *                     debug);
  +
  +extern
  +globus_result_t
  +globus_wsrf_options_handle_get_attr(
  +    globus_wsrf_options_handle_t        handle,
  +    globus_soap_message_attr_t *        attr);
  +
  +extern
  +globus_result_t
  +globus_wsrf_options_handle_add_to_table(
  +    globus_wsrf_options_handle_t        handle,
  +    globus_options_handle_t             options_handle);
  +
  +#endif /* GLOBUS_WSRF_OPTIONS_H */
  
  
  




More information about the cwscore-commit mailing list