|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.125 2005/06/14 17:43:13 momjian Exp $ |
| 11 | + * $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.126 2005/06/27 02:04:24 neilc Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -69,83 +69,6 @@ static Port *pam_port_cludge; /* Workaround for passing "Port *port"
|
69 | 69 | * into pam_passwd_conv_proc */
|
70 | 70 | #endif /* USE_PAM */
|
71 | 71 |
|
72 |
| -#ifdef KRB4 |
73 |
| -/*---------------------------------------------------------------- |
74 |
| - * MIT Kerberos authentication system - protocol version 4 |
75 |
| - *---------------------------------------------------------------- |
76 |
| - */ |
77 |
| - |
78 |
| -#include "krb.h" |
79 |
| - |
80 |
| -/* |
81 |
| - * pg_krb4_recvauth -- server routine to receive authentication information |
82 |
| - * from the client |
83 |
| - * |
84 |
| - * Nothing unusual here, except that we compare the username obtained from |
85 |
| - * the client's setup packet to the authenticated name. (We have to retain |
86 |
| - * the name in the setup packet since we have to retain the ability to handle |
87 |
| - * unauthenticated connections.) |
88 |
| - */ |
89 |
| -static int |
90 |
| -pg_krb4_recvauth(Port *port) |
91 |
| -{ |
92 |
| - long krbopts = 0; /* one-way authentication */ |
93 |
| - KTEXT_ST clttkt; |
94 |
| - char instance[INST_SZ + 1], |
95 |
| - version[KRB_SENDAUTH_VLEN + 1]; |
96 |
| - AUTH_DAT auth_data; |
97 |
| - Key_schedule key_sched; |
98 |
| - int status; |
99 |
| - |
100 |
| - strcpy(instance, "*"); /* don't care, but arg gets expanded |
101 |
| - * anyway */ |
102 |
| - status = krb_recvauth(krbopts, |
103 |
| - port->sock, |
104 |
| - &clttkt, |
105 |
| - pg_krb_srvnam, |
106 |
| - instance, |
107 |
| - &port->raddr.in, |
108 |
| - &port->laddr.in, |
109 |
| - &auth_data, |
110 |
| - pg_krb_server_keyfile, |
111 |
| - key_sched, |
112 |
| - version); |
113 |
| - if (status != KSUCCESS) |
114 |
| - { |
115 |
| - ereport(LOG, |
116 |
| - (errmsg("Kerberos error: %s", krb_err_txt[status]))); |
117 |
| - return STATUS_ERROR; |
118 |
| - } |
119 |
| - if (strncmp(version, PG_KRB4_VERSION, KRB_SENDAUTH_VLEN) != 0) |
120 |
| - { |
121 |
| - ereport(LOG, |
122 |
| - (errmsg("unexpected Kerberos protocol version received from client (received \"%s\", expected \"%s\")", |
123 |
| - version, PG_KRB4_VERSION))); |
124 |
| - return STATUS_ERROR; |
125 |
| - } |
126 |
| - if (strncmp(port->user_name, auth_data.pname, SM_DATABASE_USER) != 0) |
127 |
| - { |
128 |
| - ereport(LOG, |
129 |
| - (errmsg("unexpected Kerberos user name received from client (received \"%s\", expected \"%s\")", |
130 |
| - port->user_name, auth_data.pname))); |
131 |
| - return STATUS_ERROR; |
132 |
| - } |
133 |
| - return STATUS_OK; |
134 |
| -} |
135 |
| - |
136 |
| -#else |
137 |
| - |
138 |
| -static int |
139 |
| -pg_krb4_recvauth(Port *port) |
140 |
| -{ |
141 |
| - ereport(LOG, |
142 |
| - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), |
143 |
| - errmsg("Kerberos 4 not implemented on this server"))); |
144 |
| - return STATUS_ERROR; |
145 |
| -} |
146 |
| -#endif /* KRB4 */ |
147 |
| - |
148 |
| - |
149 | 72 | #ifdef KRB5
|
150 | 73 | /*----------------------------------------------------------------
|
151 | 74 | * MIT Kerberos authentication system - protocol version 5
|
@@ -252,8 +175,7 @@ pg_krb5_init(void)
|
252 | 175 | * from the client
|
253 | 176 | *
|
254 | 177 | * We still need to compare the username obtained from the client's setup
|
255 |
| - * packet to the authenticated name, as described in pg_krb4_recvauth. This |
256 |
| - * is a bit more problematic in v5, as described above in pg_an_to_ln. |
| 178 | + * packet to the authenticated name. |
257 | 179 | *
|
258 | 180 | * We have our own keytab file because postgres is unlikely to run as root,
|
259 | 181 | * and so cannot read the default keytab.
|
@@ -380,9 +302,6 @@ auth_failed(Port *port, int status)
|
380 | 302 | case uaReject:
|
381 | 303 | errstr = gettext_noop("authentication failed for user \"%s\": host rejected");
|
382 | 304 | break;
|
383 |
| - case uaKrb4: |
384 |
| - errstr = gettext_noop("Kerberos 4 authentication failed for user \"%s\""); |
385 |
| - break; |
386 | 305 | case uaKrb5:
|
387 | 306 | errstr = gettext_noop("Kerberos 5 authentication failed for user \"%s\"");
|
388 | 307 | break;
|
@@ -461,27 +380,16 @@ ClientAuthentication(Port *port)
|
461 | 380 | (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
|
462 | 381 | errmsg("no pg_hba.conf entry for host \"%s\", user \"%s\", database \"%s\", %s",
|
463 | 382 | hostinfo, port->user_name, port->database_name,
|
464 |
| - port->ssl ? _("SSL on") : _("SSL off")))); |
| 383 | + port->ssl ? _("SSL on") : _("SSL off")))); |
465 | 384 | #else
|
466 | 385 | ereport(FATAL,
|
467 | 386 | (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
|
468 | 387 | errmsg("no pg_hba.conf entry for host \"%s\", user \"%s\", database \"%s\"",
|
469 |
| - hostinfo, port->user_name, port->database_name))); |
| 388 | + hostinfo, port->user_name, port->database_name))); |
470 | 389 | #endif
|
471 | 390 | break;
|
472 | 391 | }
|
473 | 392 |
|
474 |
| - case uaKrb4: |
475 |
| - /* Kerberos 4 only seems to work with AF_INET. */ |
476 |
| - if (port->raddr.addr.ss_family != AF_INET |
477 |
| - || port->laddr.addr.ss_family != AF_INET) |
478 |
| - ereport(FATAL, |
479 |
| - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), |
480 |
| - errmsg("Kerberos 4 only supports IPv4 connections"))); |
481 |
| - sendAuthRequest(port, AUTH_REQ_KRB4); |
482 |
| - status = pg_krb4_recvauth(port); |
483 |
| - break; |
484 |
| - |
485 | 393 | case uaKrb5:
|
486 | 394 | sendAuthRequest(port, AUTH_REQ_KRB5);
|
487 | 395 | status = pg_krb5_recvauth(port);
|
|
0 commit comments