svn rev #21808: trunk/src/lib/ kadm5/ krb5/os/

tsitkova@MIT.EDU tsitkova at MIT.EDU
Tue Jan 27 16:09:37 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=21808
Commit By: tsitkova
Log Message:
"Coding practices" related fixes.



Changed Files:
U   trunk/src/lib/kadm5/alt_prof.c
U   trunk/src/lib/krb5/os/def_realm.c
Modified: trunk/src/lib/kadm5/alt_prof.c
===================================================================
--- trunk/src/lib/kadm5/alt_prof.c	2009-01-27 20:24:37 UTC (rev 21807)
+++ trunk/src/lib/kadm5/alt_prof.c	2009-01-27 21:09:35 UTC (rev 21808)
@@ -46,95 +46,95 @@
     krb5_key_salt_tuple *knew;    
 
     if((knew = (krb5_key_salt_tuple *)
-		malloc((len ) * sizeof(krb5_key_salt_tuple)))) {
+                malloc((len ) * sizeof(krb5_key_salt_tuple)))) {
          memcpy(knew, ksalt, len * sizeof(krb5_key_salt_tuple));
-	 return knew;
+         return knew;
     }
     return 0;
 }
 
 /*
- * krb5_aprof_init()	- Initialize alternate profile context.
+ * krb5_aprof_init()        - Initialize alternate profile context.
  *
  * Parameters:
- *	fname		- default file name of the profile.
- *	envname		- environment variable name which can override fname.
- *	acontextp	- Pointer to opaque context for alternate profile.
+ *        fname                - default file name of the profile.
+ *        envname                - environment variable name which can override fname.
+ *        acontextp        - Pointer to opaque context for alternate profile.
  *
  * Returns:
- *	error codes from profile_init()
+ *        error codes from profile_init()
  */
 krb5_error_code
 krb5_aprof_init(fname, envname, acontextp)
-    char		*fname;
-    char		*envname;
-    krb5_pointer	*acontextp;
+    char                *fname;
+    char                *envname;
+    krb5_pointer        *acontextp;
 {
-    krb5_error_code	kret;
-    profile_t		profile;
-    const char *kdc_config;
-    char *profile_path;
-    char **filenames;
-    int i;
-    struct k5buf buf;
+    krb5_error_code kret;
+    profile_t       profile;
+    const char      *kdc_config;
+    char            *profile_path;
+    char            **filenames;
+    int             i;
+    struct          k5buf buf;
 
     kret = krb5_get_default_config_files (&filenames);
     if (kret)
-	return kret;
+        return kret;
     if (envname == NULL || (kdc_config = getenv(envname)) == NULL)
-	kdc_config = fname;
+        kdc_config = fname;
     krb5int_buf_init_dynamic(&buf);
     if (kdc_config)
-	krb5int_buf_add(&buf, kdc_config);
+        krb5int_buf_add(&buf, kdc_config);
     for (i = 0; filenames[i] != NULL; i++) {
-	if (krb5int_buf_len(&buf) > 0)
-	    krb5int_buf_add(&buf, ":");
-	krb5int_buf_add(&buf, filenames[i]);
+        if (krb5int_buf_len(&buf) > 0)
+            krb5int_buf_add(&buf, ":");
+        krb5int_buf_add(&buf, filenames[i]);
     }
     krb5_free_config_files(filenames);
     profile_path = krb5int_buf_data(&buf);
     if (profile_path == NULL)
-	return ENOMEM;
+        return ENOMEM;
     profile = (profile_t) NULL;
     kret = profile_init_path(profile_path, &profile);
     free(profile_path);
     if (kret)
-	return kret;
+        return kret;
     *acontextp = profile;
     return 0;
 }
 
 /*
- * krb5_aprof_getvals()	- Get values from alternate profile.
+ * krb5_aprof_getvals()        - Get values from alternate profile.
  *
  * Parameters:
- *	acontext	- opaque context for alternate profile.
- *	hierarchy	- hierarchy of value to retrieve.
- *	retdata		- Returned data values.
+ *        acontext        - opaque context for alternate profile.
+ *        hierarchy        - hierarchy of value to retrieve.
+ *        retdata                - Returned data values.
  *
  * Returns:
- * 	error codes from profile_get_values()
+ *         error codes from profile_get_values()
  */
 krb5_error_code
 krb5_aprof_getvals(acontext, hierarchy, retdata)
-    krb5_pointer	acontext;
-    const char		**hierarchy;
-    char		***retdata;
+    krb5_pointer        acontext;
+    const char          **hierarchy;
+    char                ***retdata;
 {
     return(profile_get_values((profile_t) acontext,
-			      hierarchy,
-			      retdata));
+                              hierarchy,
+                              retdata));
 }
 
 /*
  * krb5_aprof_get_boolean()
  *
  * Parameters:
- *	acontext	- opaque context for alternate profile
- *	hierarchy	- hierarchy of value to retrieve
- *	retdata		- Returned data value
+ *        acontext        - opaque context for alternate profile
+ *        hierarchy        - hierarchy of value to retrieve
+ *        retdata                - Returned data value
  * Returns:
- *	error codes
+ *        error codes
  */
 
 static krb5_error_code
@@ -145,21 +145,21 @@
     unsigned int i;
 
     for (i = 0; i < sizeof(yes)/sizeof(yes[0]); i++)
-	if (!strcasecmp(string, yes[i])) {
-	    *out = 1;
-	    return 0;
-	}
+        if (!strcasecmp(string, yes[i])) {
+            *out = 1;
+            return 0;
+        }
     for (i = 0; i < sizeof(no)/sizeof(no[0]); i++)
-	if (!strcasecmp(string, no[i])) {
-	    *out = 0;
-	    return 0;
-	}
+        if (!strcasecmp(string, no[i])) {
+            *out = 0;
+            return 0;
+        }
     return PROF_BAD_BOOLEAN;
 }
 
 krb5_error_code
 krb5_aprof_get_boolean(krb5_pointer acontext, const char **hierarchy,
-		       int uselast, krb5_boolean *retdata)
+                       int uselast, krb5_boolean *retdata)
 {
     krb5_error_code kret;
     char **values;
@@ -169,136 +169,136 @@
 
     kret = krb5_aprof_getvals (acontext, hierarchy, &values);
     if (kret)
-	return kret;
+        return kret;
     idx = 0;
     if (uselast) {
-	while (values[idx])
-	    idx++;
-	idx--;
+        while (values[idx])
+            idx++;
+        idx--;
     }
     valp = values[idx];
     kret = string_to_boolean (valp, &val);
     profile_free_list(values);
     if (kret)
-	return kret;
+        return kret;
     *retdata = val;
     return 0;
 }
 
 /*
- * krb5_aprof_get_deltat()	- Get a delta time value from the alternate
- *				  profile.
+ * krb5_aprof_get_deltat()        - Get a delta time value from the alternate
+ *                                  profile.
  *
  * Parameters:
- *	acontext		- opaque context for alternate profile.
- *	hierarchy		- hierarchy of value to retrieve.
- *	uselast			- if true, use last value, otherwise use
- *				  first value found.
- *	deltatp			- returned delta time value.
+ *        acontext                 - opaque context for alternate profile.
+ *        hierarchy                - hierarchy of value to retrieve.
+ *        uselast                  - if true, use last value, otherwise use
+ *                                   first value found.
+ *        deltatp                  - returned delta time value.
  *
  * Returns:
- * 	error codes from profile_get_values()
- *	error codes from krb5_string_to_deltat()
+ *         error codes from profile_get_values()
+ *        error codes from krb5_string_to_deltat()
  */
 krb5_error_code
 krb5_aprof_get_deltat(acontext, hierarchy, uselast, deltatp)
-    krb5_pointer	acontext;
-    const char		**hierarchy;
-    krb5_boolean	uselast;
-    krb5_deltat		*deltatp;
+    krb5_pointer        acontext;
+    const char          **hierarchy;
+    krb5_boolean        uselast;
+    krb5_deltat         *deltatp;
 {
-    krb5_error_code	kret;
-    char		**values;
-    char		*valp;
-    int			idx;
+    krb5_error_code     kret;
+    char                **values;
+    char                *valp;
+    int                 idx;
 
     if (!(kret = krb5_aprof_getvals(acontext, hierarchy, &values))) {
-	idx = 0;
-	if (uselast) {
-	    for (idx=0; values[idx]; idx++);
-	    idx--;
-	}
-	valp = values[idx];
-	kret = krb5_string_to_deltat(valp, deltatp);
+        idx = 0;
+        if (uselast) {
+            for (idx=0; values[idx]; idx++);
+            idx--;
+        }
+        valp = values[idx];
+        kret = krb5_string_to_deltat(valp, deltatp);
 
-	/* Free the string storage */
-	profile_free_list(values);
+        /* Free the string storage */
+        profile_free_list(values);
     }
     return(kret);
 }
 
 /*
- * krb5_aprof_get_string()	- Get a string value from the alternate
- *				  profile.
+ * krb5_aprof_get_string()        - Get a string value from the alternate
+ *                                  profile.
  *
  * Parameters:
- *	acontext		- opaque context for alternate profile.
- *	hierarchy		- hierarchy of value to retrieve.
- *	uselast			- if true, use last value, otherwise use
- *				  first value found.
- *	stringp			- returned string value.
+ *        acontext                 - opaque context for alternate profile.
+ *        hierarchy                - hierarchy of value to retrieve.
+ *        uselast                  - if true, use last value, otherwise use
+ *                                   first value found.
+ *        stringp                  - returned string value.
  *
  * Returns:
- * 	error codes from profile_get_values()
+ *         error codes from profile_get_values()
  */
 krb5_error_code
 krb5_aprof_get_string(acontext, hierarchy, uselast, stringp)
-    krb5_pointer	acontext;
-    const char		**hierarchy;
-    krb5_boolean	uselast;
-    char		**stringp;
+    krb5_pointer        acontext;
+    const char          **hierarchy;
+    krb5_boolean        uselast;
+    char                **stringp;
 {
-    krb5_error_code	kret;
-    char		**values;
-    int			lastidx;
+    krb5_error_code     kret;
+    char                **values;
+    int                 lastidx;
 
     if (!(kret = krb5_aprof_getvals(acontext, hierarchy, &values))) {
-	for (lastidx=0; values[lastidx]; lastidx++);
-	lastidx--;
+        for (lastidx=0; values[lastidx]; lastidx++);
+        lastidx--;
 
-	/* Excise the entry we want from the null-terminated list,
-	   and free up the rest.  */
-	if (uselast) {
-	    *stringp = values[lastidx];
-	    values[lastidx] = NULL;
-	} else {
-	    *stringp = values[0];
-	    values[0] = values[lastidx];
-	    values[lastidx] = NULL;
-	}
+        /* Excise the entry we want from the null-terminated list,
+           and free up the rest.  */
+        if (uselast) {
+            *stringp = values[lastidx];
+            values[lastidx] = NULL;
+        } else {
+            *stringp = values[0];
+            values[0] = values[lastidx];
+            values[lastidx] = NULL;
+        }
 
-	/* Free the string storage */
-	profile_free_list(values);
+        /* Free the string storage */
+        profile_free_list(values);
     }
     return(kret);
 }
 
 /*
- * krb5_aprof_get_string_all()	- When the attr identified by "hierarchy" is specified multiple times, 
+ * krb5_aprof_get_string_all()  - When the attr identified by "hierarchy" is specified multiple times, 
  *                                collect all its string values from the alternate  profile. 
  *
  * Parameters:
- *	acontext		- opaque context for alternate profile.
- *	hierarchy		- hierarchy of value to retrieve.
- *	stringp			- Returned string value.
+ *        acontext                 - opaque context for alternate profile.
+ *        hierarchy                - hierarchy of value to retrieve.
+ *        stringp                  - Returned string value.
  *
  * Returns:
- * 	error codes from profile_get_values() or ENOMEM
- * 	Caller is responsible for deallocating stringp buffer
+ *         error codes from profile_get_values() or ENOMEM
+ *         Caller is responsible for deallocating stringp buffer
  */
 krb5_error_code
 krb5_aprof_get_string_all(acontext, hierarchy, stringp)
-    krb5_pointer  	acontext;
-    const char    	**hierarchy;
+    krb5_pointer        acontext;
+    const char          **hierarchy;
     char                **stringp;
 {
     krb5_error_code     kret=0;
     char                **values;
     int                 lastidx;
     char                *tmp;
-    size_t             buf_size=0; 
- 
-    if (!(kret = krb5_aprof_getvals(acontext, hierarchy, &values))) {
+    size_t              buf_size=0; 
+    kret = krb5_aprof_getvals(acontext, hierarchy, &values);
+    if (!kret) {
         for (lastidx=0; values[lastidx]; lastidx++);
         lastidx--;
          
@@ -310,11 +310,11 @@
     if (buf_size > 0) {
         *stringp = calloc(1,buf_size);
         if (stringp == NULL){
-  	    profile_free_list(values);
+            profile_free_list(values);
             return ENOMEM;
         }
         tmp=*stringp;
-        strcpy(tmp,values[0]);
+        strlcpy(tmp, values[0], buf_size);
         for (lastidx=1; values[lastidx]; lastidx++){
             tmp = strcat(tmp, " ");
             tmp = strcat(tmp, values[lastidx]);
@@ -327,59 +327,59 @@
 
 
 /*
- * krb5_aprof_get_int32()	- Get a 32-bit integer value from the alternate
- *				  profile.
+ * krb5_aprof_get_int32()        - Get a 32-bit integer value from the alternate
+ *                                  profile.
  *
  * Parameters:
- *	acontext		- opaque context for alternate profile.
- *	hierarchy		- hierarchy of value to retrieve.
- *	uselast			- if true, use last value, otherwise use
- *				  first value found.
- *	intp			- returned 32-bit integer value.
+ *        acontext                 - opaque context for alternate profile.
+ *        hierarchy                - hierarchy of value to retrieve.
+ *        uselast                  - if true, use last value, otherwise use
+ *                                   first value found.
+ *        intp                     - returned 32-bit integer value.
  *
  * Returns:
- * 	error codes from profile_get_values()
- *	EINVAL			- value is not an integer
+ *        error codes from profile_get_values()
+ *        EINVAL                        - value is not an integer
  */
 krb5_error_code
 krb5_aprof_get_int32(acontext, hierarchy, uselast, intp)
-    krb5_pointer	acontext;
-    const char		**hierarchy;
-    krb5_boolean	uselast;
-    krb5_int32		*intp;
+    krb5_pointer        acontext;
+    const char          **hierarchy;
+    krb5_boolean        uselast;
+    krb5_int32          *intp;
 {
-    krb5_error_code	kret;
-    char		**values;
-    int			idx;
+    krb5_error_code     kret;
+    char                **values;
+    int                 idx;
 
     if (!(kret = krb5_aprof_getvals(acontext, hierarchy, &values))) {
-	idx = 0;
-	if (uselast) {
-	    for (idx=0; values[idx]; idx++);
-	    idx--;
-	}
+        idx = 0;
+        if (uselast) {
+            for (idx=0; values[idx]; idx++);
+            idx--;
+        }
 
-	if (sscanf(values[idx], "%d", intp) != 1)
-	    kret = EINVAL;
+        if (sscanf(values[idx], "%d", intp) != 1)
+            kret = EINVAL;
 
-	/* Free the string storage */
-	profile_free_list(values);
+        /* Free the string storage */
+        profile_free_list(values);
     }
     return(kret);
 }
 
 /*
- * krb5_aprof_finish()	- Finish alternate profile context.
+ * krb5_aprof_finish()    - Finish alternate profile context.
  *
  * Parameter:
- *	acontext	- opaque context for alternate profile.
+ *        acontext        - opaque context for alternate profile.
  *
  * Returns:
- *	0 on success, something else on failure.
+ *        0 on success, something else on failure.
  */
 krb5_error_code
 krb5_aprof_finish(acontext)
-    krb5_pointer	acontext;
+    krb5_pointer        acontext;
 {
     profile_release(acontext);
     return(0);
@@ -395,32 +395,32 @@
  */
 static int
 get_string_param(char **param_out, char *param_in,
-		 long *mask_out, long mask_in, long mask_bit,
-		 krb5_pointer aprofile,
-		 const char **hierarchy,
-		 const char *config_name,
-		 const char *default_value)
+                 long *mask_out, long mask_in, long mask_bit,
+                 krb5_pointer aprofile,
+                 const char **hierarchy,
+                 const char *config_name,
+                 const char *default_value)
 {
     char *svalue;
 
     hierarchy[2] = config_name;
     if (mask_in & mask_bit) {
-	*param_out = strdup(param_in);
-	if (*param_out)
-	    *mask_out |= mask_bit;
-	return 1;
+        *param_out = strdup(param_in);
+        if (*param_out)
+            *mask_out |= mask_bit;
+        return 1;
     } else if (aprofile &&
-	       !krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue)) {
-	*param_out = svalue;
-	*mask_out |= mask_bit;
-	return 1;
+               !krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue)) {
+        *param_out = svalue;
+        *mask_out |= mask_bit;
+        return 1;
     } else if (default_value) {
-	*param_out = strdup(default_value);
-	if (*param_out)
-	    *mask_out |= mask_bit;
-	return 1;
+        *param_out = strdup(default_value);
+        if (*param_out)
+            *mask_out |= mask_bit;
+        return 1;
     } else {
-	return 0;
+        return 0;
     }
 }
 /*
@@ -429,27 +429,27 @@
  */
 static void
 get_port_param(int *param_out, int param_in,
-	       long *mask_out, long mask_in, long mask_bit,
-	       krb5_pointer aprofile,
-	       const char **hierarchy,
-	       const char *config_name,
-	       int default_value)
+               long *mask_out, long mask_in, long mask_bit,
+               krb5_pointer aprofile,
+               const char **hierarchy,
+               const char *config_name,
+               int default_value)
 {
     krb5_int32 ivalue;
 
     if (! (*mask_out & mask_bit)) {
-	hierarchy[2] = config_name;
-	if (mask_in & mask_bit) {
-	    *mask_out |= mask_bit;
-	    *param_out = param_in;
-	} else if (aprofile &&
-		   !krb5_aprof_get_int32(aprofile, hierarchy, TRUE, &ivalue)) {
-	    *param_out = ivalue;
-	    *mask_out |= mask_bit;
-	} else if (default_value) {
-	    *param_out = default_value;
-	    *mask_out |= mask_bit;
-	}
+        hierarchy[2] = config_name;
+        if (mask_in & mask_bit) {
+            *mask_out |= mask_bit;
+            *param_out = param_in;
+        } else if (aprofile &&
+                   !krb5_aprof_get_int32(aprofile, hierarchy, TRUE, &ivalue)) {
+            *param_out = ivalue;
+            *mask_out |= mask_bit;
+        } else if (default_value) {
+            *param_out = default_value;
+            *mask_out |= mask_bit;
+        }
     }
 }
 /*
@@ -457,25 +457,25 @@
  */
 static void
 get_deltat_param(krb5_deltat *param_out, krb5_deltat param_in,
-		 long *mask_out, long mask_in, long mask_bit,
-		 krb5_pointer aprofile,
-		 const char **hierarchy,
-		 const char *config_name,
-		 krb5_deltat default_value)
+                 long *mask_out, long mask_in, long mask_bit,
+                 krb5_pointer aprofile,
+                 const char **hierarchy,
+                 const char *config_name,
+                 krb5_deltat default_value)
 {
     krb5_deltat dtvalue;
 
     hierarchy[2] = config_name;
     if (mask_in & mask_bit) {
-	*mask_out |= mask_bit;
-	*param_out = param_in;
+        *mask_out |= mask_bit;
+        *param_out = param_in;
     } else if (aprofile &&
-	       !krb5_aprof_get_deltat(aprofile, hierarchy, TRUE, &dtvalue)) {
-	*param_out = dtvalue;
-	*mask_out |= mask_bit;
+               !krb5_aprof_get_deltat(aprofile, hierarchy, TRUE, &dtvalue)) {
+        *param_out = dtvalue;
+        *mask_out |= mask_bit;
     } else {
-	*param_out = default_value;
-	*mask_out |= mask_bit;
+        *param_out = default_value;
+        *mask_out |= mask_bit;
     }
 }
 
@@ -487,13 +487,13 @@
  *
  * Arguments:
  *
- *	context		(r) krb5_context to use
- *	profile		(r) profile file to use
- *	envname		(r) envname that contains a profile name to
- *			override profile
- *	params_in	(r) params structure containing user-supplied
- *			values, or NULL
- *	params_out	(w) params structure to be filled in
+ *        context     (r) krb5_context to use
+ *        profile     (r) profile file to use
+ *        envname     (r) envname that contains a profile name to
+ *                        override profile
+ *        params_in   (r) params structure containing user-supplied
+ *                        values, or NULL
+ *        params_out  (w) params structure to be filled in
  *
  * Effects:
  *
@@ -508,21 +508,21 @@
  * versions, overwriting the old pointer value.
  */
 krb5_error_code kadm5_get_config_params(context, use_kdc_config,
-					params_in, params_out)
-   krb5_context		context;
-   int			use_kdc_config;
-   kadm5_config_params	*params_in, *params_out;
+                                        params_in, params_out)
+   krb5_context               context;
+   int                        use_kdc_config;
+   kadm5_config_params        *params_in, *params_out;
 {
-    char		*filename;
-    char		*envname;
-    char		*lrealm;
-    krb5_pointer	aprofile = 0;
-    const char		*hierarchy[4];
-    char		*svalue;
-    krb5_int32		ivalue;
+    char                *filename;
+    char                *envname;
+    char                *lrealm;
+    krb5_pointer        aprofile = 0;
+    const char          *hierarchy[4];
+    char                *svalue;
+    krb5_int32          ivalue;
     kadm5_config_params params, empty_params;
 
-    krb5_error_code	kret = 0;
+    krb5_error_code        kret = 0;
 
     memset((char *) &params, 0, sizeof(params));
     memset((char *) &empty_params, 0, sizeof(empty_params));
@@ -530,15 +530,15 @@
     if (params_in == NULL) params_in = &empty_params;
 
     if (params_in->mask & KADM5_CONFIG_REALM) {
-	 lrealm = params.realm = strdup(params_in->realm);
-	 if (params.realm)
-	      params.mask |= KADM5_CONFIG_REALM;
+         lrealm = params.realm = strdup(params_in->realm);
+         if (params.realm)
+              params.mask |= KADM5_CONFIG_REALM;
     } else {
-	 kret = krb5_get_default_realm(context, &lrealm);
-	 if (kret)
-	      goto cleanup;
-	 params.realm = lrealm;
-	 params.mask |= KADM5_CONFIG_REALM;
+         kret = krb5_get_default_realm(context, &lrealm);
+         if (kret)
+              goto cleanup;
+         params.realm = lrealm;
+         params.mask |= KADM5_CONFIG_REALM;
     }
 
     if (params_in->mask & KADM5_CONFIG_KVNO) {
@@ -552,45 +552,45 @@
      * defaults for NULL values.
      */
     if (use_kdc_config) {
-	filename = DEFAULT_KDC_PROFILE;
-	envname = KDC_PROFILE_ENV;
+        filename = DEFAULT_KDC_PROFILE;
+        envname = KDC_PROFILE_ENV;
     } else {
-	filename = DEFAULT_PROFILE_PATH;
-	envname = "KRB5_CONFIG";
+        filename = DEFAULT_PROFILE_PATH;
+        envname = "KRB5_CONFIG";
     }
     if (context->profile_secure == TRUE) envname = 0;
 
     kret = krb5_aprof_init(filename, envname, &aprofile);
     if (kret)
-	    goto cleanup;
+            goto cleanup;
     
     /* Initialize realm parameters */
     hierarchy[0] = "realms";
     hierarchy[1] = lrealm;
     hierarchy[3] = (char *) NULL;
 
-#define GET_STRING_PARAM(FIELD, BIT, CONFTAG, DEFAULT)		\
-    get_string_param(&params.FIELD, params_in->FIELD,		\
-		     &params.mask, params_in->mask, BIT,	\
-		     aprofile, hierarchy, CONFTAG, DEFAULT)
+#define GET_STRING_PARAM(FIELD, BIT, CONFTAG, DEFAULT) \
+    get_string_param(&params.FIELD, params_in->FIELD,  \
+                     &params.mask, params_in->mask, BIT, \
+                     aprofile, hierarchy, CONFTAG, DEFAULT)
 
     /* Get the value for the admin server */
     GET_STRING_PARAM(admin_server, KADM5_CONFIG_ADMIN_SERVER, "admin_server",
-		     NULL);
+                     NULL);
 
     if (params.mask & KADM5_CONFIG_ADMIN_SERVER) {
-	 char *p;
-	 p = strchr(params.admin_server, ':');
-	 if (p) {
-	      params.kadmind_port = atoi(p+1);
-	      params.mask |= KADM5_CONFIG_KADMIND_PORT;
-	      *p = '\0';
-	 }
+         char *p;
+         p = strchr(params.admin_server, ':');
+         if (p) {
+              params.kadmind_port = atoi(p+1);
+              params.mask |= KADM5_CONFIG_KADMIND_PORT;
+              *p = '\0';
+         }
     }
 
     /* Get the value for the database */
     GET_STRING_PARAM(dbname, KADM5_CONFIG_DBNAME, "database_name",
-		     DEFAULT_KDB_FILE);
+                     DEFAULT_KDB_FILE);
 
     params.admin_dbname_was_here = NULL;
     params.admin_lockfile_was_here = NULL;
@@ -598,133 +598,133 @@
 
     /* Get the value for the admin (policy) database lock file*/
     if (!GET_STRING_PARAM(admin_keytab, KADM5_CONFIG_ADMIN_KEYTAB,
-			  "admin_keytab", NULL)) {
-	const char *s = getenv("KRB5_KTNAME");
-	if (s == NULL)
-	    s = DEFAULT_KADM5_KEYTAB;
-	params.admin_keytab = strdup(s);
-	if (params.admin_keytab)
-	    params.mask |= KADM5_CONFIG_ADMIN_KEYTAB;
+                          "admin_keytab", NULL)) {
+        const char *s = getenv("KRB5_KTNAME");
+        if (s == NULL)
+            s = DEFAULT_KADM5_KEYTAB;
+        params.admin_keytab = strdup(s);
+        if (params.admin_keytab)
+            params.mask |= KADM5_CONFIG_ADMIN_KEYTAB;
     }
     
     /* Get the name of the acl file */
     GET_STRING_PARAM(acl_file, KADM5_CONFIG_ACL_FILE, "acl_file",
-		     DEFAULT_KADM5_ACL_FILE);
+                     DEFAULT_KADM5_ACL_FILE);
 
     /* Get the name of the dict file */
     GET_STRING_PARAM(dict_file, KADM5_CONFIG_DICT_FILE, "dict_file", NULL);
 
-#define GET_PORT_PARAM(FIELD, BIT, CONFTAG, DEFAULT)		\
-    get_port_param(&params.FIELD, params_in->FIELD,		\
-		   &params.mask, params_in->mask, BIT,		\
-		   aprofile, hierarchy, CONFTAG, DEFAULT)
+#define GET_PORT_PARAM(FIELD, BIT, CONFTAG, DEFAULT) \
+    get_port_param(&params.FIELD, params_in->FIELD,  \
+                   &params.mask, params_in->mask, BIT, \
+                   aprofile, hierarchy, CONFTAG, DEFAULT)
     /* Get the value for the kadmind port */
     GET_PORT_PARAM(kadmind_port, KADM5_CONFIG_KADMIND_PORT,
-		   "kadmind_port", DEFAULT_KADM5_PORT);
+                   "kadmind_port", DEFAULT_KADM5_PORT);
 
     /* Get the value for the kpasswd port */
     GET_PORT_PARAM(kpasswd_port, KADM5_CONFIG_KPASSWD_PORT,
-		   "kpasswd_port", DEFAULT_KPASSWD_PORT);
+                   "kpasswd_port", DEFAULT_KPASSWD_PORT);
 
     /* Get the value for the master key name */
     GET_STRING_PARAM(mkey_name, KADM5_CONFIG_MKEY_NAME,
-		     "master_key_name", NULL);
+                     "master_key_name", NULL);
 
     /* Get the value for the master key type */
     hierarchy[2] = "master_key_type";
     if (params_in->mask & KADM5_CONFIG_ENCTYPE) {
-	 params.mask |= KADM5_CONFIG_ENCTYPE;
-	 params.enctype = params_in->enctype;
+         params.mask |= KADM5_CONFIG_ENCTYPE;
+         params.enctype = params_in->enctype;
     } else if (aprofile &&
-	       !krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue)) {
-	 if (!krb5_string_to_enctype(svalue, &params.enctype)) {
-	      params.mask |= KADM5_CONFIG_ENCTYPE;
-	      krb5_xfree(svalue);
-	 }
+               !krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue)) {
+         if (!krb5_string_to_enctype(svalue, &params.enctype)) {
+              params.mask |= KADM5_CONFIG_ENCTYPE;
+              krb5_xfree(svalue);
+         }
     } else {
-	 params.mask |= KADM5_CONFIG_ENCTYPE;
-	 params.enctype = DEFAULT_KDC_ENCTYPE;
+         params.mask |= KADM5_CONFIG_ENCTYPE;
+         params.enctype = DEFAULT_KDC_ENCTYPE;
     }
     
     /* Get the value for mkey_from_kbd */
     if (params_in->mask & KADM5_CONFIG_MKEY_FROM_KBD) {
-	 params.mask |= KADM5_CONFIG_MKEY_FROM_KBD;
-	 params.mkey_from_kbd = params_in->mkey_from_kbd;
+         params.mask |= KADM5_CONFIG_MKEY_FROM_KBD;
+         params.mkey_from_kbd = params_in->mkey_from_kbd;
     }
     
     /* Get the value for the stashfile */
     GET_STRING_PARAM(stash_file, KADM5_CONFIG_STASH_FILE,
-		     "key_stash_file", NULL);
+                     "key_stash_file", NULL);
 
     /* Get the value for maximum ticket lifetime. */
-#define GET_DELTAT_PARAM(FIELD, BIT, CONFTAG, DEFAULT)		\
-    get_deltat_param(&params.FIELD, params_in->FIELD,		\
-		     &params.mask, params_in->mask, BIT,	\
-		     aprofile, hierarchy, CONFTAG, DEFAULT)
+#define GET_DELTAT_PARAM(FIELD, BIT, CONFTAG, DEFAULT) \
+    get_deltat_param(&params.FIELD, params_in->FIELD,  \
+                     &params.mask, params_in->mask, BIT, \
+                     aprofile, hierarchy, CONFTAG, DEFAULT)
 
     GET_DELTAT_PARAM(max_life, KADM5_CONFIG_MAX_LIFE, "max_life",
-		     24 * 60 * 60); /* 1 day */
+                     24 * 60 * 60); /* 1 day */
 
     /* Get the value for maximum renewable ticket lifetime. */
     GET_DELTAT_PARAM(max_rlife, KADM5_CONFIG_MAX_RLIFE, "max_renewable_life",
-		     0);
+                     0);
 
     /* Get the value for the default principal expiration */
     hierarchy[2] = "default_principal_expiration";
     if (params_in->mask & KADM5_CONFIG_EXPIRATION) {
-	 params.mask |= KADM5_CONFIG_EXPIRATION;
-	 params.expiration = params_in->expiration;
+         params.mask |= KADM5_CONFIG_EXPIRATION;
+         params.expiration = params_in->expiration;
     } else if (aprofile &&
-	       !krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue)) {
-	 if (!krb5_string_to_timestamp(svalue, &params.expiration)) {
-	      params.mask |= KADM5_CONFIG_EXPIRATION;
-	      krb5_xfree(svalue);
-	 }
+               !krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue)) {
+         if (!krb5_string_to_timestamp(svalue, &params.expiration)) {
+              params.mask |= KADM5_CONFIG_EXPIRATION;
+              krb5_xfree(svalue);
+         }
     } else {
-	 params.mask |= KADM5_CONFIG_EXPIRATION;
-	 params.expiration = 0;
+         params.mask |= KADM5_CONFIG_EXPIRATION;
+         params.expiration = 0;
     }
     
     /* Get the value for the default principal flags */
     hierarchy[2] = "default_principal_flags";
     if (params_in->mask & KADM5_CONFIG_FLAGS) {
-	 params.mask |= KADM5_CONFIG_FLAGS;
-	 params.flags = params_in->flags;
+         params.mask |= KADM5_CONFIG_FLAGS;
+         params.flags = params_in->flags;
     } else if (aprofile &&
-	       !krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue)) {
-	 char *sp, *ep, *tp;
-	 
-	 sp = svalue;
-	 params.flags = 0;
-	 while (sp) {
-	      if ((ep = strchr(sp, (int) ',')) ||
-		  (ep = strchr(sp, (int) ' ')) ||
-		  (ep = strchr(sp, (int) '\t'))) {
-		   /* Fill in trailing whitespace of sp */
-		   tp = ep - 1;
-		   while (isspace((int) *tp) && (tp > sp)) {
-			*tp = '\0';
-			tp--;
-		   }
-		   *ep = '\0';
-		   ep++;
-		   /* Skip over trailing whitespace of ep */
-		   while (isspace((int) *ep) && (*ep)) ep++;
-	      }
-	      /* Convert this flag */
-	      if (krb5_string_to_flags(sp,
-				       "+",
-				       "-",
-				       &params.flags))
-		   break;
-	      sp = ep;
-	 }
-	 if (!sp)
-	      params.mask |= KADM5_CONFIG_FLAGS;
-	 krb5_xfree(svalue);
+               !krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue)) {
+         char *sp, *ep, *tp;
+         
+         sp = svalue;
+         params.flags = 0;
+         while (sp) {
+              if ((ep = strchr(sp, (int) ',')) ||
+                  (ep = strchr(sp, (int) ' ')) ||
+                  (ep = strchr(sp, (int) '\t'))) {
+                   /* Fill in trailing whitespace of sp */
+                   tp = ep - 1;
+                   while (isspace((int) *tp) && (tp > sp)) {
+                        *tp = '\0';
+                        tp--;
+                   }
+                   *ep = '\0';
+                   ep++;
+                   /* Skip over trailing whitespace of ep */
+                   while (isspace((int) *ep) && (*ep)) ep++;
+              }
+              /* Convert this flag */
+              if (krb5_string_to_flags(sp,
+                                       "+",
+                                       "-",
+                                       &params.flags))
+                   break;
+              sp = ep;
+         }
+         if (!sp)
+              params.mask |= KADM5_CONFIG_FLAGS;
+         krb5_xfree(svalue);
     } else {
-	 params.mask |= KADM5_CONFIG_FLAGS;
-	 params.flags = KRB5_KDB_DEF_FLAGS;
+         params.mask |= KADM5_CONFIG_FLAGS;
+         params.flags = KRB5_KDB_DEF_FLAGS;
     }
 
     /* Get the value for the supported enctype/salttype matrix */
@@ -732,130 +732,130 @@
     if (params_in->mask & KADM5_CONFIG_ENCTYPES) {
          /* The following scenario is when the input keysalts are !NULL */
          if(params_in->keysalts) {
-	       params.keysalts = copy_key_salt_tuple(params_in->keysalts, 
-						     params_in->num_keysalts);
-	       if(params.keysalts) {
-		 params.mask |= KADM5_CONFIG_ENCTYPES;
-		 params.num_keysalts = params_in->num_keysalts;
-	       }
-	 } else {
-		 params.mask |= KADM5_CONFIG_ENCTYPES;
-		 params.keysalts = 0;
-		 params.num_keysalts = params_in->num_keysalts;
-	 }
+               params.keysalts = copy_key_salt_tuple(params_in->keysalts, 
+                                                     params_in->num_keysalts);
+               if(params.keysalts) {
+                 params.mask |= KADM5_CONFIG_ENCTYPES;
+                 params.num_keysalts = params_in->num_keysalts;
+               }
+         } else {
+                 params.mask |= KADM5_CONFIG_ENCTYPES;
+                 params.keysalts = 0;
+                 params.num_keysalts = params_in->num_keysalts;
+         }
     } else {
-	 svalue = NULL;
-	 if (aprofile)
-	      krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue);
-	 if (svalue == NULL)
-	     svalue = strdup("des3-hmac-sha1:normal des-cbc-crc:normal");
+         svalue = NULL;
+         if (aprofile)
+              krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue);
+         if (svalue == NULL)
+             svalue = strdup("des3-hmac-sha1:normal des-cbc-crc:normal");
 
-	 params.keysalts = NULL;
-	 params.num_keysalts = 0;
-	 krb5_string_to_keysalts(svalue,
-				 ", \t",/* Tuple separators	*/
-				 ":.-",	/* Key/salt separators	*/
-				 0,	/* No duplicates	*/
-				 &params.keysalts,
-				 &params.num_keysalts);
-	 if (params.num_keysalts)
-	      params.mask |= KADM5_CONFIG_ENCTYPES;
+         params.keysalts = NULL;
+         params.num_keysalts = 0;
+         krb5_string_to_keysalts(svalue,
+                                 ", \t",/* Tuple separators */
+                                 ":.-",        /* Key/salt separators */
+                                 0,        /* No duplicates */
+                                 &params.keysalts,
+                                 &params.num_keysalts);
+         if (params.num_keysalts)
+              params.mask |= KADM5_CONFIG_ENCTYPES;
 
-	 krb5_xfree(svalue);
+         krb5_xfree(svalue);
     }
     
-	hierarchy[2] = "iprop_enable";
+        hierarchy[2] = "iprop_enable";
 
-	params.iprop_enabled = FALSE;
-	params.mask |= KADM5_CONFIG_IPROP_ENABLED;
+        params.iprop_enabled = FALSE;
+        params.mask |= KADM5_CONFIG_IPROP_ENABLED;
 
-	if (params_in->mask & KADM5_CONFIG_IPROP_ENABLED) {
-		params.mask |= KADM5_CONFIG_IPROP_ENABLED;
-		params.iprop_enabled = params_in->iprop_enabled;
-	} else {
-		krb5_boolean bvalue;
-		if (aprofile &&
-		    !krb5_aprof_get_boolean(aprofile, hierarchy, TRUE, &bvalue)) {
-		    params.iprop_enabled = bvalue;
-		    params.mask |= KADM5_CONFIG_IPROP_ENABLED;
-		}
-	}
+        if (params_in->mask & KADM5_CONFIG_IPROP_ENABLED) {
+                params.mask |= KADM5_CONFIG_IPROP_ENABLED;
+                params.iprop_enabled = params_in->iprop_enabled;
+        } else {
+                krb5_boolean bvalue;
+                if (aprofile &&
+                    !krb5_aprof_get_boolean(aprofile, hierarchy, TRUE, &bvalue)) {
+                    params.iprop_enabled = bvalue;
+                    params.mask |= KADM5_CONFIG_IPROP_ENABLED;
+                }
+        }
 
-	if (!GET_STRING_PARAM(iprop_logfile, KADM5_CONFIG_IPROP_LOGFILE,
-			      "iprop_logfile", NULL)) {
-	    if (params.mask & KADM5_CONFIG_DBNAME) {
-		if (asprintf(&params.iprop_logfile, "%s.ulog", params.dbname) >= 0) {
-		    params.mask |= KADM5_CONFIG_IPROP_LOGFILE;
-		}
-	    }
-	}
+        if (!GET_STRING_PARAM(iprop_logfile, KADM5_CONFIG_IPROP_LOGFILE,
+                              "iprop_logfile", NULL)) {
+            if (params.mask & KADM5_CONFIG_DBNAME) {
+                if (asprintf(&params.iprop_logfile, "%s.ulog", params.dbname) >= 0) {
+                    params.mask |= KADM5_CONFIG_IPROP_LOGFILE;
+                }
+            }
+        }
 
-	GET_PORT_PARAM(iprop_port, KADM5_CONFIG_IPROP_PORT,
-		       "iprop_port", 0);
+        GET_PORT_PARAM(iprop_port, KADM5_CONFIG_IPROP_PORT,
+                       "iprop_port", 0);
 
-	hierarchy[2] = "iprop_master_ulogsize";
+        hierarchy[2] = "iprop_master_ulogsize";
 
-	params.iprop_ulogsize = DEF_ULOGENTRIES;
-	params.mask |= KADM5_CONFIG_ULOG_SIZE;
+        params.iprop_ulogsize = DEF_ULOGENTRIES;
+        params.mask |= KADM5_CONFIG_ULOG_SIZE;
 
-	if (params_in->mask & KADM5_CONFIG_ULOG_SIZE) {
-		params.mask |= KADM5_CONFIG_ULOG_SIZE;
-		params.iprop_ulogsize = params_in->iprop_ulogsize;
-	} else {
-		if (aprofile && !krb5_aprof_get_int32(aprofile, hierarchy,
-		    TRUE, &ivalue)) {
-			if (ivalue > MAX_ULOGENTRIES)
-				params.iprop_ulogsize = MAX_ULOGENTRIES;
-			else if (ivalue <= 0)
-				params.iprop_ulogsize = DEF_ULOGENTRIES;
-			else
-				params.iprop_ulogsize = ivalue;
-			params.mask |= KADM5_CONFIG_ULOG_SIZE;
-		}
-	}
+        if (params_in->mask & KADM5_CONFIG_ULOG_SIZE) {
+                params.mask |= KADM5_CONFIG_ULOG_SIZE;
+                params.iprop_ulogsize = params_in->iprop_ulogsize;
+        } else {
+                if (aprofile && !krb5_aprof_get_int32(aprofile, hierarchy,
+                    TRUE, &ivalue)) {
+                        if (ivalue > MAX_ULOGENTRIES)
+                                params.iprop_ulogsize = MAX_ULOGENTRIES;
+                        else if (ivalue <= 0)
+                                params.iprop_ulogsize = DEF_ULOGENTRIES;
+                        else
+                                params.iprop_ulogsize = ivalue;
+                        params.mask |= KADM5_CONFIG_ULOG_SIZE;
+                }
+        }
 
-	GET_DELTAT_PARAM(iprop_poll_time, KADM5_CONFIG_POLL_TIME,
-			 "iprop_slave_poll", 2 * 60); /* 2m */
+        GET_DELTAT_PARAM(iprop_poll_time, KADM5_CONFIG_POLL_TIME,
+                         "iprop_slave_poll", 2 * 60); /* 2m */
 
     *params_out = params;
     
 cleanup:
     if (aprofile)
-	krb5_aprof_finish(aprofile);
+        krb5_aprof_finish(aprofile);
     if (kret) {
-	 kadm5_free_config_params(context, &params);
-	 params_out->mask = 0;
+         kadm5_free_config_params(context, &params);
+         params_out->mask = 0;
     }
     return(kret);
 }
 /*
- * kadm5_free_config_params()	- Free data allocated by above.
+ * kadm5_free_config_params()        - Free data allocated by above.
  */
 krb5_error_code
 kadm5_free_config_params(context, params)
-    krb5_context	context;
-    kadm5_config_params	*params;
+    krb5_context        context;
+    kadm5_config_params        *params;
 {
     if (params) {
-	free(params->dbname);
-	free(params->mkey_name);
-	free(params->stash_file);
-	free(params->keysalts);
-	free(params->admin_server);
-	free(params->admin_keytab);
-	free(params->dict_file);
-	free(params->acl_file);
-	free(params->realm);
-	free(params->iprop_logfile);
+        free(params->dbname);
+        free(params->mkey_name);
+        free(params->stash_file);
+        free(params->keysalts);
+        free(params->admin_server);
+        free(params->admin_keytab);
+        free(params->dict_file);
+        free(params->acl_file);
+        free(params->realm);
+        free(params->iprop_logfile);
     }
     return(0);
 }
 
 krb5_error_code
 kadm5_get_admin_service_name(krb5_context ctx,
-			     char *realm_in,
-			     char *admin_name,
-			     size_t maxlen)
+                             char *realm_in,
+                             char *admin_name,
+                             size_t maxlen)
 {
     krb5_error_code ret;
     kadm5_config_params params_in, params_out;
@@ -868,21 +868,21 @@
     params_in.realm = realm_in;
     ret = kadm5_get_config_params(ctx, 0, &params_in, &params_out);
     if (ret)
-	return ret;
+        return ret;
 
     if (!(params_out.mask & KADM5_CONFIG_ADMIN_SERVER)) {
-	ret = KADM5_MISSING_KRB5_CONF_PARAMS;
-	goto err_params;
+        ret = KADM5_MISSING_KRB5_CONF_PARAMS;
+        goto err_params;
     }
 
     hp = gethostbyname(params_out.admin_server);
     if (hp == NULL) {
-	ret = errno;
-	goto err_params;
+        ret = errno;
+        goto err_params;
     }
     if (strlen(hp->h_name) + sizeof("kadmin/") > maxlen) {
-	ret = ENOMEM;
-	goto err_params;
+        ret = ENOMEM;
+        goto err_params;
     }
     snprintf(admin_name, maxlen, "kadmin/%s", hp->h_name);
 
@@ -897,34 +897,34 @@
  ***********************************************************************/
 
 /*
- * krb5_read_realm_params()	- Read per-realm parameters from KDC
- *				  alternate profile.
+ * krb5_read_realm_params()       - Read per-realm parameters from KDC
+ *                                  alternate profile.
  */
 krb5_error_code
 krb5_read_realm_params(kcontext, realm, rparamp)
-    krb5_context	kcontext;
-    char		*realm;
-    krb5_realm_params	**rparamp;
+    krb5_context        kcontext;
+    char                *realm;
+    krb5_realm_params   **rparamp;
 {
-    char		*filename;
-    char		*envname;
-    char		*lrealm;
-    krb5_pointer	aprofile = 0;
-    krb5_realm_params	*rparams;
-    const char		*hierarchy[4];
-    char		*svalue;
-    krb5_int32		ivalue;
-    krb5_boolean	bvalue;
-    krb5_deltat		dtvalue;
+    char                *filename;
+    char                *envname;
+    char                *lrealm;
+    krb5_pointer        aprofile = 0;
+    krb5_realm_params   *rparams;
+    const char          *hierarchy[4];
+    char                *svalue;
+    krb5_int32          ivalue;
+    krb5_boolean        bvalue;
+    krb5_deltat         dtvalue;
 
-    char		*kdcprofile = 0;
-    char		*kdcenv = 0;
+    char                *kdcprofile = 0;
+    char                *kdcenv = 0;
     char                *no_refrls = 0;
     char                *host_based_srvcs = 0;
          
 
 
-    krb5_error_code	kret;
+    krb5_error_code        kret;
 
     filename = (kdcprofile) ? kdcprofile : DEFAULT_KDC_PROFILE;
     envname = (kdcenv) ? kdcenv : KDC_PROFILE_ENV;
@@ -933,21 +933,21 @@
 
     rparams = (krb5_realm_params *) NULL;
     if (realm)
-	lrealm = strdup(realm);
+        lrealm = strdup(realm);
     else {
-	kret = krb5_get_default_realm(kcontext, &lrealm);
-	if (kret)
-	    goto cleanup;
+        kret = krb5_get_default_realm(kcontext, &lrealm);
+        if (kret)
+            goto cleanup;
     }
 
     kret = krb5_aprof_init(filename, envname, &aprofile);
     if (kret)
-	goto cleanup;
+        goto cleanup;
     
     rparams = (krb5_realm_params *) malloc(sizeof(krb5_realm_params));
     if (rparams == 0) {
-	kret = ENOMEM;
-	goto cleanup;
+        kret = ENOMEM;
+        goto cleanup;
     }
 
     /* Initialize realm parameters */
@@ -959,73 +959,73 @@
     hierarchy[2] = "database_name";
     hierarchy[3] = (char *) NULL;
     if (!krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue))
-	rparams->realm_dbname = svalue;
-	
+        rparams->realm_dbname = svalue;
+        
     /* Get the value for the KDC port list */
     hierarchy[2] = "kdc_ports";
     if (!krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue))
-	rparams->realm_kdc_ports = svalue;
+        rparams->realm_kdc_ports = svalue;
     hierarchy[2] = "kdc_tcp_ports";
     if (!krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue))
-	rparams->realm_kdc_tcp_ports = svalue;
+        rparams->realm_kdc_tcp_ports = svalue;
 
     /* Get the name of the acl file */
     hierarchy[2] = "acl_file";
     if (!krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue))
-	rparams->realm_acl_file = svalue;
-	    
+        rparams->realm_acl_file = svalue;
+            
     /* Get the value for the kadmind port */
     hierarchy[2] = "kadmind_port";
     if (!krb5_aprof_get_int32(aprofile, hierarchy, TRUE, &ivalue)) {
-	rparams->realm_kadmind_port = ivalue;
-	rparams->realm_kadmind_port_valid = 1;
+        rparams->realm_kadmind_port = ivalue;
+        rparams->realm_kadmind_port_valid = 1;
     }
-	    
+            
     /* Get the value for the master key name */
     hierarchy[2] = "master_key_name";
     if (!krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue))
-	rparams->realm_mkey_name = svalue;
-	    
+        rparams->realm_mkey_name = svalue;
+            
     /* Get the value for the master key type */
     hierarchy[2] = "master_key_type";
     if (!krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue)) {
-	if (!krb5_string_to_enctype(svalue, &rparams->realm_enctype))
-	    rparams->realm_enctype_valid = 1;
-	krb5_xfree(svalue);
+        if (!krb5_string_to_enctype(svalue, &rparams->realm_enctype))
+            rparams->realm_enctype_valid = 1;
+        krb5_xfree(svalue);
     }
-	    
+            
     /* Get the value for the stashfile */
     hierarchy[2] = "key_stash_file";
     if (!krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue))
-	rparams->realm_stash_file = svalue;
-	    
+        rparams->realm_stash_file = svalue;
+            
     /* Get the value for maximum ticket lifetime. */
     hierarchy[2] = "max_life";
     if (!krb5_aprof_get_deltat(aprofile, hierarchy, TRUE, &dtvalue)) {
-	rparams->realm_max_life = dtvalue;
-	rparams->realm_max_life_valid = 1;
+        rparams->realm_max_life = dtvalue;
+        rparams->realm_max_life_valid = 1;
     }
-	    
+            
     /* Get the value for maximum renewable ticket lifetime. */
     hierarchy[2] = "max_renewable_life";
     if (!krb5_aprof_get_deltat(aprofile, hierarchy, TRUE, &dtvalue)) {
-	rparams->realm_max_rlife = dtvalue;
-	rparams->realm_max_rlife_valid = 1;
+        rparams->realm_max_rlife = dtvalue;
+        rparams->realm_max_rlife_valid = 1;
     }
-	    
+            
     /* Get the value for the default principal expiration */
     hierarchy[2] = "default_principal_expiration";
     if (!krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue)) {
-	if (!krb5_string_to_timestamp(svalue,
-				      &rparams->realm_expiration))
-	    rparams->realm_expiration_valid = 1;
-	krb5_xfree(svalue);
+        if (!krb5_string_to_timestamp(svalue,
+                                      &rparams->realm_expiration))
+            rparams->realm_expiration_valid = 1;
+        krb5_xfree(svalue);
     }
 
     hierarchy[2] = "reject_bad_transit";
     if (!krb5_aprof_get_boolean(aprofile, hierarchy, TRUE, &bvalue)) {
-	rparams->realm_reject_bad_transit = bvalue;
-	rparams->realm_reject_bad_transit_valid = 1;
+        rparams->realm_reject_bad_transit = bvalue;
+        rparams->realm_reject_bad_transit_valid = 1;
     }
 
         hierarchy[2] = "no_host_referral";
@@ -1037,9 +1037,9 @@
         } else
             no_refrls = 0;
 
-  	if (no_refrls == 0 || strlen(no_refrls) == 0 || strncmp(no_refrls, "*",1) != 0) {
+          if (no_refrls == 0 || strlen(no_refrls) == 0 || strncmp(no_refrls, "*",1) != 0) {
             hierarchy[2] = "host_based_services";
-  	    if (!krb5_aprof_get_string_all(aprofile, hierarchy, &host_based_srvcs)){
+              if (!krb5_aprof_get_string_all(aprofile, hierarchy, &host_based_srvcs)){
                 if (strchr(host_based_srvcs, '*'))
                     host_based_srvcs = strdup("*");
                 rparams->realm_host_based_services = host_based_srvcs;
@@ -1051,36 +1051,36 @@
     /* Get the value for the default principal flags */
     hierarchy[2] = "default_principal_flags";
     if (!krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue)) {
-	char *sp, *ep, *tp;
+        char *sp, *ep, *tp;
 
-	sp = svalue;
-	rparams->realm_flags = 0;
-	while (sp) {
-	    if ((ep = strchr(sp, (int) ',')) ||
-		(ep = strchr(sp, (int) ' ')) ||
-		(ep = strchr(sp, (int) '\t'))) {
-		/* Fill in trailing whitespace of sp */
-		tp = ep - 1;
-		while (isspace((int) *tp) && (tp < sp)) {
-		    *tp = '\0';
-		    tp--;
-		}
-		*ep = '\0';
-		ep++;
-		/* Skip over trailing whitespace of ep */
-		while (isspace((int) *ep) && (*ep)) ep++;
-	    }
-	    /* Convert this flag */
-	    if (krb5_string_to_flags(sp,
-				     "+",
-				     "-",
-				     &rparams->realm_flags))
-		break;
-	    sp = ep;
-	}
-	if (!sp)
-	    rparams->realm_flags_valid = 1;
-	krb5_xfree(svalue);
+        sp = svalue;
+        rparams->realm_flags = 0;
+        while (sp) {
+            if ((ep = strchr(sp, (int) ',')) ||
+                (ep = strchr(sp, (int) ' ')) ||
+                (ep = strchr(sp, (int) '\t'))) {
+                /* Fill in trailing whitespace of sp */
+                tp = ep - 1;
+                while (isspace((int) *tp) && (tp < sp)) {
+                    *tp = '\0';
+                    tp--;
+                }
+                *ep = '\0';
+                ep++;
+                /* Skip over trailing whitespace of ep */
+                while (isspace((int) *ep) && (*ep)) ep++;
+            }
+            /* Convert this flag */
+            if (krb5_string_to_flags(sp,
+                                     "+",
+                                     "-",
+                                     &rparams->realm_flags))
+                break;
+            sp = ep;
+        }
+        if (!sp)
+            rparams->realm_flags_valid = 1;
+        krb5_xfree(svalue);
     }
 
     rparams->realm_keysalts = NULL;
@@ -1088,37 +1088,37 @@
 
 cleanup:
     if (aprofile)
-	krb5_aprof_finish(aprofile);
+        krb5_aprof_finish(aprofile);
     free(lrealm);
     if (kret) {
-	if (rparams)
-	    krb5_free_realm_params(kcontext, rparams);
-	rparams = 0;
+        if (rparams)
+            krb5_free_realm_params(kcontext, rparams);
+        rparams = 0;
     }
     *rparamp = rparams;
     return(kret);
 }
 
 /*
- * krb5_free_realm_params()	- Free data allocated by above.
+ * krb5_free_realm_params()        - Free data allocated by above.
  */
 krb5_error_code
 krb5_free_realm_params(kcontext, rparams)
-    krb5_context	kcontext;
-    krb5_realm_params	*rparams;
+    krb5_context        kcontext;
+    krb5_realm_params        *rparams;
 {
     if (rparams) {
-	krb5_xfree(rparams->realm_profile);
-	krb5_xfree(rparams->realm_dbname);
-	krb5_xfree(rparams->realm_mkey_name);
-	krb5_xfree(rparams->realm_stash_file);
-	krb5_xfree(rparams->realm_keysalts);
-	krb5_xfree(rparams->realm_kdc_ports);
-	krb5_xfree(rparams->realm_kdc_tcp_ports);
-	krb5_xfree(rparams->realm_acl_file);
-	krb5_xfree(rparams->realm_no_host_referral);
-	krb5_xfree(rparams->realm_host_based_services);
-	krb5_xfree(rparams);
+        krb5_xfree(rparams->realm_profile);
+        krb5_xfree(rparams->realm_dbname);
+        krb5_xfree(rparams->realm_mkey_name);
+        krb5_xfree(rparams->realm_stash_file);
+        krb5_xfree(rparams->realm_keysalts);
+        krb5_xfree(rparams->realm_kdc_ports);
+        krb5_xfree(rparams->realm_kdc_tcp_ports);
+        krb5_xfree(rparams->realm_acl_file);
+        krb5_xfree(rparams->realm_no_host_referral);
+        krb5_xfree(rparams->realm_host_based_services);
+        krb5_xfree(rparams);
     }
     return(0);
 }

Modified: trunk/src/lib/krb5/os/def_realm.c
===================================================================
--- trunk/src/lib/krb5/os/def_realm.c	2009-01-27 20:24:37 UTC (rev 21807)
+++ trunk/src/lib/krb5/os/def_realm.c	2009-01-27 21:09:35 UTC (rev 21808)
@@ -32,7 +32,7 @@
 #include "os-proto.h"
 #include <stdio.h>
 
-#ifdef KRB5_DNS_LOOKUP	     
+#ifdef KRB5_DNS_LOOKUP             
 #ifdef WSHELPER
 #include <wshelper.h>
 #else /* WSHELPER */
@@ -75,7 +75,7 @@
     krb5_error_code retval;
 
     if (!context || (context->magic != KV5M_CONTEXT)) 
-	    return KV5M_CONTEXT;
+            return KV5M_CONTEXT;
 
     if (!context->default_realm) {
         /*
@@ -104,47 +104,47 @@
         if (context->default_realm == 0) {
             int use_dns =  _krb5_use_dns_realm(context);
             if ( use_dns ) {
-		/*
-		 * Since this didn't appear in our config file, try looking
-		 * it up via DNS.  Look for a TXT records of the form:
-		 *
-		 * _kerberos.<localhost>
-		 * _kerberos.<domainname>
-		 * _kerberos.<searchlist>
-		 *
-		 */
-		char localhost[MAX_DNS_NAMELEN+1];
-		char * p;
+                /*
+                 * Since this didn't appear in our config file, try looking
+                 * it up via DNS.  Look for a TXT records of the form:
+                 *
+                 * _kerberos.<localhost>
+                 * _kerberos.<domainname>
+                 * _kerberos.<searchlist>
+                 *
+                 */
+                char localhost[MAX_DNS_NAMELEN+1];
+                char * p;
 
-		krb5int_get_fq_local_hostname (localhost, sizeof(localhost));
+                krb5int_get_fq_local_hostname (localhost, sizeof(localhost));
 
-		if ( localhost[0] ) {
-		    p = localhost;
-		    do {
-			retval = krb5_try_realm_txt_rr("_kerberos", p, 
-						       &context->default_realm);
-			p = strchr(p,'.');
-			if (p)
-			    p++;
-		    } while (retval && p && p[0]);
+                if ( localhost[0] ) {
+                    p = localhost;
+                    do {
+                        retval = krb5_try_realm_txt_rr("_kerberos", p, 
+                                                       &context->default_realm);
+                        p = strchr(p,'.');
+                        if (p)
+                            p++;
+                    } while (retval && p && p[0]);
 
-		    if (retval)
-			retval = krb5_try_realm_txt_rr("_kerberos", "", 
-						       &context->default_realm);
-		} else {
-		    retval = krb5_try_realm_txt_rr("_kerberos", "", 
-						   &context->default_realm);
-		}
-		if (retval) {
-		    return(KRB5_CONFIG_NODEFREALM);
-		}
+                    if (retval)
+                        retval = krb5_try_realm_txt_rr("_kerberos", "", 
+                                                       &context->default_realm);
+                } else {
+                    retval = krb5_try_realm_txt_rr("_kerberos", "", 
+                                                   &context->default_realm);
+                }
+                if (retval) {
+                    return(KRB5_CONFIG_NODEFREALM);
+                }
             }
         }
 #endif /* KRB5_DNS_LOOKUP */
     }
 
     if (context->default_realm == 0)
-	return(KRB5_CONFIG_NODEFREALM);
+        return(KRB5_CONFIG_NODEFREALM);
     if (context->default_realm[0] == 0) {
         free (context->default_realm);
         context->default_realm = 0;
@@ -162,11 +162,11 @@
 krb5_set_default_realm(krb5_context context, const char *lrealm)
 {
     if (!context || (context->magic != KV5M_CONTEXT)) 
-	    return KV5M_CONTEXT;
+            return KV5M_CONTEXT;
 
     if (context->default_realm) {
-	    free(context->default_realm);
-	    context->default_realm = 0;
+            free(context->default_realm);
+            context->default_realm = 0;
     }
 
     /* Allow the user to clear the default realm setting by passing in 
@@ -176,7 +176,7 @@
     context->default_realm = strdup(lrealm);
 
     if (!context->default_realm)
-	    return ENOMEM;
+            return ENOMEM;
 
     return(0);
 
@@ -185,8 +185,9 @@
 void KRB5_CALLCONV
 krb5_free_default_realm(krb5_context context, char *lrealm)
 {
-	free (lrealm);
+    free (lrealm);
 }
+
 krb5_error_code
 krb5int_get_domain_realm_mapping(krb5_context context, const char *host, char ***realmsp)
 {
@@ -195,9 +196,6 @@
     krb5_error_code retval;
     char temp_host[MAX_DNS_NAMELEN+1];
 
-#ifdef DEBUG_REFERRALS
-    printf("krb5int_get_domain_realm_mapping(host:%s) called\n",host);
-#endif
     /* do sanity check and lower-case */
     retval = krb5int_clean_hostname(context, host, temp_host, sizeof temp_host);
     if (retval)
@@ -212,15 +210,12 @@
     realm = (char *)NULL;
     temp_realm = 0;
     while (cp ) {
-#ifdef DEBUG_REFERRALS
-        printf("  trying to look up %s in the domain_realm map\n",cp);
-#endif
-  	retval = profile_get_string(context->profile, "domain_realm", cp,
+        retval = profile_get_string(context->profile, "domain_realm", cp,
                                     0, (char *)NULL, &temp_realm);
         if (retval)
             return retval;
         if (temp_realm != (char *)NULL)
-            break;	/* Match found */
+            break;        /* Match found */
  
         /* Setup for another test */
         if (*cp == '.') {
@@ -229,20 +224,15 @@
             cp = strchr(cp, '.');
         }
     }
-#ifdef DEBUG_REFERRALS
-    printf("  done searching the domain_realm map\n");
-#endif
-    if (temp_realm!=(char*)NULL) {
-#ifdef DEBUG_REFERRALS
-       printf("  temp_realm is %s\n",temp_realm);
-#endif
+    if (temp_realm != (char*)NULL) {
         realm = strdup(temp_realm);
         profile_release_string(temp_realm);
         if (!realm) {
             return ENOMEM;
         }
     }
-    if (!(retrealms = (char **)calloc(2, sizeof(*retrealms)))) {
+    retrealms = (char **)calloc(2, sizeof(*retrealms));
+    if (!retrealms) {
         if (realm != (char *)NULL)
             free(realm);
         return ENOMEM;
@@ -252,8 +242,6 @@
     retrealms[1] = 0;
 
     *realmsp = retrealms;
-
     return 0;
 }
 
-




More information about the cvs-krb5 mailing list