mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-10 21:38:50 +01:00
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.
This commit is contained in:
parent
61765b20e6
commit
b17fcc5d51
@ -1,3 +1,9 @@
|
|||||||
|
2006-09-28 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* compat.h: New, used for libcompat.a functions.
|
||||||
|
|
||||||
|
* util.h: Includes compat.h.
|
||||||
|
|
||||||
2006-04-20 David Shaw <dshaw@jabberwocky.com>
|
2006-04-20 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* cipher.h: Add dsa2_generate();
|
* cipher.h: Add dsa2_generate();
|
||||||
|
6
include/compat.h
Normal file
6
include/compat.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef _COMPAT_H_
|
||||||
|
#define _COMPAT_H_
|
||||||
|
|
||||||
|
int hextobyte( const char *s );
|
||||||
|
|
||||||
|
#endif /* !_COMPAT_H_ */
|
@ -30,7 +30,7 @@
|
|||||||
#include "errors.h"
|
#include "errors.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
|
#include "compat.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int *argc; /* pointer to argc (value subject to change) */
|
int *argc; /* pointer to argc (value subject to change) */
|
||||||
@ -164,7 +164,6 @@ int answer_is_yes( const char *s );
|
|||||||
int answer_is_yes_no_quit( const char *s );
|
int answer_is_yes_no_quit( const char *s );
|
||||||
int answer_is_okay_cancel (const char *s, int def_answer);
|
int answer_is_okay_cancel (const char *s, int def_answer);
|
||||||
int match_multistr(const char *multistr,const char *match);
|
int match_multistr(const char *multistr,const char *match);
|
||||||
int hextobyte( const char *s );
|
|
||||||
|
|
||||||
/*-- strgutil.c --*/
|
/*-- strgutil.c --*/
|
||||||
void free_strlist( STRLIST sl );
|
void free_strlist( STRLIST sl );
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
2006-09-28 David Shaw <dshaw@jabberwocky.com>
|
2006-09-28 David Shaw <dshaw@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,
|
* gpgkeys_ldap.c (build_attrs), ksutil.c (ks_toupper,
|
||||||
ks_strcasecmp), ksutil.h: Remove the need for strcasecmp as the
|
ks_strcasecmp), ksutil.h: Remove the need for strcasecmp as the
|
||||||
field tags are always lowercase.
|
field tags are always lowercase.
|
||||||
|
@ -36,7 +36,7 @@ gpgkeys_curl_SOURCES = gpgkeys_curl.c ksutil.c ksutil.h
|
|||||||
other_libs = $(LIBICONV) $(LIBINTL) $(CAPLIBS)
|
other_libs = $(LIBICONV) $(LIBINTL) $(CAPLIBS)
|
||||||
|
|
||||||
gpgkeys_ldap_CPPFLAGS = @LDAP_CPPFLAGS@
|
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@
|
gpgkeys_finger_LDADD = ../util/libutil.a @NETLIBS@ $(other_libs) @GETOPT@ @W32LIBS@
|
||||||
|
|
||||||
|
@ -532,7 +532,7 @@ build_attrs(LDAPMod ***modlist,char *line)
|
|||||||
while(*tok)
|
while(*tok)
|
||||||
if(tok[0]=='%' && tok[1] && tok[2])
|
if(tok[0]=='%' && tok[1] && tok[2])
|
||||||
{
|
{
|
||||||
if((userid[i]=ks_hextobyte(&tok[1]))==-1)
|
if((userid[i]=hextobyte(&tok[1]))==-1)
|
||||||
userid[i]='?';
|
userid[i]='?';
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
@ -549,28 +549,3 @@ curl_writer_finalize(struct curl_writer_ctx *ctx)
|
|||||||
ctx->flags.done=1;
|
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;
|
|
||||||
}
|
|
||||||
|
@ -138,6 +138,4 @@ struct curl_writer_ctx
|
|||||||
size_t curl_writer(const void *ptr,size_t size,size_t nmemb,void *cw_ctx);
|
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);
|
void curl_writer_finalize(struct curl_writer_ctx *ctx);
|
||||||
|
|
||||||
int ks_hextobyte (const char *s);
|
|
||||||
|
|
||||||
#endif /* !_KSUTIL_H_ */
|
#endif /* !_KSUTIL_H_ */
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2006-09-28 David Shaw <dshaw@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@g10code.com>
|
2006-07-31 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* iobuf.c (iobuf_ioctl, fd_cache_invalidate): Allow closing all
|
* iobuf.c (iobuf_ioctl, fd_cache_invalidate): Allow closing all
|
||||||
|
@ -20,11 +20,12 @@
|
|||||||
|
|
||||||
INCLUDES = -I.. -I$(top_srcdir)/include -I$(top_srcdir)/intl
|
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 \
|
libutil_a_SOURCES = logger.c fileutil.c miscutil.c strgutil.c \
|
||||||
ttyio.c argparse.c memory.c secmem.c errors.c iobuf.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
|
if USE_SIMPLE_GETTEXT
|
||||||
libutil_a_SOURCES+=simple-gettext.c
|
libutil_a_SOURCES+=simple-gettext.c
|
||||||
@ -52,10 +53,18 @@ endif
|
|||||||
EXTRA_libutil_a_SOURCES = regcomp.c regexec.c regex_internal.c \
|
EXTRA_libutil_a_SOURCES = regcomp.c regexec.c regex_internal.c \
|
||||||
regex_internal.h
|
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_DEPENDENCIES = @LIBOBJS@
|
||||||
libutil_a_LIBADD = @LIBOBJS@
|
libutil_a_LIBADD = @LIBOBJS@
|
||||||
|
|
||||||
|
libcompat_a_SOURCES=compat.c
|
||||||
|
libcompat_a_DEPENDENCIES = @LIBOBJS@
|
||||||
|
libcompat_a_LIBADD = @LIBOBJS@
|
||||||
|
|
||||||
http-test: http.c
|
http-test: http.c
|
||||||
cc -DHAVE_CONFIG_H -I. -I. -I.. $(INCLUDES) $(LDFLAGS) -g -Wall \
|
cc -DHAVE_CONFIG_H -I. -I. -I.. $(INCLUDES) $(LDFLAGS) -g -Wall \
|
||||||
-DTEST -o http-test http.c libutil.a @LIBINTL@ @DNSLIBS@ @CAPLIBS@
|
-DTEST -o http-test http.c libutil.a @LIBINTL@ @DNSLIBS@ @CAPLIBS@
|
||||||
|
24
util/compat.c
Normal file
24
util/compat.c
Normal file
@ -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;
|
||||||
|
}
|
@ -453,28 +453,3 @@ match_multistr(const char *multistr,const char *match)
|
|||||||
|
|
||||||
return 0;
|
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;
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user