diff -ur cyrus-sasl-1.5.24.orig/plugins/gssapi.c cyrus-sasl-1.5.24/plugins/gssapi.c
--- cyrus-sasl-1.5.24.orig/plugins/gssapi.c.orig	Fri Jul 21 04:06:52 2000
+++ cyrus-sasl-1.5.24/plugins/gssapi.c	Sun Dec 17 15:19:31 2000
@@ -592,6 +594,7 @@
 	gss_buffer_desc name_without_realm;
 	gss_name_t without = NULL;
 	int equal;
+	char *realm = NULL;
 
 	name_token.value = NULL;
 	name_without_realm.value = NULL;
@@ -625,7 +623,8 @@
 	   without the realm and see if it's the same id (i.e. 
 	   tmartin == tmartin@ANDREW.CMU.EDU. If this is the case we just want
 	   to return the id (i.e. just "tmartin: */
-	if (strchr((char *)name_token.value, (int) '@')!=NULL)
+	realm = strchr((char *)name_token.value, (int) '@');
+	if (realm != NULL)
 	{
 	    name_without_realm.value = (char *) params->utils->malloc(strlen(name_token.value)+1);
 	    if (name_without_realm.value == NULL) return SASL_NOMEM;
@@ -687,6 +686,14 @@
 	    strcpy(oparams->authid, name_token.value);
 	}
 
+	if (realm != NULL)
+	{
+	    realm++; /* skip '@' */
+	    oparams->realm = (char *) params->utils->malloc(strlen(realm)+1);
+	    if (oparams->realm == NULL) return SASL_NOMEM;
+	    strcpy(oparams->realm, realm);
+	}
+
 	if (name_token.value)
 	    params->utils->free(name_token.value);
 	if (name_without_realm.value)

