forked from wingrunr21/OpenSSH-Database-Keys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
database-keys-5.8p2.patch
1961 lines (1897 loc) · 62.1 KB
/
database-keys-5.8p2.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/Makefile.in b/Makefile.in
index 870a7f1..6ace974 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -94,6 +94,7 @@ SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \
auth2-gss.o gss-serv.o gss-serv-krb5.o \
loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \
sftp-server.o sftp-common.o \
+ database-keys.o mysql-keys.o postgresql-keys.o \
roaming_common.o roaming_serv.o
MANPAGES = moduli.5.out scp.1.out ssh-add.1.out ssh-agent.1.out ssh-keygen.1.out ssh-keyscan.1.out ssh.1.out sshd.8.out sftp-server.8.out sftp.1.out ssh-rand-helper.8.out ssh-keysign.8.out ssh-pkcs11-helper.8.out sshd_config.5.out ssh_config.5.out
diff --git a/README.database-keys b/README.database-keys
new file mode 100644
index 0000000..5c33a0d
--- /dev/null
+++ b/README.database-keys
@@ -0,0 +1,176 @@
+OpenSSH MySQL key lookup patch
+
+Written by Matt Palmer <[email protected]>
+Modifications by Stafford Brunk <[email protected]>
+
+Copyright (C) 2011
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Introduction
+------------
+
+- Matt
+OpenSSH's performance for public key authentication when there are thousands
+of keys in the authorized_keys file is a bit poor. I don't blame SSH for
+this -- it is optimized for the overwhelmingly common case, and that's fine.
+
+This patch, however, is a way of optimizing for the uncommon case of a very
+large number of keys attached to a single Unix user account. In my case,
+the key data was already being stored in a MySQL database, so it seemed
+reasonable to just teach SSH to look in there to get it's keys, with a bit
+of indexing to make everything blazingly fast.
+
+- Stafford
+I needed to use database key lookups for SSH with a PostgreSQL database. Rather
+than simply modify Matt's original patch for PostgreSQL, I decided to abstract
+out the database functionality and allow support for different database drivers.
+Through my experience with the gitolite git management system, I have seen
+that many people wish to provide a more "Github" like SSH key management
+experience without using Github itself. This patch brings that
+experience one step closer.
+
+
+Why Should I Use This Patch?
+----------------------------
+
+Because it makes logins to accounts with thousands of public keys much
+faster. If you don't have thousands of public keys for a single Unix user,
+you probably have no need for this patch.
+
+It also drastically simplifies the management of SSH keys for access control when
+a more advanced model such as Kerberos cannot be used.
+
+Principle of Operation
+----------------------
+
+The first thing you need to understand is how SSH does key lookups in an
+authorized_keys file. This work is primarily done in auth-rsa.c and
+auth2-pubkey.c. When a pubkey authentication method is requested, the
+client presents some information about the key that it wants to authenticate
+with (not the whole key, just a few selected bits of info) along with the
+info that every sort of login needs (username, etc). The server then opens
+up the user's authorized_keys file and parses that file one line at a time,
+looking for a public key that has the same values for the selected bits of
+info as the key that the client is using. A challenge/response process is
+then initiated, so that the client can *prove* it's got the correct key, and
+not just the few bits of info it initially presented (which are, after all,
+in the public key as well).
+
+What is particularly important to note here is that (a) the trundling
+through the authorized_keys file is a linear search; and (b) there is enough
+info presented by the client for us to be able to do a near-guaranteed
+unique index search of the available public keys. The purpose of this patch
+is to do (b).
+
+This patch effectively short-circuits the linear search of the
+authorized_keys file by using the fingerprint of the key that is connecting
+as an index to immediately retrieve the full public key of interest.
+
+Before a user attempts to authenticate, you have to have the database
+prepared and user keys imported in an appropriate format. The exact table
+structure is documented in the 'Setup' section, but basically you need to
+create the table and then populate it with keys and their fingerprints.
+
+When a user attempts to authenticate using a public key, the server computes
+the fingerprint of the key that is presented and tries to retrieve all keys
+that match the username and computed index hash. The usual public key
+challenge/response dance is then performed with each key to guarantee that
+the client has the private key it says it does.
+
+
+Building
+--------
+
+Apply the patch (if you haven't done so already), install the appropriate database
+development libraries and headers, then add the --with-[dbname]-keys option to
+./configure, followed by the usual building commands.
+
+The following databases are supported:
+
+ * MySQL
+ --with-mysql-keys
+ * PostgreSQL
+ --with-postgresql-keys
+
+Setup and Configuration
+-----------------------
+
+The minimum table you need to have created is as follows:
+
+CREATE TABLE public_keys (
+ username VARCHAR(255) NOT NULL, -- Unix username for the key --
+ options VARCHAR(255), -- Options for the key --
+ key TEXT NOT NULL, -- The key itself, exactly as it would be in --
+ -- authorized_keys, including the key type and ID --
+ fingerprint CHAR(48) NOT NULL -- Key fingerprint; see below --
+);
+
+CREATE INDEX public_keys_username_fingerprint ON public_keys(username, fingerprint);
+
+Yes, the table and column names are hardcoded. If you'd like to make them
+all configurable, feel free to extend the patch.
+
+Then you need to tell OpenSSH to use the database as a source of keys, with the
+following options in sshd_config:
+
+UseDatabaseKeys (yes/no): Whether or not to even consider the database as a source of
+ keys. Default: no
+
+DatabaseKeystoreDriver (string): The name of the database driver to use. Options
+ right now are [mysql, postgresql]. No default.
+
+DatabaseKeystoreServer (string): The IP address or hostname of the database server to use.
+ At present, only one server can be specified. Default: localhost
+
+DatabaseKeystoreUsername (string): The username to login to the database server with. No
+ default.
+
+DatabaseKeystorePassword (string): The password to login to the database server with. No
+ default.
+
+DatabaseKeystoreDatabase (string) The name of the database to use. No default.
+
+Finally, you need to populate the database with your users. I leave that as
+an exercise for the reader, with one hint: the fingerprint of a key can be
+obtained with the command "ssh-keygen -l -f <file> | cut -d ' ' -f 2" (or
+equivalent).
+
+
+Operation
+---------
+
+If something appears to be going wrong, check the debug logs -- the patch is
+pretty keen on putting a lot of info in there. Otherwise there shouldn't
+need to be much on-going maintenance, except to maintain your keys in the
+public_keys table.
+
+
+Questions?
+----------
+
+See Github:
+ http://www.github.com/wingrunr21/OpenSSH-DatabaseKeys
diff --git a/auth2-pubkey.c b/auth2-pubkey.c
index 7d21413..aac0a55 100644
--- a/auth2-pubkey.c
+++ b/auth2-pubkey.c
@@ -59,6 +59,19 @@
#include "authfile.h"
#include "match.h"
+#ifdef WITH_DATABASE_KEYS
+#include <string.h>
+#include "database-keys.h"
+
+#ifdef WITH_MYSQL_KEYS
+#include "mysql-keys.h"
+#endif
+
+#ifdef WITH_POSTGRESQL_KEYS
+#include "postgresql-keys.h"
+#endif
+#endif
+
/* import */
extern ServerOptions options;
extern u_char *session_id2;
@@ -266,9 +279,82 @@ user_key_allowed2(struct passwd *pw, Key *key, char *file)
Key *found;
char *fp;
+#ifdef WITH_DATABASE_KEYS
+ database_key_t *my_keys;
+ unsigned int i = 0;
+#endif
+
/* Temporarily use the user's uid. */
temporarily_use_uid(pw);
+#ifdef WITH_DATABASE_KEYS
+ if (options.dbkeys_enabled) {
+ found_key = 0;
+ found = key_new(key->type);
+
+ debug("[DBKeys] looking for a key for uid=%s in database", pw->pw_name);
+ if (strcmp(options.dbkeys_driver, "mysql") == 0)
+ {
+ my_keys = mysql_keys_search(&options, key, pw->pw_name);
+ }
+ else if (strcmp(options.dbkeys_driver, "postgresql") == 0)
+ {
+ my_keys = postgresql_keys_search(&options, key, pw->pw_name);
+ }
+
+ if (!(my_keys[0].key)) {
+ fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX);
+ logit("[DBKeys] no keys found for uid=%s and key fingerprint %s", pw->pw_name, fp);
+ xfree(fp);
+ }
+
+ for (i = 0; !found_key && my_keys[i].key; i++) {
+ char *cp;
+
+ cp = my_keys[i].key;
+ if (key_read(found, &cp) != 1) {
+ debug("[DBKeys] user_key_allowed2: invalid key string %s", my_keys[i].key);
+ continue;
+ }
+
+ /* Copy the key options into a separate buffer that ends with a space,
+ * otherwise auth_parse_options gets all shirty, because it expects
+ * the options to be part of a key, not all out on their own, and
+ * doesn't like a \0-terminated option string.
+ */
+ if (my_keys[i].options) {
+ int sl;
+ sl = strlen(my_keys[i].options);
+ cp = xmalloc(sl + 2);
+ if (snprintf(cp, sl + 2, "%s ", my_keys[i].options) >= sl + 2) {
+ fatal("Can't happen: snprintf for key options overran buffer!");
+ }
+ } else {
+ cp = NULL;
+ }
+ if (key_equal(found, key) &&
+ auth_parse_options(pw, cp, file, linenum) == 1) {
+ found_key = 1;
+ fp = key_fingerprint(found, SSH_FP_MD5, SSH_FP_HEX);
+ verbose("[DBKeys] Found matching %s key: %s", key_type(found), fp);
+
+ xfree(fp);
+ }
+ if (cp) {
+ xfree(cp);
+ }
+ }
+
+ database_keys_free(my_keys);
+ key_free(found);
+
+ if (found_key) {
+ restore_uid();
+ return found_key;
+ }
+ }
+#endif /* WITH_DATABASE_KEYS */
+
debug("trying public key file %s", file);
f = auth_openkeyfile(file, pw, options.strict_modes);
diff --git a/config.h.in b/config.h.in
index e5c9379..d22a678 100644
--- a/config.h.in
+++ b/config.h.in
@@ -596,6 +596,15 @@
/* Define to 1 if you have the <linux/if_tun.h> header file. */
#undef HAVE_LINUX_IF_TUN_H
+/* Define to 1 if you want database key lookup support. */
+#undef WITH_DATABASE_KEYS
+
+/* Enable MySQL pubkey support */
+#undef WITH_MYSQL_KEYS
+
+/* Enable PostgreSQL pubkey support */
+#undef WITH_POSTGRESQL_KEYS
+
/* Define if your libraries define login() */
#undef HAVE_LOGIN
diff --git a/configure b/configure
index 73040c5..812a175 100755
--- a/configure
+++ b/configure
@@ -1349,6 +1349,8 @@ Optional Packages:
--with-tcp-wrappers[=PATH] Enable tcpwrappers support (optionally in PATH)
--with-libedit[=PATH] Enable libedit support for sftp
--with-audit=module Enable audit support (modules=debug,bsm,linux)
+ --with-mysql-keys[=PATH] Enable MySQL key lookups (optionally with PATH)
+ --with-postgresql-keys[=PATH] Enable PostgreSQL key lookups (optionally with PATH)
--with-ssl-dir=PATH Specify path to OpenSSL installation
--without-openssl-header-check Disable OpenSSL version consistency check
--with-ssl-engine Enable OpenSSL (hardware) ENGINE support
@@ -3317,7 +3319,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
ac_cv_header_stdc=no
fi
-rm -f conftest*
+rm -f -r conftest*
fi
@@ -3338,7 +3340,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
ac_cv_header_stdc=no
fi
-rm -f conftest*
+rm -f -r conftest*
fi
@@ -5158,7 +5160,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
;;
esac
-rm -f conftest*
+rm -f -r conftest*
if test $ac_cv_sys_file_offset_bits = unknown; then
{ echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6; }
@@ -5279,7 +5281,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
;;
esac
-rm -f conftest*
+rm -f -r conftest*
fi
fi
@@ -12494,7 +12496,7 @@ echo "${ECHO_T}no" >&6; }
fi
-rm -f conftest*
+rm -f -r conftest*
# Check for g.gl_matchc glob() extension
@@ -13744,6 +13746,518 @@ echo "$as_me: error: Unknown audit module $withval" >&2;}
fi
+use_database_keys=0
+
+MYSQL_KEYS_MSG="no"
+
+# Check whether --with-mysql-keys was given.
+if test "${with_mysql_keys+set}" = set; then
+ withval=$with_mysql_keys;
+ if test "x$withval" != "xno" ; then
+ if test "x$withval" != "xyes" ; then
+ CPPFLAGS="$CPPFLAGS -I${withval}/include"
+ LDFLAGS="$LDFLAGS -L${withval}/lib"
+ fi
+
+
+cat >>confdefs.h <<\_ACEOF
+#define WITH_MYSQL_KEYS 1
+_ACEOF
+
+ LIBS="$LIBS -lmysqlclient"
+ MYSQL_KEYS_MSG="yes"
+
+ if test "x$use_database_keys" = "x0"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define WITH_DATABASE_KEYS 1
+_ACEOF
+
+ use_database_keys=1
+ fi
+
+ if test "${ac_cv_header_mysql_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for mysql.h" >&5
+echo $ECHO_N "checking for mysql.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_mysql_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_mysql_h" >&5
+echo "${ECHO_T}$ac_cv_header_mysql_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking mysql.h usability" >&5
+echo $ECHO_N "checking mysql.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <mysql.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking mysql.h presence" >&5
+echo $ECHO_N "checking mysql.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <mysql.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: mysql.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: mysql.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: mysql.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: mysql.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: mysql.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: mysql.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: mysql.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: mysql.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: mysql.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: mysql.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: mysql.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: mysql.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: mysql.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: mysql.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: mysql.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: mysql.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------------- ##
+## Report this to [email protected] ##
+## ------------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for mysql.h" >&5
+echo $ECHO_N "checking for mysql.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_mysql_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_mysql_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_mysql_h" >&5
+echo "${ECHO_T}$ac_cv_header_mysql_h" >&6; }
+
+fi
+if test $ac_cv_header_mysql_h = yes; then
+
+
+{ echo "$as_me:$LINENO: checking for mysql_init in -lmysqlclient" >&5
+echo $ECHO_N "checking for mysql_init in -lmysqlclient... $ECHO_C" >&6; }
+if test "${ac_cv_lib_mysqlclient_mysql_init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmysqlclient $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char mysql_init ();
+int
+main ()
+{
+return mysql_init ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_lib_mysqlclient_mysql_init=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_mysqlclient_mysql_init=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_mysqlclient_mysql_init" >&5
+echo "${ECHO_T}$ac_cv_lib_mysqlclient_mysql_init" >&6; }
+if test $ac_cv_lib_mysqlclient_mysql_init = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBMYSQLCLIENT 1
+_ACEOF
+
+ LIBS="-lmysqlclient $LIBS"
+
+else
+
+ { { echo "$as_me:$LINENO: error: ** Incomplete or missing MySQL libraries **" >&5
+echo "$as_me: error: ** Incomplete or missing MySQL libraries **" >&2;}
+ { (exit 1); exit 1; }; }
+
+
+fi
+
+
+else
+
+ { { echo "$as_me:$LINENO: error: ** Incomplete or missing MySQL libraries **" >&5
+echo "$as_me: error: ** Incomplete or missing MySQL libraries **" >&2;}
+ { (exit 1); exit 1; }; }
+
+
+fi
+
+
+ fi
+
+
+fi
+
+
+POSTGRESQL_KEYS_MSG="no"
+
+# Check whether --with-postgresql-keys was given.
+if test "${with_postgresql_keys+set}" = set; then
+ withval=$with_postgresql_keys;
+ if test "x$withval" != "xno" ; then
+ if test "x$withval" != "xyes" ; then
+ CPPFLAGS="$CPPFLAGS -I${withval}/include"
+ LDFLAGS="$LDFLAGS -L${withval}/lib"
+ fi
+
+
+cat >>confdefs.h <<\_ACEOF
+#define WITH_POSTGRESQL_KEYS 1
+_ACEOF
+
+ LIBS="$LIBS -lpq"
+ POSTGRESQL_KEYS_MSG="yes"
+
+ if test "x$use_database_keys" = "x0"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define WITH_DATABASE_KEYS 1
+_ACEOF
+
+ use_database_keys=1
+ fi
+
+ if test "${ac_cv_header_libpq_fe_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for libpq-fe.h" >&5
+echo $ECHO_N "checking for libpq-fe.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_libpq_fe_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_libpq_fe_h" >&5
+echo "${ECHO_T}$ac_cv_header_libpq_fe_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking libpq-fe.h usability" >&5
+echo $ECHO_N "checking libpq-fe.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <libpq-fe.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking libpq-fe.h presence" >&5
+echo $ECHO_N "checking libpq-fe.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <libpq-fe.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: libpq-fe.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: libpq-fe.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: libpq-fe.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: libpq-fe.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: libpq-fe.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: libpq-fe.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: libpq-fe.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: libpq-fe.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: libpq-fe.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: libpq-fe.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: libpq-fe.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: libpq-fe.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: libpq-fe.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: libpq-fe.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: libpq-fe.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: libpq-fe.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------------- ##
+## Report this to [email protected] ##
+## ------------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for libpq-fe.h" >&5
+echo $ECHO_N "checking for libpq-fe.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_libpq_fe_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_libpq_fe_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_libpq_fe_h" >&5
+echo "${ECHO_T}$ac_cv_header_libpq_fe_h" >&6; }
+
+fi
+if test $ac_cv_header_libpq_fe_h = yes; then
+
+
+{ echo "$as_me:$LINENO: checking for PQconnectdb in -lpq" >&5
+echo $ECHO_N "checking for PQconnectdb in -lpq... $ECHO_C" >&6; }
+if test "${ac_cv_lib_pq_PQconnectdb+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpq $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char PQconnectdb ();
+int
+main ()
+{
+return PQconnectdb ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_lib_pq_PQconnectdb=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_pq_PQconnectdb=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_pq_PQconnectdb" >&5
+echo "${ECHO_T}$ac_cv_lib_pq_PQconnectdb" >&6; }
+if test $ac_cv_lib_pq_PQconnectdb = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBPQ 1
+_ACEOF
+
+ LIBS="-lpq $LIBS"
+
+else
+
+ { { echo "$as_me:$LINENO: error: ** Incomplete or missing PostgreSQL libraries **" >&5
+echo "$as_me: error: ** Incomplete or missing PostgreSQL libraries **" >&2;}
+ { (exit 1); exit 1; }; }
+
+
+fi
+
+
+else
+
+ { { echo "$as_me:$LINENO: error: ** Incomplete or missing PostgreSQL libraries **" >&5
+echo "$as_me: error: ** Incomplete or missing PostgreSQL libraries **" >&2;}
+ { (exit 1); exit 1; }; }
+
+
+fi
+
+
+ fi
+
+
+fi
+
+
@@ -24767,7 +25281,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
eval "$ossh_varname=no"
fi
-rm -f conftest*
+rm -f -r conftest*
fi
@@ -24812,7 +25326,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
eval "$ossh_varname=no"
fi
-rm -f conftest*
+rm -f -r conftest*
fi
@@ -24857,7 +25371,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
eval "$ossh_varname=no"
fi
-rm -f conftest*
+rm -f -r conftest*
fi
@@ -24902,7 +25416,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
eval "$ossh_varname=no"
fi
-rm -f conftest*
+rm -f -r conftest*
fi
@@ -24947,7 +25461,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
eval "$ossh_varname=no"
fi
-rm -f conftest*
+rm -f -r conftest*
fi
@@ -24992,7 +25506,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
eval "$ossh_varname=no"
fi
-rm -f conftest*
+rm -f -r conftest*
fi
@@ -25037,7 +25551,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
eval "$ossh_varname=no"
fi
-rm -f conftest*
+rm -f -r conftest*
fi
@@ -25082,7 +25596,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
eval "$ossh_varname=no"
fi
-rm -f conftest*
+rm -f -r conftest*
fi
@@ -25127,7 +25641,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
eval "$ossh_varname=no"
fi
-rm -f conftest*
+rm -f -r conftest*
fi
@@ -25172,7 +25686,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
eval "$ossh_varname=no"
fi
-rm -f conftest*
+rm -f -r conftest*
fi
@@ -25217,7 +25731,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
eval "$ossh_varname=no"
fi
-rm -f conftest*
+rm -f -r conftest*
fi
@@ -25262,7 +25776,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
eval "$ossh_varname=no"