summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-02-24 11:55:46 +1100
committerDamien Miller <djm@mindrot.org>2003-02-24 11:55:46 +1100
commitb7df3af154d035be480b9d9f433f440f1c66e1bd (patch)
treec65e09bdaff201141b6fa243ac67631fcdf89991
parent386f1f3e6c5c3ea72970fcce4d939b2d4eb1bf3e (diff)
- markus@cvs.openbsd.org 2003/02/04 09:33:22
[monitor.c monitor_wrap.c] skey/bsdauth: use 0 to indicate failure instead of -1, because the buffer API only supports unsigned ints.
-rw-r--r--ChangeLog6
-rw-r--r--monitor.c26
-rw-r--r--monitor_wrap.c15
3 files changed, 26 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index e2f4635ea..0ba9fe7a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -35,6 +35,10 @@
35 - markus@cvs.openbsd.org 2003/02/04 09:32:08 35 - markus@cvs.openbsd.org 2003/02/04 09:32:08
36 [key.c] 36 [key.c]
37 better debug3 message 37 better debug3 message
38 - markus@cvs.openbsd.org 2003/02/04 09:33:22
39 [monitor.c monitor_wrap.c]
40 skey/bsdauth: use 0 to indicate failure instead of -1, because
41 the buffer API only supports unsigned ints.
38 42
3920030211 4320030211
40 - (djm) Cygwin needs libcrypt too. Patch from vinschen@redhat.com 44 - (djm) Cygwin needs libcrypt too. Patch from vinschen@redhat.com
@@ -1135,4 +1139,4 @@
1135 save auth method before monitor_reset_key_state(); bugzilla bug #284; 1139 save auth method before monitor_reset_key_state(); bugzilla bug #284;
1136 ok provos@ 1140 ok provos@
1137 1141
1138$Id: ChangeLog,v 1.2602 2003/02/24 00:54:57 djm Exp $ 1142$Id: ChangeLog,v 1.2603 2003/02/24 00:55:46 djm Exp $
diff --git a/monitor.c b/monitor.c
index b91cfdeda..07d1728ec 100644
--- a/monitor.c
+++ b/monitor.c
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#include "includes.h" 27#include "includes.h"
28RCSID("$OpenBSD: monitor.c,v 1.30 2002/11/05 19:45:20 markus Exp $"); 28RCSID("$OpenBSD: monitor.c,v 1.31 2003/02/04 09:33:22 markus Exp $");
29 29
30#include <openssl/dh.h> 30#include <openssl/dh.h>
31 31
@@ -634,20 +634,20 @@ mm_answer_bsdauthquery(int socket, Buffer *m)
634 u_int numprompts; 634 u_int numprompts;
635 u_int *echo_on; 635 u_int *echo_on;
636 char **prompts; 636 char **prompts;
637 int res; 637 u_int success;
638 638
639 res = bsdauth_query(authctxt, &name, &infotxt, &numprompts, 639 success = bsdauth_query(authctxt, &name, &infotxt, &numprompts,
640 &prompts, &echo_on); 640 &prompts, &echo_on) < 0 ? 0 : 1;
641 641
642 buffer_clear(m); 642 buffer_clear(m);
643 buffer_put_int(m, res); 643 buffer_put_int(m, success);
644 if (res != -1) 644 if (success)
645 buffer_put_cstring(m, prompts[0]); 645 buffer_put_cstring(m, prompts[0]);
646 646
647 debug3("%s: sending challenge res: %d", __func__, res); 647 debug3("%s: sending challenge success: %u", __func__, success);
648 mm_request_send(socket, MONITOR_ANS_BSDAUTHQUERY, m); 648 mm_request_send(socket, MONITOR_ANS_BSDAUTHQUERY, m);
649 649
650 if (res != -1) { 650 if (success) {
651 xfree(name); 651 xfree(name);
652 xfree(infotxt); 652 xfree(infotxt);
653 xfree(prompts); 653 xfree(prompts);
@@ -691,16 +691,16 @@ mm_answer_skeyquery(int socket, Buffer *m)
691{ 691{
692 struct skey skey; 692 struct skey skey;
693 char challenge[1024]; 693 char challenge[1024];
694 int res; 694 u_int success;
695 695
696 res = skeychallenge(&skey, authctxt->user, challenge); 696 success = skeychallenge(&skey, authctxt->user, challenge) < 0 ? 0 : 1;
697 697
698 buffer_clear(m); 698 buffer_clear(m);
699 buffer_put_int(m, res); 699 buffer_put_int(m, success);
700 if (res != -1) 700 if (success)
701 buffer_put_cstring(m, challenge); 701 buffer_put_cstring(m, challenge);
702 702
703 debug3("%s: sending challenge res: %d", __func__, res); 703 debug3("%s: sending challenge success: %u", __func__, success);
704 mm_request_send(socket, MONITOR_ANS_SKEYQUERY, m); 704 mm_request_send(socket, MONITOR_ANS_SKEYQUERY, m);
705 705
706 return (0); 706 return (0);
diff --git a/monitor_wrap.c b/monitor_wrap.c
index b75f9dfc7..551bbc15a 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#include "includes.h" 27#include "includes.h"
28RCSID("$OpenBSD: monitor_wrap.c,v 1.20 2002/11/21 23:03:51 deraadt Exp $"); 28RCSID("$OpenBSD: monitor_wrap.c,v 1.21 2003/02/04 09:33:22 markus Exp $");
29 29
30#include <openssl/bn.h> 30#include <openssl/bn.h>
31#include <openssl/dh.h> 31#include <openssl/dh.h>
@@ -714,7 +714,7 @@ mm_bsdauth_query(void *ctx, char **name, char **infotxt,
714 u_int *numprompts, char ***prompts, u_int **echo_on) 714 u_int *numprompts, char ***prompts, u_int **echo_on)
715{ 715{
716 Buffer m; 716 Buffer m;
717 int res; 717 u_int success;
718 char *challenge; 718 char *challenge;
719 719
720 debug3("%s: entering", __func__); 720 debug3("%s: entering", __func__);
@@ -724,8 +724,8 @@ mm_bsdauth_query(void *ctx, char **name, char **infotxt,
724 724
725 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_BSDAUTHQUERY, 725 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_BSDAUTHQUERY,
726 &m); 726 &m);
727 res = buffer_get_int(&m); 727 success = buffer_get_int(&m);
728 if (res == -1) { 728 if (success == 0) {
729 debug3("%s: no challenge", __func__); 729 debug3("%s: no challenge", __func__);
730 buffer_free(&m); 730 buffer_free(&m);
731 return (-1); 731 return (-1);
@@ -771,7 +771,8 @@ mm_skey_query(void *ctx, char **name, char **infotxt,
771 u_int *numprompts, char ***prompts, u_int **echo_on) 771 u_int *numprompts, char ***prompts, u_int **echo_on)
772{ 772{
773 Buffer m; 773 Buffer m;
774 int len, res; 774 int len;
775 u_int success;
775 char *p, *challenge; 776 char *p, *challenge;
776 777
777 debug3("%s: entering", __func__); 778 debug3("%s: entering", __func__);
@@ -781,8 +782,8 @@ mm_skey_query(void *ctx, char **name, char **infotxt,
781 782
782 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SKEYQUERY, 783 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SKEYQUERY,
783 &m); 784 &m);
784 res = buffer_get_int(&m); 785 success = buffer_get_int(&m);
785 if (res == -1) { 786 if (success == 0) {
786 debug3("%s: no challenge", __func__); 787 debug3("%s: no challenge", __func__);
787 buffer_free(&m); 788 buffer_free(&m);
788 return (-1); 789 return (-1);