bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-mailutils] [PATCH] IMAP GSS-API fixes


From: Simon Josefsson
Subject: [bug-mailutils] [PATCH] IMAP GSS-API fixes
Date: Sat, 17 May 2003 20:39:57 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

The data after "+ " must be B64 data according to IMAP, and it must be
empty according to SASL/GSSAPI.

Secondly, the output with username is not zero terminated, so calling
strdup() on it doesn't work well.

Thanks.

2003-05-17  Simon Josefsson  <address@hidden>

        * imap4d/auth_gss.c (auth_gssapi): Don't send invalid B64.
        (auth_gssapi): Don't strdup non-zero terminated string.

Index: auth_gss.c
===================================================================
RCS file: /cvsroot/mailutils/mailutils/imap4d/auth_gss.c,v
retrieving revision 1.7
diff -u -p -u -w -r1.7 auth_gss.c
--- auth_gss.c  26 Jan 2003 13:46:16 -0000      1.7
+++ auth_gss.c  17 May 2003 18:36:34 -0000
@@ -132,7 +136,7 @@ auth_gssapi (struct imap4d_command *comm
 
   /* Start the dialogue */
 
-  util_send ("+ GO AHEAD\r\n");
+  util_send ("+ \r\n");
   util_flush_output ();
   
   context = GSS_C_NO_CONTEXT;
@@ -221,7 +225,9 @@ auth_gssapi (struct imap4d_command *comm
   protection_mech = mech;
   client_buffer_size = sec_level & 0x00ffffffff;
 
-  *username = strdup ((char *) outbuf.value + 4);
+  *username = malloc(outbuf.length - 4 + 1);
+  memcpy(*username, outbuf.value + 4, outbuf.length - 4);
+  (*username)[outbuf.length - 4] = '\0';
   gss_release_buffer (&min_stat, &outbuf);
 
   maj_stat = gss_display_name (&min_stat, client, &client_name, &mech_type);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]