Browse Source

adding set_identity_flags_test

doc_update_sequoia
Volker Birk 6 years ago
parent
commit
7474af98bf
3 changed files with 20 additions and 8 deletions
  1. +7
    -1
      src/keymanagement.c
  2. +5
    -2
      src/pEpEngine.c
  3. +8
    -5
      src/pEpEngine.h

+ 7
- 1
src/keymanagement.c View File

@ -134,7 +134,7 @@ DYNAMIC_API PEP_STATUS update_identity(
snprintf(identity->user_id, strlen(identity->address) + 5,
"TOFU_%s", identity->address);
}
status = get_identity(session,
identity->address,
identity->user_id,
@ -207,6 +207,8 @@ DYNAMIC_API PEP_STATUS update_identity(
identity->flags = stored_identity->flags;
}
else /* stored_identity == NULL */ {
identity->flags = 0;
if (!EMPTYSTR(identity->fpr)) {
PEP_comm_type _comm_type_key;
@ -401,6 +403,8 @@ DYNAMIC_API PEP_STATUS myself(PEP_SESSION session, pEp_identity * identity)
// import of private key, or similar.
// Take given fpr as-is.
identity->flags = 0;
}
else
{
@ -409,6 +413,8 @@ DYNAMIC_API PEP_STATUS myself(PEP_SESSION session, pEp_identity * identity)
if (status != PEP_STATUS_OK) {
return status;
}
identity->flags = 0;
}
bool revoked = false;


+ 5
- 2
src/pEpEngine.c View File

@ -994,7 +994,9 @@ DYNAMIC_API PEP_STATUS set_identity(
}
DYNAMIC_API PEP_STATUS set_identity_flags(
PEP_SESSION session, const pEp_identity *identity
PEP_SESSION session,
pEp_identity *identity,
unsigned int flags
)
{
int result;
@ -1008,7 +1010,7 @@ DYNAMIC_API PEP_STATUS set_identity_flags(
return PEP_ILLEGAL_VALUE;
sqlite3_reset(session->set_identity_flags);
sqlite3_bind_int(session->set_identity_flags, 1, identity->flags);
sqlite3_bind_int(session->set_identity_flags, 1, flags);
sqlite3_bind_text(session->set_identity_flags, 2, identity->address, -1,
SQLITE_STATIC);
sqlite3_bind_text(session->set_identity_flags, 3, identity->user_id, -1,
@ -1018,6 +1020,7 @@ DYNAMIC_API PEP_STATUS set_identity_flags(
if (result != SQLITE_DONE)
return PEP_CANNOT_SET_IDENTITY;
identity->flags = flags;
return PEP_STATUS_OK;
}


+ 8
- 5
src/pEpEngine.h View File

@ -380,8 +380,8 @@ typedef enum _PEP_comm_type {
} PEP_comm_type;
typedef enum _identity_flags {
PEP_idf_NOT_FOR_SYNC = 1, // don't use this identity for sync
PEP_idf_GROUP = 2 // identity of group of persons
PEP_idf_not_for_sync = 1, // don't use this identity for sync
PEP_idf_group = 2 // identity of group of persons
} identity_flags;
typedef struct _pEp_identity {
@ -500,17 +500,20 @@ DYNAMIC_API PEP_STATUS set_identity(
//
// parameters:
// session (in) session handle
// identity (in) pointer to pEp_identity structure
// identity (in,out) pointer to pEp_identity structure
// flags (in) new value for flags
//
// return value:
// PEP_STATUS_OK = 0 encryption and signing succeeded
// PEP_CANNOT_SET_IDENTITY update of identity failed
//
// caveat:
// address and user_id must be given
// address and user_id must be given in identity
DYNAMIC_API PEP_STATUS set_identity_flags(
PEP_SESSION session, const pEp_identity *identity
PEP_SESSION session,
pEp_identity *identity,
unsigned int flags
);


Loading…
Cancel
Save