Re: [ODBC] MD5 support for ODBC - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [ODBC] MD5 support for ODBC
Date
Msg-id 200111120149.fAC1nvR28663@candle.pha.pa.us
Whole thread Raw
In response to Re: [ODBC] MD5 support for ODBC  (Hiroshi Inoue <Inoue@tpf.co.jp>)
Responses Re: [ODBC] MD5 support for ODBC  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-patches
> Bruce Momjian wrote:
> >
> > The attached patch should add MD5 support to ODBC.  I don't have ODBC
> > here so I would appreciate if someone would test it and let me know.  I
> > am not considering applying the patch to CVS.
>
> I checked it under Windows and it worked well.
> I already committed the interfaces/odbc part.

OK, great.  I am surprised it worked the first time.  I didn't test it
here, and I am know more for my persistance than skill.  :-)

I have applied the rest of the patch.  It adds a check to the
backend/libpq Makefile and aborts if the two C md5.c files are not
identical.

There are two copies of md5.c because odbc has to be compile-able on its
own, and md5.c is also used by the backend and libpq.  With this check,
the two files will remain in sync because it will not even compile if
they aren't.

Also, odbc/md5.h has copies of certain definitions that normally appear
in include/c.h.  Because md5.c must compile alone in the odbc directory,
I needed those defines pulled out and added into odbc.  I will document
that these defines also appear in odbc/md5.h.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: src/backend/libpq/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/backend/libpq/Makefile,v
retrieving revision 1.25
diff -c -r1.25 Makefile
*** src/backend/libpq/Makefile    2001/08/15 18:42:14    1.25
--- src/backend/libpq/Makefile    2001/11/08 19:55:43
***************
*** 19,25 ****
      pqcomm.o pqformat.o pqpacket.o pqsignal.o util.o


! all: SUBSYS.o

  SUBSYS.o: $(OBJS)
      $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
--- 19,30 ----
      pqcomm.o pqformat.o pqpacket.o pqsignal.o util.o


! all: check_md5 SUBSYS.o
!
! check_md5:
!     @cmp -s md5.c ../../interfaces/odbc/md5.c || \
!     (echo "src/interfaces/odbc/md5.c doesn't match src/backend/libpq/md5.c" && \
!      exit 1)

  SUBSYS.o: $(OBJS)
      $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
Index: src/backend/libpq/md5.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/libpq/md5.c,v
retrieving revision 1.9
diff -c -r1.9 md5.c
*** src/backend/libpq/md5.c    2001/10/25 05:49:30    1.9
--- src/backend/libpq/md5.c    2001/11/08 19:55:43
***************
*** 13,21 ****
   * $Header: /cvsroot/pgsql/src/backend/libpq/md5.c,v 1.9 2001/10/25 05:49:30 momjian Exp $
   */

- #include "postgres.h"

  #include "libpq/crypt.h"

  #ifdef FRONTEND
  #undef palloc
--- 13,25 ----
   * $Header: /cvsroot/pgsql/src/backend/libpq/md5.c,v 1.9 2001/10/25 05:49:30 momjian Exp $
   */


+ #ifndef MD5_ODBC
+ #include "postgres.h"
  #include "libpq/crypt.h"
+ #else
+ #include "md5.h"
+ #endif

  #ifdef FRONTEND
  #undef palloc

pgsql-patches by date:

Previous
From: Hiroshi Inoue
Date:
Subject: Re: [ODBC] MD5 support for ODBC
Next
From: Tom Lane
Date:
Subject: Re: Patch for Makefile race against current cvs