svn rev #21676: branches/mskrb-integ/src/lib/krb5/krb/

lhoward@MIT.EDU lhoward at MIT.EDU
Fri Jan 2 20:28:19 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=21676
Commit By: lhoward
Log Message:
If KRB5_PRINCIPAL_UNPARSE_NO_REALM is specified, don't escape the @
symbol.



Changed Files:
U   branches/mskrb-integ/src/lib/krb5/krb/unparse.c
Modified: branches/mskrb-integ/src/lib/krb5/krb/unparse.c
===================================================================
--- branches/mskrb-integ/src/lib/krb5/krb/unparse.c	2009-01-02 23:59:17 UTC (rev 21675)
+++ branches/mskrb-integ/src/lib/krb5/krb/unparse.c	2009-01-03 01:28:18 UTC (rev 21676)
@@ -66,8 +66,12 @@
     int size = length;
 
     if ((flags & KRB5_PRINCIPAL_UNPARSE_DISPLAY) == 0) {
+	int no_realm = (flags & KRB5_PRINCIPAL_UNPARSE_NO_REALM) &&
+		       !(flags & KRB5_PRINCIPAL_UNPARSE_SHORT);
+
 	for (j = 0; j < length; j++,cp++)
-	    if (*cp == REALM_SEP  || *cp == COMPONENT_SEP ||
+	    if ((!no_realm && *cp == REALM_SEP) ||
+		*cp == COMPONENT_SEP ||
 		*cp == '\0' || *cp == '\\' || *cp == '\t' ||
 		*cp == '\n' || *cp == '\b')
 		size++;
@@ -90,9 +94,16 @@
     }
 
     for (j=0; j < length; j++,cp++) {
+	int no_realm = (flags & KRB5_PRINCIPAL_UNPARSE_NO_REALM) &&
+		       !(flags & KRB5_PRINCIPAL_UNPARSE_SHORT);
+
 	switch (*cp) {
+	case REALM_SEP:
+	    if (no_realm) {
+		*q++ = *cp;
+		break;
+	    }
 	case COMPONENT_SEP:
-	case REALM_SEP:
 	case '\\':
 	    *q++ = '\\';
 	    *q++ = *cp;




More information about the cvs-krb5 mailing list