示例#1
0
文件: actSession.c 项目: akdh/Ingres
/*
** Name: WSMRequestActSession() - create an active session
**
** Description:
**
** Inputs:
**	char*		: query text (name of the html file)
**	char*		: host (http server which requests that file)
**
** Outputs:
**	ACT_PSESSION* : active session
**
** Returns:
**	GSTATUS	:	GSTAT_OK
**
** Exceptions:
**	None
**
** Side Effects:
**	None
**
** History:
**      03-Jul-98 (fanra01)
**          Rename wts_sess_attach to act_sess_attach.
**      28-Apr-2000 (fanra01)
**          Add secure flag and scheme string to WSMRequestActSession.
**          Also use i4 instead of nats.
*/
GSTATUS
WSMRequestActSession(
    u_i4            clientType,
    char*           query,
    char*           secure,
    char*           scheme,
    char*           host,
    char*           port,
    USR_PSESSION    user_session,
    ACT_PSESSION    *act_session)
{
    GSTATUS err = GSTAT_OK;
    WSF_PVAR    var = NULL;
    ACT_PSESSION session = NULL;
    u_i4 length;
    u_i4 i;

    err = G_ME_REQ_MEM(0, session, ACT_SESSION, 1);
    if (err == GSTAT_OK)
    {
        session->mem_tag = MEgettag();

        if (err == GSTAT_OK)
        {
            err = G_ME_REQ_MEM(session->mem_tag, session->name, char, NUM_MAX_ADD_STR);
            if (err == GSTAT_OK)
                CVptrax( (PTR)session, session->name );
        }
示例#2
0
TAGID
FEgettag(void)
{
	u_i2 tag;

	tag = MEgettag();
	if (tag == 0)
	    IIUGerr(E_UG002F_BadMemoryTag, 0, 0);

	return tag;
}
示例#3
0
文件: usrSession.c 项目: akdh/Ingres
/*
** Name: WSMCreateUsrSession() - create a user new session
**
** Description:
**
** Inputs:
**	char*	: name
**	u_i4	: userid
**	char*	: user
**	char*	: password
**
** Outputs:
**	USR_PSESSION*	: user session (NULL if doesn't exist)
**
** Returns:
**	GSTATUS	:	GSTAT_OK
**
** Exceptions:
**	None
**
** Side Effects:
**	None
**
** History:
**      03-Jul-98 (fanra01)
**          Enable creation of user session instance for ima.
**      03-Jun-1999 (fanra01)
**          Add semaphore for protecting user session variables.
**      29-Jul-2002 (fanra01)
**          If a duplicate hash entry is detected during session creation it
**          could be a duplicate session from a frame it should be safe to
**          ignore the error and continue.
*/
GSTATUS 
WSMCreateUsrSession (
    char            *name,
    u_i4           userid,
    char            *user,
    char            *password,
    USR_PSESSION    *session)
{
    GSTATUS         err = GSTAT_OK;
    u_i4            i = 0;
    u_i4            length = 0;
    WSF_PVAR        var = NULL;
    USR_PSESSION    tmp = NULL;

    G_ASSERT((userid == SYSTEM_ID) && (user == NULL || password == NULL),
        E_WS0010_WPS_UNDEF_USERPASS);

    err = G_ME_REQ_MEM(0, tmp, USR_SESSION, 1);
    if (err == GSTAT_OK)
    {
        tmp->transactions = NULL;
        tmp->mem_tag = MEgettag();
        tmp->requested_counter = 0;

        length = STlength(name) + 1;
        err = G_ME_REQ_MEM(tmp->mem_tag, tmp->name, char, length);
        if (err == GSTAT_OK)
        {
            MECOPY_VAR_MACRO(name, length, tmp->name);
            if (userid == SYSTEM_ID)
            {
                length = STlength(user) + 1;
                err = G_ME_REQ_MEM(tmp->mem_tag, tmp->user, char, length);
                if (err == GSTAT_OK)
                {
                    MECOPY_VAR_MACRO(user, length, tmp->user);
                    length = STlength(password) + 1;
                    err = G_ME_REQ_MEM(tmp->mem_tag, tmp->password, char, length);
                    if (err == GSTAT_OK)
                        MECOPY_VAR_MACRO(password, length, tmp->password);
                }
示例#4
0
/*
** Name: gipParseInstances()
**
** Description:
**
**	Import generated XML doc, validate it against the DTD and
**	extract instance info about all existing "instances" with
**	gipParseInstance().
**
** History:
**	03-Sep-2007 (hanje04)
**	    Created.
**	01-Mar-2010 (hanje04)
**	    BUG 123358
**	    Make sure startup mode is set correctly when only "ignored"
*	    instances are found (greater in version than saveset)
*/
static STATUS
gipParseInstances( xmlDocPtr doc, xmlNodePtr cur, UGMODE *state, i4 *count )
{
    i4 inst_count = 0;
    i4 skp_count = 0;

    cur = cur->xmlChildrenNode;

    while (cur != NULL)
    {
	instance	*cur_inst;
	i4		inst_idx;
	u_i2		memtag;
	STATUS		mestat;

	inst_count++;
	inst_idx = inst_count - 1;

	/*
	** Get tag for each instance, request the memory
	** and store the tag
	*/
	memtag = MEgettag();
	cur_inst= existing_instances[inst_idx] = (instance *)MEreqmem( memtag,
                                                    sizeof(instance),
                                                    TRUE,
                                                    &mestat );
	cur_inst->memtag = memtag ;

	/* return error if we failed to get memory */
       	if ( mestat != OK )
	    return( mestat );

	/* initialize package info */
	if ( selected_instance == NULL )
	    selected_instance = *existing_instances ;

	if ( ! xmlStrcmp( cur->name, (const xmlChar *)"instance" ) )
	    gipParseInstance( doc, cur, cur_inst, state );

	if ( cur_inst->action == UM_FALSE )
	    skp_count++;

	cur = cur->next;
    }
    if ( inst_count - skp_count == 0 )
    {
	/*
        ** No existing installations found so force
        ** new installation mode
        */
        *state |= UM_INST;
        ug_mode |= UM_INST;
    }
    else if (inst_count - skp_count > 1)
	*state |= UM_MULTI;
 
    *count=inst_count;

    return(OK);
}