Less printf, less memory leaks.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16459 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -57,7 +57,6 @@ struct p11_module {
|
|||||||
CK_SLOT_ID id;
|
CK_SLOT_ID id;
|
||||||
CK_BBOOL token;
|
CK_BBOOL token;
|
||||||
char *name;
|
char *name;
|
||||||
char *pin;
|
|
||||||
hx509_certs certs;
|
hx509_certs certs;
|
||||||
} slot;
|
} slot;
|
||||||
};
|
};
|
||||||
@@ -228,17 +227,15 @@ p11_get_session(struct p11_module *p, struct p11_slot *slot)
|
|||||||
asprintf(&prompt, "PIN code for %s: ", slot->name);
|
asprintf(&prompt, "PIN code for %s: ", slot->name);
|
||||||
|
|
||||||
if (UI_UTIL_read_pw_string(pin, sizeof(pin), prompt, 0)) {
|
if (UI_UTIL_read_pw_string(pin, sizeof(pin), prompt, 0)) {
|
||||||
printf("no pin");
|
free(prompt);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
free(prompt);
|
free(prompt);
|
||||||
|
|
||||||
ret = P11FUNC(p, Login, (P11SESSION(slot), CKU_USER,
|
ret = P11FUNC(p, Login, (P11SESSION(slot), CKU_USER,
|
||||||
(unsigned char*)pin, 4));
|
(unsigned char*)pin, strlen(pin)));
|
||||||
if (ret != CKR_OK)
|
if (ret != CKR_OK)
|
||||||
printf("login failed\n");
|
return EINVAL;
|
||||||
else
|
|
||||||
slot->pin = strdup(pin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -625,8 +622,8 @@ p11_release_module(struct p11_module *p)
|
|||||||
_hx509_abort("pkcs11 refcount to low");
|
_hx509_abort("pkcs11 refcount to low");
|
||||||
if (--p->refcount > 0)
|
if (--p->refcount > 0)
|
||||||
return;
|
return;
|
||||||
|
if (p->refcount <= 0)
|
||||||
printf("p11 free\n");
|
_hx509_abort("pkcs11 refcount to low");
|
||||||
|
|
||||||
if (p->dl_handle)
|
if (p->dl_handle)
|
||||||
dlclose(p->dl_handle);
|
dlclose(p->dl_handle);
|
||||||
|
Reference in New Issue
Block a user