summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-10-16 13:05:52 -0400
committerSimo Sorce <simo@redhat.com>2013-10-17 01:26:03 -0400
commit69bcad38a45e2154502b9d8a11fcfe1245e260de (patch)
tree3017b9193c32dc21416177da5acafbd3574087ef
parent3b20e312154f3ef09100b7613f26b2e89e47870f (diff)
downloadgss-ntlmssp-69bcad38a45e2154502b9d8a11fcfe1245e260de.tar.gz
gss-ntlmssp-69bcad38a45e2154502b9d8a11fcfe1245e260de.tar.xz
gss-ntlmssp-69bcad38a45e2154502b9d8a11fcfe1245e260de.zip
Fix acquiring creds via cred_store
Make sure to set the cred type and copy in the name.
-rw-r--r--src/gss_creds.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gss_creds.c b/src/gss_creds.c
index 5ccc344..8a7049c 100644
--- a/src/gss_creds.c
+++ b/src/gss_creds.c
@@ -155,6 +155,32 @@ static int get_creds_from_store(struct gssntlm_name *name,
uint32_t i;
int ret;
+ cred->type = GSSNTLM_CRED_NONE;
+
+ if (name) {
+ switch (name->type) {
+ case GSSNTLM_NAME_NULL:
+ cred->type = GSSNTLM_CRED_NONE;
+ break;
+ case GSSNTLM_NAME_ANON:
+ cred->type = GSSNTLM_CRED_ANON;
+ break;
+ case GSSNTLM_NAME_USER:
+ cred->type = GSSNTLM_CRED_USER;
+ ret = gssntlm_copy_name(name, &cred->cred.user.user);
+ break;
+ case GSSNTLM_NAME_SERVER:
+ cred->type = GSSNTLM_CRED_SERVER;
+ ret = gssntlm_copy_name(name, &cred->cred.server.name);
+ break;
+ default:
+ return EINVAL;
+ }
+ }
+
+ /* so far only user options can be defined in the cred_store */
+ if (cred->type != GSSNTLM_CRED_USER) return 0;
+
for (i = 0; i < cred_store->count; i++) {
if (strcmp(cred_store->elements[i].key, NTLM_CS_DOMAIN) == 0) {
/* ignore duplicates */