Back to index

lightning-sunbird  0.9+nobinonly
Typedefs | Functions
argpin.h File Reference
#include <svrcore.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct SVRCOREArgPinObj

Functions

SVRCOREError SVRCORE_CreateArgPinObj (SVRCOREArgPinObj **out, const char *tokenName, const char *password, SVRCOREPinObj *pinObj)
void SVRCORE_DestroyArgPinObj (SVRCOREArgPinObj *obj)

Typedef Documentation

typedef struct SVRCOREArgPinObj

Definition at line 43 of file argpin.h.


Function Documentation

SVRCOREError SVRCORE_CreateArgPinObj ( SVRCOREArgPinObj **  out,
const char *  tokenName,
const char *  password,
SVRCOREPinObj *  pinObj 
)

Definition at line 81 of file argpin.c.

{
  SVRCOREError err = 0;
  SVRCOREArgPinObj *obj = 0;

  do {
    obj = (SVRCOREArgPinObj*)malloc(sizeof (SVRCOREArgPinObj));
    if (!obj) { err = 1; break; }

    obj->base.methods = &vtable;
    obj->tokenName=NULL;
    obj->password=NULL;
    obj->alt=pinObj;

    if ( tokenName == NULL) {
      PK11SlotInfo *slot = PK11_GetInternalKeySlot();

      obj->tokenName = strdup(PK11_GetTokenName(slot));
      PK11_FreeSlot(slot);
    }
    else
    {
      obj->tokenName = strdup(tokenName);
    }
    if (obj->tokenName == NULL) { err = 1; break; }

    obj->password = strdup(password);
    if (obj->password == NULL) { err = 1; break; }
  } while(0);

  if (err)
  {
    SVRCORE_DestroyArgPinObj(obj);
    obj = 0;
  }

  *out = obj;
  return err;
}

Here is the call graph for this function:

Definition at line 122 of file argpin.c.

{
  if (obj->tokenName) free(obj->tokenName);
  if (obj->password)
  {
    memset(obj->password, 0, strlen(obj->password));
    free(obj->password);
  }
  if (obj) free(obj);
}

Here is the call graph for this function:

Here is the caller graph for this function: