X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/4e66da02f19648ee1be862e67ba1d1fc5549fb7f..5d01b1b9514a258c5a3c201e944f676cb2c467f0:/key-flags.c diff --git a/key-flags.c b/key-flags.c index d80da4f..bf5b70f 100644 --- a/key-flags.c +++ b/key-flags.c @@ -1,13 +1,13 @@ /* -*-c-*- * - * $Id: key-flags.c,v 1.4 2004/04/02 01:03:49 mdw Exp $ + * $Id$ * * Reading and writing key flag strings * * (c) 1999 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,35 +15,18 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * Catacomb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with Catacomb; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: key-flags.c,v $ - * Revision 1.4 2004/04/02 01:03:49 mdw - * Miscellaneous constification. - * - * Revision 1.3 2004/03/28 01:58:47 mdw - * Generate, store and retreive elliptic curve keys. - * - * Revision 1.2 2000/02/12 18:21:02 mdw - * Overhaul of key management (again). - * - * Revision 1.1 1999/12/22 15:47:48 mdw - * Major key-management revision. - * - */ - /*----- Header files ------------------------------------------------------*/ #include @@ -123,6 +106,8 @@ int key_readflags(const char *p, char **pp, unsigned *ff, unsigned *mm) /* --- Look up the string in the flags table --- */ + if (sz == 4 && strncmp(p, "none", 4) == 0) + goto next; for (e = flagtab; e->name; e++) { if (strncmp(e->name, p, sz) == 0) { if (e->name[sz] == 0) { @@ -146,6 +131,7 @@ int key_readflags(const char *p, char **pp, unsigned *ff, unsigned *mm) return (KERR_BADFLAGS); m |= ee->m; f |= ee->f; + next: p += sz; if (*p == 0 || *p == ':') break; @@ -199,16 +185,17 @@ void key_writeflags(unsigned f, dstr *d) int key_match(key_data *k, const key_filter *kf) { - sym_iter i; - key_struct *ks; + key_subkeyiter i; + const char *tag; + key_data *kd; if (!kf) return (1); if ((k->e & KF_ENCMASK) != KENC_STRUCT) return ((k->e & kf->m) == kf->f); - for (sym_mkiter(&i, &k->u.s); (ks = sym_next(&i)) != 0; ) { - if (key_match(&ks->k, kf)) + for (key_mksubkeyiter(&i, k); key_nextsubkey(&i, &tag, &kd); ) { + if (key_match(kd, kf)) return (1); } return (0);