use AF_UNIX like the rest of the codebase, add some more error strings

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14538 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-02-02 20:01:22 +00:00
parent c132b3d3e6
commit e211cca93d

View File

@@ -77,7 +77,7 @@ kcm_send_request(krb5_context context,
for (i = 0; i < context->max_retries; i++) { for (i = 0; i < context->max_retries; i++) {
int fd; int fd;
fd = socket(PF_LOCAL, SOCK_STREAM, 0); fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd < 0) if (fd < 0)
continue; continue;
@@ -110,22 +110,31 @@ kcm_storage_request(krb5_context context,
krb5_storage *sp; krb5_storage *sp;
krb5_error_code ret; krb5_error_code ret;
*storage_p = NULL;
sp = krb5_storage_emem(); sp = krb5_storage_emem();
if (sp == NULL) { if (sp == NULL) {
krb5_set_error_string(context, "malloc: out of memory");
return KRB5_CC_NOMEM; return KRB5_CC_NOMEM;
} }
/* Send MAJOR | VERSION | OPCODE */ /* Send MAJOR | VERSION | OPCODE */
ret = krb5_store_int8(sp, KCM_PROTOCOL_VERSION_MAJOR); ret = krb5_store_int8(sp, KCM_PROTOCOL_VERSION_MAJOR);
ret |= krb5_store_int8(sp, KCM_PROTOCOL_VERSION_MINOR); if (ret)
ret |= krb5_store_int16(sp, opcode); goto fail;
ret = krb5_store_int8(sp, KCM_PROTOCOL_VERSION_MINOR);
if (ret) { if (ret)
krb5_storage_free(sp); goto fail;
sp = NULL; ret = krb5_store_int16(sp, opcode);
} if (ret)
goto fail;
*storage_p = sp; *storage_p = sp;
fail:
if (ret) {
krb5_set_error_string(context, "Failed to encode request");
krb5_storage_free(sp);
}
return ret; return ret;
} }
@@ -151,7 +160,7 @@ kcm_alloc(krb5_context context, const char *name, krb5_ccache *id)
} else } else
k->name = NULL; k->name = NULL;
k->path.sun_family = AF_LOCAL; k->path.sun_family = AF_UNIX;
strlcpy(k->path.sun_path, _PATH_KCM_SOCKET, sizeof(k->path.sun_path)); strlcpy(k->path.sun_path, _PATH_KCM_SOCKET, sizeof(k->path.sun_path));
(*id)->data.data = k; (*id)->data.data = k;