Exemplo n.º 1
0
/******************************************************************************
Function:   plugin_introspect
Description:
    return list of required arguments
Parameters:

Returns:
    LCMAPS_MOD_SUCCESS : succes
    LCMAPS_MOD_FAIL    : failure
******************************************************************************/
int plugin_introspect(
        int * argc,
        lcmaps_argument_t ** argv
)
{
    const char * logstr = "lcmaps_plugin_voms_poolgroup-plugin_introspect()";
    static lcmaps_argument_t argList[] = {
        {"user_dn"              ,   "char *"    ,   0   ,   NULL},
        {"fqan_list"            ,   "char **"   ,   0   ,   NULL},
        {"nfqan"                ,   "int"       ,   0   ,   NULL},
        {"requested_pgid_list"  ,   "gid_t *"   ,   0   ,   NULL},
        {"requested_npgid"      ,   "int"       ,   0   ,   NULL},
        {"requested_sgid_list"  ,   "gid_t *"   ,   0   ,   NULL},
        {"requested_nsgid"      ,   "int"       ,   0   ,   NULL},
        {NULL                   ,   NULL        ,   -1  ,   NULL}
    };

    lcmaps_log_debug(5,"%s: introspecting\n", logstr);

    *argv = argList;
    *argc = lcmaps_cntArgs(argList);
    lcmaps_log_debug(5,"%s: address first argument: 0x%x\n", logstr, argList);

    return LCMAPS_MOD_SUCCESS;
}
Exemplo n.º 2
0
/******************************************************************************
Function:   plugin_introspect
Description:
    return list of required arguments
Parameters:

Returns:
    LCMAPS_MOD_SUCCESS : succes
    LCMAPS_MOD_FAIL    : failure
******************************************************************************/
int plugin_introspect(
        int * argc,
        lcmaps_argument_t ** argv
)
{
    const char * logstr = "lcmaps_plugin_voms_localaccount-plugin_introspect()";
    static lcmaps_argument_t argList[] = {
        {"user_dn"      ,       "char *"        , 0,   NULL},
        {"fqan_list"    ,       "char **"       , 0,   NULL},
        {"nfqan"        ,       "int"           , 0,   NULL},
        {NULL           ,       NULL            , -1,   NULL},
        {NULL           ,       NULL            , -1,   NULL}
    };

    /* Get the version of LCMAPS being used: we need at least 1.5.8 to be able
     * to demand "requested_username" in the argList */
    int major=0,minor=0,patch=0;
    /* Most UNIX now support RTLD_DEFAULT (POSIX reserved) */
#ifdef RTLD_DEFAULT
    int (*lcmaps_major)(void),(*lcmaps_minor)(void),(*lcmaps_patch)(void);
    dlerror();
    lcmaps_major=dlsym(RTLD_DEFAULT,"lcmaps_get_major_version");
    lcmaps_minor=dlsym(RTLD_DEFAULT,"lcmaps_get_minor_version");
    lcmaps_patch=dlsym(RTLD_DEFAULT,"lcmaps_get_patch_version");
    if (dlerror()==NULL)    {
	major=lcmaps_major();
	minor=lcmaps_minor();
	patch=lcmaps_patch();
    }
#else
    /* No RTLD_DEFAULT, just hope the symbol exists in LCMAPS */
    major=lcmaps_get_major_version();
    minor=lcmaps_get_minor_version();
    patch=lcmaps_get_patch_version();
#endif

    /* Too old when older than 1.5.8 */
    if (major<1 || (major==1 && (minor<5 || (minor==5 && patch<8))))	{
	lcmaps_log_debug(4,
	    "%s: Old LCMAPS found (%d.%d.%d), not using requested_username\n",
	    logstr,major,minor,patch);
    } else {
	lcmaps_log_debug(4,
	    "%s LCMAPS (%d.%d.%d) supports using requested_username\n",
	    logstr,major,minor,patch);
	argList[3].argName="requested_username";
	argList[3].argType="char *";
	argList[3].argInOut=1;
	argList[3].value=NULL;
    }

    lcmaps_log_debug(4,"%s: introspecting\n", logstr);

    *argv = argList;
    *argc = lcmaps_cntArgs(argList);
    lcmaps_log_debug(5,"%s: address first argument: 0x%x\n", logstr, argList);

    return LCMAPS_MOD_SUCCESS;
}
/******************************************************************************
Function:   plugin_introspect
Description:
    return list of required arguments
Parameters:

Returns:
    LCMAPS_MOD_SUCCESS : success
******************************************************************************/
int plugin_introspect(int *argc, lcmaps_argument_t **argv)
{
  char *logstr = "\tlcmaps_plugins_condor_update-plugin_introspect()";
  static lcmaps_argument_t argList[] = {
    { "user_dn"        , "char *"                ,  1, NULL},
    {NULL        ,  NULL    , -1, NULL}
  };

  lcmaps_log_debug(2, "%s: introspecting\n", logstr);

  *argv = argList;
  *argc = lcmaps_cntArgs(argList);
  lcmaps_log_debug(2, "%s: address first argument: 0x%x\n", logstr, argList);

  lcmaps_log_debug(2, "%s: Introspect succeeded\n", logstr);

  return LCMAPS_MOD_SUCCESS;
}
Exemplo n.º 4
0
/******************************************************************************
Function:   plugin_introspect
Description:
    return list of required arguments
Parameters:

Returns:
    LCMAPS_MOD_SUCCESS : succes
    LCMAPS_MOD_FAIL    : failure
******************************************************************************/
int plugin_introspect(
        int * argc,
        lcmaps_argument_t ** argv
)
{
    const char * logstr = "lcmaps_plugin_posix_enf-plugin_introspect()";  

    static lcmaps_argument_t argList[] = {
        {NULL           ,       NULL            , -1,   NULL}
    };

    lcmaps_log_debug(5,"%s: introspecting\n", logstr);

    *argv = argList;
    *argc = lcmaps_cntArgs(argList);
    lcmaps_log_debug(5,"%s: address first argument: 0x%x\n", logstr, argList);

    return LCMAPS_MOD_SUCCESS;
}
Exemplo n.º 5
0
/*!
    \fn lcmaps_extractRunVars(
        lcmaps_request_t request,
        lcmaps_cred_id_t lcmaps_cred
        )
    \brief extract the variables from user credential that can be used by the plugins
    
    This function takes the user credential and job request (in RSL) and extracts the
    information which is published in the runvars_list. These variables can be accessed
    by the plugins.

    \param request     the job request (RSL)
    \param lcmaps_cred the credential presented by the user

    \retval 0 succes.
    \retval 1 failure.
    \internal
*/
int lcmaps_extractRunVars(
        lcmaps_request_t request,
        lcmaps_cred_id_t lcmaps_cred,
	char *req_username
)
{
    static lcmaps_request_t job_request;
    static lcmaps_cred_id_t lcmaps_credential;
    static char *requested_username;

    int number_of_runvars=0;
    const char * logstr = "lcmaps.mod-lcmaps_extractRunVars()";

    /* Get the number of variables
     */
    number_of_runvars = lcmaps_cntArgs(runvars_list);
    if (NUMBER_OF_RUNVARS != number_of_runvars)
    {
        lcmaps_log(LOG_ERR,"%s: conflict in number of run variables:\n", logstr);
        lcmaps_log(LOG_ERR,"%s: estimated = %d, defined = %d\n",
                   logstr, number_of_runvars, NUMBER_OF_RUNVARS);
        return 1;
    }
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Number of runvars: %d\n", logstr, NUMBER_OF_RUNVARS);
    lcmaps_log_debug(2,"%s: Address of runvars_list (first element): 0x%x\n", logstr, runvars_list);
#endif

    /* Save request en credential in static variables
     */
    job_request=request;
    lcmaps_credential=lcmaps_cred;
    requested_username=req_username;

    /* decompose request and credential
     * for each run variable do lcmaps_setRunVars(name, type, value)
     */
    /* Set user_dn */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"user_dn\": %s, address: 0x%x\n", logstr, lcmaps_credential.dn, &(lcmaps_credential.dn));
#endif
    if (lcmaps_setRunVars("user_dn" , "char *", (void *) &(lcmaps_credential.dn)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"user_dn\" variable\n", logstr);
        return 1;
    }

    /* Set the list of FQANs */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"fqan_list\", address: 0x%x\n",
                     logstr, &(lcmaps_credential.fqan));
#endif
    if (lcmaps_setRunVars("fqan_list" , "char **", (void *) &(lcmaps_credential.fqan)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"fqan_list\" variable\n", logstr);
        return 1;
    }
    /* Set the number of FQANs */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"nfqan\": %d, address: 0x%x\n",
                     logstr, lcmaps_credential.nfqan, &(lcmaps_credential.nfqan));
#endif
    if (lcmaps_setRunVars("nfqan" , "int", (void *) &(lcmaps_credential.nfqan)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"nfqan\" variable\n", logstr);
        return 1;
    }

#ifdef LCMAPS_GSI_MODE
    /* Set user_cred */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"user_cred\"\n", logstr);
#endif
    if (lcmaps_setRunVars("user_cred" , "gss_cred_id_t", (void *) &(lcmaps_credential.cred)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"user_cred\" variable\n", logstr);
        return 1;
    }

    /* Set security context */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"gss_context\"\n", logstr);
#endif
    if (lcmaps_setRunVars("gss_context" , "gss_ctx_id_t", (void *) &(lcmaps_credential.context)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"gss_context\" variable\n", logstr);
        return 1;
    }

    /* Set pointer to X509 proxy certificate */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"px509_cred\"\n", logstr);
#endif
    if (lcmaps_setRunVars("px509_cred" , "X509 *", (void *) &(lcmaps_credential.px509_cred)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"px509_cred\" variable\n", logstr);
        return 1;
    }

    /* Set pointer to X509 proxy certificate chain */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"px509_chain\"\n", logstr);
#endif
    if (lcmaps_setRunVars("px509_chain" , "STACK_OF(X509) *", (void *) &(lcmaps_credential.px509_chain)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"px509_chain\" variable\n", logstr);
        return 1;
    }

    /* Set pointer to PEM string of proxy certificate */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"pem_string\"\n", logstr);
#endif
    if (lcmaps_setRunVars("pem_string" , "char *", (void *) &(lcmaps_credential.pem_string)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"pem_string\" variable\n", logstr);
        return 1;
    }



#endif /* LCMAPS_GSI_MODE */

    /* Set job_request */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"job_request\" of type \"lcmaps_request_t\"\n", logstr);
#endif
    if (lcmaps_setRunVars("job_request" , "lcmaps_request_t", (void *) &job_request) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"job_request\" variable of type \"lcmaps_request_t\"\n", logstr);
        return 1;
    }
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"job_request\" of type \"char *\"\n", logstr);
#endif
    if (lcmaps_setRunVars("job_request" , "char *", (void *) &job_request) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"job_request\" variable of type \"char *\"\n", logstr);
        return 1;
    }

    /* Set the mapcounter */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"mapcounter\": %d, address: 0x%x\n",
                     logstr, lcmaps_credential.mapcounter, &(lcmaps_credential.mapcounter));
#endif
    if (lcmaps_setRunVars("mapcounter" , "int", (void *) &(lcmaps_credential.mapcounter)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"mapcounter\" variable\n", logstr);
        return 1;
    }

    /* Set the requested uid */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"requested_uid\": %d, address: 0x%x\n",
                     logstr, (int) lcmaps_credential.requested_account.uid,
                     &(lcmaps_credential.requested_account.uid));
#endif
    if (lcmaps_setRunVars("requested_uid" , "uid_t",
        (void *) &(lcmaps_credential.requested_account.uid)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"requested_uid\" variable\n", logstr);
        return 1;
    }

    /* Set the list of requested primary gids */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"requested_pgid_list\", address: 0x%x\n",
                     logstr, &(lcmaps_credential.requested_account.pgid_list));
#endif
    if (lcmaps_setRunVars("requested_pgid_list" , "gid_t *",
        (void *) &(lcmaps_credential.requested_account.pgid_list)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"requested_pgid_list\" variable\n", logstr);
        return 1;
    }
    /* Set the number of requested primary gids */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"requested_npgid\": %d, address: 0x%x\n",
                     logstr, lcmaps_credential.requested_account.npgid,
                     &(lcmaps_credential.requested_account.npgid));
#endif
    if (lcmaps_setRunVars("requested_npgid" , "int",
        (void *) &(lcmaps_credential.requested_account.npgid)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"requested_npgid\" variable\n", logstr);
        return 1;
    }

    /* Set the list of requested secondary gids */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"requested_sgid_list\", address: 0x%x\n",
                     logstr, &(lcmaps_credential.requested_account.sgid_list));
#endif
    if (lcmaps_setRunVars("requested_sgid_list" , "gid_t *",
        (void *) &(lcmaps_credential.requested_account.sgid_list)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"requested_sgid_list\" variable\n", logstr);
        return 1;
    }
    /* Set the number of requested secondary gids */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"requested_nsgid\": %d, address: 0x%x\n",
                     logstr, lcmaps_credential.requested_account.nsgid,
                     &(lcmaps_credential.requested_account.nsgid));
#endif
    if (lcmaps_setRunVars("requested_nsgid" , "int",
        (void *) &(lcmaps_credential.requested_account.nsgid)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"requested_nsgid\" variable\n", logstr);
        return 1;
    }

    /* Set the requested poolindex */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"requested_poolindex\", address: 0x%x\n",
                     logstr, &(lcmaps_credential.requested_account.poolindex));
    lcmaps_log_debug(2,"lcmaps.mod-lcmaps_extractRunVars(): requested_poolindex value: %s\n",
        (lcmaps_credential.requested_account).poolindex ? (lcmaps_credential.requested_account).poolindex : "(null)" );
#endif
    if (lcmaps_setRunVars("requested_poolindex" , "char *",
        (void *) &(lcmaps_credential.requested_account.poolindex)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"requested_poolindex\" variable\n", logstr);
        return 1;
    }

    /* Set the requested username */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"requested_username\", address: 0x%x\n",
                     logstr, &(requested_username));
    lcmaps_log_debug(2,"lcmaps.mod-lcmaps_extractRunVars(): requested_username value: %s\n",
        requested_username ? requested_username : "******" );
#endif
    if (lcmaps_setRunVars("requested_username" , "char *",
        (void *) &(requested_username)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"requested_username\" variable\n", logstr);
        return 1;
    }

    /* Newly added vo_data for GUMS and Job Repository */

    /* Set pointer to multiple VOMS Data structures */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"voms_data_list\"\n", logstr);
#endif
    if (lcmaps_setRunVars("voms_data_list" , "lcmaps_vomsdata_t *", (void *) &(lcmaps_credential.voms_data_list)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"voms_data_list\" variable\n", logstr);
        return 1;
    }

    /* Set number of VOMS Data structures */
#ifdef LCMAPS_DEBUG
    lcmaps_log_debug(2,"%s: Setting \"nvoms_data\"\n", logstr);
#endif
    if (lcmaps_setRunVars("nvoms_data" , "int", (void *) &(lcmaps_credential.nvoms_data)) != 0)
    {
        lcmaps_log(LOG_ERR,"%s: error while setting \"nvoms_data\" variable\n", logstr);
        return 1;
    }

    return 0;
}