[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: kerberos 4 problem



joda@pdc.kth.se (Johan Danielsson) writes:
> >                 v4_domains = foo.se
> 
> This is though.

Shouldn't it default to something reasonable, like the patch below?

/assar

Index: principal.c
===================================================================
RCS file: /afs/pdc.kth.se/src/packages/kth-krb/SourceRepository/heimdal/lib/krb5/principal.c,v
retrieving revision 1.74
diff -u -w -u -w -r1.74 principal.c
--- principal.c	2001/05/14 06:14:50	1.74
+++ principal.c	2001/05/31 20:55:43
@@ -741,9 +741,25 @@
     }
     {
 	char **domains, **d;
+
 	domains = krb5_config_get_strings(context, NULL, "realms", realm,
 					  "v4_domains", NULL);
-	for(d = domains; d && *d; d++){
+	if (domains == NULL) {
+	    domains = malloc(2 * sizeof(*domains));
+	    if (domains == NULL) {
+		krb5_set_error_string (context, "out of memory");
+		return ENOMEM;
+	    }
+	    domains[0] = strdup(realm);
+	    if (domains[0] == NULL) {
+		free (domains);
+		krb5_set_error_string (context, "out of memory");
+		return ENOMEM;
+	    }
+	    strlwr(domains[0]);
+	}
+
+	for(d = domains; *d; d++){
 	    snprintf(host, sizeof(host), "%s.%s", instance, *d);
 	    ret = krb5_make_principal(context, &pr, realm, name, host, NULL);
 	    if(func == NULL || (*func)(context, pr)){