}
/* XXX this is probably NOT what we want to be doing */
- *minor = krb5_sname_to_principal(krbContext, host, service,
- KRB5_NT_SRV_HST, &krbPrinc);
- if (*minor != 0) {
+ if (krb5_sname_to_principal(krbContext, host, service,
+ KRB5_NT_SRV_HST, &krbPrinc) != 0) {
GSSEAP_FREE(service);
+ *minor = GSSEAP_BAD_SERVICE_NAME;
return GSS_S_FAILURE;
}
#define CHECK_REMAIN(n) do { \
if (remain < (n)) { \
- *minor = ERANGE; \
+ *minor = GSSEAP_WRONG_SIZE; \
major = GSS_S_BAD_NAME; \
goto cleanup; \
} \
if (flags & EXPORT_NAME_FLAG_COMPOSITE) {
gss_buffer_desc buf;
- CHECK_REMAIN(4);
- buf.length = load_uint32_be(p);
- UPDATE_REMAIN(4);
-
- CHECK_REMAIN(buf.length);
+ buf.length = remain;
buf.value = p;
- UPDATE_REMAIN(buf.length);
major = gssEapImportAttrContext(minor, &buf, name);
if (GSS_ERROR(major))
major = gssEapExportAttrContext(minor, name, &attrs);
if (GSS_ERROR(major))
goto cleanup;
- exportedNameLen += 4 + attrs.length;
+ exportedNameLen += attrs.length;
}
exportedName->value = GSSEAP_MALLOC(exportedNameLen);
p += krbNameLen;
if (flags & EXPORT_NAME_FLAG_COMPOSITE) {
- store_uint32_be(attrs.length, p);
- memcpy(&p[4], attrs.value, attrs.length);
- p += 4 + attrs.length;
+ memcpy(p, attrs.value, attrs.length);
+ p += attrs.length;
}
+ assert(p == (unsigned char *)exportedName->value + exportedNameLen);
+
*minor = 0;
major = GSS_S_COMPLETE;