]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
svcgssd: Encryption types not being parsed correctly
authorSteve Dickson <steved@redhat.com>
Sat, 17 Nov 2012 13:50:09 +0000 (08:50 -0500)
committerSteve Dickson <steved@redhat.com>
Mon, 19 Nov 2012 15:44:30 +0000 (10:44 -0500)
When svcgssd reads the supported encrytion types from the
kernel, they are prefixed with a 'enctypes='. That prefix
has to be ignored to correctly parse the rest of the types.

Signed-off-by: Steve Dickson <steved@redhat.com>
utils/gssd/svcgssd_krb5.c

index 6c34faf4b5f8537fc8c5f04508adf979f2a7ae7e..1d44d3449c02cd71cfbe0d7be6f1f9991654a798 100644 (file)
@@ -38,6 +38,7 @@
 
 #include <stdio.h>
 #include <errno.h>
 
 #include <stdio.h>
 #include <errno.h>
+#include <ctype.h>
 #include <gssapi/gssapi.h>
 #include <krb5.h>
 
 #include <gssapi/gssapi.h>
 #include <krb5.h>
 
@@ -98,6 +99,12 @@ parse_enctypes(char *enctypes)
        if (n == 0)
                return ENOENT;
 
        if (n == 0)
                return ENOENT;
 
+       /* Skip pass any non digits */
+       while (*enctypes && isdigit(*enctypes) == 0)
+               enctypes++;
+       if (*enctypes == '\0')
+               return EINVAL;
+
        /* Allocate space for enctypes array */
        if ((parsed_enctypes = (int *) calloc(n, sizeof(int))) == NULL) {
                return ENOMEM;
        /* Allocate space for enctypes array */
        if ((parsed_enctypes = (int *) calloc(n, sizeof(int))) == NULL) {
                return ENOMEM;