* more details.
*
* You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
+#include <inttypes.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "keystructs.h"
#include "ll.h"
#include "mem.h"
+#include "onak.h"
#include "onak-conf.h"
#include "parsekey.h"
#include "log.h"
/**
* delete_key - Given a keyid delete the key from storage.
- * @keyid: The keyid to delete.
+ * @fp: The fingerprint of the key to delete.
* @intrans: If we're already in a transaction.
*/
-static int fs_delete_key(struct onak_dbctx *dbctx, uint64_t keyid, bool intrans)
+static int fs_delete_key(struct onak_dbctx *dbctx,
+ struct openpgp_fingerprint *fp, bool intrans)
{
static char buffer[PATH_MAX];
int ret;
struct openpgp_fingerprint *subkeyids = NULL;
uint64_t subkeyid;
int i = 0;
+ uint64_t keyid;
- if ((keyid >> 32) == 0)
- keyid = fs_getfullkeyid(dbctx, keyid);
+ keyid = fingerprint2keyid(fp);
+ if (keyid == 0)
+ return 1;
if (!intrans)
fs_starttrans(dbctx);
dbctx->getkeysigs = generic_getkeysigs;
dbctx->cached_getkeysigs = generic_cached_getkeysigs;
dbctx->keyid2uid = generic_keyid2uid;
- dbctx->getfullkeyid = fs_getfullkeyid;
dbctx->iterate_keys = fs_iterate_keys;
return dbctx;