* keyserver.c (keyserver_spawn): Show log line for what keyserver action
authorDavid Shaw <dshaw@jabberwocky.com>
Mon, 23 Aug 2004 19:20:17 +0000 (19:20 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Mon, 23 Aug 2004 19:20:17 +0000 (19:20 +0000)
we are taking.

* keyid.c (keystr): If printing a keyid that lacks the high 4 bytes, print
the low 4 alone. (keystr_from_desc): Handle short keyids and warn on v3
fingerprints.

g10/ChangeLog
g10/keyid.c
g10/keyserver.c

index 5e9c72f..c4a9090 100644 (file)
@@ -1,5 +1,13 @@
 2004-08-23  David Shaw  <dshaw@jabberwocky.com>
 
+       * keyserver.c (keyserver_spawn): Show log line for what keyserver
+       action we are taking.
+
+       * keyid.c (keystr): If printing a keyid that lacks the high 4
+       bytes, print the low 4 alone.
+       (keystr_from_desc): Handle short keyids and warn on v3
+       fingerprints.
+
        * keydb.h, getkey.c (get_user_id_printable): Rename to
        get_user_id_native and remove the printable stuff since we're
        print-ifying valid utf8 characters.  Change all callers in
index aa9ec0b..9d98717 100644 (file)
@@ -178,7 +178,10 @@ keystr(u32 *keyid)
       break;
 
     case KF_LONG:
-      sprintf(keyid_str,"%08lX%08lX",(ulong)keyid[0],(ulong)keyid[1]);
+      if(keyid[0])
+       sprintf(keyid_str,"%08lX%08lX",(ulong)keyid[0],(ulong)keyid[1]);
+      else
+       sprintf(keyid_str,"%08lX",(ulong)keyid[1]);
       break;
 
     case KF_0xSHORT:
@@ -186,7 +189,10 @@ keystr(u32 *keyid)
       break;
 
     case KF_0xLONG:
-      sprintf(keyid_str,"0x%08lX%08lX",(ulong)keyid[0],(ulong)keyid[1]);
+      if(keyid[0])
+       sprintf(keyid_str,"0x%08lX%08lX",(ulong)keyid[0],(ulong)keyid[1]);
+      else
+       sprintf(keyid_str,"0x%08lX",(ulong)keyid[1]);
       break;
 
     default:
@@ -215,25 +221,34 @@ keystr_from_sk(PKT_secret_key *sk)
 const char *
 keystr_from_desc(KEYDB_SEARCH_DESC *desc)
 {
-  if(desc->mode==KEYDB_SEARCH_MODE_LONG_KID)
-    return keystr(desc->u.kid);
-  else if(desc->mode==KEYDB_SEARCH_MODE_FPR20)
+  switch(desc->mode)
     {
-      u32 keyid[2];
-
-      keyid[0] = (unsigned char)desc->u.fpr[12] << 24
-       | (unsigned char)desc->u.fpr[13] << 16
-       | (unsigned char)desc->u.fpr[14] << 8
-       | (unsigned char)desc->u.fpr[15] ;
-      keyid[1] = (unsigned char)desc->u.fpr[16] << 24
-       | (unsigned char)desc->u.fpr[17] << 16
-       | (unsigned char)desc->u.fpr[18] << 8
-       | (unsigned char)desc->u.fpr[19] ;
-
-      return keystr(keyid);
+    case KEYDB_SEARCH_MODE_LONG_KID:
+    case KEYDB_SEARCH_MODE_SHORT_KID:
+      return keystr(desc->u.kid);
+
+    case KEYDB_SEARCH_MODE_FPR20:
+      {
+       u32 keyid[2];
+
+       keyid[0] = (unsigned char)desc->u.fpr[12] << 24
+         | (unsigned char)desc->u.fpr[13] << 16
+         | (unsigned char)desc->u.fpr[14] << 8
+         | (unsigned char)desc->u.fpr[15] ;
+       keyid[1] = (unsigned char)desc->u.fpr[16] << 24
+         | (unsigned char)desc->u.fpr[17] << 16
+         | (unsigned char)desc->u.fpr[18] << 8
+         | (unsigned char)desc->u.fpr[19] ;
+
+       return keystr(keyid);
+      }
+
+    case KEYDB_SEARCH_MODE_FPR16:
+      return "?v3 fpr?";
+
+    default:
+      BUG();
     }
-  else
-    BUG();
 }
 
 /****************
index 028c65a..2bd5a40 100644 (file)
@@ -878,6 +878,10 @@ keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,
            else if(desc[i].mode==KEYDB_SEARCH_MODE_SHORT_KID)
              fprintf(spawn->tochild,"0x%08lX\n",
                      (ulong)desc[i].u.kid[1]);
+
+           log_info(_("requesting key %s from %s server %s\n"),
+                    keystr_from_desc(&desc[i]),
+                    keyserver->scheme,keyserver->host);
          }
 
        fprintf(spawn->tochild,"\n");
@@ -1019,6 +1023,11 @@ keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,
                fprintf(spawn->tochild,"KEY %s END\n",key->d);
 
                iobuf_close(buffer);
+
+               log_info(_("sending key %s to %s server %s\n"),
+                        keystr(block->pkt->pkt.public_key->keyid),
+                        keyserver->scheme,keyserver->host);
+
                release_kbnode(block);
              }
 
@@ -1057,6 +1066,9 @@ keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,
 
        fprintf(spawn->tochild,"\n");
 
+       log_info(_("searching for \"%s\" from %s server %s\n"),
+                searchstr,keyserver->scheme,keyserver->host);
+
        break;
       }
 
@@ -1152,11 +1164,8 @@ keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,
        break;
 
       case SEARCH:
-       {
-         keyserver_search_prompt(spawn->fromchild,searchstr);
-
-         break;
-       }
+       keyserver_search_prompt(spawn->fromchild,searchstr);
+       break;
 
       default:
        log_fatal(_("no keyserver action!\n"));
@@ -1165,6 +1174,7 @@ keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,
 
  fail:
   m_free(line);
+  m_free(searchstr);
 
   *prog=exec_finish(spawn);