Skip to contentSkip to conversation

svcgssd: Encryption types not being parsed correctly

PATCH In review Steve Dickson 1 participant 2 messages Nov 17, 2012 – Nov 19, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 svcgssd: Encryption types not being parsed correctly

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.

---
 utils/gssd/svcgssd_krb5.c | 7 +++++++
 1 file changed, 7 insertions(+)
utils/gssd/svcgssd_krb5.c +7 -0
index 6c34faf..1d44d34 100644
@@ -38,6 +38,7 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <ctype.h>
 #include <gssapi/gssapi.h>
 #include <krb5.h>
 
@@ -98,6 +99,12 @@ parse_enctypes(char *enctypes)
 	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;
Signature · 1 line
1.7.11.7
#1 lore raw
Quoted 5 lines · Steve Dickson

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.

Committed...

steved.

Quoted 30 lines
---
 utils/gssd/svcgssd_krb5.c | 7 +++++++
 1 file changed, 7 insertions(+)
utils/gssd/svcgssd_krb5.c +7 -0
index 6c34faf..1d44d34 100644
@@ -38,6 +38,7 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <ctype.h>
 #include <gssapi/gssapi.h>
 #include <krb5.h>
 
@@ -98,6 +99,12 @@ parse_enctypes(char *enctypes)
 	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;