|
7 | 7 | *
|
8 | 8 | *
|
9 | 9 | * IDENTIFICATION
|
10 |
| - * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.23 1998/01/27 03:24:54 scrappy Exp $ |
| 10 | + * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.24 1998/01/29 03:23:05 scrappy Exp $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
@@ -390,80 +390,83 @@ void auth_failed(Port *port)
|
390 | 390 | */
|
391 | 391 | void be_recvauth(Port *port)
|
392 | 392 | {
|
393 |
| - AuthRequest areq; |
394 |
| - void (*auth_handler)(); |
395 |
| - |
396 | 393 | /*
|
397 | 394 | * Get the authentication method to use for this frontend/database
|
398 | 395 | * combination.
|
399 | 396 | */
|
400 | 397 |
|
401 | 398 | if (hba_getauthmethod(&port->raddr, port->database, port->auth_arg,
|
402 | 399 | &port->auth_method) != STATUS_OK)
|
403 |
| - { |
404 | 400 | PacketSendError(&port->pktInfo, "Missing or mis-configured pg_hba.conf file");
|
405 |
| - return; |
406 |
| - } |
407 | 401 |
|
408 |
| - /* Handle old style authentication. */ |
409 |
| - |
410 |
| - if (PG_PROTOCOL_MAJOR(port->proto) == 0) |
| 402 | + else if (PG_PROTOCOL_MAJOR(port->proto) == 0) |
411 | 403 | {
|
| 404 | + /* Handle old style authentication. */ |
| 405 | + |
412 | 406 | if (old_be_recvauth(port) != STATUS_OK)
|
413 | 407 | auth_failed(port);
|
414 |
| - |
415 |
| - return; |
416 | 408 | }
|
417 |
| - |
418 |
| - /* Handle new style authentication. */ |
419 |
| - |
420 |
| - switch (port->auth_method) |
| 409 | + else |
421 | 410 | {
|
422 |
| - case uaReject: |
423 |
| - auth_failed(port); |
424 |
| - return; |
425 |
| - |
426 |
| - case uaKrb4: |
427 |
| - areq = AUTH_REQ_KRB4; |
428 |
| - auth_handler = handle_krb4_auth; |
429 |
| - break; |
| 411 | + AuthRequest areq; |
| 412 | + void (*auth_handler)(); |
430 | 413 |
|
431 |
| - case uaKrb5: |
432 |
| - areq = AUTH_REQ_KRB5; |
433 |
| - auth_handler = handle_krb5_auth; |
434 |
| - break; |
| 414 | + /* Keep the compiler quiet. */ |
435 | 415 |
|
436 |
| - case uaTrust: |
437 | 416 | areq = AUTH_REQ_OK;
|
438 |
| - auth_handler = handle_done_auth; |
439 |
| - break; |
440 | 417 |
|
441 |
| - case uaIdent: |
442 |
| - if (authident(&port->raddr.in, &port->laddr.in, port->user, |
443 |
| - port->auth_arg) != STATUS_OK) |
| 418 | + /* Handle new style authentication. */ |
| 419 | + |
| 420 | + auth_handler = NULL; |
| 421 | + |
| 422 | + switch (port->auth_method) |
444 | 423 | {
|
445 |
| - auth_failed(port); |
446 |
| - return; |
447 |
| - } |
| 424 | + case uaReject: |
| 425 | + break; |
| 426 | + |
| 427 | + case uaKrb4: |
| 428 | + areq = AUTH_REQ_KRB4; |
| 429 | + auth_handler = handle_krb4_auth; |
| 430 | + break; |
448 | 431 |
|
449 |
| - areq = AUTH_REQ_OK; |
450 |
| - auth_handler = handle_done_auth; |
451 |
| - break; |
| 432 | + case uaKrb5: |
| 433 | + areq = AUTH_REQ_KRB5; |
| 434 | + auth_handler = handle_krb5_auth; |
| 435 | + break; |
452 | 436 |
|
453 |
| - case uaPassword: |
454 |
| - areq = AUTH_REQ_PASSWORD; |
455 |
| - auth_handler = handle_password_auth; |
456 |
| - break; |
| 437 | + case uaTrust: |
| 438 | + areq = AUTH_REQ_OK; |
| 439 | + auth_handler = handle_done_auth; |
| 440 | + break; |
457 | 441 |
|
458 |
| - case uaCrypt: |
459 |
| - areq = AUTH_REQ_CRYPT; |
460 |
| - auth_handler = handle_password_auth; |
461 |
| - break; |
462 |
| - } |
| 442 | + case uaIdent: |
| 443 | + if (authident(&port->raddr.in, &port->laddr.in, |
| 444 | + port->user, port->auth_arg) == STATUS_OK) |
| 445 | + { |
| 446 | + areq = AUTH_REQ_OK; |
| 447 | + auth_handler = handle_done_auth; |
| 448 | + } |
| 449 | + |
| 450 | + break; |
463 | 451 |
|
464 |
| - /* Tell the frontend what we want next. */ |
| 452 | + case uaPassword: |
| 453 | + areq = AUTH_REQ_PASSWORD; |
| 454 | + auth_handler = handle_password_auth; |
| 455 | + break; |
465 | 456 |
|
466 |
| - sendAuthRequest(port, areq, auth_handler); |
| 457 | + case uaCrypt: |
| 458 | + areq = AUTH_REQ_CRYPT; |
| 459 | + auth_handler = handle_password_auth; |
| 460 | + break; |
| 461 | + } |
| 462 | + |
| 463 | + /* Tell the frontend what we want next. */ |
| 464 | + |
| 465 | + if (auth_handler != NULL) |
| 466 | + sendAuthRequest(port, areq, auth_handler); |
| 467 | + else |
| 468 | + auth_failed(port); |
| 469 | + } |
467 | 470 | }
|
468 | 471 |
|
469 | 472 |
|
|
0 commit comments