In krb5_set_realm():
authorGreg Hudson <ghudson@mit.edu>
Wed, 12 Jan 2011 23:31:58 +0000 (23:31 +0000)
committerGreg Hudson <ghudson@mit.edu>
Wed, 12 Jan 2011 23:31:58 +0000 (23:31 +0000)
* Return EINVAL and ENOMEM correctly.
* Accept an empty realm instead of returning EINVAL.
* Wrap a long line.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24595 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/set_realm.c

index 0128f6cb1846827ed78fcfd637face83983e059f..94a476338d9a6ec39d8aacdec654a37bcb5d6a45 100644 (file)
 #include "k5-int.h"
 
 krb5_error_code KRB5_CALLCONV
-krb5_set_principal_realm(krb5_context context, krb5_principal principal, const char *realm)
+krb5_set_principal_realm(krb5_context context, krb5_principal principal,
+                         const char *realm)
 {
     size_t  length;
     char    *newrealm;
 
-    if (!realm || !*realm)
-        return -EINVAL;
+    if (!realm)
+        return EINVAL;
 
     length = strlen(realm);
     newrealm = strdup(realm);
     if (!newrealm)
-        return -ENOMEM;
+        return ENOMEM;
 
     (void) free(krb5_princ_realm(context,principal)->data);