[svn] GnuPG - r4274 - in branches/STABLE-BRANCH-1-4: include keyserver util

svn author dshaw cvs at cvs.gnupg.org
Thu Sep 28 21:36:59 CEST 2006


Author: dshaw
Date: 2006-09-28 21:36:55 +0200 (Thu, 28 Sep 2006)
New Revision: 4274

Added:
   branches/STABLE-BRANCH-1-4/include/compat.h
   branches/STABLE-BRANCH-1-4/util/compat.c
Modified:
   branches/STABLE-BRANCH-1-4/include/ChangeLog
   branches/STABLE-BRANCH-1-4/include/util.h
   branches/STABLE-BRANCH-1-4/keyserver/ChangeLog
   branches/STABLE-BRANCH-1-4/keyserver/Makefile.am
   branches/STABLE-BRANCH-1-4/keyserver/gpgkeys_ldap.c
   branches/STABLE-BRANCH-1-4/keyserver/ksutil.c
   branches/STABLE-BRANCH-1-4/keyserver/ksutil.h
   branches/STABLE-BRANCH-1-4/util/ChangeLog
   branches/STABLE-BRANCH-1-4/util/Makefile.am
   branches/STABLE-BRANCH-1-4/util/miscutil.c
Log:
Put in the basic wiring (just hextobyte for now) for a libcompat.a that
can contain replacement files that can be linked to keyserver helpers
without bringing in the whole libutil.a.  libutil.a contains a complete 
copy of libcompat.a so we only need to link to one of them.


Modified: branches/STABLE-BRANCH-1-4/include/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/include/ChangeLog	2006-09-28 19:30:03 UTC (rev 4273)
+++ branches/STABLE-BRANCH-1-4/include/ChangeLog	2006-09-28 19:36:55 UTC (rev 4274)
@@ -1,3 +1,9 @@
+2006-09-28  David Shaw  <dshaw at jabberwocky.com>
+
+	* compat.h: New, used for libcompat.a functions.
+
+	* util.h: Includes compat.h.
+
 2006-04-20  David Shaw  <dshaw at jabberwocky.com>
 
 	* cipher.h: Add dsa2_generate();

Added: branches/STABLE-BRANCH-1-4/include/compat.h
===================================================================
--- branches/STABLE-BRANCH-1-4/include/compat.h	2006-09-28 19:30:03 UTC (rev 4273)
+++ branches/STABLE-BRANCH-1-4/include/compat.h	2006-09-28 19:36:55 UTC (rev 4274)
@@ -0,0 +1,6 @@
+#ifndef _COMPAT_H_
+#define _COMPAT_H_
+
+int hextobyte( const char *s );
+
+#endif /* !_COMPAT_H_ */

Modified: branches/STABLE-BRANCH-1-4/include/util.h
===================================================================
--- branches/STABLE-BRANCH-1-4/include/util.h	2006-09-28 19:30:03 UTC (rev 4273)
+++ branches/STABLE-BRANCH-1-4/include/util.h	2006-09-28 19:36:55 UTC (rev 4274)
@@ -30,8 +30,8 @@
 #include "errors.h"
 #include "types.h"
 #include "mpi.h"
+#include "compat.h"
 
-
 typedef struct {
      int  *argc;	    /* pointer to argc (value subject to change) */
      char ***argv;	    /* pointer to argv (value subject to change) */
@@ -164,7 +164,6 @@
 int answer_is_yes_no_quit( const char *s );
 int answer_is_okay_cancel (const char *s, int def_answer);
 int match_multistr(const char *multistr,const char *match);
-int hextobyte( const char *s );
 
 /*-- strgutil.c --*/
 void free_strlist( STRLIST sl );

Modified: branches/STABLE-BRANCH-1-4/keyserver/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/keyserver/ChangeLog	2006-09-28 19:30:03 UTC (rev 4273)
+++ branches/STABLE-BRANCH-1-4/keyserver/ChangeLog	2006-09-28 19:36:55 UTC (rev 4274)
@@ -1,5 +1,10 @@
 2006-09-28  David Shaw  <dshaw at jabberwocky.com>
 
+	* Makefile.am: Link gpgkeys_ldap to libcompat.a.
+
+	* gpgkeys_ldap.c, ksutil.h, ksutil.c: Remove hextobyte instead of
+	ks_hextobyte as it is provided by libcompat now.
+
 	* gpgkeys_ldap.c (build_attrs), ksutil.c (ks_toupper,
 	ks_strcasecmp), ksutil.h: Remove the need for strcasecmp as the
 	field tags are always lowercase.

Modified: branches/STABLE-BRANCH-1-4/keyserver/Makefile.am
===================================================================
--- branches/STABLE-BRANCH-1-4/keyserver/Makefile.am	2006-09-28 19:30:03 UTC (rev 4273)
+++ branches/STABLE-BRANCH-1-4/keyserver/Makefile.am	2006-09-28 19:36:55 UTC (rev 4274)
@@ -36,7 +36,7 @@
 other_libs = $(LIBICONV) $(LIBINTL) $(CAPLIBS)
 
 gpgkeys_ldap_CPPFLAGS = @LDAP_CPPFLAGS@
-gpgkeys_ldap_LDADD = @LDAPLIBS@ @NETLIBS@ $(other_libs) @GETOPT@ @W32LIBS@
+gpgkeys_ldap_LDADD = ../util/libcompat.a @LDAPLIBS@ @NETLIBS@ $(other_libs) @GETOPT@ @W32LIBS@
 
 gpgkeys_finger_LDADD = ../util/libutil.a @NETLIBS@ $(other_libs) @GETOPT@ @W32LIBS@
 

Modified: branches/STABLE-BRANCH-1-4/keyserver/gpgkeys_ldap.c
===================================================================
--- branches/STABLE-BRANCH-1-4/keyserver/gpgkeys_ldap.c	2006-09-28 19:30:03 UTC (rev 4273)
+++ branches/STABLE-BRANCH-1-4/keyserver/gpgkeys_ldap.c	2006-09-28 19:36:55 UTC (rev 4274)
@@ -532,7 +532,7 @@
       while(*tok)
 	if(tok[0]=='%' && tok[1] && tok[2])
 	  {
-	    if((userid[i]=ks_hextobyte(&tok[1]))==-1)
+	    if((userid[i]=hextobyte(&tok[1]))==-1)
 	      userid[i]='?';
 
 	    i++;

Modified: branches/STABLE-BRANCH-1-4/keyserver/ksutil.c
===================================================================
--- branches/STABLE-BRANCH-1-4/keyserver/ksutil.c	2006-09-28 19:30:03 UTC (rev 4273)
+++ branches/STABLE-BRANCH-1-4/keyserver/ksutil.c	2006-09-28 19:36:55 UTC (rev 4274)
@@ -549,28 +549,3 @@
       ctx->flags.done=1;
     }
 }
-
-int
-ks_hextobyte (const char *s)
-{
-  int c;
-
-  if ( *s >= '0' && *s <= '9' )
-    c = 16 * (*s - '0');
-  else if ( *s >= 'A' && *s <= 'F' )
-    c = 16 * (10 + *s - 'A');
-  else if ( *s >= 'a' && *s <= 'f' )
-    c = 16 * (10 + *s - 'a');
-  else
-    return -1;
-  s++;
-  if ( *s >= '0' && *s <= '9' )
-    c += *s - '0';
-  else if ( *s >= 'A' && *s <= 'F' )
-    c += 10 + *s - 'A';
-  else if ( *s >= 'a' && *s <= 'f' )
-    c += 10 + *s - 'a';
-  else
-    return -1;
-  return c;
-}

Modified: branches/STABLE-BRANCH-1-4/keyserver/ksutil.h
===================================================================
--- branches/STABLE-BRANCH-1-4/keyserver/ksutil.h	2006-09-28 19:30:03 UTC (rev 4273)
+++ branches/STABLE-BRANCH-1-4/keyserver/ksutil.h	2006-09-28 19:36:55 UTC (rev 4274)
@@ -138,6 +138,4 @@
 size_t curl_writer(const void *ptr,size_t size,size_t nmemb,void *cw_ctx);
 void curl_writer_finalize(struct curl_writer_ctx *ctx);
 
-int ks_hextobyte (const char *s);
-
 #endif /* !_KSUTIL_H_ */

Modified: branches/STABLE-BRANCH-1-4/util/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/util/ChangeLog	2006-09-28 19:30:03 UTC (rev 4273)
+++ branches/STABLE-BRANCH-1-4/util/ChangeLog	2006-09-28 19:36:55 UTC (rev 4274)
@@ -1,3 +1,11 @@
+2006-09-28  David Shaw  <dshaw at jabberwocky.com>
+
+	* Makefile.am: Build libcompat.a for keyserver helpers.  libutil.a
+	always contains everything in libcompat.a, so we only need to link
+	to one or the other.
+
+	* miscutil.c: Move hextobyte to new file compat.c.
+
 2006-07-31  Werner Koch  <wk at g10code.com>
 
 	* iobuf.c (iobuf_ioctl, fd_cache_invalidate): Allow closing all

Modified: branches/STABLE-BRANCH-1-4/util/Makefile.am
===================================================================
--- branches/STABLE-BRANCH-1-4/util/Makefile.am	2006-09-28 19:30:03 UTC (rev 4273)
+++ branches/STABLE-BRANCH-1-4/util/Makefile.am	2006-09-28 19:36:55 UTC (rev 4274)
@@ -20,11 +20,12 @@
 
 INCLUDES = -I.. -I$(top_srcdir)/include -I$(top_srcdir)/intl
 
-noinst_LIBRARIES = libutil.a
+noinst_LIBRARIES = libutil.a libcompat.a
 
 libutil_a_SOURCES = logger.c fileutil.c miscutil.c strgutil.c \
 		    ttyio.c argparse.c memory.c secmem.c errors.c iobuf.c \
-		    dotlock.c http.c pka.c membuf.c cert.c
+		    dotlock.c http.c pka.c membuf.c cert.c \
+		    $(libcompat_a_SOURCES)
 
 if USE_SIMPLE_GETTEXT
 libutil_a_SOURCES+=simple-gettext.c
@@ -52,10 +53,18 @@
 EXTRA_libutil_a_SOURCES = regcomp.c regexec.c regex_internal.c \
 	                  regex_internal.h
 
-# LIBOBJS is for the replacement functions
+# LIBOBJS and libcompat.a are for the replacement functions and
+# similar simple stuff.  They're segregated in libcompat so we can
+# link it to the keyserver helpers which have different licensing.
+# libutil.a, by definition, includes everything that libcompat.a does.
+
 libutil_a_DEPENDENCIES = @LIBOBJS@
 libutil_a_LIBADD = @LIBOBJS@
 
+libcompat_a_SOURCES=compat.c
+libcompat_a_DEPENDENCIES = @LIBOBJS@
+libcompat_a_LIBADD = @LIBOBJS@
+
 http-test:  http.c
 	cc -DHAVE_CONFIG_H -I. -I. -I.. $(INCLUDES) $(LDFLAGS) -g -Wall \
 	    -DTEST -o http-test http.c libutil.a @LIBINTL@ @DNSLIBS@ @CAPLIBS@

Added: branches/STABLE-BRANCH-1-4/util/compat.c
===================================================================
--- branches/STABLE-BRANCH-1-4/util/compat.c	2006-09-28 19:30:03 UTC (rev 4273)
+++ branches/STABLE-BRANCH-1-4/util/compat.c	2006-09-28 19:36:55 UTC (rev 4274)
@@ -0,0 +1,24 @@
+int
+hextobyte (const char *s)
+{
+  int c;
+
+  if ( *s >= '0' && *s <= '9' )
+    c = 16 * (*s - '0');
+  else if ( *s >= 'A' && *s <= 'F' )
+    c = 16 * (10 + *s - 'A');
+  else if ( *s >= 'a' && *s <= 'f' )
+    c = 16 * (10 + *s - 'a');
+  else
+    return -1;
+  s++;
+  if ( *s >= '0' && *s <= '9' )
+    c += *s - '0';
+  else if ( *s >= 'A' && *s <= 'F' )
+    c += 10 + *s - 'A';
+  else if ( *s >= 'a' && *s <= 'f' )
+    c += 10 + *s - 'a';
+  else
+    return -1;
+  return c;
+}

Modified: branches/STABLE-BRANCH-1-4/util/miscutil.c
===================================================================
--- branches/STABLE-BRANCH-1-4/util/miscutil.c	2006-09-28 19:30:03 UTC (rev 4273)
+++ branches/STABLE-BRANCH-1-4/util/miscutil.c	2006-09-28 19:36:55 UTC (rev 4274)
@@ -453,28 +453,3 @@
 
   return 0;
 }
-
-int
-hextobyte( const char *s )
-{
-    int c;
-
-    if( *s >= '0' && *s <= '9' )
-	c = 16 * (*s - '0');
-    else if( *s >= 'A' && *s <= 'F' )
-	c = 16 * (10 + *s - 'A');
-    else if( *s >= 'a' && *s <= 'f' )
-	c = 16 * (10 + *s - 'a');
-    else
-	return -1;
-    s++;
-    if( *s >= '0' && *s <= '9' )
-	c += *s - '0';
-    else if( *s >= 'A' && *s <= 'F' )
-	c += 10 + *s - 'A';
-    else if( *s >= 'a' && *s <= 'f' )
-	c += 10 + *s - 'a';
-    else
-	return -1;
-    return c;
-}




More information about the Gnupg-commits mailing list