+ gss_buffer_desc name_buf = GSS_C_EMPTY_BUFFER;
+
+ /*
+ * If no realm in authid, use server FQDN; we have no mechanism-
+ * agnostic way of determing a realm from a service name.
+ */
+ if (strchr(oparams->authid, '@') == NULL &&
+ params->serverFQDN != NULL) {
+ name_buf.length = strlen(oparams->authid) + 1 + strlen(params->serverFQDN);
+
+ name_buf.value = params->utils->malloc(name_buf.length + 1);
+ if (name_buf.value == NULL) {
+ MEMERROR(text->utils);
+ result = SASL_NOMEM;
+ goto cleanup;
+ }
+ snprintf(name_buf.value, name_buf.length + 1,
+ "%s@%s", oparams->authid, params->serverFQDN);
+ } else {
+ name_buf.length = strlen(oparams->authid);
+ name_buf.value = oparams->authid;
+ }