#define KRB5_PRINCIPAL_PARSE_ENTERPRISE 0x4 /**< Create single-component
enterprise principle */
#define KRB5_PRINCIPAL_PARSE_IGNORE_REALM 0x8 /**< Ignore realm if present */
+#define KRB5_PRINCIPAL_PARSE_NO_DEF_REALM 0x10 /**< Don't add default realm */
/**
* Convert a string principal name to a krb5_principal with flags.
krb5_boolean require_realm = (flags & KRB5_PRINCIPAL_PARSE_REQUIRE_REALM);
krb5_boolean no_realm = (flags & KRB5_PRINCIPAL_PARSE_NO_REALM);
krb5_boolean ignore_realm = (flags & KRB5_PRINCIPAL_PARSE_IGNORE_REALM);
+ krb5_boolean no_def_realm = (flags & KRB5_PRINCIPAL_PARSE_NO_DEF_REALM);
*principal_out = NULL;
goto cleanup;
parse_name_into_princ(name, enterprise, princ);
- /*
- * If a realm was not found, then use the default realm, unless
- * KRB5_PRINCIPAL_PARSE_NO_REALM was specified in which case the
- * realm will be empty.
- */
+ /* If a realm was not included, use the default realm, unless flags
+ * indicate otherwise. */
if (!has_realm) {
if (require_realm) {
ret = KRB5_PARSE_MALFORMED;
_("Principal %s is missing required realm"), name);
goto cleanup;
}
- if (!no_realm && !ignore_realm) {
+ if (!no_realm && !ignore_realm && !no_def_realm) {
ret = krb5_get_default_realm(context, &default_realm);
if (ret)
goto cleanup;