[prev in list] [next in list] [prev in thread] [next in thread]
List: pgp-keyserver-folk
Subject: Some fixes
From: Marcel Waldvogel <mwa () tik ! ee ! ethz ! ch>
Date: 1998-11-26 19:08:14
[Download RAW message or body]
This message is in MIME format
I have found some time to figure out fixes for several of the problems
that have been plagueing us:
- Pubkeys without userid will no longer be added to the DB (and
therefore will also not be sent out as incrementals)
- Signatures outside of pubkeys, Symmetrically encrypted packets, UIDs
outside of pubkeys, ... no longer crash the keyserver
A patch is appended. It is against pksd-0.9.3 with my previous set of
patches.
Enjoy,
-Marcel
["patch2" (patch2)]
Index: kd_add.c
===================================================================
RCS file: /home/mwa/Admin/cvsroot/home/mwa/src/pks/kd_add.c,v
retrieving revision 1.5
diff -c -5 -r1.5 kd_add.c
*** kd_add.c 1998/07/10 22:01:10 1.5
--- kd_add.c 1998/11/26 18:46:30
***************
*** 1314,1341 ****
}
}
}
if (err->soft_count > 0) {
! char err_count[20], keyid[20];
! sprintf(keyid, "%02x%02x%02x%02x", err->soft_keyid[0],
! err->soft_keyid[1], err->soft_keyid[2], err->soft_keyid[3]);
! sprintf(err_count, "%d", err->soft_count);
! if (!xbuffer_append_str(win_msg, "Your key block contained ") ||
! !xbuffer_append_str(win_msg, err_count) ||
! !xbuffer_append_str(win_msg, " format errors,\n"
! "which were ignored. The last error was on\n"
! "key 0x") ||
! !xbuffer_append_str(win_msg, keyid) ||
! !xbuffer_append_str(win_msg, ":\n") ||
! !xbuffer_append_str(win_msg, err->soft_str) ||
! !xbuffer_append_str(win_msg, "\n")) {
xbuffer_free(newkeys_xb);
err->fatal = 1;
err->str = "Failed allocating space for success string";
fail();
! }
}
return(1);
}
--- 1314,1362 ----
}
}
}
if (err->soft_count > 0) {
! char err_count[20];
! sprintf(err_count, "%d", err->soft_count);
! if (!xbuffer_append_str(win_msg, "Your key block contained ") ||
! !xbuffer_append_str(win_msg, err_count) ||
! !xbuffer_append_str(win_msg, " format errors,\n"
! "which were treated as if the erroneous elements
\n"
! "hadn't been part of your submission.\n")) {
xbuffer_free(newkeys_xb);
err->fatal = 1;
err->str = "Failed allocating space for success string";
fail();
! }
! if (err->soft_keyid_set) {
! char keyid[20];
! sprintf(keyid, "%02x%02x%02x%02x", err->soft_keyid[0],
! err->soft_keyid[1], err->soft_keyid[2], err->soft_keyid[3]);
! if (!xbuffer_append_str(win_msg, "The last error was on key 0x") ||
! !xbuffer_append_str(win_msg, keyid) ||
! !xbuffer_append_str(win_msg, ":\n") ||
! !xbuffer_append_str(win_msg, err->soft_str) ||
! !xbuffer_append_str(win_msg, "\n")) {
! xbuffer_free(newkeys_xb);
! err->fatal = 1;
! err->str = "Failed allocating space for success string";
! fail();
! }
! } else {
! if (!xbuffer_append_str(win_msg,
! "The errors were outside of any PGP public ke
y;\n"
! "maybe you didn't send a public key block at
all.\n"
! "Anyway, the last error encountered was:\n")
||
! !xbuffer_append_str(win_msg, err->soft_str) ||
! !xbuffer_append_str(win_msg, "\n")) {
! xbuffer_free(newkeys_xb);
! err->fatal = 1;
! err->str = "Failed allocating space for success string";
! fail();
! }
! }
}
return(1);
}
Index: kd_search.c
===================================================================
RCS file: /home/mwa/Admin/cvsroot/home/mwa/src/pks/kd_search.c,v
retrieving revision 1.3
diff -c -5 -r1.3 kd_search.c
*** kd_search.c 1998/07/10 22:01:21 1.3
--- kd_search.c 1998/11/26 18:44:15
***************
*** 137,152 ****
return(1);
}
static void soft_err(mke_state *s, char *message)
{
s->err->soft_count++;
s->err->soft_str = message;
log_info("soft_err", message);
! if (s->ke->keyidbits.len >= 4) {
memcpy(&s->err->soft_keyid,
(char *)s->ke->keyidbits.buf + s->ke->keyidbits.len - 4, 4);
} else {
log_error("soft_err", "No keyid available for logging");
}
}
--- 137,158 ----
return(1);
}
static void soft_err(mke_state *s, char *message)
{
+ char keyid[80];
s->err->soft_count++;
s->err->soft_str = message;
log_info("soft_err", message);
! if (s->ke != NULL && s->ke->keyidbits.len >= 4) {
memcpy(&s->err->soft_keyid,
(char *)s->ke->keyidbits.buf + s->ke->keyidbits.len - 4, 4);
+ s->err->soft_keyid_set=1;
+ sprintf(keyid, "KeyID: 0x%02x%02x%02x%02x\n",
+ s->err->soft_keyid[0], s->err->soft_keyid[1],
+ s->err->soft_keyid[2], s->err->soft_keyid[3]);
+ log_info("soft_err", keyid);
} else {
log_error("soft_err", "No keyid available for logging");
}
}
***************
*** 156,179 ****
when a public key is seen, or at the end of the keyblock. s->ke
contains the current key entry, including the pubkey. If the
primary userid does not exist, that's an error */
/* first, finish up the current userid */
! if (!finish_userid(s))
/* error set already */
! return(0);
/* no prior pubkey, means this is the first. that's ok. */
if (!s->ke)
return(1);
/* if there's no primary userid, that's an error */
if (!s->ke->primary) {
soft_err(s,"Key block corrupt: pubkey with no userid");
return(1);
}
/* do something useful with the key */
if (!(*(s->iter))(s->ke, s->c))
return(0);
--- 162,200 ----
when a public key is seen, or at the end of the keyblock. s->ke
contains the current key entry, including the pubkey. If the
primary userid does not exist, that's an error */
/* first, finish up the current userid */
! if (!finish_userid(s)) {
/* error set already */
! if (s->ke != NULL)
! keys_elem_free((void *)s->ke, NULL);
! s->ke = NULL;
! return(1);
! }
/* no prior pubkey, means this is the first. that's ok. */
if (!s->ke)
return(1);
/* if there's no primary userid, that's an error */
if (!s->ke->primary) {
soft_err(s,"Key block corrupt: pubkey with no userid");
+ if (s->ke != NULL)
+ keys_elem_free((void *)s->ke, NULL);
+ s->ke = NULL;
return(1);
}
+ if (!s->ke->keyidbits.len) {
+ soft_err(s,"Key block corrupt: userid outside of pubkey");
+ if (s->ke != NULL)
+ keys_elem_free((void *)s->ke, NULL);
+ s->ke = NULL;
+ return(1);
+ }
+
/* do something useful with the key */
if (!(*(s->iter))(s->ke, s->c))
return(0);
***************
*** 290,302 ****
if (s->ignoring)
break;
/* finish the prior userid, if any */
! if (!finish_userid(s))
! /* error message already set */
! return(0);
/* allocate userids_elem and fill it in */
if ((s->ue = (userids_elem *) malloc(sizeof(userids_elem)))
== NULL) {
--- 311,325 ----
if (s->ignoring)
break;
/* finish the prior userid, if any */
! if (!finish_userid(s)) {
! /* error message already set */
! s->ignoring = 1;
! return(0);
! }
/* allocate userids_elem and fill it in */
if ((s->ue = (userids_elem *) malloc(sizeof(userids_elem)))
== NULL) {
Index: kd_internal.h
===================================================================
RCS file: /home/mwa/Admin/cvsroot/home/mwa/src/pks/kd_internal.h,v
retrieving revision 1.3
diff -c -5 -r1.3 kd_internal.h
*** kd_internal.h 1998/07/10 22:01:20 1.3
--- kd_internal.h 1998/11/26 17:59:08
***************
*** 17,26 ****
--- 17,27 ----
int fatal;
char *str;
char buf[1024];
/* Provisioning for soft errors */
int soft_count;
+ int soft_keyid_set;
unsigned char soft_keyid[4];
char *soft_str;
} error;
extern DB *keydb, *worddb, *timedb;
End of MIME message
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic